All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 00/18] EFI boot partition improvements
@ 2017-12-19 22:58 California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 01/18] fs-uuid.bbclass: rewrite get_fs_uuid function California Sullivan
                   ` (20 more replies)
  0 siblings, 21 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

First, note that this is based on top of Haris' multiple kernels patch:
http://lists.openembedded.org/pipermail/openembedded-core/2017-November/144031.html

Currently, the boot partition of an EFI system is entirely controlled by
image creation. Either done entirely through wic, or one of the
bootloader bbclasses. This is rather bad since it makes it very
difficult to add additional items to the boot partition, such as
alternative kernels, bootloaders, or other utilities, and since its not
package controlled its hard to update.

The goal of these changes is to have the boot partition built through
packages instead. We accomplish this by installing everything to /boot,
and using the contents of /boot to create the partition. This required
changes to several bootloaders, the kernel recipe, one new
rootfs-postcommand to avoid data duplication, and a new .wks file to
make use of the new functionality.

Legacy hddimg, iso images, and wic images should be mostly unchanged,
and their functionality is preserved. The only change they received is
the kernel is now installed as ${KERNEL_IMAGETYPE} instead of hardcoded
as vmlinuz, and their bootloader configs have been updated to reflect
that.

This is still a WIP, but I wanted to get some eyes and feedback on it.
Here are some known issues that I've ran into, and am still working on:
* fs-uuid (DISK_SIGNATURE_UUID) seems to have issues when changing MACHINE
  types, and the image can get an old uuid when building from sstate
* init-install.sh hasn't been updated to support multiple kernels, and
  still uses hardcoded vmlinuz (broken)
* the boot partition is vfat, which doesn't support symlinks, so the
  symlink from the long kernel name to bzImage turns into a copy.

I fully expect this to take several iterations to get right, so please
any feedback is welcome.

Thanks,
Cal

California Sullivan (18):
  fs-uuid.bbclass: rewrite get_fs_uuid function
  image.bbclass: Add fs-uuid bbclass
  grub-efi.bbclass: split out configuration portion
  grub: create recipe for configuration
  grub-efi: install to /boot/
  grub-efi: if installed and EFI_PROVIDER, install as bootx64 or
    bootia32
  rootfs-postcommands: add rootfs postprocess command to avoid /boot/
    duplication
  packagegroup-core-boot: add bootloader to EFI systems
  live-vm-common.bbclass: Don't use vmlinuz or VM_DEFAULT_KERNEL
  grub-efi*.bbclass: don't reference vmlinuz
  wic: add wks file to make use of new bootfs functionality
  init-install-efi.sh: Update to support installing multiple kernels
  syslinux.bbclass: don't use vmlinuz
  systemd-boot.bbclass: break out configuration creation
  systemd: add systemd-bootconf recipe
  systemd-boot*.bbclass: Don't use vmlinuz
  systemd-boot: add package that installs to boot
  packagegroup-core-boot: add kernel for EFI systems

 meta/classes/fs-uuid.bbclass                       |  32 ++++--
 .../{grub-efi.bbclass => grub-efi-cfg.bbclass}     |  44 +-------
 meta/classes/grub-efi.bbclass                      | 124 +--------------------
 meta/classes/image.bbclass                         |   3 +
 meta/classes/live-vm-common.bbclass                |   9 +-
 meta/classes/rootfs-postcommands.bbclass           |  19 ++++
 meta/classes/syslinux.bbclass                      |   4 +-
 meta/classes/systemd-boot-cfg.bbclass              |  75 +++++++++++++
 meta/classes/systemd-boot.bbclass                  |  72 +-----------
 meta/recipes-bsp/grub/grub-bootconf_1.00.bb        |  30 +++++
 meta/recipes-bsp/grub/grub-efi_2.02.bb             |  41 +++++--
 .../initrdscripts/files/init-install-efi.sh        |  15 ++-
 .../packagegroups/packagegroup-core-boot.bb        |   3 +
 meta/recipes-core/systemd/systemd-boot_234.bb      |  28 ++++-
 meta/recipes-core/systemd/systemd-bootconf_1.00.bb |  31 ++++++
 scripts/lib/wic/canned-wks/efi-bootdisk.wks.in     |   6 +
 16 files changed, 269 insertions(+), 267 deletions(-)
 copy meta/classes/{grub-efi.bbclass => grub-efi-cfg.bbclass} (74%)
 create mode 100644 meta/classes/systemd-boot-cfg.bbclass
 create mode 100644 meta/recipes-bsp/grub/grub-bootconf_1.00.bb
 create mode 100644 meta/recipes-core/systemd/systemd-bootconf_1.00.bb
 create mode 100644 scripts/lib/wic/canned-wks/efi-bootdisk.wks.in

-- 
2.14.3



^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH RFC 01/18] fs-uuid.bbclass: rewrite get_fs_uuid function
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-20  8:00   ` Martin Hundebøll
  2017-12-19 22:58 ` [PATCH RFC 02/18] image.bbclass: Add fs-uuid bbclass California Sullivan
                   ` (19 subsequent siblings)
  20 siblings, 1 reply; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

I couldn't find anywhere it was being used, and in trying to use it it
just spit out an error.

It now generates a random UUID and puts it in the deploy dir for
consumption.

Also use DISK_SIGNATURE_UUID for the replacement function, since that
is user-overridable.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/classes/fs-uuid.bbclass | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/meta/classes/fs-uuid.bbclass b/meta/classes/fs-uuid.bbclass
index 9b53dfba7ab..5a96054294e 100644
--- a/meta/classes/fs-uuid.bbclass
+++ b/meta/classes/fs-uuid.bbclass
@@ -1,16 +1,26 @@
+inherit deploy
+
 # Extract UUID from ${ROOTFS}, which must have been built
 # by the time that this function gets called. Only works
 # on ext file systems and depends on tune2fs.
 def get_rootfs_uuid(d):
-    import subprocess
-    rootfs = d.getVar('ROOTFS')
-    output = subprocess.check_output(['tune2fs', '-l', rootfs])
-    for line in output.split('\n'):
-        if line.startswith('Filesystem UUID:'):
-            uuid = line.split()[-1]
-            bb.note('UUID of %s: %s' % (rootfs, uuid))
-            return uuid
-    bb.fatal('Could not determine filesystem UUID of %s' % rootfs)
+    import os
+    import uuid
+    deploydir = d.getVar('DEPLOY_DIR_IMAGE')
+    bootfs_uuid_file = deploydir + "/bootfs-uuid"
+    uuid_str = "deadbeef-dead-beef-dead-beefdeadbeef"
+    if d.getVar('BUILD_REPRODUCIBLE_BINARIES', True) != "1":
+        if os.path.exists(bootfs_uuid_file):
+            with open(bootfs_uuid_file, "r+") as file:
+                uuid_str = file.read()
+        else:
+            # deploydir might not exist yet...creating it here could be bad?
+            if not os.path.exists(deploydir):
+                os.makedirs(deploydir)
+            uuid_str = str(uuid.uuid4())
+            with open(bootfs_uuid_file, "w") as file:
+                file.write(uuid_str)
+    return uuid_str
 
 # Replace the special <<uuid-of-rootfs>> inside a string (like the
 # root= APPEND string in a syslinux.cfg or systemd-boot entry) with the
@@ -19,6 +29,8 @@ def get_rootfs_uuid(d):
 def replace_rootfs_uuid(d, string):
     UUID_PLACEHOLDER = '<<uuid-of-rootfs>>'
     if UUID_PLACEHOLDER in string:
-        uuid = get_rootfs_uuid(d)
+        uuid = d.getVar('DISK_SIGNATURE_UUID', True)
         string = string.replace(UUID_PLACEHOLDER, uuid)
     return string
+
+DISK_SIGNATURE_UUID ?= "${@get_rootfs_uuid(d)}"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 02/18] image.bbclass: Add fs-uuid bbclass
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 01/18] fs-uuid.bbclass: rewrite get_fs_uuid function California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 03/18] grub-efi.bbclass: split out configuration portion California Sullivan
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

This gives the class access to the DISK_SIGNATURE_UUID variable.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/classes/image.bbclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index ec940a4b659..38709691721 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -135,6 +135,9 @@ def build_live(d):
         return ""
     return "image-live"
 
+# uuid tools are useful for image creation
+inherit fs-uuid
+
 IMAGE_TYPE_live = "${@build_live(d)}"
 inherit ${IMAGE_TYPE_live}
 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 03/18] grub-efi.bbclass: split out configuration portion
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 01/18] fs-uuid.bbclass: rewrite get_fs_uuid function California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 02/18] image.bbclass: Add fs-uuid bbclass California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 04/18] grub: create recipe for configuration California Sullivan
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

This part is useful on its own, whereas the whole class together is
specific for image-live.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 .../{grub-efi.bbclass => grub-efi-cfg.bbclass}     |  40 -------
 meta/classes/grub-efi.bbclass                      | 122 +--------------------
 2 files changed, 1 insertion(+), 161 deletions(-)
 copy meta/classes/{grub-efi.bbclass => grub-efi-cfg.bbclass} (76%)

diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi-cfg.bbclass
similarity index 76%
copy from meta/classes/grub-efi.bbclass
copy to meta/classes/grub-efi-cfg.bbclass
index 610479b85d1..730323c72e6 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi-cfg.bbclass
@@ -16,8 +16,6 @@
 # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
 # ${GRUB_ROOT} - grub's root device.
 
-do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy"
-
 GRUB_SERIAL ?= "console=ttyS0,115200"
 GRUB_CFG_VM = "${S}/grub_vm.cfg"
 GRUB_CFG_LIVE = "${S}/grub_live.cfg"
@@ -32,44 +30,6 @@ APPEND ?= ""
 # Need UUID utility code.
 inherit fs-uuid
 
-efi_populate() {
-	# DEST must be the root of the image so that EFIDIR is not
-	# nested under a top level directory.
-	DEST=$1
-
-	install -d ${DEST}${EFIDIR}
-
-	GRUB_IMAGE="grub-efi-bootia32.efi"
-	DEST_IMAGE="bootia32.efi"
-	if [ "${TARGET_ARCH}" = "x86_64" ]; then
-		GRUB_IMAGE="grub-efi-bootx64.efi"
-		DEST_IMAGE="bootx64.efi"
-	fi
-	install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}/${DEST_IMAGE}
-	EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-	printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_IMAGE" >${DEST}/startup.nsh
-
-	install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
-}
-
-efi_iso_populate() {
-	iso_dir=$1
-	efi_populate $iso_dir
-	# Build a EFI directory to create efi.img
-	mkdir -p ${EFIIMGDIR}/${EFIDIR}
-	cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
-	cp $iso_dir/vmlinuz ${EFIIMGDIR}
-	EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-	printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" > ${EFIIMGDIR}/startup.nsh
-	if [ -f "$iso_dir/initrd" ] ; then
-		cp $iso_dir/initrd ${EFIIMGDIR}
-	fi
-}
-
-efi_hddimg_populate() {
-	efi_populate $1
-}
-
 python build_efi_cfg() {
     import sys
 
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 610479b85d1..4b5704c19cc 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -1,36 +1,4 @@
-# grub-efi.bbclass
-# Copyright (c) 2011, Intel Corporation.
-# All rights reserved.
-#
-# Released under the MIT license (see packages/COPYING)
-
-# Provide grub-efi specific functions for building bootable images.
-
-# External variables
-# ${INITRD} - indicates a list of filesystem images to concatenate and use as an initrd (optional)
-# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
-# ${GRUB_GFXSERIAL} - set this to 1 to have graphics and serial in the boot menu
-# ${LABELS} - a list of targets for the automatic config
-# ${APPEND} - an override list of append strings for each label
-# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
-# ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
-# ${GRUB_ROOT} - grub's root device.
-
-do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy"
-
-GRUB_SERIAL ?= "console=ttyS0,115200"
-GRUB_CFG_VM = "${S}/grub_vm.cfg"
-GRUB_CFG_LIVE = "${S}/grub_live.cfg"
-GRUB_TIMEOUT ?= "10"
-#FIXME: build this from the machine config
-GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
-
-EFIDIR = "/EFI/BOOT"
-GRUB_ROOT ?= "${ROOT}"
-APPEND ?= ""
-
-# Need UUID utility code.
-inherit fs-uuid
+inherit grub-efi-cfg
 
 efi_populate() {
 	# DEST must be the root of the image so that EFIDIR is not
@@ -69,91 +37,3 @@ efi_iso_populate() {
 efi_hddimg_populate() {
 	efi_populate $1
 }
-
-python build_efi_cfg() {
-    import sys
-
-    workdir = d.getVar('WORKDIR')
-    if not workdir:
-        bb.error("WORKDIR not defined, unable to package")
-        return
-
-    gfxserial = d.getVar('GRUB_GFXSERIAL') or ""
-
-    labels = d.getVar('LABELS')
-    if not labels:
-        bb.debug(1, "LABELS not defined, nothing to do")
-        return
-
-    if labels == []:
-        bb.debug(1, "No labels, nothing to do")
-        return
-
-    cfile = d.getVar('GRUB_CFG')
-    if not cfile:
-        bb.fatal('Unable to read GRUB_CFG')
-
-    try:
-         cfgfile = open(cfile, 'w')
-    except OSError:
-        bb.fatal('Unable to open %s' % cfile)
-
-    cfgfile.write('# Automatically created by OE\n')
-
-    opts = d.getVar('GRUB_OPTS')
-    if opts:
-        for opt in opts.split(';'):
-            cfgfile.write('%s\n' % opt)
-
-    cfgfile.write('default=%s\n' % (labels.split()[0]))
-
-    timeout = d.getVar('GRUB_TIMEOUT')
-    if timeout:
-        cfgfile.write('timeout=%s\n' % timeout)
-    else:
-        cfgfile.write('timeout=50\n')
-
-    root = d.getVar('GRUB_ROOT')
-    if not root:
-        bb.fatal('GRUB_ROOT not defined')
-
-    if gfxserial == "1":
-        btypes = [ [ " graphics console", "" ],
-            [ " serial console", d.getVar('GRUB_SERIAL') or "" ] ]
-    else:
-        btypes = [ [ "", "" ] ]
-
-    for label in labels.split():
-        localdata = d.createCopy()
-
-        overrides = localdata.getVar('OVERRIDES')
-        if not overrides:
-            bb.fatal('OVERRIDES not defined')
-
-        for btype in btypes:
-            localdata.setVar('OVERRIDES', label + ':' + overrides)
-
-            cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0]))
-            lb = label
-            if label == "install":
-                lb = "install-efi"
-            cfgfile.write('linux /vmlinuz LABEL=%s' % (lb))
-
-            cfgfile.write(' %s' % replace_rootfs_uuid(d, root))
-
-            append = localdata.getVar('APPEND')
-            initrd = localdata.getVar('INITRD')
-
-            if append:
-                append = replace_rootfs_uuid(d, append)
-                cfgfile.write(' %s' % (append))
-
-            cfgfile.write(' %s' % btype[1])
-            cfgfile.write('\n')
-
-            if initrd:
-                cfgfile.write('initrd /initrd')
-            cfgfile.write('\n}\n')
-
-    cfgfile.close()
-}
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 04/18] grub: create recipe for configuration
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (2 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 03/18] grub-efi.bbclass: split out configuration portion California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 05/18] grub-efi: install to /boot/ California Sullivan
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

This makes use of the grub-efi-cfg bbclass that was split out to create
a grub.cfg file just like the old one.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-bsp/grub/grub-bootconf_1.00.bb | 30 +++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 meta/recipes-bsp/grub/grub-bootconf_1.00.bb

diff --git a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
new file mode 100644
index 00000000000..3dd897c3501
--- /dev/null
+++ b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
@@ -0,0 +1,30 @@
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+RPROVIDES_${PN} += "virtual/grub-bootconf"
+
+inherit allarch
+
+S = "${WORKDIR}"
+
+GRUB_CFG = "${S}/grub-bootconf"
+LABELS = "boot install"
+
+ROOT = "root=PARTUUID=${DISK_SIGNATURE_UUID}"
+
+do_configure[vardeps] += "ROOT APPEND DISK_SIGNATURE_UUID"
+
+python do_configure() {
+    bb.build.exec_func('build_efi_cfg', d)
+}
+
+do_install() {
+	install -d ${D}/boot
+	install -d ${D}/boot/EFI
+	install -d ${D}/boot/EFI/BOOT
+	install -m 0744 grub-bootconf ${D}/boot/EFI/BOOT/grub.cfg
+}
+
+FILES_${PN} = "/boot/EFI/BOOT/grub.cfg"
+
+inherit grub-efi-cfg
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 05/18] grub-efi: install to /boot/
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (3 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 04/18] grub: create recipe for configuration California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 06/18] grub-efi: if installed and EFI_PROVIDER, install as bootx64 or bootia32 California Sullivan
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

Since /boot/ will be recipe/package controlled now we can't just deploy.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-bsp/grub/grub-efi_2.02.bb | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-bsp/grub/grub-efi_2.02.bb b/meta/recipes-bsp/grub/grub-efi_2.02.bb
index a38d05a2a0d..1c882650524 100644
--- a/meta/recipes-bsp/grub/grub-efi_2.02.bb
+++ b/meta/recipes-bsp/grub/grub-efi_2.02.bb
@@ -3,8 +3,7 @@ require grub2.inc
 GRUBPLATFORM = "efi"
 
 DEPENDS_class-target = "grub-efi-native"
-RDEPENDS_${PN}_class-target = "diffutils freetype"
-
+RDEPENDS_${PN}_class-target = "diffutils freetype virtual/grub-bootconf"
 SRC_URI += " \
            file://cfg \
           "
@@ -36,6 +35,28 @@ EXTRA_OECONF += "--enable-efiemu=no"
 # and many other places in the grub code when compiled with some native gcc compilers (specifically, gentoo)
 CFLAGS_append_class-native = " -Wno-error=trampolines"
 
+do_mkimage() {
+	cd ${B}
+	# Search for the grub.cfg on the local boot media by using the
+	# built in cfg file provided via this recipe
+	grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
+	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
+	               ${GRUB_BUILDIN}
+}
+
+addtask mkimage before do_install after do_compile
+
+do_mkimage_class-native() {
+	:
+}
+
+do_install_append_class-target() {
+	install -d ${D}/boot
+	install -d ${D}/boot/EFI
+	install -d ${D}/boot/EFI/BOOT
+	install -m 644 ${B}/${GRUB_IMAGE} ${D}/boot/EFI/BOOT/
+}
+
 do_install_class-native() {
 	install -d ${D}${bindir}
 	install -m 755 grub-mkimage ${D}${bindir}
@@ -55,11 +76,6 @@ GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \
                  efi_gop iso9660 search loadenv test"
 
 do_deploy() {
-	# Search for the grub.cfg on the local boot media by using the
-	# built in cfg file provided via this recipe
-	grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
-	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
-	               ${GRUB_BUILDIN}
 	install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
 }
 
@@ -71,8 +87,10 @@ addtask deploy after do_install before do_build
 
 FILES_${PN} += "${libdir}/grub/${GRUB_TARGET}-efi \
                 ${datadir}/grub \
+                /boot/EFI/BOOT/${GRUB_IMAGE} \
                 "
 
+
 # 64-bit binaries are expected for the bootloader with an x32 userland
 INSANE_SKIP_${PN}_append_linux-gnux32 = " arch"
 INSANE_SKIP_${PN}-dbg_append_linux-gnux32 = " arch"
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 06/18] grub-efi: if installed and EFI_PROVIDER, install as bootx64 or bootia32
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (4 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 05/18] grub-efi: install to /boot/ California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 07/18] rootfs-postcommands: add rootfs postprocess command to avoid /boot/ duplication California Sullivan
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

This way we could theoretically support multiple bootloaders, and we
keep the convention of boot(x64|ia32).

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-bsp/grub/grub-efi_2.02.bb | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-bsp/grub/grub-efi_2.02.bb b/meta/recipes-bsp/grub/grub-efi_2.02.bb
index 1c882650524..6d0cd4f4ea1 100644
--- a/meta/recipes-bsp/grub/grub-efi_2.02.bb
+++ b/meta/recipes-bsp/grub/grub-efi_2.02.bb
@@ -14,16 +14,19 @@ S = "${WORKDIR}/grub-${PV}"
 python __anonymous () {
     import re
     target = d.getVar('TARGET_ARCH')
+    prefix = "" if d.getVar('EFI_PROVIDER') == "grub-efi" else "grub-efi-"
     if target == "x86_64":
         grubtarget = 'x86_64'
-        grubimage = "grub-efi-bootx64.efi"
+        grubimage = prefix + "bootx64.efi"
     elif re.match('i.86', target):
         grubtarget = 'i386'
-        grubimage = "grub-efi-bootia32.efi"
+        grubimage = prefix + "bootia32.efi"
     else:
         raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target)
     d.setVar("GRUB_TARGET", grubtarget)
     d.setVar("GRUB_IMAGE", grubimage)
+    prefix = "grub-efi-" if prefix == "" else ""
+    d.setVar("GRUB_IMAGE_PREFIX", prefix)
 }
 
 inherit deploy
@@ -40,7 +43,7 @@ do_mkimage() {
 	# Search for the grub.cfg on the local boot media by using the
 	# built in cfg file provided via this recipe
 	grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
-	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
+	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} \
 	               ${GRUB_BUILDIN}
 }
 
@@ -54,7 +57,7 @@ do_install_append_class-target() {
 	install -d ${D}/boot
 	install -d ${D}/boot/EFI
 	install -d ${D}/boot/EFI/BOOT
-	install -m 644 ${B}/${GRUB_IMAGE} ${D}/boot/EFI/BOOT/
+	install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${D}/boot/EFI/BOOT/${GRUB_IMAGE}
 }
 
 do_install_class-native() {
@@ -76,7 +79,7 @@ GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \
                  efi_gop iso9660 search loadenv test"
 
 do_deploy() {
-	install -m 644 ${B}/${GRUB_IMAGE} ${DEPLOYDIR}
+	install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${DEPLOYDIR}
 }
 
 do_deploy_class-native() {
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 07/18] rootfs-postcommands: add rootfs postprocess command to avoid /boot/ duplication
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (5 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 06/18] grub-efi: if installed and EFI_PROVIDER, install as bootx64 or bootia32 California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 08/18] packagegroup-core-boot: add bootloader to EFI systems California Sullivan
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

EFI systems need their /boot/ directory in its own partition. By
splitting it into its own directory like this, we avoid /boot/ ending up
in the primary rootfs, and can easily create the EFI partition from the
IMAGE_BOOTFS directory.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/classes/rootfs-postcommands.bbclass | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index a4e627fef84..e617c26f41a 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -25,6 +25,9 @@ APPEND_append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro
 # Generates test data file with data store variables expanded in json format
 ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data ; "
 
+# Splits /boot into its own rootfs to easily turn it into its own partition
+ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("MACHINE_FEATURES", "efi", "split_bootpartition; ", "",d)}'
+
 # Write manifest
 IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.manifest"
 ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
@@ -317,6 +320,22 @@ python write_image_test_data() {
 }
 write_image_test_data[vardepsexclude] += "TOPDIR"
 
+IMAGE_BOOTFS="${WORKDIR}/bootfs"
+# hardlink rootfs/boot/* into bootfs/, then delete the original
+split_bootpartition () {
+	if [ ! -d ${IMAGE_BOOTFS} ];
+	then
+		mkdir -p ${IMAGE_BOOTFS}
+	else
+		rm -rf ${IMAGE_BOOTFS}/*
+	fi
+	if [ -d ${IMAGE_ROOTFS}/boot ] && [ -n "$(ls -A ${IMAGE_ROOTFS}/boot)" ];
+	then
+		cp -rla ${IMAGE_ROOTFS}/boot/* ${IMAGE_BOOTFS}/
+		rm -rf ${IMAGE_ROOTFS}/boot/*
+	fi
+}
+
 # Check for unsatisfied recommendations (RRECOMMENDS)
 python rootfs_log_check_recommends() {
     log_path = d.expand("${T}/log.do_rootfs")
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 08/18] packagegroup-core-boot: add bootloader to EFI systems
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (6 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 07/18] rootfs-postcommands: add rootfs postprocess command to avoid /boot/ duplication California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 09/18] live-vm-common.bbclass: Don't use vmlinuz or VM_DEFAULT_KERNEL California Sullivan
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

Since the bootloader is now installed instead of added at image creation
time, this is necessary for booting.

Also set the default to grub-efi. This is done because a default of
grub-efi is already used by live-vm-common.bbclass, and in the event
that EFI_PROVIDER isn't defined errors would occur.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-core/packagegroups/packagegroup-core-boot.bb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
index 04bc0f2b693..0fcb8ba9193 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
@@ -23,6 +23,8 @@ VIRTUAL-RUNTIME_init_manager ?= "sysvinit"
 VIRTUAL-RUNTIME_initscripts ?= "initscripts"
 VIRTUAL-RUNTIME_keymaps ?= "keymaps"
 
+EFI_PROVIDER ??= "grub-efi"
+
 SYSVINIT_SCRIPTS = "${@bb.utils.contains('MACHINE_FEATURES', 'rtc', '${VIRTUAL-RUNTIME_base-utils-hwclock}', '', d)} \
                     modutils-initscripts \
                     init-ifupdown \
@@ -35,6 +37,7 @@ RDEPENDS_${PN} = "\
     ${VIRTUAL-RUNTIME_base-utils} \
     ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
     ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
+    ${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)} \
     netbase \
     ${VIRTUAL-RUNTIME_login_manager} \
     ${VIRTUAL-RUNTIME_init_manager} \
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 09/18] live-vm-common.bbclass: Don't use vmlinuz or VM_DEFAULT_KERNEL
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (7 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 08/18] packagegroup-core-boot: add bootloader to EFI systems California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 10/18] grub-efi*.bbclass: don't reference vmlinuz California Sullivan
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

I can't find VM_DEFAULT_KERNEL used anywhere else, and we should not be
statically installing the kernel as vmlinuz.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/classes/live-vm-common.bbclass | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/meta/classes/live-vm-common.bbclass b/meta/classes/live-vm-common.bbclass
index e1d8b1843b6..714d6d4788c 100644
--- a/meta/classes/live-vm-common.bbclass
+++ b/meta/classes/live-vm-common.bbclass
@@ -33,18 +33,17 @@ inherit ${EFI_CLASS}
 inherit ${PCBIOS_CLASS}
 
 KERNEL_IMAGETYPE ??= "bzImage"
-VM_DEFAULT_KERNEL ??= "${KERNEL_IMAGETYPE}"
 
 populate_kernel() {
 	dest=$1
 	install -d $dest
 
 	# Install bzImage, initrd, and rootfs.img in DEST for all loaders to use.
-	bbnote "Trying to install ${DEPLOY_DIR_IMAGE}/${VM_DEFAULT_KERNEL} as $dest/vmlinuz"
-	if [ -e ${DEPLOY_DIR_IMAGE}/${VM_DEFAULT_KERNEL} ]; then
-		install -m 0644 ${DEPLOY_DIR_IMAGE}/${VM_DEFAULT_KERNEL} $dest/vmlinuz
+	bbnote "Trying to install ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} as $dest/${KERNEL_IMAGETYPE}"
+	if [ -e ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ]; then
+		install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} $dest/${KERNEL_IMAGETYPE}
 	else
-		bbwarn "${DEPLOY_DIR_IMAGE}/${VM_DEFAULT_KERNEL} doesn't exist"
+		bbwarn "${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} doesn't exist"
 	fi
 
 	# initrd is made of concatenation of multiple filesystem images
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 10/18] grub-efi*.bbclass: don't reference vmlinuz
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (8 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 09/18] live-vm-common.bbclass: Don't use vmlinuz or VM_DEFAULT_KERNEL California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 11/18] wic: add wks file to make use of new bootfs functionality California Sullivan
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

Rather than renaming the kernel to vmlinuz and assuming the name is
vmlinuz in the grub.cfg, copy to ${KERNEL_IMAGETYPE} and also use that
value in the grub.cfg file.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/classes/grub-efi-cfg.bbclass | 4 +++-
 meta/classes/grub-efi.bbclass     | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes/grub-efi-cfg.bbclass b/meta/classes/grub-efi-cfg.bbclass
index 730323c72e6..85173c91fc3 100644
--- a/meta/classes/grub-efi-cfg.bbclass
+++ b/meta/classes/grub-efi-cfg.bbclass
@@ -22,6 +22,7 @@ GRUB_CFG_LIVE = "${S}/grub_live.cfg"
 GRUB_TIMEOUT ?= "10"
 #FIXME: build this from the machine config
 GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
+KERNEL_IMAGETYPE ??= "bzImage"
 
 EFIDIR = "/EFI/BOOT"
 GRUB_ROOT ?= "${ROOT}"
@@ -97,7 +98,8 @@ python build_efi_cfg() {
             lb = label
             if label == "install":
                 lb = "install-efi"
-            cfgfile.write('linux /vmlinuz LABEL=%s' % (lb))
+            kernel = localdata.getVar('KERNEL_IMAGETYPE')
+            cfgfile.write('linux /%s LABEL=%s' % (kernel, lb))
 
             cfgfile.write(' %s' % replace_rootfs_uuid(d, root))
 
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 4b5704c19cc..90badc03a0e 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -26,7 +26,7 @@ efi_iso_populate() {
 	# Build a EFI directory to create efi.img
 	mkdir -p ${EFIIMGDIR}/${EFIDIR}
 	cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
-	cp $iso_dir/vmlinuz ${EFIIMGDIR}
+	cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
 	EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
 	printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" > ${EFIIMGDIR}/startup.nsh
 	if [ -f "$iso_dir/initrd" ] ; then
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 11/18] wic: add wks file to make use of new bootfs functionality
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (9 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 10/18] grub-efi*.bbclass: don't reference vmlinuz California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 12/18] init-install-efi.sh: Update to support installing multiple kernels California Sullivan
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

With the postprocess command and installation into /boot/ in place, we
can use wic to create an EFI-compatible image without it having any
knowledge of the kernel or bootloader.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 scripts/lib/wic/canned-wks/efi-bootdisk.wks.in | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 scripts/lib/wic/canned-wks/efi-bootdisk.wks.in

diff --git a/scripts/lib/wic/canned-wks/efi-bootdisk.wks.in b/scripts/lib/wic/canned-wks/efi-bootdisk.wks.in
new file mode 100644
index 00000000000..c9d7aa5761e
--- /dev/null
+++ b/scripts/lib/wic/canned-wks/efi-bootdisk.wks.in
@@ -0,0 +1,6 @@
+# based off of refkit's refkit-directdisk.wks.in kickstart template
+# uses the image's boot directory to populate a vfat boot partition,
+# which works with EFI.
+bootloader --ptable gpt
+part /boot --source rootfs --rootfs-dir=${IMAGE_BOOTFS} --fstype=vfat --label msdos --active --align 1024 --use-uuid
+part / --source rootfs --fstype=ext4 --label root --align 1024 --uuid ${DISK_SIGNATURE_UUID}
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 12/18] init-install-efi.sh: Update to support installing multiple kernels
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (10 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 11/18] wic: add wks file to make use of new bootfs functionality California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 13/18] syslinux.bbclass: don't use vmlinuz California Sullivan
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

We can no longer rely on the kernel having a static name of "vmlinuz".
This means we can't use it as a sentinel value in our sed commands, and
we can't just copy vmlinuz to the boot directory.

Instead, we'll use "root=" as the sentinel value for our sed commands,
and we'll search for common kernel names to copy into our boot
directory.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-core/initrdscripts/files/init-install-efi.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 706418fa9c5..f946d971d11 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -244,10 +244,9 @@ if [ -f /run/media/$1/EFI/BOOT/grub.cfg ]; then
     sed -i "/initrd /d" $GRUBCFG
     # Delete any LABEL= strings
     sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
-    # Delete any root= strings
-    sed -i "s/ root=[^ ]*/ /g" $GRUBCFG
-    # Add the root= and other standard boot options
-    sed -i "s@linux /vmlinuz *@linux /vmlinuz root=PARTUUID=$root_part_uuid rw $rootwait quiet @" $GRUBCFG
+    # Replace root= and add additional standard boot options
+    # We use root as a sentinel value, as vmlinuz is no longer guaranteed
+    sed -i "s/ root=[^ ]*/ root=PARTUUID=$root_part_uuid rw $rootwait quiet /g" $GRUBCFG
 fi
 
 if [ -d /run/media/$1/loader ]; then
@@ -269,7 +268,13 @@ fi
 
 umount /tgt_root
 
-cp /run/media/$1/vmlinuz /boot
+# Copy kernel artifacts. To add more artifacts just add to types
+# For now just support kernel types already being used by something in OE-core
+for types in bzImage zImage vmlinux vmlinuz fitImage; do
+    for kernel in `find /run/media/$1/ -name $types*`; do
+        cp $kernel /boot
+    done
+done
 
 umount /boot
 
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 13/18] syslinux.bbclass: don't use vmlinuz
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (11 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 12/18] init-install-efi.sh: Update to support installing multiple kernels California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 14/18] systemd-boot.bbclass: break out configuration creation California Sullivan
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

We can't guarantee the kernel will be named vmlinuz anymore. Use
KERNEL_IMAGETYPE instead.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/classes/syslinux.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index d6f882420e4..959aed4fb8f 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -21,6 +21,7 @@ do_bootimg[depends] += "${MLPREFIX}syslinux:do_populate_sysroot \
                         syslinux-native:do_populate_sysroot"
 
 ISOLINUXDIR ?= "/isolinux"
+KERNEL_IMAGETYPE ??= "bzImage"
 SYSLINUXDIR = "/"
 # The kernel has an internal default console, which you can override with
 # a console=...some_tty...
@@ -173,8 +174,9 @@ python build_syslinux_cfg () {
         if not root:
             bb.fatal('SYSLINUX_ROOT not defined')
 
+        kernel = localdata.getVar('KERNEL_IMAGETYPE')
         for btype in btypes:
-            cfgfile.write('LABEL %s%s\nKERNEL /vmlinuz\n' % (btype[0], label))
+            cfgfile.write('LABEL %s%s\nKERNEL /%s\n' % (btype[0], label, kernel))
 
             exargs = d.getVar('SYSLINUX_KERNEL_ARGS')
             if exargs:
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 14/18] systemd-boot.bbclass: break out configuration creation
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (12 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 13/18] syslinux.bbclass: don't use vmlinuz California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 15/18] systemd: add systemd-bootconf recipe California Sullivan
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

This class is useful on its own and can be used to create configuration
recipes.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 ...stemd-boot.bbclass => systemd-boot-cfg.bbclass} | 57 ------------------
 meta/classes/systemd-boot.bbclass                  | 70 +---------------------
 2 files changed, 1 insertion(+), 126 deletions(-)
 copy meta/classes/{systemd-boot.bbclass => systemd-boot-cfg.bbclass} (50%)

diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot-cfg.bbclass
similarity index 50%
copy from meta/classes/systemd-boot.bbclass
copy to meta/classes/systemd-boot-cfg.bbclass
index 937307076f7..46eeae126ae 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot-cfg.bbclass
@@ -1,18 +1,3 @@
-# Copyright (C) 2016 Intel Corporation
-#
-# Released under the MIT license (see COPYING.MIT)
-
-# systemd-boot.bbclass - The "systemd-boot" is essentially the gummiboot merged into systemd.
-#                        The original standalone gummiboot project is dead without any more
-#                        maintenance.
-#
-# Set EFI_PROVIDER = "systemd-boot" to use systemd-boot on your live images instead of grub-efi
-# (images built by image-live.bbclass)
-
-do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
-
-EFIDIR = "/EFI/BOOT"
-
 SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
 SYSTEMD_BOOT_ENTRIES ?= ""
 SYSTEMD_BOOT_TIMEOUT ?= "10"
@@ -20,48 +5,6 @@ SYSTEMD_BOOT_TIMEOUT ?= "10"
 # Need UUID utility code.
 inherit fs-uuid
 
-efi_populate() {
-        DEST=$1
-
-        EFI_IMAGE="systemd-bootia32.efi"
-        DEST_EFI_IMAGE="bootia32.efi"
-        if [ "${TARGET_ARCH}" = "x86_64" ]; then
-            EFI_IMAGE="systemd-bootx64.efi"
-            DEST_EFI_IMAGE="bootx64.efi"
-        fi
-
-        install -d ${DEST}${EFIDIR}
-        # systemd-boot requires these paths for configuration files
-        # they are not customizable so no point in new vars
-        install -d ${DEST}/loader
-        install -d ${DEST}/loader/entries
-        install -m 0644 ${DEPLOY_DIR_IMAGE}/${EFI_IMAGE} ${DEST}${EFIDIR}/${DEST_EFI_IMAGE}
-        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-        printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_EFI_IMAGE" >${DEST}/startup.nsh
-        install -m 0644 ${SYSTEMD_BOOT_CFG} ${DEST}/loader/loader.conf
-        for i in ${SYSTEMD_BOOT_ENTRIES}; do
-            install -m 0644 ${i} ${DEST}/loader/entries
-        done
-}
-
-efi_iso_populate() {
-        iso_dir=$1
-        efi_populate $iso_dir
-        mkdir -p ${EFIIMGDIR}/${EFIDIR}
-        cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
-        cp -r $iso_dir/loader ${EFIIMGDIR}
-        cp $iso_dir/vmlinuz ${EFIIMGDIR}
-        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-        echo "fs0:${EFIPATH}\\${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
-        if [ -f "$iso_dir/initrd" ] ; then
-            cp $iso_dir/initrd ${EFIIMGDIR}
-        fi
-}
-
-efi_hddimg_populate() {
-        efi_populate $1
-}
-
 python build_efi_cfg() {
     s = d.getVar("S")
     labels = d.getVar('LABELS')
diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index 937307076f7..14538fe2d7a 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -12,11 +12,6 @@
 do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
 
 EFIDIR = "/EFI/BOOT"
-
-SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
-SYSTEMD_BOOT_ENTRIES ?= ""
-SYSTEMD_BOOT_TIMEOUT ?= "10"
-
 # Need UUID utility code.
 inherit fs-uuid
 
@@ -62,67 +57,4 @@ efi_hddimg_populate() {
         efi_populate $1
 }
 
-python build_efi_cfg() {
-    s = d.getVar("S")
-    labels = d.getVar('LABELS')
-    if not labels:
-        bb.debug(1, "LABELS not defined, nothing to do")
-        return
-
-    if labels == []:
-        bb.debug(1, "No labels, nothing to do")
-        return
-
-    cfile = d.getVar('SYSTEMD_BOOT_CFG')
-    cdir = os.path.dirname(cfile)
-    if not os.path.exists(cdir):
-        os.makedirs(cdir)
-    try:
-         cfgfile = open(cfile, 'w')
-    except OSError:
-        bb.fatal('Unable to open %s' % cfile)
-
-    cfgfile.write('# Automatically created by OE\n')
-    cfgfile.write('default %s\n' % (labels.split()[0]))
-    timeout = d.getVar('SYSTEMD_BOOT_TIMEOUT')
-    if timeout:
-        cfgfile.write('timeout %s\n' % timeout)
-    else:
-        cfgfile.write('timeout 10\n')
-    cfgfile.close()
-
-    for label in labels.split():
-        localdata = d.createCopy()
-
-        overrides = localdata.getVar('OVERRIDES')
-        if not overrides:
-            bb.fatal('OVERRIDES not defined')
-
-        entryfile = "%s/%s.conf" % (s, label)
-        if not os.path.exists(s):
-            os.makedirs(s)
-        d.appendVar("SYSTEMD_BOOT_ENTRIES", " " + entryfile)
-        try:
-            entrycfg = open(entryfile, "w")
-        except OSError:
-            bb.fatal('Unable to open %s' % entryfile)
-        localdata.setVar('OVERRIDES', label + ':' + overrides)
-
-        entrycfg.write('title %s\n' % label)
-        entrycfg.write('linux /vmlinuz\n')
-
-        append = localdata.getVar('APPEND')
-        initrd = localdata.getVar('INITRD')
-
-        if initrd:
-            entrycfg.write('initrd /initrd\n')
-        lb = label
-        if label == "install":
-            lb = "install-efi"
-        entrycfg.write('options LABEL=%s ' % lb)
-        if append:
-            append = replace_rootfs_uuid(d, append)
-            entrycfg.write('%s' % append)
-        entrycfg.write('\n')
-        entrycfg.close()
-}
+inherit systemd-boot-cfg
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 15/18] systemd: add systemd-bootconf recipe
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (13 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 14/18] systemd-boot.bbclass: break out configuration creation California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 16/18] systemd-boot*.bbclass: Don't use vmlinuz California Sullivan
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

Reuses our systemd-boot-cfg bbclass to generate systemd-boot
configuration files.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-core/systemd/systemd-bootconf_1.00.bb | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd-bootconf_1.00.bb

diff --git a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb
new file mode 100644
index 00000000000..3ea7548f29a
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb
@@ -0,0 +1,31 @@
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+RPROVIDES_${PN} += "virtual/systemd-bootconf"
+
+inherit allarch
+
+S = "${WORKDIR}"
+
+LABELS = "boot"
+
+APPEND_append = " root=PARTUUID=${DISK_SIGNATURE_UUID}"
+
+do_configure[vardeps] += "APPEND LABELS DISK_SIGNATURE_UUID"
+
+python do_configure() {
+    bb.build.exec_func('build_efi_cfg', d)
+}
+
+do_install() {
+	install -d ${D}/boot
+	install -d ${D}/boot/loader
+	install -d ${D}/boot/loader/entries
+	install -m 0744 loader.conf ${D}/boot/loader/
+        rm loader.conf
+        install -m 077 *.conf ${D}/boot/loader/entries/
+}
+
+FILES_${PN} = "/boot/loader/* /boot/loader/entries/*"
+
+inherit systemd-boot-cfg
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 16/18] systemd-boot*.bbclass: Don't use vmlinuz
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (14 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 15/18] systemd: add systemd-bootconf recipe California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 17/18] systemd-boot: add package that installs to boot California Sullivan
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

We can't guarantee vmlinuz anymore. Use KERNEL_IMAGETYPE instead.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/classes/systemd-boot-cfg.bbclass | 6 +++++-
 meta/classes/systemd-boot.bbclass     | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/meta/classes/systemd-boot-cfg.bbclass b/meta/classes/systemd-boot-cfg.bbclass
index 46eeae126ae..360c86cbd34 100644
--- a/meta/classes/systemd-boot-cfg.bbclass
+++ b/meta/classes/systemd-boot-cfg.bbclass
@@ -1,3 +1,5 @@
+KERNEL_IMAGETYPE ??= "bzImage"
+
 SYSTEMD_BOOT_CFG ?= "${S}/loader.conf"
 SYSTEMD_BOOT_ENTRIES ?= ""
 SYSTEMD_BOOT_TIMEOUT ?= "10"
@@ -52,7 +54,9 @@ python build_efi_cfg() {
         localdata.setVar('OVERRIDES', label + ':' + overrides)
 
         entrycfg.write('title %s\n' % label)
-        entrycfg.write('linux /vmlinuz\n')
+
+        kernel = localdata.getVar("KERNEL_IMAGETYPE")
+        entrycfg.write('linux /%s\n' % kernel)
 
         append = localdata.getVar('APPEND')
         initrd = localdata.getVar('INITRD')
diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index 14538fe2d7a..3cd6811a6ce 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -45,7 +45,7 @@ efi_iso_populate() {
         mkdir -p ${EFIIMGDIR}/${EFIDIR}
         cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
         cp -r $iso_dir/loader ${EFIIMGDIR}
-        cp $iso_dir/vmlinuz ${EFIIMGDIR}
+        cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
         EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
         echo "fs0:${EFIPATH}\\${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
         if [ -f "$iso_dir/initrd" ] ; then
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 17/18] systemd-boot: add package that installs to boot
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (15 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 16/18] systemd-boot*.bbclass: Don't use vmlinuz California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 22:58 ` [PATCH RFC 18/18] packagegroup-core-boot: add kernel for EFI systems California Sullivan
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

If the EFI_PROVIDER is systemd-boot, install as boot(x64|ia32) as per
convention. If its not the EFI_PROVIDER, install as
systemd-boot(x64|ia32), as to not collide with other possible
bootloaders.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-core/systemd/systemd-boot_234.bb | 28 ++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd-boot_234.bb b/meta/recipes-core/systemd/systemd-boot_234.bb
index 7b18b25e35d..80b57a1d378 100644
--- a/meta/recipes-core/systemd/systemd-boot_234.bb
+++ b/meta/recipes-core/systemd/systemd-boot_234.bb
@@ -18,6 +18,26 @@ EXTRA_OECONF = " --enable-gnuefi \
                  EFI_CC='${EFI_CC}' \
                "
 
+# install to the image as boot*.efi if its the EFI_PROVIDER,
+# otherwise install as the full name.
+# This allows multiple bootloaders to coexist in a single image.
+python __anonymous () {
+    import re
+    target = d.getVar('TARGET_ARCH')
+    prefix = "" if d.getVar('EFI_PROVIDER', True) == "systemd-boot" else "systemd-"
+    if target == "x86_64":
+        systemdimage = prefix + "bootx64.efi"
+    else:
+        systemdimage = prefix + "bootia32.efi"
+    d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
+    prefix = "systemd-" if prefix == "" else ""
+    d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
+}
+
+FILES_${PN} = "/boot/EFI/BOOT/${SYSTEMD_BOOT_IMAGE}"
+
+RDEPENDS_${PN} += "virtual/systemd-bootconf"
+
 # Imported from the old gummiboot recipe
 TUNE_CCARGS_remove = "-mfpmath=sse"
 COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
@@ -29,12 +49,14 @@ do_compile() {
 		SYSTEMD_BOOT_EFI_ARCH="x64"
 	fi
 
-	oe_runmake systemd-boot${SYSTEMD_BOOT_EFI_ARCH}.efi
+	oe_runmake ${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE}
 }
 
 do_install() {
-	# Bypass systemd installation with a NOP
-	:
+	install -d ${D}/boot
+	install -d ${D}/boot/EFI
+	install -d ${D}/boot/EFI/BOOT
+	install ${B}/systemd-boot*.efi ${D}/boot/EFI/BOOT/${SYSTEMD_BOOT_IMAGE}
 }
 
 do_deploy () {
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH RFC 18/18] packagegroup-core-boot: add kernel for EFI systems
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (16 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 17/18] systemd-boot: add package that installs to boot California Sullivan
@ 2017-12-19 22:58 ` California Sullivan
  2017-12-19 23:03 ` ✗ patchtest: failure for EFI boot partition improvements Patchwork
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: California Sullivan @ 2017-12-19 22:58 UTC (permalink / raw)
  To: openembedded-core

Previously this wasn't needed because the kernel was added at image
creation time to the boot partition. Now that the boot partition is
created from the /boot/ partition of the rootfs, it needs to be
installed there.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-core/packagegroups/packagegroup-core-boot.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
index 0fcb8ba9193..76cd7fc4ebf 100644
--- a/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
+++ b/meta/recipes-core/packagegroups/packagegroup-core-boot.bb
@@ -37,7 +37,7 @@ RDEPENDS_${PN} = "\
     ${VIRTUAL-RUNTIME_base-utils} \
     ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "${SYSVINIT_SCRIPTS}", "", d)} \
     ${@bb.utils.contains("MACHINE_FEATURES", "keyboard", "${VIRTUAL-RUNTIME_keymaps}", "", d)} \
-    ${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)} \
+    ${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER} kernel", "", d)} \
     netbase \
     ${VIRTUAL-RUNTIME_login_manager} \
     ${VIRTUAL-RUNTIME_init_manager} \
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 23+ messages in thread

* ✗ patchtest: failure for EFI boot partition improvements
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (17 preceding siblings ...)
  2017-12-19 22:58 ` [PATCH RFC 18/18] packagegroup-core-boot: add kernel for EFI systems California Sullivan
@ 2017-12-19 23:03 ` Patchwork
  2017-12-19 23:16 ` [PATCH RFC 00/18] " Cal Sullivan
  2017-12-20 11:29 ` Alexander Kanavin
  20 siblings, 0 replies; 23+ messages in thread
From: Patchwork @ 2017-12-19 23:03 UTC (permalink / raw)
  To: Sullivan, California L; +Cc: openembedded-core

== Series Details ==

Series: EFI boot partition improvements
Revision: 1
URL   : https://patchwork.openembedded.org/series/10262/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             SUMMARY is missing in newly added recipe [test_summary_presence] 
  Suggested fix    Specify the variable SUMMARY in grub-bootconf



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 00/18] EFI boot partition improvements
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (18 preceding siblings ...)
  2017-12-19 23:03 ` ✗ patchtest: failure for EFI boot partition improvements Patchwork
@ 2017-12-19 23:16 ` Cal Sullivan
  2017-12-20 11:29 ` Alexander Kanavin
  20 siblings, 0 replies; 23+ messages in thread
From: Cal Sullivan @ 2017-12-19 23:16 UTC (permalink / raw)
  To: openembedded-core

I forgot to mention, my contrib branch with these and a few additional 
WIPs can be found here:

https://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=clsulliv/image-creation

Thanks,
Cal


On 12/19/2017 02:58 PM, California Sullivan wrote:
> First, note that this is based on top of Haris' multiple kernels patch:
> http://lists.openembedded.org/pipermail/openembedded-core/2017-November/144031.html
>
> Currently, the boot partition of an EFI system is entirely controlled by
> image creation. Either done entirely through wic, or one of the
> bootloader bbclasses. This is rather bad since it makes it very
> difficult to add additional items to the boot partition, such as
> alternative kernels, bootloaders, or other utilities, and since its not
> package controlled its hard to update.
>
> The goal of these changes is to have the boot partition built through
> packages instead. We accomplish this by installing everything to /boot,
> and using the contents of /boot to create the partition. This required
> changes to several bootloaders, the kernel recipe, one new
> rootfs-postcommand to avoid data duplication, and a new .wks file to
> make use of the new functionality.
>
> Legacy hddimg, iso images, and wic images should be mostly unchanged,
> and their functionality is preserved. The only change they received is
> the kernel is now installed as ${KERNEL_IMAGETYPE} instead of hardcoded
> as vmlinuz, and their bootloader configs have been updated to reflect
> that.
>
> This is still a WIP, but I wanted to get some eyes and feedback on it.
> Here are some known issues that I've ran into, and am still working on:
> * fs-uuid (DISK_SIGNATURE_UUID) seems to have issues when changing MACHINE
>    types, and the image can get an old uuid when building from sstate
> * init-install.sh hasn't been updated to support multiple kernels, and
>    still uses hardcoded vmlinuz (broken)
> * the boot partition is vfat, which doesn't support symlinks, so the
>    symlink from the long kernel name to bzImage turns into a copy.
>
> I fully expect this to take several iterations to get right, so please
> any feedback is welcome.
>
> Thanks,
> Cal
>
> California Sullivan (18):
>    fs-uuid.bbclass: rewrite get_fs_uuid function
>    image.bbclass: Add fs-uuid bbclass
>    grub-efi.bbclass: split out configuration portion
>    grub: create recipe for configuration
>    grub-efi: install to /boot/
>    grub-efi: if installed and EFI_PROVIDER, install as bootx64 or
>      bootia32
>    rootfs-postcommands: add rootfs postprocess command to avoid /boot/
>      duplication
>    packagegroup-core-boot: add bootloader to EFI systems
>    live-vm-common.bbclass: Don't use vmlinuz or VM_DEFAULT_KERNEL
>    grub-efi*.bbclass: don't reference vmlinuz
>    wic: add wks file to make use of new bootfs functionality
>    init-install-efi.sh: Update to support installing multiple kernels
>    syslinux.bbclass: don't use vmlinuz
>    systemd-boot.bbclass: break out configuration creation
>    systemd: add systemd-bootconf recipe
>    systemd-boot*.bbclass: Don't use vmlinuz
>    systemd-boot: add package that installs to boot
>    packagegroup-core-boot: add kernel for EFI systems
>
>   meta/classes/fs-uuid.bbclass                       |  32 ++++--
>   .../{grub-efi.bbclass => grub-efi-cfg.bbclass}     |  44 +-------
>   meta/classes/grub-efi.bbclass                      | 124 +--------------------
>   meta/classes/image.bbclass                         |   3 +
>   meta/classes/live-vm-common.bbclass                |   9 +-
>   meta/classes/rootfs-postcommands.bbclass           |  19 ++++
>   meta/classes/syslinux.bbclass                      |   4 +-
>   meta/classes/systemd-boot-cfg.bbclass              |  75 +++++++++++++
>   meta/classes/systemd-boot.bbclass                  |  72 +-----------
>   meta/recipes-bsp/grub/grub-bootconf_1.00.bb        |  30 +++++
>   meta/recipes-bsp/grub/grub-efi_2.02.bb             |  41 +++++--
>   .../initrdscripts/files/init-install-efi.sh        |  15 ++-
>   .../packagegroups/packagegroup-core-boot.bb        |   3 +
>   meta/recipes-core/systemd/systemd-boot_234.bb      |  28 ++++-
>   meta/recipes-core/systemd/systemd-bootconf_1.00.bb |  31 ++++++
>   scripts/lib/wic/canned-wks/efi-bootdisk.wks.in     |   6 +
>   16 files changed, 269 insertions(+), 267 deletions(-)
>   copy meta/classes/{grub-efi.bbclass => grub-efi-cfg.bbclass} (74%)
>   create mode 100644 meta/classes/systemd-boot-cfg.bbclass
>   create mode 100644 meta/recipes-bsp/grub/grub-bootconf_1.00.bb
>   create mode 100644 meta/recipes-core/systemd/systemd-bootconf_1.00.bb
>   create mode 100644 scripts/lib/wic/canned-wks/efi-bootdisk.wks.in
>



^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 01/18] fs-uuid.bbclass: rewrite get_fs_uuid function
  2017-12-19 22:58 ` [PATCH RFC 01/18] fs-uuid.bbclass: rewrite get_fs_uuid function California Sullivan
@ 2017-12-20  8:00   ` Martin Hundebøll
  0 siblings, 0 replies; 23+ messages in thread
From: Martin Hundebøll @ 2017-12-20  8:00 UTC (permalink / raw)
  To: California Sullivan, openembedded-core

Hi,

On 2017-12-19 23:58, California Sullivan wrote:
> I couldn't find anywhere it was being used, and in trying to use it it
> just spit out an error.
> 
> It now generates a random UUID and puts it in the deploy dir for
> consumption.
> 
> Also use DISK_SIGNATURE_UUID for the replacement function, since that
> is user-overridable.
> 
> Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
> ---
>   meta/classes/fs-uuid.bbclass | 32 ++++++++++++++++++++++----------
>   1 file changed, 22 insertions(+), 10 deletions(-)
> 
> diff --git a/meta/classes/fs-uuid.bbclass b/meta/classes/fs-uuid.bbclass
> index 9b53dfba7ab..5a96054294e 100644
> --- a/meta/classes/fs-uuid.bbclass
> +++ b/meta/classes/fs-uuid.bbclass
> @@ -1,16 +1,26 @@
> +inherit deploy
> +
>   # Extract UUID from ${ROOTFS}, which must have been built
>   # by the time that this function gets called. Only works
>   # on ext file systems and depends on tune2fs.
>   def get_rootfs_uuid(d):
> -    import subprocess
> -    rootfs = d.getVar('ROOTFS')
> -    output = subprocess.check_output(['tune2fs', '-l', rootfs])
> -    for line in output.split('\n'):
> -        if line.startswith('Filesystem UUID:'):
> -            uuid = line.split()[-1]
> -            bb.note('UUID of %s: %s' % (rootfs, uuid))
> -            return uuid
> -    bb.fatal('Could not determine filesystem UUID of %s' % rootfs)
> +    import os
> +    import uuid
> +    deploydir = d.getVar('DEPLOY_DIR_IMAGE')
> +    bootfs_uuid_file = deploydir + "/bootfs-uuid"

Maybe use a default assigned class variable here instead of the 
hard-coded "bootfs-uuid". The class is named "get_rootfs_uuid", so I 
would expect it to handle multiple cases.

> +    uuid_str = "deadbeef-dead-beef-dead-beefdeadbeef"
> +    if d.getVar('BUILD_REPRODUCIBLE_BINARIES', True) != "1":
> +        if os.path.exists(bootfs_uuid_file):
> +            with open(bootfs_uuid_file, "r+") as file:
> +                uuid_str = file.read()
> +        else:
> +            # deploydir might not exist yet...creating it here could be bad?
> +            if not os.path.exists(deploydir):
> +                os.makedirs(deploydir)
> +            uuid_str = str(uuid.uuid4())
> +            with open(bootfs_uuid_file, "w") as file:
> +                file.write(uuid_str)
> +    return uuid_str
>   
>   # Replace the special <<uuid-of-rootfs>> inside a string (like the
>   # root= APPEND string in a syslinux.cfg or systemd-boot entry) with the
> @@ -19,6 +29,8 @@ def get_rootfs_uuid(d):
>   def replace_rootfs_uuid(d, string):
>       UUID_PLACEHOLDER = '<<uuid-of-rootfs>>'
>       if UUID_PLACEHOLDER in string:
> -        uuid = get_rootfs_uuid(d)
> +        uuid = d.getVar('DISK_SIGNATURE_UUID', True)
>           string = string.replace(UUID_PLACEHOLDER, uuid)
>       return string
> +
> +DISK_SIGNATURE_UUID ?= "${@get_rootfs_uuid(d)}"
> 

-- 
MARTIN HUNDEBØLL, Prevas A/S
Software Developer

Hedeager 3, DK-8200 Aarhus N
Phone +45 87438070
Mobile +45 25562438
Martin.Hundeboll@prevas.dk
www.prevas.com


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH RFC 00/18] EFI boot partition improvements
  2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
                   ` (19 preceding siblings ...)
  2017-12-19 23:16 ` [PATCH RFC 00/18] " Cal Sullivan
@ 2017-12-20 11:29 ` Alexander Kanavin
  20 siblings, 0 replies; 23+ messages in thread
From: Alexander Kanavin @ 2017-12-20 11:29 UTC (permalink / raw)
  To: California Sullivan, openembedded-core

On 12/20/2017 12:58 AM, California Sullivan wrote:
> Currently, the boot partition of an EFI system is entirely controlled by
> image creation. Either done entirely through wic, or one of the
> bootloader bbclasses. This is rather bad since it makes it very
> difficult to add additional items to the boot partition, such as
> alternative kernels, bootloaders, or other utilities, and since its not
> package controlled its hard to update.

How are you planning to have this documented? You probably need to 
review the yocto manuals and see what needs to be changed or newly written.

Alex


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-12-20 11:34 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 22:58 [PATCH RFC 00/18] EFI boot partition improvements California Sullivan
2017-12-19 22:58 ` [PATCH RFC 01/18] fs-uuid.bbclass: rewrite get_fs_uuid function California Sullivan
2017-12-20  8:00   ` Martin Hundebøll
2017-12-19 22:58 ` [PATCH RFC 02/18] image.bbclass: Add fs-uuid bbclass California Sullivan
2017-12-19 22:58 ` [PATCH RFC 03/18] grub-efi.bbclass: split out configuration portion California Sullivan
2017-12-19 22:58 ` [PATCH RFC 04/18] grub: create recipe for configuration California Sullivan
2017-12-19 22:58 ` [PATCH RFC 05/18] grub-efi: install to /boot/ California Sullivan
2017-12-19 22:58 ` [PATCH RFC 06/18] grub-efi: if installed and EFI_PROVIDER, install as bootx64 or bootia32 California Sullivan
2017-12-19 22:58 ` [PATCH RFC 07/18] rootfs-postcommands: add rootfs postprocess command to avoid /boot/ duplication California Sullivan
2017-12-19 22:58 ` [PATCH RFC 08/18] packagegroup-core-boot: add bootloader to EFI systems California Sullivan
2017-12-19 22:58 ` [PATCH RFC 09/18] live-vm-common.bbclass: Don't use vmlinuz or VM_DEFAULT_KERNEL California Sullivan
2017-12-19 22:58 ` [PATCH RFC 10/18] grub-efi*.bbclass: don't reference vmlinuz California Sullivan
2017-12-19 22:58 ` [PATCH RFC 11/18] wic: add wks file to make use of new bootfs functionality California Sullivan
2017-12-19 22:58 ` [PATCH RFC 12/18] init-install-efi.sh: Update to support installing multiple kernels California Sullivan
2017-12-19 22:58 ` [PATCH RFC 13/18] syslinux.bbclass: don't use vmlinuz California Sullivan
2017-12-19 22:58 ` [PATCH RFC 14/18] systemd-boot.bbclass: break out configuration creation California Sullivan
2017-12-19 22:58 ` [PATCH RFC 15/18] systemd: add systemd-bootconf recipe California Sullivan
2017-12-19 22:58 ` [PATCH RFC 16/18] systemd-boot*.bbclass: Don't use vmlinuz California Sullivan
2017-12-19 22:58 ` [PATCH RFC 17/18] systemd-boot: add package that installs to boot California Sullivan
2017-12-19 22:58 ` [PATCH RFC 18/18] packagegroup-core-boot: add kernel for EFI systems California Sullivan
2017-12-19 23:03 ` ✗ patchtest: failure for EFI boot partition improvements Patchwork
2017-12-19 23:16 ` [PATCH RFC 00/18] " Cal Sullivan
2017-12-20 11:29 ` Alexander Kanavin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.