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]

(From OE-Core rev: 1928f46e8e9f281e3e64f916048cc9314e125150)

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jonathan Liu 2013-07-20 22:11:20 +10:00 committed by Richard Purdie
parent 1b01e392e1
commit 1d5d93101e
1 changed files with 1 additions and 1 deletions

View File

@ -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`