All of lore.kernel.org
 help / color / mirror / Atom feed
From: California Sullivan <california.l.sullivan@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH RFC 03/18] grub-efi.bbclass: split out configuration portion
Date: Tue, 19 Dec 2017 14:58:16 -0800	[thread overview]
Message-ID: <20171219225831.22587-4-california.l.sullivan@intel.com> (raw)
In-Reply-To: <20171219225831.22587-1-california.l.sullivan@intel.com>

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



  parent reply	other threads:[~2017-12-19 22:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` California Sullivan [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171219225831.22587-4-california.l.sullivan@intel.com \
    --to=california.l.sullivan@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.