-
Notifications
You must be signed in to change notification settings - Fork 148
TipsAndTricks
Some general hints for kernel development.
You can build a kernel out of the yocto environment, by using the initramfs (from a pre-existing yocto build) directly:
make ARCH=arm \
O=obj \
CROSS_COMPILE=arm-linux-gnueabihf- \
CONFIG_INITRAMFS_SOURCE=/path/tp/obmc-phosphor-image-palmetto.cpio.gz
(adjust O and CROSS_COMPILE parameters as appropriate).
You'll need to use aspeed_g4_defconfig or aspeed_g5_defconfig as your base
kernel configuration.
The cpio can be found in the following yocto output directory:
build/tmp/deploy/images/palmetto/
$ git clone https://github.com/openbmc/qemu -b aspeed
$ cd qemu
$ ./configure --target-list=arm-softmmu
$ make
~/dev/qemu/cedric/arm-softmmu/qemu-system-arm -m 512 -M romulus-bmc \
-nodefaults -nographic -serial stdio \
-net nic -net user,hostfwd=:127.0.0.1:2222-:22,hostname=qemu \
-drive file=flash-romulus,format=raw,if=mtd \
-drive file=flash-romulus,format=raw,if=mtd \
-drive file=romulus.pnor,format=raw,if=mtd \
-kernel ~/dev/linux/arch/arm/boot/zImage
-dtb ~/dev/linux/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dtb
TODO: Document how to put the FIT kernel+initramfs into the flash image
When sending patches for inclusion in the OpenBMC tree, use the following:
git format-patch --subject-prefix="PATCH linux dev-4.7" \
--to=openbmc@lists.ozlabs.org --to=joel@jms.id.au \
origin/dev-4.7
If you add -o dir, it will put the patch(es) dir for you to check, test, and finally use git send-email to send.
To build a uImage (for example, to netboot):
# build a zImage using the obmc rootfs
make ARCH=arm \
O=obj \
CROSS_COMPILE=arm-linux-gnueabihf- \
CONFIG_INITRAMFS_SOURCE=/path/tp/obmc-phosphor-image-palmetto.cpio.gz
# create a combined zImage + DTB image
cat obj/arch/arm/boot/zImage \
obj/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dtb \
> obj/aspeed-zimage
# create a uImage
./scripts/mkuboot.sh -A arm -O linux -C none -T kernel \
-a 0x40008000 -e 0x40008000 -n $USER-`date +%Y%m%d%H%M` \
-d obj/aspeed-zimage obj/uImage
Use these instructions to test on the ast2500 with OpenBMC userspace. OpenBMC userspace is slow to boot, but allows you to test interactions with the host booting. Note that we're grabbing the witherspoon initrd, but they're all the same, so it will work on any ast2500 machine.
git clone https://github.com/openbmc/linux -b dev-4.10cd linux-
wget http://ozlabs.org/~joel/openbmc.its. Edit the dtb path to point to the machine you're testing on. wget https://openpower.xyz/job/openbmc-build/distro=ubuntu,target=witherspoon/lastSuccessfulBuild/artifact/images/witherspoon/obmc-phosphor-initramfs-witherspoon.cpio.lzmamake aspeed_g5_defconfigmkimage -f openbmc.its thingy- Place
thingyin your tftp directory
Jump on the target machine:
- On the machine you're testing on, jump on a serial console and type
reboot. tftp thingybootm
This will boot your FIT image with the OpenBMC initrd, which then loads the OpenBMC userspace from flash.