]> code.ossystems Code Review - openembedded-core.git/commitdiff
image-vm: Avoid use of fold, tac and paste commands for DISK_SIGNATURE
authorJonathan Liu <net147@gmail.com>
Thu, 8 Jun 2017 11:07:54 +0000 (21:07 +1000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 12 Jun 2017 14:04:08 +0000 (15:04 +0100)
These commands are not whitelisted by the HOSTTOOLS variable which
silently prevents the MBR disk signature from being written to the
image.

Reported-by: Michael Davis <michael.davis@essvote.com>
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/image-vm.bbclass

index 35c9244e9b0570d57dbe09228319af81587ddaf1..98bd92000e303fbf76796731bf0dfceee75acd57 100644 (file)
@@ -93,7 +93,7 @@ build_boot_dd() {
 
        parted $IMAGE print
 
-       awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \
+       awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | sed 's/\(..\)\(..\)\(..\)\(..\)/\\x\4\\x\3\\x\2\\x\1/')\" }" | \
                dd of=$IMAGE bs=1 seek=440 conv=notrunc
 
        OFFSET=`expr $END2 / 512`