diff options
-rw-r--r-- | meta/classes/bootimg.bbclass | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index 8ec07a04ee..b50202f68f 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass | |||
@@ -103,13 +103,21 @@ build_hddimg() { | |||
103 | grubefi_hddimg_populate | 103 | grubefi_hddimg_populate |
104 | fi | 104 | fi |
105 | 105 | ||
106 | # Determine the block count for the final image | 106 | # Determine the 1024 byte block count for the final image. |
107 | BLOCKS=`du -bks ${HDDDIR} | cut -f 1` | 107 | BLOCKS=`du --apparent-size -ks ${HDDDIR} | cut -f 1` |
108 | SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}` | 108 | SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}` |
109 | 109 | ||
110 | mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \ | 110 | # Ensure total sectors is an integral number of sectors per |
111 | -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE | 111 | # track or mcopy will complain. Sectors are 512 bytes, and and |
112 | dosfsck -a -l ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg || true | 112 | # we generate images with 32 sectors per track. This calculation |
113 | # is done in blocks, which are twice the size of sectors, thus | ||
114 | # the 16 instead of 32. | ||
115 | SIZE=$(expr $SIZE + $(expr 16 - $(expr $SIZE % 16))) | ||
116 | |||
117 | IMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg | ||
118 | mkdosfs -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${IMG} ${SIZE} | ||
119 | # Copy HDDDIR recursively into the image file directly | ||
120 | mcopy -i ${IMG} -s ${HDDDIR}/* ::/ | ||
113 | 121 | ||
114 | if [ "${PCBIOS}" = "1" ]; then | 122 | if [ "${PCBIOS}" = "1" ]; then |
115 | syslinux_hddimg_install | 123 | syslinux_hddimg_install |