Extract from openbmc document.

Setting up OpenBMC project

1) Prerequisite

  • Ubuntu 14.04
    sudo apt-get install -y git build-essential libsdl1.2-dev texinfo gawk chrpath diffstat
    

2) Download the source

git clone git@github.com:openbmc/openbmc.git
cd openbmc

3) Target your hardware

Any build requires an environment variable known as TEMPLATECONF to be set to a hardware target. You can see all of the known targets with find meta-* -name local.conf.sample. Choose the hardware target https://github.com/openbmc/docs/blob/master/cheatsheet.mdand then move to the next step. Additional examples can be found in the OpenBMC Cheatsheet

Machine TEMPLATECONF
Palmetto meta-ibm/meta-palmetto/conf
Zaius meta-ingrasys/meta-zaius/conf
Witherspoon meta-ibm/meta-witherspoon/conf
Romulus meta-ibm/meta-romulus/conf

As an example target Romulus

export TEMPLATECONF=meta-ibm/meta-romulus/conf

4) Build

. openbmc-env
bitbake obmc-phosphor-image

Additional details can be found in the docs repository.

Download and Start QEMU Session

  1. Download latest openbmc/qemu fork of QEMU application
  wget https://openpower.xyz/job/openbmc-qemu-build-merge-x86/lastSuccessfulBuild/artifact/qemu/arm-softmmu/qemu-system-arm

  chmod u+x qemu-system-arm
  1. Download the Romulus image or use the Romulus image generated by previous build
  wget https://openpower.xyz/job/openbmc-build/distro=ubuntu,label=builder,target=romulus/lastSuccessfulBuild/artifact/deploy/images/romulus/obmc-phosphor-image-romulus.static.mtd

or

  mv ~/openbmc/build/tmp/deploy/images/romulus/obmc-phosphor-image-romulus-xxxxxxxx.static.mtd ~/openbmc/build/tmp/deploy/images/romulus/obmc-phosphor-image-romulus.static.mtd 

where xxxxxxx is the time tags, like ‘20190306233106’

  1. Start QEMU with downloaded Romulus image

Note - For REST and SSH to work into your QEMU session, you must connect up some host ports to the REST and SSH ports in your QEMU session. In this example, it just uses 2222 and 2443. You can use whatever you prefer.

  ./qemu-system-arm -m 256 -M romulus-bmc -nographic -drive file=./obmc-phosphor-image-romulus.static.mtd,format=raw,if=mtd -net nic -net user,hostfwd=:127.0.0.1:2222-:22,hostfwd=:127.0.0.1:2443-:443,hostname=qemu
  1. Wait for your QEMU-based BMC to boot

Login using default root/0penBmc login (Note the 0 is a zero).

  1. Check the system state

You’ll see a lot of services starting in the console, you can start running the obmcutil tool to check the state of the OpenBMC state services. When you see the following then you have successfully booted to “Ready” state.

  root@openbmc:~# obmcutil state
  CurrentBMCState     : xyz.openbmc_project.State.BMC.BMCState.Ready
  CurrentPowerState   : xyz.openbmc_project.State.Chassis.PowerState.Off
  CurrentHostState    : xyz.openbmc_project.State.Host.HostState.Off

Note To exit (and kill) your QEMU session run: ctrl+a x

Download and Install SDK

To keep things organized, create a directory to store your SDK install scripts and directories.

  1. Download the latest SDK to your system (using Romulus for this walk through)
  mkdir -p ~/sdk
  cd ~/sdk

  wget https://openpower.xyz/job/openbmc-build-sdk/distro=ubuntu,target=romulus/lastSuccessfulBuild/artifact/deploy/sdk/oecore-x86_64-armv6-toolchain-nodistro.0.sh

  chmod u+x oecore-x86_64-armv6-toolchain-nodistro.0.sh
  1. Install the SDK

Choose an appropriate location and name. It’s a good idea to include the date and system supported by that SDK in the directory name. For example:

  mkdir -p ~/sdk/romulus-`date +%F`

Run the following command to install the SDK. When command asks you to “Enter target directory for SDK”, enter the directory you created in the previous step.

  ./oecore-x86_64-armv6-toolchain-nodistro.0.sh

The installation script will indicate progress and give completion messages like this:

  SDK has been successfully set up and is ready to be used.
  Each time you wish to use the SDK in a new shell session, you need to source
  the environment setup script e.g. $ . /...path-to-sdk.../environment-setup-armv6-openbmc-linux-gnueabi
  1. Source yourself into the SDK

Ensure no errors. The command to do this will be provided at the end of installation. To make your shell use the new SDK environment, you must source its environment-setup script which was created in the previous step. You may wish to save the required command, for example, cut/paste the text above into a README.

That’s it, you now have a working development environment for OpenBMC!

OpenBMC Web User Interface Development

OpenBMC Hello World in SDK