summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2019-07-30 19:41:35 +0000
committerAndrei Gherzan <andrei@gherzan.ro>2019-08-14 13:56:20 +0200
commiteebcfc1ecaa0227d8125ab03f287f3c3bc1cb32d (patch)
treecc98267ba7ff76631ffcd4e08c96c64776d9e962
parent559287aed92787d2e6e46e5a7af814a679849ef1 (diff)
downloadmeta-raspberrypi-eebcfc1ecaa0227d8125ab03f287f3c3bc1cb32d.tar.gz
sdcard_image-rpi.bbclass: use -v for all mcopy calls and add bbfatal in case mcopy fails
* I have this in our layer for some time: RPI_KERNEL_DEVICETREE_OVERLAYS_append = " overlays/vc4-fkms-v3d.dtbo" because we're using vc4graphics also on raspberrypi3 and it was working fine until recently. * now the default rpi-base.inc in warrior and master branch includes the same since: https://github.com/agherzan/meta-raspberrypi/commit/37aa050d5a44eb797540ef50408c2ca8e3da6fa0 and do_image_rpi_sdimg started failing with a bit useless log: ... Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 4194kB 46.1MB 41.9MB primary boot, lba 2 46.1MB 1145MB 1099MB primary mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows mkfs.fat 4.1 (2017-01-24) WARNING: exit code 1 from a shell command. * after adding -v to mcopy calls I got slightly better log: ... Copying w1-gpio-pullup.dtbo Copying w1-gpio.dtbo WARNING: exit code 1 from a shell command. * the issue is that mcopy behavior in non-interactive shell is to fail when the target file already exists (sometimes it seems to cause mcopy to hang forever), but when you execute the run.do_image_rpi_sdimg script manually in interactive shell it will nicely show this prompt on stderr: $ dtb=vc4-fkms-v3d.dtbo recipe-sysroot-native/usr/bin/mcopy -i boot.img -s BUILD/deploy/images/raspberrypi3/$dtb ::overlays/$dtb Long file name "vc4-fkms-v3d.dtbo" already exists. a)utorename A)utorename-all r)ename R)ename-all o)verwrite O)verwrite-all s)kip S)kip-all q)uit (aArRoOsSq): o * with the bbfatal the log is finally a bit more useful: ... Copying w1-gpio-pullup.dtbo Copying w1-gpio.dtbo ERROR: mcopy cannot copy TOPDIR/BUILD/deploy/images/raspberrypi3/vc4-fkms-v3d.dtbo into boot.img WARNING: exit code 1 from a shell command. * the only exception is FATPAYLOAD where it was ignoring mcopy with || true before, I've added bbwarn, because even issues like mentioned there "vfat issues like not supporting .~lock files" are probably worth reporting as warning (why would people add .~lock to FATPAYLOAD if it cannot be copied into boot.img) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--classes/sdcard_image-rpi.bbclass26
1 files changed, 13 insertions, 13 deletions
diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
index 041abb4..dc625a3 100644
--- a/classes/sdcard_image-rpi.bbclass
+++ b/classes/sdcard_image-rpi.bbclass
@@ -113,51 +113,51 @@ IMAGE_CMD_rpi-sdimg () {
113 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }') 113 BOOT_BLOCKS=$(LC_ALL=C parted -s ${SDIMG} unit b print | awk '/ 1 / { print substr($4, 1, length($4 -1)) / 512 /2 }')
114 rm -f ${WORKDIR}/boot.img 114 rm -f ${WORKDIR}/boot.img
115 mkfs.vfat -F32 -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS 115 mkfs.vfat -F32 -n "${BOOTDD_VOLUME_ID}" -S 512 -C ${WORKDIR}/boot.img $BOOT_BLOCKS
116 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/ 116 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* ::/ || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/bcm2835-bootfiles/* into boot.img"
117 if [ "${@bb.utils.contains("MACHINE_FEATURES", "armstub", "1", "0", d)}" = "1" ]; then 117 if [ "${@bb.utils.contains("MACHINE_FEATURES", "armstub", "1", "0", d)}" = "1" ]; then
118 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/armstubs/${ARMSTUB} ::/ 118 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/armstubs/${ARMSTUB} ::/ || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/armstubs/${ARMSTUB} into boot.img"
119 fi 119 fi
120 if test -n "${DTS}"; then 120 if test -n "${DTS}"; then
121 # Copy board device trees to root folder 121 # Copy board device trees to root folder
122 for dtbf in ${@split_overlays(d, True)}; do 122 for dtbf in ${@split_overlays(d, True)}; do
123 dtb=`basename $dtbf` 123 dtb=`basename $dtbf`
124 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::$dtb 124 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::$dtb || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/$dtb into boot.img"
125 done 125 done
126 126
127 # Copy device tree overlays to dedicated folder 127 # Copy device tree overlays to dedicated folder
128 mmd -i ${WORKDIR}/boot.img overlays 128 mmd -i ${WORKDIR}/boot.img overlays
129 for dtbf in ${@split_overlays(d, False)}; do 129 for dtbf in ${@split_overlays(d, False)}; do
130 dtb=`basename $dtbf` 130 dtb=`basename $dtbf`
131 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::overlays/$dtb 131 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/$dtb ::overlays/$dtb || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/$dtb into boot.img"
132 done 132 done
133 fi 133 fi
134 if [ "${RPI_USE_U_BOOT}" = "1" ]; then 134 if [ "${RPI_USE_U_BOOT}" = "1" ]; then
135 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE} 135 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/u-boot.bin ::${SDIMG_KERNELIMAGE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/u-boot.bin into boot.img"
136 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr 136 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/boot.scr ::boot.scr || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/boot.scr into boot.img"
137 if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then 137 if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
138 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${KERNEL_IMAGETYPE} 138 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${KERNEL_IMAGETYPE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin into boot.img"
139 else 139 else
140 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${KERNEL_IMAGETYPE} 140 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${KERNEL_IMAGETYPE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} into boot.img"
141 fi 141 fi
142 else 142 else
143 if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then 143 if [ ! -z "${INITRAMFS_IMAGE}" -a "${INITRAMFS_IMAGE_BUNDLE}" = "1" ]; then
144 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${SDIMG_KERNELIMAGE} 144 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin ::${SDIMG_KERNELIMAGE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin into boot.img"
145 else 145 else
146 mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${SDIMG_KERNELIMAGE} 146 mcopy -v -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ::${SDIMG_KERNELIMAGE} || bbfatal "mcopy cannot copy ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} into boot.img"
147 fi 147 fi
148 fi 148 fi
149 149
150 if [ -n "${FATPAYLOAD}" ] ; then 150 if [ -n "${FATPAYLOAD}" ] ; then
151 echo "Copying payload into VFAT" 151 echo "Copying payload into VFAT"
152 for entry in ${FATPAYLOAD} ; do 152 for entry in ${FATPAYLOAD} ; do
153 # add the || true to stop aborting on vfat issues like not supporting .~lock files 153 # use bbwarn instead of bbfatal to stop aborting on vfat issues like not supporting .~lock files
154 mcopy -i ${WORKDIR}/boot.img -s -v ${IMAGE_ROOTFS}$entry :: || true 154 mcopy -v -i ${WORKDIR}/boot.img -s ${IMAGE_ROOTFS}$entry :: || bbwarn "mcopy cannot copy ${IMAGE_ROOTFS}$entry into boot.img"
155 done 155 done
156 fi 156 fi
157 157
158 # Add stamp file 158 # Add stamp file
159 echo "${IMAGE_NAME}" > ${WORKDIR}/image-version-info 159 echo "${IMAGE_NAME}" > ${WORKDIR}/image-version-info
160 mcopy -i ${WORKDIR}/boot.img -v ${WORKDIR}/image-version-info :: 160 mcopy -v -i ${WORKDIR}/boot.img ${WORKDIR}/image-version-info :: || bbfatal "mcopy cannot copy ${WORKDIR}/image-version-info into boot.img"
161 161
162 # Deploy vfat partition 162 # Deploy vfat partition
163 if [ "${SDIMG_VFAT_DEPLOY}" = "1" ]; then 163 if [ "${SDIMG_VFAT_DEPLOY}" = "1" ]; then