1 2# OpenBMC cheatsheet 3 4This document is intended to provide a set of recipes for common OpenBMC 5customisation tasks, without having to know the full yocto build process. 6 7## Using a local kernel build 8 9The kernel recipe is in: 10 11``` 12 meta-phosphor/common/recipes-kernel/linux/linux-obmc_4.2.bb 13``` 14 15To use a local git tree, change the `SRC_URI` to a git:// URL without 16a hostname. For example: 17 18``` 19SRC_URI = "git:///home/jk/devel/linux;protocol=git;branch=${KBRANCH}" 20``` 21 22The `SRCREV` variable can be used to set an explicit git commit. The 23default (`${AUTOREV}`) will use the latest commit in `KBRANCH`. 24 25## Building for Palmetto 26 27The Palmetto target is `palmetto`. 28 29If you are starting from scratch without a `build/conf` directory you can just: 30``` 31$ cd openbmc 32$ TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ibm/meta-palmetto/conf . oe-init-build-env 33$ bitbake obmc-phosphor-image 34``` 35 36## Building for Barreleye 37 38The Barreleye target is `barreleye`. 39 40If you are starting from scratch without a `build/conf` directory you can just: 41``` 42$ cd openbmc 43$ TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/conf . oe-init-build-env 44$ bitbake obmc-phosphor-image 45``` 46 47## Building the OpenBMC SDK 48Looking for a way to compile your programs for 'ARM' but you happen to be running on a 'PPC' or 'x86' system? You can build the sdk receive a fakeroot environment. 49``` 50$ bitbake -c populate_sdk obmc-phosphor-image 51$ ./tmp/deploy/sdk/openbmc-phosphor-glibc-x86_64-obmc-phosphor-image-armv5e-toolchain-1.8+snapshot.sh 52``` 53Follow the prompts. After it has been installed the default to setup your env will be similar to this command 54``` 55. /opt/openbmc-phosphor/1.8+snapshot/environment-setup-armv5e-openbmc-linux-gnueabi 56``` 57 58## Rebuilds & Reconfiguration 59 60You can reconfigure your build by removing the build/conf dir: 61``` 62rm -rf build/conf 63``` 64and running `oe-init-build-env` again (possibly with `TEMPLATECONF` set). 65 66## Useful dbus CLI tools 67 68## `busctl` 69 70http://www.freedesktop.org/software/systemd/man/busctl.html 71 72Great tool to issue dbus commands via cli. That way you don't have to wait for 73the code to hit the path on the system. Great for running commands with QEMU 74too! 75 76Run as: 77 78``` 79busctl call <path> <interface> <object> <method> <parameters> 80``` 81 82* \<parameters\> example : sssay "t1" "t2" "t3" 2 2 3 83 84## Using QEMU 85 86QEMU has a palmetto-bmc machine (as of v2.6.0) which implements the core 87devices to boot a Linux kernel. OpenBMC also [maintains a 88tree](https://github.com/openbmc/qemu) with patches on their way upstream or 89temporary work-arounds that add to QEMU's capabilities where appropriate. 90 91QEMU's wiki has instructions for [building from 92source](http://wiki.qemu.org/Documentation/GettingStartedDevelopers). 93 94Assuming the CWD is the root of the openbmc tree, a palmetto-bmc machine can be 95invoked with: 96 97``` 98qemu-system-arm \ 99 -M palmetto-bmc \ 100 -m 256 \ 101 -append "console=ttyS4" \ 102 -nographic \ 103 -kernel build/tmp/deploy/images/palmetto/cuImage-palmetto.bin \ 104 -dtb build/tmp/deploy/images/palmetto/cuImage-aspeed-bmc-opp-palmetto.dtb \ 105 -initrd build/tmp/deploy/images/palmetto/obmc-phosphor-image-palmetto.cpio.gz 106``` 107 108To quit, type `Ctrl-a c` to switch to the QEMU monitor, and then `quit` to exit. 109