diff options
| -rw-r--r-- | meta/classes/boot-directdisk.bbclass | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 31690432dd..182957b106 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass | |||
| @@ -34,6 +34,7 @@ BOOTDD_EXTRA_SPACE ?= "16384" | |||
| 34 | # Get the build_syslinux_cfg() function from the syslinux class | 34 | # Get the build_syslinux_cfg() function from the syslinux class |
| 35 | 35 | ||
| 36 | AUTO_SYSLINUXCFG = "1" | 36 | AUTO_SYSLINUXCFG = "1" |
| 37 | DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" | ||
| 37 | SYSLINUX_ROOT ?= "root=/dev/sda2" | 38 | SYSLINUX_ROOT ?= "root=/dev/sda2" |
| 38 | SYSLINUX_TIMEOUT ?= "10" | 39 | SYSLINUX_TIMEOUT ?= "10" |
| 39 | 40 | ||
| @@ -80,6 +81,9 @@ build_boot_dd() { | |||
| 80 | parted $IMAGE set 1 boot on | 81 | parted $IMAGE set 1 boot on |
| 81 | parted $IMAGE print | 82 | parted $IMAGE print |
| 82 | 83 | ||
| 84 | echo -ne "$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')" | \ | ||
| 85 | dd of=$IMAGE bs=1 seek=440 conv=notrunc | ||
| 86 | |||
| 83 | OFFSET=`expr $END2 / 512` | 87 | OFFSET=`expr $END2 / 512` |
| 84 | dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc | 88 | dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc |
| 85 | dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 | 89 | dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 |
| @@ -91,8 +95,24 @@ build_boot_dd() { | |||
| 91 | } | 95 | } |
| 92 | 96 | ||
| 93 | python do_bootdirectdisk() { | 97 | python do_bootdirectdisk() { |
| 98 | validate_disk_signature(d) | ||
| 94 | bb.build.exec_func('build_syslinux_cfg', d) | 99 | bb.build.exec_func('build_syslinux_cfg', d) |
| 95 | bb.build.exec_func('build_boot_dd', d) | 100 | bb.build.exec_func('build_boot_dd', d) |
| 96 | } | 101 | } |
| 97 | 102 | ||
| 103 | def generate_disk_signature(): | ||
| 104 | import uuid | ||
| 105 | |||
| 106 | return str(uuid.uuid4())[:8] | ||
| 107 | |||
| 108 | def validate_disk_signature(d): | ||
| 109 | import re | ||
| 110 | |||
| 111 | disk_signature = d.getVar("DISK_SIGNATURE", True) | ||
| 112 | |||
| 113 | if not re.match(r'^[0-9a-fA-F]{8}$', disk_signature): | ||
| 114 | bb.fatal("DISK_SIGNATURE '%s' must be an 8 digit hex string" % disk_signature) | ||
| 115 | |||
| 116 | DISK_SIGNATURE_GENERATED := "${@generate_disk_signature()}" | ||
| 117 | |||
| 98 | addtask bootdirectdisk before do_build | 118 | addtask bootdirectdisk before do_build |
