xref: /openbmc/docs/kernel-development.md (revision a7297431)
1# OpenBMC kernel development
2
3Some general hints for kernel development
4
5## Out-of-tree builds
6
7You can build a kernel out of the yocto environment, by using the initramfs
8(from a pre-existing yocto build) directly:
9
10```
11make ARCH=arm \
12    O=obj \
13    CROSS_COMPILE=arm-linux-gnueabihf- \
14    CONFIG_INITRAMFS_SOURCE=/path/tp/obmc-phosphor-image-palmetto.cpio.gz
15```
16
17(adjust `O` and `CROSS_COMPILE` parameters as appropriate).
18
19You'll need to use `aspeed_defconfig` as your base kernel configuration.
20
21The cpio can be found in the following yocto output directory:
22
23```
24 build/tmp/deploy/images/palmetto/
25```
26
27# Building a uImage
28
29To build a uImage (for example, to netboot):
30
31```
32# build a zImage using the obmc rootfs
33make ARCH=arm \
34    O=obj \
35    CROSS_COMPILE=arm-linux-gnueabihf- \
36    CONFIG_INITRAMFS_SOURCE=/path/tp/obmc-phosphor-image-palmetto.cpio.gz
37
38# create a combined zImage + DTB image
39cat obj/arch/arm/boot/zImage \
40    obj/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dtb \
41        > obj/aspeed-zimage
42
43# create a uImage
44./scripts/mkuboot.sh -A arm -O linux -C none -T kernel \
45    -a 0x40008000 -e 0x40008000 -n $USER-`date +%Y%m%d%H%M` \
46    -d obj/aspeed-zimage obj/uImage
47```
48