summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>2019-09-18 16:12:47 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-19 10:54:32 +0100
commit4ad3130c20bfb4eac7c1fd4eedb7d10e49c364c9 (patch)
tree37ec412b6b2ad3a9a498af7af03c5488ee302db4 /meta/classes
parent94df595512a4b60279b8bfeef8d625d82495ed59 (diff)
downloadpoky-4ad3130c20bfb4eac7c1fd4eedb7d10e49c364c9.tar.gz
live-vm-common.bbclass: provide efi population functions for live images
Define common functions for populating EFI directories in live image by reusing common code from grub-efi and systemd-boot bbclasses. (From OE-Core rev: 3728899a0cd543793db258da0976362b4bde7133) Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/grub-efi.bbclass28
-rw-r--r--meta/classes/live-vm-common.bbclass33
-rw-r--r--meta/classes/systemd-boot.bbclass22
3 files changed, 36 insertions, 47 deletions
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 724bbe8684..8fc6999e52 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -2,33 +2,7 @@ inherit grub-efi-cfg
2require conf/image-uefi.conf 2require conf/image-uefi.conf
3 3
4efi_populate() { 4efi_populate() {
5 # DEST must be the root of the image so that EFIDIR is not 5 efi_populate_common "$1" grub-efi
6 # nested under a top level directory.
7 DEST=$1
8
9 install -d ${DEST}${EFIDIR}
10
11 install -m 0644 ${DEPLOY_DIR_IMAGE}/grub-efi-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE}
12 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
13 printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
14 6
15 install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg 7 install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
16} 8}
17
18efi_iso_populate() {
19 iso_dir=$1
20 efi_populate $iso_dir
21 # Build a EFI directory to create efi.img
22 mkdir -p ${EFIIMGDIR}/${EFIDIR}
23 cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
24 cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
25 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
26 printf 'fs0:%s\%s\n' "$EFIPATH" "grub-efi-${EFI_BOOT_IMAGE}" > ${EFIIMGDIR}/startup.nsh
27 if [ -f "$iso_dir/initrd" ] ; then
28 cp $iso_dir/initrd ${EFIIMGDIR}
29 fi
30}
31
32efi_hddimg_populate() {
33 efi_populate $1
34}
diff --git a/meta/classes/live-vm-common.bbclass b/meta/classes/live-vm-common.bbclass
index 68105d9b84..74e7074a53 100644
--- a/meta/classes/live-vm-common.bbclass
+++ b/meta/classes/live-vm-common.bbclass
@@ -29,6 +29,39 @@ def pcbios(d):
29PCBIOS = "${@pcbios(d)}" 29PCBIOS = "${@pcbios(d)}"
30PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS') == '1']}" 30PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS') == '1']}"
31 31
32# efi_populate_common DEST BOOTLOADER
33efi_populate_common() {
34 # DEST must be the root of the image so that EFIDIR is not
35 # nested under a top level directory.
36 DEST=$1
37
38 install -d ${DEST}${EFIDIR}
39
40 install -m 0644 ${DEPLOY_DIR_IMAGE}/$2-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE}
41 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
42 printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
43}
44
45efi_iso_populate() {
46 iso_dir=$1
47 efi_populate $iso_dir
48 # Build a EFI directory to create efi.img
49 mkdir -p ${EFIIMGDIR}/${EFIDIR}
50 cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
51 cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
52
53 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
54 printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${EFIIMGDIR}/startup.nsh
55
56 if [ -f "$iso_dir/initrd" ] ; then
57 cp $iso_dir/initrd ${EFIIMGDIR}
58 fi
59}
60
61efi_hddimg_populate() {
62 efi_populate $1
63}
64
32inherit ${EFI_CLASS} 65inherit ${EFI_CLASS}
33inherit ${PCBIOS_CLASS} 66inherit ${PCBIOS_CLASS}
34 67
diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index bb3221dacc..336c4c2ff5 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -16,38 +16,20 @@ require conf/image-uefi.conf
16inherit fs-uuid 16inherit fs-uuid
17 17
18efi_populate() { 18efi_populate() {
19 DEST=$1 19 efi_populate_common "$1" systemd
20 20
21 install -d ${DEST}${EFIDIR}
22 # systemd-boot requires these paths for configuration files 21 # systemd-boot requires these paths for configuration files
23 # they are not customizable so no point in new vars 22 # they are not customizable so no point in new vars
24 install -d ${DEST}/loader 23 install -d ${DEST}/loader
25 install -d ${DEST}/loader/entries 24 install -d ${DEST}/loader/entries
26 install -m 0644 ${DEPLOY_DIR_IMAGE}/systemd-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE}
27 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
28 printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
29 install -m 0644 ${SYSTEMD_BOOT_CFG} ${DEST}/loader/loader.conf 25 install -m 0644 ${SYSTEMD_BOOT_CFG} ${DEST}/loader/loader.conf
30 for i in ${SYSTEMD_BOOT_ENTRIES}; do 26 for i in ${SYSTEMD_BOOT_ENTRIES}; do
31 install -m 0644 ${i} ${DEST}/loader/entries 27 install -m 0644 ${i} ${DEST}/loader/entries
32 done 28 done
33} 29}
34 30
35efi_iso_populate() { 31efi_iso_populate_append() {
36 iso_dir=$1
37 efi_populate $iso_dir
38 mkdir -p ${EFIIMGDIR}/${EFIDIR}
39 cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
40 cp -r $iso_dir/loader ${EFIIMGDIR} 32 cp -r $iso_dir/loader ${EFIIMGDIR}
41 cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
42 EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
43 echo "fs0:${EFIPATH}\\${EFI_BOOT_IMAGE}" > ${EFIIMGDIR}/startup.nsh
44 if [ -f "$iso_dir/initrd" ] ; then
45 cp $iso_dir/initrd ${EFIIMGDIR}
46 fi
47}
48
49efi_hddimg_populate() {
50 efi_populate $1
51} 33}
52 34
53inherit systemd-boot-cfg 35inherit systemd-boot-cfg