Skip to contentSkip to conversation

bootimg: Fix a math thinko in the block count calculation

PATCH Applied Darren Hart 3 participants 4 messages Jan 25, 2012

lore
Share & tools
lore
#0 lore raw

cover bootimg: Fix a math thinko in the block count calculation

The following changes since commit 6b2cb8280211d2e28ce75d6a107f99a3fa7868ae:

gcc-common.inc: Fix comment (2012-01-24 14:38:39 +0000)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib dvhart/bug/1852
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/bug/1852

Darren Hart (1):
bootimg: Fix a math thinko in the block count calculation

 meta/classes/bootimg.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.6.5
#1 lore raw

PATCH 1/1 bootimg: Fix a math thinko in the block count calculation

Fixes [YOCTO #1852] ... again.

The conversion from sectors to blocks was multiplying by 2 instead of dividing by 2. Blocks are 1024 bytes, sectors are 512 bytes. The result was images being much larger than intended.

---
 meta/classes/bootimg.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/bootimg.bbclass +1 -1
index df3ee73..e65bef7 100644
@@ -133,7 +133,7 @@ build_hddimg() {
 		SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS))
 
 		# Determine the final size in blocks accounting for some padding
-		BLOCKS=$(expr $(expr $SECTORS \* 2) + ${BOOTIMG_EXTRA_SPACE})
+		BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE})
 
 		# Ensure total sectors is an integral number of sectors per
 		# track or mcopy will complain. Sectors are 512 bytes, and we
Signature · 1 line
1.7.6.5
Tested-by on v1 1/1
#2 lore raw
Quoted 6 lines · Darren Hart

Fixes [YOCTO #1852] ... again.

The conversion from sectors to blocks was multiplying by 2 instead of dividing by 2. Blocks are 1024 bytes, sectors are 512 bytes. The result was images being much larger than intended.

Much better, thanks for the quick fix.

Quoted 20 lines
---
 meta/classes/bootimg.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/bootimg.bbclass +1 -1
index df3ee73..e65bef7 100644
@@ -133,7 +133,7 @@ build_hddimg() {
 		SECTORS=$(expr $SECTORS + $(expr $DIR_SECTORS + $FAT_SECTORS))
 
 		# Determine the final size in blocks accounting for some padding
-		BLOCKS=$(expr $(expr $SECTORS \* 2) + ${BOOTIMG_EXTRA_SPACE})
+		BLOCKS=$(expr $(expr $SECTORS / 2) + ${BOOTIMG_EXTRA_SPACE})
 
 		# Ensure total sectors is an integral number of sectors per
 		# track or mcopy will complain. Sectors are 512 bytes, and we
#3 lore raw
In reply to Darren Hart
Quoted 6 lines · Darren Hart

Fixes [YOCTO #1852] ... again.

The conversion from sectors to blocks was multiplying by 2 instead of dividing by 2. Blocks are 1024 bytes, sectors are 512 bytes. The result was images being much larger than intended.

Quoted 6 lines
---
 meta/classes/bootimg.bbclass |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Merged to master, thanks.

Richard