summaryrefslogtreecommitdiff
path: root/meta/classes/boot-directdisk.bbclass
diff options
context:
space:
mode:
authorSaul Wold <sgw@linux.intel.com>2012-03-26 22:42:57 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-27 13:21:46 +0100
commit53ae1737611e10e7fef815e8fde9e22165aa1047 (patch)
tree156880e7ae84944700a58373c0895d60b63fb3a8 /meta/classes/boot-directdisk.bbclass
parentfe157bb9543bbb6c9523c0feb150ae3913802379 (diff)
downloadopenembedded-core-53ae1737611e10e7fef815e8fde9e22165aa1047.tar.gz
openembedded-core-53ae1737611e10e7fef815e8fde9e22165aa1047.tar.bz2
openembedded-core-53ae1737611e10e7fef815e8fde9e22165aa1047.zip
boot-directdisk: Fix Block Calcuation
This also changes the timeout to be settable The block calcuation was not correctly rounding, see comment Thanks to Darren Hart for fixing this. Cc: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/boot-directdisk.bbclass')
-rw-r--r--meta/classes/boot-directdisk.bbclass19
1 files changed, 13 insertions, 6 deletions
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 893164f853..e9e1ba30db 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -37,9 +37,8 @@ BOOTDD_EXTRA_SPACE ?= "16384"
# Get the build_syslinux_cfg() function from the syslinux class
AUTO_SYSLINUXCFG = "1"
-LABELS = "boot"
SYSLINUX_ROOT ?= "root=/dev/sda2"
-SYSLINUX_TIMEOUT = "10" # 1 second
+SYSLINUX_TIMEOUT ?= "10"
SYSLINUXCFG = "${HDDDIR}/syslinux.cfg"
SYSLINUXMENU = "${HDDDIR}/menu"
@@ -55,15 +54,23 @@ build_boot_dd() {
install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
- SIZE=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}`
+ BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}`
+
+ # Ensure total sectors is an integral number of sectors per
+ # track or mcopy will complain. Sectors are 512 bytes, and we
+ # generate images with 32 sectors per track. This calculation is
+ # done in blocks, thus the mod by 16 instead of 32.
+ BLOCKS=$(expr $BLOCKS + $(expr 16 - $(expr $BLOCKS % 16)))
+
+ mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C ${HDDIMG} $BLOCKS
+ mcopy -i ${HDDIMG} -s ${HDDDIR}/* ::/
- mkdosfs -n ${BOOTDD_VOLUME_ID} -d ${HDDDIR} -C ${HDDIMG} $SIZE
syslinux ${HDDIMG}
chmod 644 ${HDDIMG}
ROOTFSBLOCKS=`du -Lbks ${ROOTFS} | cut -f 1`
- TOTALSIZE=`expr $SIZE + $ROOTFSBLOCKS`
- END1=`expr $SIZE \* 1024`
+ TOTALSIZE=`expr $BLOCKS + $ROOTFSBLOCKS`
+ END1=`expr $BLOCKS \* 1024`
END2=`expr $END1 + 512`
END3=`expr \( $ROOTFSBLOCKS \* 1024 \) + $END1`