diff options
| author | Robert Yang <liezhi.yang@windriver.com> | 2016-03-30 00:23:11 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-31 23:01:37 +0100 |
| commit | 4d1df2cfe84fe4ad061cee01cddea4e7ae627fe4 (patch) | |
| tree | cc38dc059d7d54425d10127316e5d961f5d26c92 /meta/classes/image-live.bbclass | |
| parent | d6d75260fa0a9874a62acd3251b7405ed59f0cfa (diff) | |
| download | poky-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-live.bbclass')
| -rw-r--r-- | meta/classes/image-live.bbclass | 60 |
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 | ||
| 28 | inherit live-vm-common | ||
| 29 | |||
| 28 | do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ | 30 | do_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" | |||
| 71 | BOOTIMG_VOLUME_ID ?= "boot" | 73 | BOOTIMG_VOLUME_ID ?= "boot" |
| 72 | BOOTIMG_EXTRA_SPACE ?= "512" | 74 | BOOTIMG_EXTRA_SPACE ?= "512" |
| 73 | 75 | ||
| 74 | EFI = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "1", "0", d)}" | 76 | populate_live() { |
| 75 | EFI_PROVIDER ?= "grub-efi" | 77 | populate_kernel $1 |
| 76 | EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}" | 78 | if [ -s "${ROOTFS}" ]; then |
| 77 | 79 | install -m 0644 ${ROOTFS} $1/rootfs.img | |
| 78 | KERNEL_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. | ||
| 83 | def 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 | |||
| 89 | PCBIOS = "${@pcbios(d)}" | ||
| 90 | PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS', True) == '1']}" | ||
| 91 | |||
| 92 | inherit ${EFI_CLASS} | ||
| 93 | inherit ${PCBIOS_CLASS} | ||
| 94 | |||
| 95 | populate() { | ||
| 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 | ||
| 122 | build_iso() { | 83 | build_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() { | |||
| 275 | build_hddimg() { | 235 | build_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} |
