xref: /openbmc/docs/cheatsheet.md (revision dd7e99977843adb049f31e94826ac59d1969145c)
1cdfa8079SJeremy Kerr
2cdfa8079SJeremy Kerr# OpenBMC cheatsheet
3cdfa8079SJeremy Kerr
4cdfa8079SJeremy KerrThis document is intended to provide a set of recipes for common OpenBMC
5cdfa8079SJeremy Kerrcustomisation tasks, without having to know the full yocto build process.
6cdfa8079SJeremy Kerr
7cdfa8079SJeremy Kerr## Using a local kernel build
8cdfa8079SJeremy Kerr
9cdfa8079SJeremy KerrThe kernel recipe is in:
10cdfa8079SJeremy Kerr
11cdfa8079SJeremy Kerr```
12cdfa8079SJeremy Kerr meta-phosphor/common/recipes-kernel/linux/linux-obmc_4.2.bb
13cdfa8079SJeremy Kerr```
14cdfa8079SJeremy Kerr
15cdfa8079SJeremy KerrTo use a local git tree, change the `SRC_URI` to a git:// URL without
16cdfa8079SJeremy Kerra hostname. For example:
17cdfa8079SJeremy Kerr
18cdfa8079SJeremy Kerr```
19cdfa8079SJeremy KerrSRC_URI = "git:///home/jk/devel/linux;protocol=git;branch=${KBRANCH}"
20cdfa8079SJeremy Kerr```
21cdfa8079SJeremy Kerr
22cdfa8079SJeremy KerrThe `SRCREV` variable can be used to set an explicit git commit. The
23cdfa8079SJeremy Kerrdefault (`${AUTOREV}`) will use the latest commit in `KBRANCH`.
24cdfa8079SJeremy Kerr
257b22067aSJoel Stanley## Building for Palmetto
26cdfa8079SJeremy Kerr
277b22067aSJoel StanleyThe Palmetto target is `palmetto`.
287b22067aSJoel Stanley
297b22067aSJoel StanleyIf you are starting from scratch without a `build/conf` directory you can just:
307b22067aSJoel Stanley```
317b22067aSJoel Stanley$ cd openbmc
327b22067aSJoel Stanley$ TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-ibm/meta-palmetto/conf . oe-init-build-env
3335abff5fSJeremy Kerr$ bitbake obmc-phosphor-image
347b22067aSJoel Stanley```
357b22067aSJoel Stanley
3657812c89SAdi Gangidi## Building for Barreleye
3757812c89SAdi Gangidi
3857812c89SAdi GangidiThe Barreleye target is `barreleye`.
3957812c89SAdi Gangidi
4057812c89SAdi GangidiIf you are starting from scratch without a `build/conf` directory you can just:
4157812c89SAdi Gangidi```
4257812c89SAdi Gangidi$ cd openbmc
4357812c89SAdi Gangidi$ TEMPLATECONF=meta-openbmc-machines/meta-openpower/meta-rackspace/meta-barreleye/conf . oe-init-build-env
4457812c89SAdi Gangidi$ bitbake obmc-phosphor-image
4557812c89SAdi Gangidi```
4657812c89SAdi Gangidi
470ea78f3aSChris Austen## Building the OpenBMC SDK
480ea78f3aSChris AustenLooking 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.
490ea78f3aSChris Austen```
500ea78f3aSChris Austen$ bitbake -c populate_sdk obmc-phosphor-image
510ea78f3aSChris Austen$ ./tmp/deploy/sdk/openbmc-phosphor-glibc-x86_64-obmc-phosphor-image-armv5e-toolchain-1.8+snapshot.sh
520ea78f3aSChris Austen```
530ea78f3aSChris AustenFollow the prompts.  After it has been installed the default to setup your env will be similar to this command
540ea78f3aSChris Austen```
550ea78f3aSChris Austen. /opt/openbmc-phosphor/1.8+snapshot/environment-setup-armv5e-openbmc-linux-gnueabi
560ea78f3aSChris Austen```
570ea78f3aSChris Austen
587b22067aSJoel Stanley## Rebuilds & Reconfiguration
597b22067aSJoel Stanley
607b22067aSJoel StanleyYou can reconfigure your build by removing the build/conf dir:
617b22067aSJoel Stanley```
627b22067aSJoel Stanleyrm -rf build/conf
637b22067aSJoel Stanley```
64a91308a9SJoel Stanleyand running `oe-init-build-env` again (possibly with `TEMPLATECONF` set).
658196be3eSJeremy Kerr
668196be3eSJeremy Kerr## Useful dbus CLI tools
678196be3eSJeremy Kerr
688196be3eSJeremy Kerr## `busctl`
698196be3eSJeremy Kerr
708196be3eSJeremy Kerrhttp://www.freedesktop.org/software/systemd/man/busctl.html
718196be3eSJeremy Kerr
72111325b5SBrad BishopGreat tool to issue dbus commands via cli. That way you don't have to wait for
738196be3eSJeremy Kerrthe code to hit the path on the system. Great for running commands with QEMU
748196be3eSJeremy Kerrtoo!
758196be3eSJeremy Kerr
768196be3eSJeremy KerrRun as:
778196be3eSJeremy Kerr
788196be3eSJeremy Kerr```
798196be3eSJeremy Kerrbusctl call <path> <interface> <object> <method> <parameters>
808196be3eSJeremy Kerr```
818196be3eSJeremy Kerr
828196be3eSJeremy Kerr* \<parameters\> example : sssay "t1" "t2" "t3" 2 2 3
83*dd7e9997SAndrew Jeffery
84*dd7e9997SAndrew Jeffery## Using QEMU
85*dd7e9997SAndrew Jeffery
86*dd7e9997SAndrew JefferyQEMU has a palmetto-bmc machine (as of v2.6.0) which implements the core
87*dd7e9997SAndrew Jefferydevices to boot a Linux kernel. OpenBMC also [maintains a
88*dd7e9997SAndrew Jefferytree](https://github.com/openbmc/qemu) with patches on their way upstream or
89*dd7e9997SAndrew Jefferytemporary work-arounds that add to QEMU's capabilities where appropriate.
90*dd7e9997SAndrew Jeffery
91*dd7e9997SAndrew JefferyQEMU's wiki has instructions for [building from
92*dd7e9997SAndrew Jefferysource](http://wiki.qemu.org/Documentation/GettingStartedDevelopers).
93*dd7e9997SAndrew Jeffery
94*dd7e9997SAndrew JefferyAssuming the CWD is the root of the openbmc tree, a palmetto-bmc machine can be
95*dd7e9997SAndrew Jefferyinvoked with:
96*dd7e9997SAndrew Jeffery
97*dd7e9997SAndrew Jeffery```
98*dd7e9997SAndrew Jefferyqemu-system-arm \
99*dd7e9997SAndrew Jeffery    -M palmetto-bmc \
100*dd7e9997SAndrew Jeffery    -m 256 \
101*dd7e9997SAndrew Jeffery    -append "console=ttyS4" \
102*dd7e9997SAndrew Jeffery    -nographic \
103*dd7e9997SAndrew Jeffery    -kernel build/tmp/deploy/images/palmetto/cuImage-palmetto.bin \
104*dd7e9997SAndrew Jeffery    -dtb build/tmp/deploy/images/palmetto/cuImage-aspeed-bmc-opp-palmetto.dtb \
105*dd7e9997SAndrew Jeffery    -initrd build/tmp/deploy/images/palmetto/obmc-phosphor-image-palmetto.cpio.gz
106*dd7e9997SAndrew Jeffery```
107*dd7e9997SAndrew Jeffery
108*dd7e9997SAndrew JefferyTo quit, type `Ctrl-a c` to switch to the QEMU monitor, and then `quit` to exit.
109