summaryrefslogtreecommitdiff
path: root/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta-raspberrypi/classes/sdcard_image-rpi.bbclass')
-rw-r--r--meta-raspberrypi/classes/sdcard_image-rpi.bbclass37
1 files changed, 14 insertions, 23 deletions
diff --git a/meta-raspberrypi/classes/sdcard_image-rpi.bbclass b/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
index 1389720346..a7b9ac82fb 100644
--- a/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
+++ b/meta-raspberrypi/classes/sdcard_image-rpi.bbclass
@@ -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