diff options
Diffstat (limited to 'meta/classes/bootimg.bbclass')
-rw-r--r-- | meta/classes/bootimg.bbclass | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index 49ee85ea72..bcae2aeab1 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass | |||
@@ -62,13 +62,21 @@ build_boot_bin() { | |||
62 | 62 | ||
63 | install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys | 63 | install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys |
64 | 64 | ||
65 | # Do a little math, bash style | 65 | # Determine the 1024 byte block count for the final image. |
66 | #BLOCKS=`du -s ${HDDDIR} | cut -f 1` | 66 | BLOCKS=`du --apparent-size -ks ${HDDDIR} | cut -f 1` |
67 | BLOCKS=`du -bks ${HDDDIR} | cut -f 1` | 67 | SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}` |
68 | SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}` | 68 | |
69 | 69 | # Ensure total sectors is an integral number of sectors per | |
70 | mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \ | 70 | # track or mcopy will complain. Sectors are 512 bytes, and and |
71 | -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE | 71 | # we generate images with 32 sectors per track. This calculation |
72 | # is done in blocks, which are twice the size of sectors, thus | ||
73 | # the 16 instead of 32. | ||
74 | SIZE=$(expr $SIZE + $(expr 16 - $(expr $SIZE % 16))) | ||
75 | |||
76 | IMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg | ||
77 | mkdosfs -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${IMG} ${SIZE} | ||
78 | # Copy HDDDIR recursively into the image file directly | ||
79 | mcopy -i ${IMG} -s ${HDDDIR}/* ::/ | ||
72 | 80 | ||
73 | syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg | 81 | syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg |
74 | chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg | 82 | chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg |