summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Clark <christopher.w.clark@gmail.com>2020-07-15 15:46:23 -0700
committerAndrei Gherzan <andrei@gherzan.ro>2020-07-29 11:54:14 +0100
commitc883daa802027abde6c5a3ff87dac6923e7b5b1a (patch)
treef31ef98e6bdc930e0f255445568e6f5cca9297b7
parenteaf4a5f17e6adb50d7115a5eb995b0b5674d6b02 (diff)
downloadmeta-raspberrypi-c883daa802027abde6c5a3ff87dac6923e7b5b1a.tar.gz
sdcard_image-rpi.bbclass: enable extensible inclusion into boot
Add DEPLOYPAYLOAD, similar to the existing FATPAYLOAD, to enable adding files to the boot partition from the image deploy directory. Files such as hypervisor binaries may not be present (and in fact unwanted) within the root filesystem, so FATPAYLOAD is not sufficient. DEPLOYPAYLOAD is implemented with support for file renaming from the source file in the image deploy directory to the filename written into the boot image. DEPLOYPAYLOAD is a space-separated list of entries for additions, each of which can optionally be colon-separated: <image deploy directory file>:<destination filename> If the colon separator is omitted, the source deploy directory filename is used as the destination filename. The support for specifying the destination filename is used for including Xen, which produces a machine-specific file in the image deploy directory, and is written to the image partition with its expected filename: xen. Files that are to be included from the image deploy directory will be produced by tasks that the do_image_rpi_sdimg[depends] must list, so enable adding entries to that via a new variable: RPI_SDIMG_EXTRA_DEPENDS. These changes enable retiring a Xen-specific Raspberry Pi SD card bbclass from meta-virtualization and have been tested on the Raspberry Pi 4. Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
-rw-r--r--classes/sdcard_image-rpi.bbclass17
1 files changed, 17 insertions, 0 deletions
diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
index 43426b2..779a9e2 100644
--- a/classes/sdcard_image-rpi.bbclass
+++ b/classes/sdcard_image-rpi.bbclass
@@ -59,6 +59,7 @@ do_image_rpi_sdimg[depends] = " \
59 ${@bb.utils.contains('MACHINE_FEATURES', 'armstub', 'armstubs:do_deploy', '' ,d)} \ 59 ${@bb.utils.contains('MACHINE_FEATURES', 'armstub', 'armstubs:do_deploy', '' ,d)} \
60 ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \ 60 ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot:do_deploy', '',d)} \
61 ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot-default-script:do_deploy', '',d)} \ 61 ${@bb.utils.contains('RPI_USE_U_BOOT', '1', 'u-boot-default-script:do_deploy', '',d)} \
62 ${RPI_SDIMG_EXTRA_DEPENDS} \
62" 63"
63 64
64do_image_rpi_sdimg[recrdeps] = "do_build" 65do_image_rpi_sdimg[recrdeps] = "do_build"
@@ -148,6 +149,22 @@ IMAGE_CMD_rpi-sdimg () {
148 fi 149 fi
149 fi 150 fi
150 151
152 # Add files (eg. hypervisor binaries) from the deploy dir
153 if [ -n "${DEPLOYPAYLOAD}" ] ; then
154 echo "Copying deploy file payload into VFAT"
155 for entry in ${DEPLOYPAYLOAD} ; do
156 # Split entry at optional ':' to enable file renaming for the destination
157 if [ $(echo "$entry" | grep -c :) = "0" ] ; then
158 DEPLOY_FILE="$entry"
159 DEST_FILENAME="$entry"
160 else
161 DEPLOY_FILE="$(echo "$entry" | cut -f1 -d:)"
162 DEST_FILENAME="$(echo "$entry" | cut -f2- -d:)"
163 fi
164 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"
165 done
166 fi
167
151 if [ -n "${FATPAYLOAD}" ] ; then 168 if [ -n "${FATPAYLOAD}" ] ; then
152 echo "Copying payload into VFAT" 169 echo "Copying payload into VFAT"
153 for entry in ${FATPAYLOAD} ; do 170 for entry in ${FATPAYLOAD} ; do