Skip to content
Tao Ren edited this page Aug 10, 2018 · 5 revisions

Some general hints for kernel development.

Out-of-tree builds

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/

Testing in u-boot

Building

$ git clone https://github.com/openbmc/qemu -b aspeed
$ cd qemu
$ ./configure --target-list=arm-softmmu
$ make

Booting a kenrel

~/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

Booting a kernel with u-boot

TODO: Document how to put the FIT kernel+initramfs into the flash image

Sending patches

When sending patches for inclusion in the OpenBMC tree, use the following:

git format-patch --subject-prefix="PATCH linux dev-4.7" \
  [email protected] [email protected] \
  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.

Building a uImage

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

Using FIT and OpenBMC

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.

  1. git clone https://github.com/openbmc/linux -b dev-4.10
  2. cd linux
  3. wget http://ozlabs.org/~joel/openbmc.its. Edit the dtb path to point to the machine you're testing on.
  4. wget https://openpower.xyz/job/openbmc-build/distro=ubuntu,target=witherspoon/lastSuccessfulBuild/artifact/images/witherspoon/obmc-phosphor-initramfs-witherspoon.cpio.lzma
  5. make aspeed_g5_defconfig
  6. mkimage -f openbmc.its thingy
  7. Place thingy in your tftp directory

Jump on the target machine:

  1. On the machine you're testing on, jump on a serial console and type reboot.
  2. tftp thingy
  3. bootm

This will boot your FIT image with the OpenBMC initrd, which then loads the OpenBMC userspace from flash.