summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJoão Henrique Ferreira de Freitas <joaohf@gmail.com>2013-09-12 19:02:08 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-09-14 08:29:42 +0100
commit707da95b4ad5babdf5edfa76c29012fd7c816dcb (patch)
treecd21221bc0158b59d5c803f3f63693c807598ae0 /meta
parenta6974f2a70d1900b29a441bf350106769714ca2c (diff)
downloadpoky-707da95b4ad5babdf5edfa76c29012fd7c816dcb.tar.gz
boot-directdisk: Allow for EFI-only boot direct disk images
Condition building PCBIOS legacy images on MACHINE_FEATURES containing "pcbios" or not containing "efi". This ensures existing BSPs will continue to get the old PCBIOS legacy-only images. New BSPs can add "efi", "pcbios", or both. The images created likewise support one or the other or both. (From OE-Core rev: c58aceee7dc243467dd87f07ccc61859f8d945e6) Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/boot-directdisk.bbclass65
-rw-r--r--meta/classes/syslinux.bbclass5
2 files changed, 60 insertions, 10 deletions
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 8a55aae6a3..4b9d7bd128 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -31,6 +31,29 @@ EXCLUDE_FROM_WORLD = "1"
31BOOTDD_VOLUME_ID ?= "boot" 31BOOTDD_VOLUME_ID ?= "boot"
32BOOTDD_EXTRA_SPACE ?= "16384" 32BOOTDD_EXTRA_SPACE ?= "16384"
33 33
34EFI = "${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
35EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "", d)}"
36
37# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
38# contain "efi". This way legacy is supported by default if neither is
39# specified, maintaining the original behavior.
40def pcbios(d):
41 pcbios = base_contains("MACHINE_FEATURES", "pcbios", "1", "0", d)
42 if pcbios == "0":
43 pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d)
44 return pcbios
45
46def pcbios_class(d):
47 if d.getVar("PCBIOS", True) == "1":
48 return "syslinux"
49 return ""
50
51PCBIOS = "${@pcbios(d)}"
52PCBIOS_CLASS = "${@pcbios_class(d)}"
53
54inherit ${PCBIOS_CLASS}
55inherit ${EFI_CLASS}
56
34# Get the build_syslinux_cfg() function from the syslinux class 57# Get the build_syslinux_cfg() function from the syslinux class
35 58
36AUTO_SYSLINUXCFG = "1" 59AUTO_SYSLINUXCFG = "1"
@@ -38,17 +61,32 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
38SYSLINUX_ROOT ?= "root=/dev/sda2" 61SYSLINUX_ROOT ?= "root=/dev/sda2"
39SYSLINUX_TIMEOUT ?= "10" 62SYSLINUX_TIMEOUT ?= "10"
40 63
41inherit syslinux 64populate() {
42 65 DEST=$1
66 install -d ${DEST}
67
68 # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
69 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage ${DEST}/vmlinuz
70
71 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
72 install -m 0644 ${INITRD} ${DEST}/initrd
73 fi
74
75}
76
43build_boot_dd() { 77build_boot_dd() {
44 HDDDIR="${S}/hdd/boot" 78 HDDDIR="${S}/hdd/boot"
45 HDDIMG="${S}/hdd.image" 79 HDDIMG="${S}/hdd.image"
46 IMAGE=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect 80 IMAGE=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect
47 81
48 install -d $HDDDIR 82 populate ${HDDDIR}
49 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage $HDDDIR/vmlinuz 83
50 install -m 0644 ${S}/syslinux.cfg $HDDDIR/syslinux.cfg 84 if [ "${PCBIOS}" = "1" ]; then
51 install -m 444 ${STAGING_DATADIR}/syslinux/ldlinux.sys $HDDDIR/ldlinux.sys 85 syslinux_hddimg_populate
86 fi
87 if [ "${EFI}" = "1" ]; then
88 grubefi_hddimg_populate
89 fi
52 90
53 BLOCKS=`du -bks $HDDDIR | cut -f 1` 91 BLOCKS=`du -bks $HDDDIR | cut -f 1`
54 BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}` 92 BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}`
@@ -62,7 +100,9 @@ build_boot_dd() {
62 mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C $HDDIMG $BLOCKS 100 mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C $HDDIMG $BLOCKS
63 mcopy -i $HDDIMG -s $HDDDIR/* ::/ 101 mcopy -i $HDDIMG -s $HDDDIR/* ::/
64 102
65 syslinux $HDDIMG 103 if [ "${PCBIOS}" = "1" ]; then
104 syslinux_hdddirect_install $HDDIMG
105 fi
66 chmod 644 $HDDIMG 106 chmod 644 $HDDIMG
67 107
68 ROOTFSBLOCKS=`du -Lbks ${ROOTFS} | cut -f 1` 108 ROOTFSBLOCKS=`du -Lbks ${ROOTFS} | cut -f 1`
@@ -85,9 +125,11 @@ build_boot_dd() {
85 dd of=$IMAGE bs=1 seek=440 conv=notrunc 125 dd of=$IMAGE bs=1 seek=440 conv=notrunc
86 126
87 OFFSET=`expr $END2 / 512` 127 OFFSET=`expr $END2 / 512`
88 dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc 128 if [ "${PCBIOS}" = "1" ]; then
129 dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc
130 fi
89 dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 131 dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512
90 dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 132 dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512
91 133
92 cd ${DEPLOY_DIR_IMAGE} 134 cd ${DEPLOY_DIR_IMAGE}
93 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect 135 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect
@@ -96,7 +138,10 @@ build_boot_dd() {
96 138
97python do_bootdirectdisk() { 139python do_bootdirectdisk() {
98 validate_disk_signature(d) 140 validate_disk_signature(d)
99 bb.build.exec_func('build_syslinux_cfg', d) 141 if d.getVar("PCBIOS", True) == "1":
142 bb.build.exec_func('build_syslinux_cfg', d)
143 if d.getVar("EFI", True) == "1":
144 bb.build.exec_func('build_grub_cfg', d)
100 bb.build.exec_func('build_boot_dd', d) 145 bb.build.exec_func('build_boot_dd', d)
101} 146}
102 147
diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index 501bc6db8e..dae66097bc 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -64,6 +64,11 @@ syslinux_hddimg_install() {
64 syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg 64 syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
65} 65}
66 66
67syslinux_hdddirect_install() {
68 DEST=$1
69 syslinux $DEST
70}
71
67python build_syslinux_cfg () { 72python build_syslinux_cfg () {
68 import copy 73 import copy
69 import sys 74 import sys