[oe-commits] Robert Yang : bootimg.bbclass:hddimg: check the size of rootfs.img for hddimg

git at git.openembedded.org git at git.openembedded.org
Tue Jun 30 08:07:02 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 316a89fa36e077e112cd4029e935010fa545c75e
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=316a89fa36e077e112cd4029e935010fa545c75e

Author: Robert Yang <liezhi.yang at windriver.com>
Date:   Mon Jun 29 20:06:38 2015 -0700

bootimg.bbclass:hddimg: check the size of rootfs.img for hddimg

The hddimg uses FAT, so the single file size should be less than 4GB,
otherwise errors, check that and error out.

Another way might be use ext2/3/4 rather than FAT, but EFI only supports
FAT, if we make EFI use FAT, and non-EFI use extX, that would the code
very different, which seems not worth.

[YOCTO #6449]

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/bootimg.bbclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index 605edc9..ab1d1bd 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -249,6 +249,19 @@ build_hddimg() {
 			efi_hddimg_populate ${HDDDIR}
 		fi
 
+		# Check the size of ${HDDDIR}/rootfs.img, error out if it
+		# exceeds 4GB, it is the single file's max size of FAT fs.
+		if [ -f ${HDDDIR}/rootfs.img ]; then
+			rootfs_img_size=`stat -c '%s' ${HDDDIR}/rootfs.img`
+			max_size=`expr 4 \* 1024 \* 1024 \* 1024`
+			if [ $rootfs_img_size -gt $max_size ]; then
+				bberror "${HDDDIR}/rootfs.img execeeds 4GB,"
+				bberror "this doesn't work on FAT filesystem, you can try either of:"
+				bberror "1) Reduce the size of rootfs.img"
+				bbfatal "2) Use iso, vmdk or vdi to instead of hddimg\n"
+			fi
+		fi
+
 		build_fat_img ${HDDDIR} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
 
 		if [ "${PCBIOS}" = "1" ]; then



More information about the Openembedded-commits mailing list