Adding /boot to the root filesystem
Hello.
I am attempting to build a rootfs image containing the kernel and other boot files. An extra vfat partition for the boot files causes minor logistical problems in my setup. Everything appears significantly less complicated when /boot
is integrated into the root filesystem.
Only minor pieces seem to be missing to allow for this setup. In the following are my findings. Note that I am building MACHINE=nanopi-r1
.
Without any changes, I am already seeing /boot/sun8i-h3-nanopi-r1.dtb
in the root filesystem. This is the only file in /boot
of the root filesystem. This seems to be caused by do_install_append
of kernel-devicetree.bbclass
(https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/kernel-devicetree.bbclass#n59). The kernel-devicetree
package gets pulled in as an extra dependency at https://gitlab.com/dimtass/meta-allwinner-hx/-/blob/aa05ec6e/recipes-kernel/linux/linux-stable.inc#L9
If I add kernel-image
to IMAGE_INSTALL
, a kernel binary zImage-5.8.5-allwinner
and a symlink to it zImage
gets added.
If I add u-boot
to IMAGE_INSTALL
, the allwinnerEnv.txt
file gets added via https://gitlab.com/dimtass/meta-allwinner-hx/-/blob/aa05ec6e/recipes-bsp/u-boot/u-boot-allwinner.inc#L39
What is missing from /boot
is:
boot.scr
fixup.scr
image-version-info
-
overlay
directory
It appears that boot.scr
(and possibly image-version-info
) simply needs to be installed at https://gitlab.com/dimtass/meta-allwinner-hx/-/blob/aa05ec6e/recipes-bsp/u-boot/u-boot-allwinner.inc#L39
fixup.scr
is handled by this code block in https://gitlab.com/dimtass/meta-allwinner-hx/-/blob/aa05ec6e/recipes-kernel/linux/linux-stable.inc#L100-120
# Compile overlays. This is for compatibility since from version 4.20
# and later individual dtbo build is not supported
do_compile_append() {
set -x
bbnote "Compiling kernel overlays"
oe_runmake -C ${B} CC="${KERNEL_CC}" ${PARALLEL_MAKE} modules dtbs
}
# deploy the dtbo overlays in the DEPLOYDIR
do_deploy_append() {
set -x
dtbos=$(find . -name "*.dtbo" | grep ${OVERLAY_PREFIX})
for dtbo in $dtbos; do
install -m 644 $dtbo ${DEPLOYDIR}/
done
bbnote "Extract ${OVERLAY_PREFIX} fixup"
fixup=$(find . -name "*.scr-cmd" | grep ${OVERLAY_PREFIX})
mkimage -C none -A arm -T script -d $fixup ${WORKDIR}/fixup.scr
install -m 644 ${WORKDIR}/fixup.scr ${DEPLOYDIR}/
}
Here it seems that compiling of fixup.scr
is not supposed to happen in do_deploy_append
, but should rather happen in do_compile_append
. To get the file added to the root filesystem, maybe then do_install_append
can be added. In the same way, the overlay
directory could be added.
Besides the missing files in the rootfs, there seems to be support for removing the extra boot partition at https://gitlab.com/dimtass/meta-allwinner-hx/-/blob/aa05ec6e/classes/allwinner-create-wks.bbclass#L36 by defining SUNXI_BOOT_IMAGE
accordingly. Also, the boot.cmd
script at https://gitlab.com/dimtass/meta-allwinner-hx/-/blob/aa05ec6e/recipes-bsp/u-boot/files/sun8i-boot/boot.cmd#L33-36 seems to have some support for booting in case /boot
is on root
.