Skip to content
Advertisement

How to deploy files to /boot partition with Yocto

I’m trying to deploy some binary files to /boot in a Yocto image for RPi CM3 but it deploys them to the wrong location.

do_install() {
    install -d ${D}/boot/overlays
    install -m 0664 ${WORKDIR}/*.dtb ${D}/boot/overlays/
    install -m 0664 ${WORKDIR}/*.dtbo ${D}/boot/overlays/
}

The files are deployed to /boot in the / partition of the final image, but not to the /boot partition. So they are not available at boot time.

I already googled and studied the kernel recipes (and classes) of the Poky distribution but I didn’t find the mechanism it uses how to ensure that the files are deployed to the boot image (and not to the /boot dir in the root image).

Any help is appreciated 🙂

Update #1

In my local.conf I did:

IMAGE_BOOT_FILES_append = " 
  overlays/3dlab-nano-player.dtbo 
  overlays/adau1977-adc.dtbo 
  ...
"

And in my rpi3-overlays.bb

do_deploy() {
    install -d ${DEPLOYDIR}/${PN}
    install -m 0664 ${WORKDIR}/*.dtb ${DEPLOYDIR}/${PN}
    install -m 0664 ${WORKDIR}/*.dtbo ${DEPLOYDIR}/${PN}

    touch ${DEPLOYDIR}/${PN}/${PN}-${PV}.stamp
}

Using this the image builds, but the files stillt don’t get deployed in the /boot partition. Using RPI_KERNEL_DEVICETREE_OVERLAYS I get a build error because the kernel recipe tries to build the dtbo files like dts files.

Advertisement

Answer

After too many hours of investigation it turned out, that deploying files to other partitions than / is not easily possible. I now went the way of a post-processing script that mounts the final image, deploys the additional files and unmounts it.

# Ensure the first loopback device is free to use
sudo -n losetup -d /dev/loop0 || true

# Create a loopback device for the given image
sudo -n losetup -Pf ../deploy/images/bapi/ba.rootfs.rpi-sdimg

# Mount the loopback device
mkdir -p tmp
sudo -n mount /dev/loop0p1 tmp

# Deploy files
sudo -n cp -n ../../meta-ba-rpi-cm3/recipes-core/rpi3-overlays/files/* tmp/overlays/
sudo -n cp ../../conf/config.txt tmp/config.txt
sudo -n cp ../../conf/cmdline.txt tmp/cmdline.txt

# Unmount the image and free the loopback device
sudo -n umount tmp
sudo -n losetup -d /dev/loop0
Advertisement