summaryrefslogtreecommitdiffstats
path: root/meta/classes/image-live.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/image-live.bbclass')
-rw-r--r--meta/classes/image-live.bbclass60
1 files changed, 10 insertions, 50 deletions
diff --git a/meta/classes/image-live.bbclass b/meta/classes/image-live.bbclass
index a08715cd83..c837fbfc92 100644
--- a/meta/classes/image-live.bbclass
+++ b/meta/classes/image-live.bbclass
@@ -25,6 +25,8 @@
25# ${HDDIMG_ID} - FAT image volume-id 25# ${HDDIMG_ID} - FAT image volume-id
26# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) 26# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
27 27
28inherit live-vm-common
29
28do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ 30do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
29 mtools-native:do_populate_sysroot \ 31 mtools-native:do_populate_sysroot \
30 cdrtools-native:do_populate_sysroot \ 32 cdrtools-native:do_populate_sysroot \
@@ -71,52 +73,11 @@ MKISOFS_OPTIONS = "-no-emul-boot -boot-load-size 4 -boot-info-table"
71BOOTIMG_VOLUME_ID ?= "boot" 73BOOTIMG_VOLUME_ID ?= "boot"
72BOOTIMG_EXTRA_SPACE ?= "512" 74BOOTIMG_EXTRA_SPACE ?= "512"
73 75
74EFI = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "1", "0", d)}" 76populate_live() {
75EFI_PROVIDER ?= "grub-efi" 77 populate_kernel $1
76EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}" 78 if [ -s "${ROOTFS}" ]; then
77 79 install -m 0644 ${ROOTFS} $1/rootfs.img
78KERNEL_IMAGETYPE ??= "bzImage"
79
80# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
81# contain "efi". This way legacy is supported by default if neither is
82# specified, maintaining the original behavior.
83def pcbios(d):
84 pcbios = bb.utils.contains("MACHINE_FEATURES", "pcbios", "1", "0", d)
85 if pcbios == "0":
86 pcbios = bb.utils.contains("MACHINE_FEATURES", "efi", "0", "1", d)
87 return pcbios
88
89PCBIOS = "${@pcbios(d)}"
90PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS', True) == '1']}"
91
92inherit ${EFI_CLASS}
93inherit ${PCBIOS_CLASS}
94
95populate() {
96 DEST=$1
97 install -d ${DEST}
98
99 # Install kernel, initrd, and rootfs.img in DEST for all loaders to use.
100 install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ${DEST}/vmlinuz
101
102 # initrd is made of concatenation of multiple filesystem images
103 if [ -n "${INITRD}" ]; then
104 rm -f ${DEST}/initrd
105 for fs in ${INITRD}
106 do
107 if [ -s "${fs}" ]; then
108 cat ${fs} >> ${DEST}/initrd
109 else
110 bbfatal "${fs} is invalid. initrd image creation failed."
111 fi
112 done
113 chmod 0644 ${DEST}/initrd
114 fi
115
116 if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
117 install -m 0644 ${ROOTFS} ${DEST}/rootfs.img
118 fi 80 fi
119
120} 81}
121 82
122build_iso() { 83build_iso() {
@@ -128,14 +89,13 @@ build_iso() {
128 # ${INITRD} is a list of multiple filesystem images 89 # ${INITRD} is a list of multiple filesystem images
129 for fs in ${INITRD} 90 for fs in ${INITRD}
130 do 91 do
131 if [ ! -s "${fs}" ]; then 92 if [ ! -s "$fs" ]; then
132 bbnote "ISO image will not be created. ${fs} is invalid." 93 bbnote "ISO image will not be created. $fs is invalid."
133 return 94 return
134 fi 95 fi
135 done 96 done
136 97
137 98 populate_live ${ISODIR}
138 populate ${ISODIR}
139 99
140 if [ "${PCBIOS}" = "1" ]; then 100 if [ "${PCBIOS}" = "1" ]; then
141 syslinux_iso_populate ${ISODIR} 101 syslinux_iso_populate ${ISODIR}
@@ -275,7 +235,7 @@ build_fat_img() {
275build_hddimg() { 235build_hddimg() {
276 # Create an HDD image 236 # Create an HDD image
277 if [ "${NOHDD}" != "1" ] ; then 237 if [ "${NOHDD}" != "1" ] ; then
278 populate ${HDDDIR} 238 populate_live ${HDDDIR}
279 239
280 if [ "${PCBIOS}" = "1" ]; then 240 if [ "${PCBIOS}" = "1" ]; then
281 syslinux_hddimg_populate ${HDDDIR} 241 syslinux_hddimg_populate ${HDDDIR}