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

login
register
mail settings
Submitter Cristian Iorga
Date July 22, 2013, 10:17 a.m.
Message ID <969F26A8BAB325438E7EB80D3C3134FB16C0733E@IRSMSX105.ger.corp.intel.com>
Download mbox | patch
Permalink /patch/54167/
State New
Headers show

Comments

Cristian Iorga - July 22, 2013, 10:17 a.m.
ACK.

-----Original Message-----
From: openembedded-core-bounces@lists.openembedded.org [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of Jonathan Liu
Sent: Saturday, July 20, 2013 3:11 PM
To: openembedded-core@lists.openembedded.org
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]

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 meta/classes/boot-directdisk.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 182957b..8a55aae 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -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`