sdcard_image-rpi.bbclass: Use processed list of device trees
make_dtb_boot_files already creates the list of device trees with their
right destination. There is no need to redo a similar logic here. As a
matter of fact, the sdimg functionality had a bug because it didn't
treat overlay_map.dtb as an overlays file.
@@ -75,18 +75,6 @@ SDIMG_VFAT_DEPLOY ?= "${RPI_USE_U_BOOT}"
SDIMG_VFAT = "${IMAGE_NAME}.vfat"
SDIMG_LINK_VFAT = "${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.vfat"
-def split_overlays(d, out, ver=None):
- dts = d.getVar("KERNEL_DEVICETREE")
- # Device Tree Overlays are assumed to be suffixed by '-overlay.dtb' (4.1.x) or by '.dtbo' (4.4.9+) string and will be put in a dedicated folder
- if out:
- overlays = oe.utils.str_filter_out(r'\S+\-overlay\.dtb$', dts, d)
- overlays = oe.utils.str_filter_out(r'\S+\.dtbo$', overlays, d)
- else:
- overlays = oe.utils.str_filter(r'\S+\-overlay\.dtb$', dts, d) + \
- " " + oe.utils.str_filter(r'\S+\.dtbo$', dts, d)
-
- return overlays
-
IMAGE_CMD:rpi-sdimg () {
# Align partitions
@@ -97,7 +85,7 @@ IMAGE_CMD:rpi-sdimg () {
echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS $ROOTFS_SIZE KiB"
# Check if we are building with device tree support
- DTS="${KERNEL_DEVICETREE}"
+ DTS="${@make_dtb_boot_files(d)}"
# Initialize sdcard image file
dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
@@ -120,17 +108,20 @@ IMAGE_CMD:rpi-sdimg () {
mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/armstubs/${ARMSTUB} ::/ || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/armstubs/${ARMSTUB} into boot.img"
fi
if test -n "${DTS}"; then
- # Copy board device trees to root folder
- for dtbf in ${@split_overlays(d, True)}; do
- dtb=`basename $dtbf`
- mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::$dtb || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/$dtb into boot.img"
- done
-
- # Copy device tree overlays to dedicated folder
+ # Copy board device trees (including overlays)
+ # There is an assumption here - no DTB in other directories than root
+ # and root/overlays. mmd/mcopy are not very flexible tools.
mmd -i ${WORKDIR}/boot.img overlays
- for dtbf in ${@split_overlays(d, False)}; do
- dtb=`basename $dtbf`
- mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::overlays/$dtb || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/$dtb into boot.img"
+ for entry in ${DTS} ; do
+ # Split entry at optional ';'
+ if [ $(echo "$entry" | grep -c \;) = "0" ] ; then
+ DEPLOY_FILE="$entry"
+ DEST_FILENAME="$entry"
+ else
+ DEPLOY_FILE="$(echo "$entry" | cut -f1 -d\;)"
+ DEST_FILENAME="$(echo "$entry" | cut -f2- -d\;)"
+ fi
+ mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${DEPLOY_FILE} ::${DEST_FILENAME} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${DEPLOY_FILE} into boot.img"
done
fi
if [ "${RPI_USE_U_BOOT}" = "1" ]; then
