xref: /openbmc/docs/cheatsheet.md (revision ae88254c911b6664605b500776b13f6ae6e662ed)
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
83dd7e9997SAndrew Jeffery
84dd7e9997SAndrew Jeffery## Using QEMU
85dd7e9997SAndrew Jeffery
86dd7e9997SAndrew JefferyQEMU has a palmetto-bmc machine (as of v2.6.0) which implements the core
87dd7e9997SAndrew Jefferydevices to boot a Linux kernel. OpenBMC also [maintains a
88dd7e9997SAndrew Jefferytree](https://github.com/openbmc/qemu) with patches on their way upstream or
89dd7e9997SAndrew Jefferytemporary work-arounds that add to QEMU's capabilities where appropriate.
90dd7e9997SAndrew Jeffery
91dd7e9997SAndrew JefferyQEMU's wiki has instructions for [building from
92dd7e9997SAndrew Jefferysource](http://wiki.qemu.org/Documentation/GettingStartedDevelopers).
93dd7e9997SAndrew Jeffery
94794e6985SAndrew JefferyAssuming the current working directory is the `build` directory (from sourcing
95794e6985SAndrew Jeffery`oe-init-build-env`), a palmetto-bmc machine can be invoked with:
96dd7e9997SAndrew Jeffery
97dd7e9997SAndrew Jeffery```
98dd7e9997SAndrew Jefferyqemu-system-arm \
99dd7e9997SAndrew Jeffery    -M palmetto-bmc \
100dd7e9997SAndrew Jeffery    -m 256 \
101dd7e9997SAndrew Jeffery    -nographic \
102794e6985SAndrew Jeffery    -kernel tmp/deploy/images/palmetto/cuImage-palmetto.bin \
103794e6985SAndrew Jeffery    -initrd tmp/deploy/images/palmetto/obmc-phosphor-image-palmetto.cpio.gz
104dd7e9997SAndrew Jeffery```
105dd7e9997SAndrew Jeffery
106dd7e9997SAndrew JefferyTo quit, type `Ctrl-a c` to switch to the QEMU monitor, and then `quit` to exit.
107*ae88254cSJoel Stanley
108*ae88254cSJoel Stanley## Booting the host
109*ae88254cSJoel Stanley
110*ae88254cSJoel StanleyLogin:
111*ae88254cSJoel Stanley```
112*ae88254cSJoel Stanleycurl -c cjar -k -X POST -H "Content-Type: application/json" -d '{"data": [ "root", "0penBmc" ] }' https://palm5-bmc/login
113*ae88254cSJoel Stanley```
114*ae88254cSJoel Stanley
115*ae88254cSJoel StanleyConnect to host console:
116*ae88254cSJoel Stanley```
117*ae88254cSJoel Stanleyssh -p 2200 root@bmc
118*ae88254cSJoel Stanley```
119*ae88254cSJoel Stanley
120*ae88254cSJoel StanleyPower on:
121*ae88254cSJoel Stanley```
122*ae88254cSJoel Stanleycurl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST     -d '{"data": []}'  https://palm5-bmc/org/openbmc/control/chassis0/action/powerOn
123*ae88254cSJoel Stanley```
124