Dunfell分支RPi-CM3 Yocto镜像添加DTBO至Boot分区失败及方案选择咨询
Hey there, let's dig into your DTBO issue and figure out the best way to get your overlay into the final image.
Why isn't the DTBO showing up in the final image's boot partition?
There are a few likely culprits here:
Boot partition content isn't pulling from the rootfs
/boot
On Raspberry Pi Yocto BSPs (like meta-raspberrypi in Dunfell), the boot partition is usually assembled using files from${DEPLOY_DIR_IMAGE}/bootrather than directly copying the rootfs's/bootdirectory. Youraffinage-devicesrecipe might be installing the DTBO to the rootfs, but it's not being added to the set of files that get packaged into the boot partition.Missing
IMAGE_BOOT_FILESconfiguration
You need to explicitly tell Yocto to include your DTBO in the boot partition. Add this line to your image recipe orlocal.conf:IMAGE_BOOT_FILES += "devicetree/affinage-actuator-overlay.dtbo"This ensures the DTBO is copied from the deployment directory into the final boot partition.
Verify
FILES_${PN}is correctly set
Double-check that your recipe's file list is actually including the DTBO. Run this command to inspect the expanded variable:bitbake affinage-devices -e | grep -A2 FILES_${PN}If the output doesn't include
/boot/devicetree/*.dtbo, you might need to explicitly define it in your recipe (even though thedevicetreeclass should set it—sometimes variable precedence can cause issues):FILES_${PN} += "/boot/devicetree/*.dtbo"Confirm the package is actually installed in the image
Check ifaffinage-devicesis present in your image's installed packages:bitbake <your-image-name> -e | grep IMAGE_INSTALL | grep affinage-devicesYou can also inspect the rootfs package list at
${TMPDIR}/deploy/images/raspberrypi-cm3/<your-image>-raspberrypi-cm3.rootfs/usr/lib/opkg/info/affinage-devices.listto see if the DTBO path is listed.
Should I use a standalone recipe or inherit devicetree in a kernel bbappend?
Both approaches work, but they're suited for different scenarios:
Standalone Recipe (Your Current Approach)
- Pros: Clean separation of your custom overlays from the kernel code, easier to maintain and version independently.
- Cons: Requires extra configuration to get the DTBO into the boot partition (as we discussed above).
- Best for: Overlays that don't depend on specific kernel versions or can be compiled with a standalone DTC.
Kernel BBAppend with devicetree Inheritance
- Pros: Ensures your DTBO is compiled with the same DTC version used for the kernel, which avoids compatibility issues if your overlay uses kernel-specific syntax.
- Cons: Ties your overlay to the kernel build process, and you ran into an indentation error here.
- Fixing the TabError: The error you saw (
inconsistent use of tabs and spaces in indentation) is because Yocto recipes require consistent indentation in shell script blocks. Open your kernel bbappend and replace all tabs with spaces (or vice versa—stick to one style) in the shell code sections. Yocto generally recommends using 4 spaces for indentation. - Best for: Overlays that rely on kernel-specific DTC features or need to stay in sync with kernel updates.
Final Recommendations
- Start by fixing the standalone recipe approach first: add
IMAGE_BOOT_FILES += "devicetree/affinage-actuator-overlay.dtbo"and verify theFILES_${PN}variable. This is simpler for most custom overlays. - If you run into compatibility issues with DTC versions, switch to the kernel bbappend approach—just make sure to fix the indentation problem in your shell code.
内容的提问来源于stack exchange,提问作者Chris

