summaryrefslogtreecommitdiffstats
path: root/meta/classes/image-vm.bbclass
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-03-30 00:23:11 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-31 23:01:37 +0100
commit4d1df2cfe84fe4ad061cee01cddea4e7ae627fe4 (patch)
treecc38dc059d7d54425d10127316e5d961f5d26c92 /meta/classes/image-vm.bbclass
parentd6d75260fa0a9874a62acd3251b7405ed59f0cfa (diff)
downloadpoky-4d1df2cfe84fe4ad061cee01cddea4e7ae627fe4.tar.gz
image-live.bbclass/image-vm.bbclass: remove duplicated code
Move the common code to live_vm_common.bbclass and remove duplicated ones. (From OE-Core rev: 4a70cc59a0350f06d4cc48c12c3053a39191ba07) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/image-vm.bbclass')
-rw-r--r--meta/classes/image-vm.bbclass53
1 files changed, 3 insertions, 50 deletions
diff --git a/meta/classes/image-vm.bbclass b/meta/classes/image-vm.bbclass
index ced8eac4d9..66712a62ff 100644
--- a/meta/classes/image-vm.bbclass
+++ b/meta/classes/image-vm.bbclass
@@ -15,6 +15,8 @@
15# We have to push the msdos parition table size > 16MB so fat 16 is used as parted 15# We have to push the msdos parition table size > 16MB so fat 16 is used as parted
16# won't touch fat12 partitions. 16# won't touch fat12 partitions.
17 17
18inherit live-vm-common
19
18do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \ 20do_bootdirectdisk[depends] += "dosfstools-native:do_populate_sysroot \
19 virtual/kernel:do_deploy \ 21 virtual/kernel:do_deploy \
20 syslinux:do_populate_sysroot \ 22 syslinux:do_populate_sysroot \
@@ -43,63 +45,14 @@ do_bootdirectdisk[depends] += "${@'${INITRD_IMAGE_VM}:do_image_complete' if '${I
43BOOTDD_VOLUME_ID ?= "boot" 45BOOTDD_VOLUME_ID ?= "boot"
44BOOTDD_EXTRA_SPACE ?= "16384" 46BOOTDD_EXTRA_SPACE ?= "16384"
45 47
46EFI = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
47EFI_PROVIDER ?= "grub-efi"
48EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
49
50# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
51# contain "efi". This way legacy is supported by default if neither is
52# specified, maintaining the original behavior.
53def pcbios(d):
54 pcbios = bb.utils.contains("MACHINE_FEATURES", "pcbios", "1", "0", d)
55 if pcbios == "0":
56 pcbios = bb.utils.contains("MACHINE_FEATURES", "efi", "0", "1", d)
57 return pcbios
58
59def pcbios_class(d):
60 if d.getVar("PCBIOS", True) == "1":
61 return "syslinux"
62 return ""
63
64PCBIOS = "${@pcbios(d)}"
65PCBIOS_CLASS = "${@pcbios_class(d)}"
66
67# Get the build_syslinux_cfg() function from the syslinux class
68inherit ${PCBIOS_CLASS}
69inherit ${EFI_CLASS}
70
71DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" 48DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}"
72 49
73boot_direct_populate() {
74 dest=$1
75 install -d $dest
76
77 # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
78 if [ -e ${DEPLOY_DIR_IMAGE}/bzImage ]; then
79 install -m 0644 ${DEPLOY_DIR_IMAGE}/bzImage $dest/vmlinuz
80 fi
81
82 # initrd is made of concatenation of multiple filesystem images
83 if [ -n "${INITRD}" ]; then
84 rm -f $dest/initrd
85 for fs in ${INITRD}
86 do
87 if [ -s "${fs}" ]; then
88 cat ${fs} >> $dest/initrd
89 else
90 bbfatal "${fs} is invalid. initrd image creation failed."
91 fi
92 done
93 chmod 0644 $dest/initrd
94 fi
95}
96
97build_boot_dd() { 50build_boot_dd() {
98 HDDDIR="${S}/hdd/boot" 51 HDDDIR="${S}/hdd/boot"
99 HDDIMG="${S}/hdd.image" 52 HDDIMG="${S}/hdd.image"
100 IMAGE=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect 53 IMAGE=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect
101 54
102 boot_direct_populate $HDDDIR 55 populate_kernel $HDDDIR
103 56
104 if [ "${PCBIOS}" = "1" ]; then 57 if [ "${PCBIOS}" = "1" ]; then
105 syslinux_hddimg_populate $HDDDIR 58 syslinux_hddimg_populate $HDDDIR