Skip to contentSkip to conversation

boot-directdisk: use awk instead of echo -ne for dash compatibility

PATCH In review Jonathan Liu 2 participants 2 messages Jul 20, 2013 – Jul 22, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 boot-directdisk: use awk instead of echo -ne for dash compatibility

The echo command is a dash shell built-in and does not support the -n and -e options so use awk instead.

This fixes the partition table being corrupted when writing the MBR disk signature into the image.

[YOCTO #4859]

---
 meta/classes/boot-directdisk.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/boot-directdisk.bbclass +1 -1
index 182957b..8a55aae 100644
@@ -81,7 +81,7 @@ build_boot_dd() {
 	parted $IMAGE set 1 boot on 
 	parted $IMAGE print
 
-	echo -ne "$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')" | \
+	awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \
 		dd of=$IMAGE bs=1 seek=440 conv=notrunc
 
 	OFFSET=`expr $END2 / 512`
Signature · 1 line
1.8.3.2
#1 lore raw

ACK.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Jonathan Liu
Sent: Saturday, July 20, 2013 3:11 PM
To: [email protected]
Subject: [OE-core] [PATCH] boot-directdisk: use awk instead of echo -ne for dash compatibility

The echo command is a dash shell built-in and does not support the -n and -e options so use awk instead.

This fixes the partition table being corrupted when writing the MBR disk signature into the image.

[YOCTO #4859]

---
 meta/classes/boot-directdisk.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/boot-directdisk.bbclass +1 -1
index 182957b..8a55aae 100644
@@ -81,7 +81,7 @@ build_boot_dd() {
 	parted $IMAGE set 1 boot on 
 	parted $IMAGE print
 
-	echo -ne "$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')" | \
+	awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \
 		dd of=$IMAGE bs=1 seek=440 conv=notrunc
 
 	OFFSET=`expr $END2 / 512`
Signature · 6 lines
1.8.3.2

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core