* [PATCH 0/3] Add gummiboot boot manager alongside grub-efi
@ 2014-03-06 18:15 Stefan Stanacar
2014-03-06 18:15 ` [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes Stefan Stanacar
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Stefan Stanacar @ 2014-03-06 18:15 UTC (permalink / raw)
To: openembedded-core; +Cc: dvhart
Hello,
This series adds recipes for gummiboot and a class allowing it to be used
as the boot loader for live/hddimg images.
Without changing EFI_PROVIDER, we have the same behaviour for EFI machines.
Using EFI_PROVIDER = "gummiboot" an installed image will use gummiboot instead
of grub-efi as it's boot manager.
I've tested this on FRI2, NUC and minnow (live USB boot and install from USB and boot)
with EFI_PROVIDER = "gummiboot" and KERNEL_FEATURES_append = " cfg/efi-ext"
in local.conf
This is a partial fix for YB#4082.
Cheers,
Stefan
The following changes since commit a01af0202558e6ed9d16590b3a8d1dd1b95c0374:
recipes: bump PRs (2014-03-05 17:36:37 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib stefans/gummiboot
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=stefans/gummiboot
Stefan Stanacar (3):
recipes-bsp: Add gummiboot and gnu-efi recipes
bootimg/grub-efi.bbclass: allow using a different class for EFI images
classes: Add gummiboot class
meta/classes/boot-directdisk.bbclass | 7 +-
meta/classes/bootimg.bbclass | 9 +-
meta/classes/grub-efi.bbclass | 6 ++
meta/classes/gummiboot.bbclass | 112 +++++++++++++++++++++
.../gnu-efi/gnu-efi/parallel-make-archives.patch | 48 +++++++++
.../gnu-efi/gnu-efi/parallel-make.patch | 22 ++++
meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb | 33 ++++++
meta/recipes-bsp/gummiboot/gummiboot_git.bb | 25 +++++
.../initrdscripts/files/init-install-efi.sh | 51 +++++++---
9 files changed, 290 insertions(+), 23 deletions(-)
create mode 100644 meta/classes/gummiboot.bbclass
create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
create mode 100644 meta/recipes-bsp/gummiboot/gummiboot_git.bb
--
1.8.5.3
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes
2014-03-06 18:15 [PATCH 0/3] Add gummiboot boot manager alongside grub-efi Stefan Stanacar
@ 2014-03-06 18:15 ` Stefan Stanacar
2014-03-06 22:27 ` Darren Hart
2014-03-09 8:00 ` Saul Wold
2014-03-06 18:15 ` [PATCH 2/3] bootimg/grub-efi.bbclass: allow using a different class for EFI images Stefan Stanacar
2014-03-06 18:15 ` [PATCH 3/3] classes: Add gummiboot class Stefan Stanacar
2 siblings, 2 replies; 14+ messages in thread
From: Stefan Stanacar @ 2014-03-06 18:15 UTC (permalink / raw)
To: openembedded-core; +Cc: dvhart
gummiboot is is a simple UEFI boot manager (not a boot loader ;-) )
These recipes are imported from meta-intel with these changes:
- drop PR and update configure options
- gummiboot was upgraded to latest version
A couple of notes:
- If you wish you can install the gummiboot package on the target and
use 'gummiboot install' to add the payload to the ESP (see gummiboot --help,
just make sure the ESP partition has the boot flag on as gummiboot won't accept it
otherwise). However the point of this recipe is to be used by bootimg.bbclass and
generate images with gummiboot instead of grub-efi.
- You need a kernel which has CONFIG_EFI_STUB=y at least
- The default linux-yocto kernel config does not enable that, easiest way
to enable is to build with KERNEL_FEATURES_append = " cfg/efi-ext" in local.conf
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
.../gnu-efi/gnu-efi/parallel-make-archives.patch | 48 ++++++++++++++++++++++
.../gnu-efi/gnu-efi/parallel-make.patch | 22 ++++++++++
meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb | 33 +++++++++++++++
meta/recipes-bsp/gummiboot/gummiboot_git.bb | 25 +++++++++++
4 files changed, 128 insertions(+)
create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
create mode 100644 meta/recipes-bsp/gummiboot/gummiboot_git.bb
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
new file mode 100644
index 0000000..e5b47c1
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
@@ -0,0 +1,48 @@
+Fix parallel make failure for archives
+
+Upstream-Status: Pending
+
+The lib and gnuefi makefiles were using the lib.a() form which compiles
+and ar's as a pair instead of compiling all and then ar'ing which can
+parallelize better. This was resulting in build failures on larger values
+of -j.
+
+See http://www.chemie.fu-berlin.de/chemnet/use/info/make/make_toc.html#TOC105
+for details.
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
+---
+---
+ gnuefi/Makefile | 3 ++-
+ lib/Makefile | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+Index: gnu-efi-3.0/lib/Makefile
+===================================================================
+--- gnu-efi-3.0.orig/lib/Makefile
++++ gnu-efi-3.0/lib/Makefile
+@@ -66,7 +66,8 @@ all: libsubdirs libefi.a
+ libsubdirs:
+ for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
+
+-libefi.a: $(patsubst %,libefi.a(%),$(OBJS))
++libefi.a: $(OBJS)
++ $(AR) rv $@ $(OBJS)
+
+ clean:
+ rm -f libefi.a *~ $(OBJS) */*.o
+Index: gnu-efi-3.0/gnuefi/Makefile
+===================================================================
+--- gnu-efi-3.0.orig/gnuefi/Makefile
++++ gnu-efi-3.0/gnuefi/Makefile
+@@ -51,7 +51,8 @@ TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
+
+ all: $(TARGETS)
+
+-libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS))
++libgnuefi.a: $(OBJS)
++ $(AR) rv $@ $(OBJS)
+
+ clean:
+ rm -f $(TARGETS) *~ *.o $(OBJS)
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
new file mode 100644
index 0000000..27c94e8
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
@@ -0,0 +1,22 @@
+Fix parallel make failure
+
+Upstream-Status: Submitted [Maintainer directly]
+
+Add a missing dependency which resulted in a race leading to failure
+on larger values of -j.
+
+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
+
+Index: gnu-efi-3.0/Makefile
+===================================================================
+--- gnu-efi-3.0.orig/Makefile
++++ gnu-efi-3.0/Makefile
+@@ -42,6 +42,8 @@ include $(SRCDIR)/Make.defaults
+
+ SUBDIRS = lib gnuefi inc apps
+
++gnuefi: lib
++
+ all: check_gcc $(SUBDIRS)
+
+ $(SUBDIRS):
diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
new file mode 100644
index 0000000..0dbdba2
--- /dev/null
+++ b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
@@ -0,0 +1,33 @@
+SUMMARY = "Libraries for producing EFI binaries"
+HOMEPAGE = "http://sourceforge.net/projects/gnu-efi/"
+SECTION = "devel"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://debian/copyright;md5=5fb358a180f484b285b0d99acdc29666"
+
+SRC_URI = "http://downloads.sourceforge.net/gnu-efi/gnu-efi_3.0u.orig.tar.gz \
+ file://parallel-make.patch \
+ file://parallel-make-archives.patch \
+ "
+SRC_URI[md5sum] = "d15d3c700e79a1e2938544d73edc572d"
+SRC_URI[sha256sum] = "3c0d450d5829204ca05dcb3b2aae772e52c379b7c7e09146759c6315606f934e"
+
+COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
+
+S = "${WORKDIR}/gnu-efi-3.0"
+
+def gnu_efi_arch(d):
+ import re
+ tarch = d.getVar("TARGET_ARCH", True)
+ if re.match("i[3456789]86", tarch):
+ return "ia32"
+ return tarch
+
+EXTRA_OEMAKE = "'ARCH=${@gnu_efi_arch(d)}' 'CC=${CC}' 'AS=${AS}' 'LD=${LD}' 'AR=${AR}' \
+ 'RANLIB=${RANLIB}' 'OBJCOPY=${OBJCOPY}' 'PREFIX=${prefix}'\
+ "
+
+do_install() {
+ oe_runmake install INSTALLROOT="${D}"
+}
+
+FILES_${PN} += "${libdir}/*.lds"
diff --git a/meta/recipes-bsp/gummiboot/gummiboot_git.bb b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
new file mode 100644
index 0000000..b55064f
--- /dev/null
+++ b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
@@ -0,0 +1,25 @@
+SUMMARY = "Gummiboot is a simple UEFI boot manager which executes configured EFI images."
+HOMEPAGE = "http://freedesktop.org/wiki/Software/gummiboot"
+
+LICENSE = "LGPLv2.1"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c"
+
+DEPENDS = "gnu-efi util-linux"
+
+inherit autotools
+inherit deploy
+
+PV = "43+git${SRCPV}"
+SRCREV = "4062c51075ba054d4949c714fe06123f9ad3097d"
+SRC_URI = "git://anongit.freedesktop.org/gummiboot"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF = "--disable-manpages --with-efi-includedir=${STAGING_INCDIR} \
+ --with-efi-ldsdir=${STAGING_LIBDIR} \
+ --with-efi-libdir=${STAGING_LIBDIR}"
+
+do_deploy () {
+ install ${S}/gummiboot*.efi ${DEPLOYDIR}/
+}
+addtask deploy before do_build after do_compile
--
1.8.5.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/3] bootimg/grub-efi.bbclass: allow using a different class for EFI images
2014-03-06 18:15 [PATCH 0/3] Add gummiboot boot manager alongside grub-efi Stefan Stanacar
2014-03-06 18:15 ` [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes Stefan Stanacar
@ 2014-03-06 18:15 ` Stefan Stanacar
2014-03-06 22:31 ` Darren Hart
2014-03-06 18:15 ` [PATCH 3/3] classes: Add gummiboot class Stefan Stanacar
2 siblings, 1 reply; 14+ messages in thread
From: Stefan Stanacar @ 2014-03-06 18:15 UTC (permalink / raw)
To: openembedded-core; +Cc: dvhart
Abstract away some names so one can select using EFI_PROVIDER a different
class than grub-efi for populating live images, basically allowing the use
of a different bootloader than grub-efi.
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
meta/classes/boot-directdisk.bbclass | 7 ++++---
meta/classes/bootimg.bbclass | 9 +++++----
meta/classes/grub-efi.bbclass | 6 ++++++
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass
index 42b3415..c35b4bb 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -32,7 +32,8 @@ BOOTDD_VOLUME_ID ?= "boot"
BOOTDD_EXTRA_SPACE ?= "16384"
EFI = "${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
-EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "", d)}"
+EFI_PROVIDER ?= "grub-efi"
+EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
# contain "efi". This way legacy is supported by default if neither is
@@ -87,7 +88,7 @@ build_boot_dd() {
syslinux_hddimg_populate $HDDDIR
fi
if [ "${EFI}" = "1" ]; then
- grubefi_hddimg_populate $HDDDIR
+ ${EFICLASS_FUNC_PREFIX}_hddimg_populate $HDDDIR
fi
if [ "${IS_VMDK}" = "true" ]; then
@@ -154,7 +155,7 @@ python do_bootdirectdisk() {
if d.getVar("PCBIOS", True) == "1":
bb.build.exec_func('build_syslinux_cfg', d)
if d.getVar("EFI", True) == "1":
- bb.build.exec_func('build_grub_cfg', d)
+ bb.build.exec_func('build_efi_cfg', d)
bb.build.exec_func('build_boot_dd', d)
}
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index c370bd6..f8cfd37 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -42,7 +42,8 @@ BOOTIMG_VOLUME_ID ?= "boot"
BOOTIMG_EXTRA_SPACE ?= "512"
EFI = "${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
-EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "", d)}"
+EFI_PROVIDER ?= "grub-efi"
+EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not
# contain "efi". This way legacy is supported by default if neither is
@@ -89,7 +90,7 @@ build_iso() {
syslinux_iso_populate ${ISODIR}
fi
if [ "${EFI}" = "1" ]; then
- grubefi_iso_populate ${ISODIR}
+ ${EFICLASS_FUNC_PREFIX}_iso_populate ${ISODIR}
build_fat_img ${EFIIMGDIR} ${ISODIR}/efi.img
fi
@@ -206,7 +207,7 @@ build_hddimg() {
syslinux_hddimg_populate ${HDDDIR}
fi
if [ "${EFI}" = "1" ]; then
- grubefi_hddimg_populate ${HDDDIR}
+ ${EFICLASS_FUNC_PREFIX}_hddimg_populate ${HDDDIR}
fi
build_fat_img ${HDDDIR} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
@@ -227,7 +228,7 @@ python do_bootimg() {
if d.getVar("PCBIOS", True) == "1":
bb.build.exec_func('build_syslinux_cfg', d)
if d.getVar("EFI", True) == "1":
- bb.build.exec_func('build_grub_cfg', d)
+ bb.build.exec_func('build_efi_cfg', d)
bb.build.exec_func('build_hddimg', d)
bb.build.exec_func('build_iso', d)
}
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 71bd00f..f7fe8d8 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -15,6 +15,8 @@
# ${GRUB_OPTS} - additional options to add to the config, ';' delimited # (optional)
# ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
+EFICLASS_FUNC_PREFIX = "grubefi"
+
do_bootimg[depends] += "grub-efi:do_deploy"
do_bootdirectdisk[depends] += "grub-efi:do_deploy"
@@ -139,3 +141,7 @@ python build_grub_cfg() {
cfgfile.close()
}
+
+python build_efi_cfg() {
+ bb.build.exec_func("build_grub_cfg", d)
+}
--
1.8.5.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/3] classes: Add gummiboot class
2014-03-06 18:15 [PATCH 0/3] Add gummiboot boot manager alongside grub-efi Stefan Stanacar
2014-03-06 18:15 ` [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes Stefan Stanacar
2014-03-06 18:15 ` [PATCH 2/3] bootimg/grub-efi.bbclass: allow using a different class for EFI images Stefan Stanacar
@ 2014-03-06 18:15 ` Stefan Stanacar
2014-03-06 22:36 ` Darren Hart
2 siblings, 1 reply; 14+ messages in thread
From: Stefan Stanacar @ 2014-03-06 18:15 UTC (permalink / raw)
To: openembedded-core; +Cc: dvhart
Adds a gummiboot class similar to grub-efi class and makes the necessary
changes so it can be used for live/hddimg images as well.
One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot instead of grub-efi.
Gummiboot requires some kernel options that are not enabled by default, so one has to build
with KERNEL_FEATURES_append = " cfg/efi-ext".
The install scripts have been updated too, keeping the old behaviour around,
but accounting for the new boot loader config files (if they exist).
It can be argued that the installer and bootimg are a bit wierd and not necessarily correct,
but I wanted to have the exact same behviour with gummiboot.
With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing should be just as before.
I've tested live boot, install and normal boot on:
- FRI2
- genericx86-64 on NUC
with:
EFI_PROVIDER = "gummiboot"
KERNEL_FEATURES_append = " cfg/efi-ext"
in local.conf.
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
---
meta/classes/gummiboot.bbclass | 112 +++++++++++++++++++++
.../initrdscripts/files/init-install-efi.sh | 51 +++++++---
2 files changed, 147 insertions(+), 16 deletions(-)
create mode 100644 meta/classes/gummiboot.bbclass
diff --git a/meta/classes/gummiboot.bbclass b/meta/classes/gummiboot.bbclass
new file mode 100644
index 0000000..5c11286
--- /dev/null
+++ b/meta/classes/gummiboot.bbclass
@@ -0,0 +1,112 @@
+EFICLASS_FUNC_PREFIX = "gummiboot"
+
+do_bootimg[depends] += "gummiboot:do_deploy"
+do_bootdirectdisk[depends] += "gummiboot:do_deploy"
+
+EFIDIR = "/EFI/BOOT"
+
+GUMMIBOOT_CFG ?= "${S}/loader.conf"
+GUMMIBOOT_ENTRIES ?= ""
+GUMMIBOOT_TIMEOUT ?= "10"
+
+gummiboot_populate() {
+ DEST=$1
+
+ EFI_IMAGE="gummibootia32.efi"
+ DEST_EFI_IMAGE="bootia32.efi"
+ if [ "${TARGET_ARCH}" = "x86_64" ]; then
+ EFI_IMAGE="gummibootx64.efi"
+ DEST_EFI_IMAGE="bootx64.efi"
+ fi
+
+ install -d ${DEST}${EFIDIR}
+ # gummiboot 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}
+ install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
+ for i in ${GUMMIBOOT_ENTRIES}; do
+ install -m 0644 ${i} ${DEST}/loader/entries
+ done
+}
+
+gummiboot_iso_populate() {
+ iso_dir=$1
+ gummiboot_populate $iso_dir
+ mkdir -p ${EFIIMGDIR}/${EFIDIR}
+ cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
+ cp $iso_dir/vmlinuz ${EFIIMGDIR}
+ echo "${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
+ if [ -f "$iso_dir/initrd" ] ; then
+ cp $iso_dir/initrd ${EFIIMGDIR}
+ fi
+}
+
+gummiboot_hddimg_populate() {
+ gummiboot_populate $1
+}
+
+python build_gummiboot_cfg() {
+ s = d.getVar("S", True)
+ labels = d.getVar('LABELS', True)
+ 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('GUMMIBOOT_CFG', True)
+ try:
+ cfgfile = open(cfile, 'w')
+ except OSError:
+ raise bb.build.funcFailed('Unable to open %s' % (cfile))
+
+ cfgfile.write('# Automatically created by OE\n')
+ cfgfile.write('default %s\n' % (labels.split()[0]))
+ timeout = d.getVar('GUMMIBOOT_TIMEOUT', True)
+ 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', True)
+ if not overrides:
+ raise bb.build.FuncFailed('OVERRIDES not defined')
+
+ entryfile = "%s/%s.conf" % (s, label)
+ d.appendVar("GUMMIBOOT_ENTRIES", " " + entryfile)
+ try:
+ entrycfg = open(entryfile, "w")
+ except OSError:
+ raise bb.build.funcFailed('Unable to open %s' % (entryfile))
+ localdata.setVar('OVERRIDES', label + ':' + overrides)
+ bb.data.update_data(localdata)
+
+ entrycfg.write('title %s\n' % label)
+ entrycfg.write('linux /vmlinuz\n')
+
+ append = localdata.getVar('APPEND', True)
+ initrd = localdata.getVar('INITRD', True)
+
+ if initrd:
+ entrycfg.write('initrd /initrd\n')
+ lb = label
+ if label == "install":
+ lb = "install-efi"
+ entrycfg.write('options LABEL=%s ' % lb)
+ if append:
+ entrycfg.write('%s' % append)
+ entrycfg.write('\n')
+ entrycfg.close()
+}
+
+python build_efi_cfg() {
+ bb.build.exec_func("build_gummiboot_cfg", d)
+}
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 9846637..ed3221b 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -104,6 +104,7 @@ parted /dev/${device} mklabel gpt
echo "Creating boot partition on $bootfs"
parted /dev/${device} mkpart primary 0% $boot_size
+parted /dev/${device} set 1 boot on
echo "Creating rootfs partition on $rootfs"
parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
@@ -149,23 +150,41 @@ mount $bootfs /ssd
EFIDIR="/ssd/EFI/BOOT"
mkdir -p $EFIDIR
-GRUBCFG="$EFIDIR/grub.cfg"
-
cp /media/$1/vmlinuz /ssd
-# Copy the efi loader and config (booti*.efi and grub.cfg)
-cp /media/$1/EFI/BOOT/* $EFIDIR
-
-# Update grub config for the installed image
-# Delete the install entry
-sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
-# Delete the initrd lines
-sed -i "/initrd /d" $GRUBCFG
-# Delete any LABEL= strings
-sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
-# Delete any root= strings
-sed -i "s/ root=[^ ]*/ /" $GRUBCFG
-# Add the root= and other standard boot options
-sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG
+# Copy the efi loader
+cp /media/$1/EFI/BOOT/*.efi $EFIDIR
+
+if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
+ GRUBCFG="$EFIDIR/grub.cfg"
+ cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
+ # Update grub config for the installed image
+ # Delete the install entry
+ sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
+ # Delete the initrd lines
+ sed -i "/initrd /d" $GRUBCFG
+ # Delete any LABEL= strings
+ sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
+ # Delete any root= strings
+ sed -i "s/ root=[^ ]*/ /" $GRUBCFG
+ # Add the root= and other standard boot options
+ sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait quiet @" $GRUBCFG
+fi
+
+if [ -d /media/$1/loader ]; then
+ GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
+ # copy config files for gummiboot
+ cp -dr /media/$1/loader /ssd
+ # delete the install entry
+ rm -f /ssd/loader/entries/install.conf
+ # delete the initrd lines
+ sed -i "/initrd /d" $GUMMIBOOT_CFGS
+ # delete any LABEL= strings
+ sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
+ # delete any root= strings
+ sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
+ # add the root= and other standard boot options
+ sed -i "s@options *@options root=$rootfs rw $rootwait quiet @" $GUMMIBOOT_CFGS
+fi
umount /ssd
sync
--
1.8.5.3
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes
2014-03-06 18:15 ` [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes Stefan Stanacar
@ 2014-03-06 22:27 ` Darren Hart
2014-03-09 8:00 ` Saul Wold
1 sibling, 0 replies; 14+ messages in thread
From: Darren Hart @ 2014-03-06 22:27 UTC (permalink / raw)
To: Stefan Stanacar, openembedded-core; +Cc: Koen Kooi
On 3/6/14, 10:15, "Stefan Stanacar" <stefanx.stanacar@intel.com> wrote:
>gummiboot is is a simple UEFI boot manager (not a boot loader ;-) )
>
>These recipes are imported from meta-intel with these changes:
> - drop PR and update configure options
> - gummiboot was upgraded to latest version
>
>A couple of notes:
> - If you wish you can install the gummiboot package on the target and
>use 'gummiboot install' to add the payload to the ESP (see gummiboot
>--help,
>just make sure the ESP partition has the boot flag on as gummiboot won't
>accept it
>otherwise). However the point of this recipe is to be used by
>bootimg.bbclass and
>generate images with gummiboot instead of grub-efi.
> - You need a kernel which has CONFIG_EFI_STUB=y at least
> - The default linux-yocto kernel config does not enable that, easiest way
>to enable is to build with KERNEL_FEATURES_append = " cfg/efi-ext" in
>local.conf
>
>Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
I don't know if Saul or RP would prefer gnu-efi and gummiboot to arrive as
separate patches, probably a good idea. But in general, I agree with this
direction:
Acked-by: Darren Hart <dvhart@linux.intel.com>
Note: Added Koen on Cc, as he happens to also have been working on
something similar in his "spare" time.
>---
> .../gnu-efi/gnu-efi/parallel-make-archives.patch | 48
>++++++++++++++++++++++
> .../gnu-efi/gnu-efi/parallel-make.patch | 22 ++++++++++
> meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb | 33 +++++++++++++++
> meta/recipes-bsp/gummiboot/gummiboot_git.bb | 25 +++++++++++
> 4 files changed, 128 insertions(+)
> create mode 100644
>meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
> create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
> create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
> create mode 100644 meta/recipes-bsp/gummiboot/gummiboot_git.bb
>
>diff --git
>a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
>b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
>new file mode 100644
>index 0000000..e5b47c1
>--- /dev/null
>+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
>@@ -0,0 +1,48 @@
>+Fix parallel make failure for archives
>+
>+Upstream-Status: Pending
>+
>+The lib and gnuefi makefiles were using the lib.a() form which compiles
>+and ar's as a pair instead of compiling all and then ar'ing which can
>+parallelize better. This was resulting in build failures on larger values
>+of -j.
>+
>+See
>http://www.chemie.fu-berlin.de/chemnet/use/info/make/make_toc.html#TOC105
>+for details.
>+
>+Signed-off-by: Saul Wold <sgw@linux.intel.com>
>+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
>+---
>+---
>+ gnuefi/Makefile | 3 ++-
>+ lib/Makefile | 3 ++-
>+ 2 files changed, 4 insertions(+), 2 deletions(-)
>+
>+Index: gnu-efi-3.0/lib/Makefile
>+===================================================================
>+--- gnu-efi-3.0.orig/lib/Makefile
>++++ gnu-efi-3.0/lib/Makefile
>+@@ -66,7 +66,8 @@ all: libsubdirs libefi.a
>+ libsubdirs:
>+ for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
>+
>+-libefi.a: $(patsubst %,libefi.a(%),$(OBJS))
>++libefi.a: $(OBJS)
>++ $(AR) rv $@ $(OBJS)
>+
>+ clean:
>+ rm -f libefi.a *~ $(OBJS) */*.o
>+Index: gnu-efi-3.0/gnuefi/Makefile
>+===================================================================
>+--- gnu-efi-3.0.orig/gnuefi/Makefile
>++++ gnu-efi-3.0/gnuefi/Makefile
>+@@ -51,7 +51,8 @@ TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
>+
>+ all: $(TARGETS)
>+
>+-libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS))
>++libgnuefi.a: $(OBJS)
>++ $(AR) rv $@ $(OBJS)
>+
>+ clean:
>+ rm -f $(TARGETS) *~ *.o $(OBJS)
>diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
>b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
>new file mode 100644
>index 0000000..27c94e8
>--- /dev/null
>+++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
>@@ -0,0 +1,22 @@
>+Fix parallel make failure
>+
>+Upstream-Status: Submitted [Maintainer directly]
>+
>+Add a missing dependency which resulted in a race leading to failure
>+on larger values of -j.
>+
>+Signed-off-by: Darren Hart <dvhart@linux.intel.com>
>+
>+Index: gnu-efi-3.0/Makefile
>+===================================================================
>+--- gnu-efi-3.0.orig/Makefile
>++++ gnu-efi-3.0/Makefile
>+@@ -42,6 +42,8 @@ include $(SRCDIR)/Make.defaults
>+
>+ SUBDIRS = lib gnuefi inc apps
>+
>++gnuefi: lib
>++
>+ all: check_gcc $(SUBDIRS)
>+
>+ $(SUBDIRS):
>diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
>b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
>new file mode 100644
>index 0000000..0dbdba2
>--- /dev/null
>+++ b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
>@@ -0,0 +1,33 @@
>+SUMMARY = "Libraries for producing EFI binaries"
>+HOMEPAGE = "http://sourceforge.net/projects/gnu-efi/"
>+SECTION = "devel"
>+LICENSE = "GPLv2+"
>+LIC_FILES_CHKSUM =
>"file://debian/copyright;md5=5fb358a180f484b285b0d99acdc29666"
>+
>+SRC_URI =
>"http://downloads.sourceforge.net/gnu-efi/gnu-efi_3.0u.orig.tar.gz \
>+ file://parallel-make.patch \
>+ file://parallel-make-archives.patch \
>+ "
>+SRC_URI[md5sum] = "d15d3c700e79a1e2938544d73edc572d"
>+SRC_URI[sha256sum] =
>"3c0d450d5829204ca05dcb3b2aae772e52c379b7c7e09146759c6315606f934e"
>+
>+COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
>+
>+S = "${WORKDIR}/gnu-efi-3.0"
>+
>+def gnu_efi_arch(d):
>+ import re
>+ tarch = d.getVar("TARGET_ARCH", True)
>+ if re.match("i[3456789]86", tarch):
>+ return "ia32"
>+ return tarch
>+
>+EXTRA_OEMAKE = "'ARCH=${@gnu_efi_arch(d)}' 'CC=${CC}' 'AS=${AS}'
>'LD=${LD}' 'AR=${AR}' \
>+ 'RANLIB=${RANLIB}' 'OBJCOPY=${OBJCOPY}'
>'PREFIX=${prefix}'\
>+ "
>+
>+do_install() {
>+ oe_runmake install INSTALLROOT="${D}"
>+}
>+
>+FILES_${PN} += "${libdir}/*.lds"
>diff --git a/meta/recipes-bsp/gummiboot/gummiboot_git.bb
>b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
>new file mode 100644
>index 0000000..b55064f
>--- /dev/null
>+++ b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
>@@ -0,0 +1,25 @@
>+SUMMARY = "Gummiboot is a simple UEFI boot manager which executes
>configured EFI images."
>+HOMEPAGE = "http://freedesktop.org/wiki/Software/gummiboot"
>+
>+LICENSE = "LGPLv2.1"
>+LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c"
>+
>+DEPENDS = "gnu-efi util-linux"
>+
>+inherit autotools
>+inherit deploy
>+
>+PV = "43+git${SRCPV}"
>+SRCREV = "4062c51075ba054d4949c714fe06123f9ad3097d"
>+SRC_URI = "git://anongit.freedesktop.org/gummiboot"
>+
>+S = "${WORKDIR}/git"
>+
>+EXTRA_OECONF = "--disable-manpages
>--with-efi-includedir=${STAGING_INCDIR} \
>+ --with-efi-ldsdir=${STAGING_LIBDIR} \
>+ --with-efi-libdir=${STAGING_LIBDIR}"
>+
>+do_deploy () {
>+ install ${S}/gummiboot*.efi ${DEPLOYDIR}/
>+}
>+addtask deploy before do_build after do_compile
>--
>1.8.5.3
>
>
--
Darren Hart
Yocto Project - Linux Kernel
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/3] bootimg/grub-efi.bbclass: allow using a different class for EFI images
2014-03-06 18:15 ` [PATCH 2/3] bootimg/grub-efi.bbclass: allow using a different class for EFI images Stefan Stanacar
@ 2014-03-06 22:31 ` Darren Hart
0 siblings, 0 replies; 14+ messages in thread
From: Darren Hart @ 2014-03-06 22:31 UTC (permalink / raw)
To: Stefan Stanacar, openembedded-core; +Cc: Koen Kooi
On 3/6/14, 10:15, "Stefan Stanacar" <stefanx.stanacar@intel.com> wrote:
>Abstract away some names so one can select using EFI_PROVIDER a different
>class than grub-efi for populating live images, basically allowing the use
>of a different bootloader than grub-efi.
>
>Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
>---
> meta/classes/boot-directdisk.bbclass | 7 ++++---
> meta/classes/bootimg.bbclass | 9 +++++----
> meta/classes/grub-efi.bbclass | 6 ++++++
> 3 files changed, 15 insertions(+), 7 deletions(-)
>
>diff --git a/meta/classes/boot-directdisk.bbclass
>b/meta/classes/boot-directdisk.bbclass
>index 42b3415..c35b4bb 100644
>--- a/meta/classes/boot-directdisk.bbclass
>+++ b/meta/classes/boot-directdisk.bbclass
>@@ -32,7 +32,8 @@ BOOTDD_VOLUME_ID ?= "boot"
> BOOTDD_EXTRA_SPACE ?= "16384"
>
> EFI = "${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
>-EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "",
>d)}"
>+EFI_PROVIDER ?= "grub-efi"
>+EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi",
>"${EFI_PROVIDER}", "", d)}"
>
> # Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it
>does not
> # contain "efi". This way legacy is supported by default if neither is
>@@ -87,7 +88,7 @@ build_boot_dd() {
> syslinux_hddimg_populate $HDDDIR
> fi
> if [ "${EFI}" = "1" ]; then
>- grubefi_hddimg_populate $HDDDIR
>+ ${EFICLASS_FUNC_PREFIX}_hddimg_populate $HDDDIR
This seems like an odd way to call a function, via a constructed function
name. Would it make more sense to define an efi interface and only one
bbclass that implemented that interface? Such as grub-efi.bbclass or
gummiboot.bbclass?
This isn't my area of expertise, maybe some recipe/bitbake experts can
weigh in here...
--
Darren Hart
Yocto Project - Linux Kernel
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] classes: Add gummiboot class
2014-03-06 18:15 ` [PATCH 3/3] classes: Add gummiboot class Stefan Stanacar
@ 2014-03-06 22:36 ` Darren Hart
2014-03-07 9:57 ` Stanacar, StefanX
0 siblings, 1 reply; 14+ messages in thread
From: Darren Hart @ 2014-03-06 22:36 UTC (permalink / raw)
To: Stefan Stanacar, openembedded-core; +Cc: Koen Kooi
On 3/6/14, 10:15, "Stefan Stanacar" <stefanx.stanacar@intel.com> wrote:
>Adds a gummiboot class similar to grub-efi class and makes the necessary
>changes so it can be used for live/hddimg images as well.
>
>One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot
>instead of grub-efi.
>Gummiboot requires some kernel options that are not enabled by default,
>so one has to build
>with KERNEL_FEATURES_append = " cfg/efi-ext".
cfg/efi is insufficient?
>
>The install scripts have been updated too, keeping the old behaviour
>around,
>but accounting for the new boot loader config files (if they exist).
>It can be argued that the installer and bootimg are a bit wierd and not
>necessarily correct,
>but I wanted to have the exact same behviour with gummiboot.
>With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing
>should be just as before.
>
>I've tested live boot, install and normal boot on:
> - FRI2
> - genericx86-64 on NUC
>with:
> EFI_PROVIDER = "gummiboot"
> KERNEL_FEATURES_append = " cfg/efi-ext"
>in local.conf.
>
>Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Generally looks good. My only reservation is the same as for 2/3, should
we define an EFI interface rather than having to construct function names
in the consumers of this class?
--
Darren
>---
> meta/classes/gummiboot.bbclass | 112
>+++++++++++++++++++++
> .../initrdscripts/files/init-install-efi.sh | 51 +++++++---
> 2 files changed, 147 insertions(+), 16 deletions(-)
> create mode 100644 meta/classes/gummiboot.bbclass
>
>diff --git a/meta/classes/gummiboot.bbclass
>b/meta/classes/gummiboot.bbclass
>new file mode 100644
>index 0000000..5c11286
>--- /dev/null
>+++ b/meta/classes/gummiboot.bbclass
>@@ -0,0 +1,112 @@
>+EFICLASS_FUNC_PREFIX = "gummiboot"
>+
>+do_bootimg[depends] += "gummiboot:do_deploy"
>+do_bootdirectdisk[depends] += "gummiboot:do_deploy"
>+
>+EFIDIR = "/EFI/BOOT"
>+
>+GUMMIBOOT_CFG ?= "${S}/loader.conf"
>+GUMMIBOOT_ENTRIES ?= ""
>+GUMMIBOOT_TIMEOUT ?= "10"
>+
>+gummiboot_populate() {
>+ DEST=$1
>+
>+ EFI_IMAGE="gummibootia32.efi"
>+ DEST_EFI_IMAGE="bootia32.efi"
>+ if [ "${TARGET_ARCH}" = "x86_64" ]; then
>+ EFI_IMAGE="gummibootx64.efi"
>+ DEST_EFI_IMAGE="bootx64.efi"
>+ fi
>+
>+ install -d ${DEST}${EFIDIR}
>+ # gummiboot 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}
>+ install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
>+ for i in ${GUMMIBOOT_ENTRIES}; do
>+ install -m 0644 ${i} ${DEST}/loader/entries
>+ done
>+}
>+
>+gummiboot_iso_populate() {
>+ iso_dir=$1
>+ gummiboot_populate $iso_dir
>+ mkdir -p ${EFIIMGDIR}/${EFIDIR}
>+ cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
>+ cp $iso_dir/vmlinuz ${EFIIMGDIR}
>+ echo "${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
>+ if [ -f "$iso_dir/initrd" ] ; then
>+ cp $iso_dir/initrd ${EFIIMGDIR}
>+ fi
>+}
>+
>+gummiboot_hddimg_populate() {
>+ gummiboot_populate $1
>+}
>+
>+python build_gummiboot_cfg() {
>+ s = d.getVar("S", True)
>+ labels = d.getVar('LABELS', True)
>+ 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('GUMMIBOOT_CFG', True)
>+ try:
>+ cfgfile = open(cfile, 'w')
>+ except OSError:
>+ raise bb.build.funcFailed('Unable to open %s' % (cfile))
>+
>+ cfgfile.write('# Automatically created by OE\n')
>+ cfgfile.write('default %s\n' % (labels.split()[0]))
>+ timeout = d.getVar('GUMMIBOOT_TIMEOUT', True)
>+ 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', True)
>+ if not overrides:
>+ raise bb.build.FuncFailed('OVERRIDES not defined')
>+
>+ entryfile = "%s/%s.conf" % (s, label)
>+ d.appendVar("GUMMIBOOT_ENTRIES", " " + entryfile)
>+ try:
>+ entrycfg = open(entryfile, "w")
>+ except OSError:
>+ raise bb.build.funcFailed('Unable to open %s' % (entryfile))
>+ localdata.setVar('OVERRIDES', label + ':' + overrides)
>+ bb.data.update_data(localdata)
>+
>+ entrycfg.write('title %s\n' % label)
>+ entrycfg.write('linux /vmlinuz\n')
>+
>+ append = localdata.getVar('APPEND', True)
>+ initrd = localdata.getVar('INITRD', True)
>+
>+ if initrd:
>+ entrycfg.write('initrd /initrd\n')
>+ lb = label
>+ if label == "install":
>+ lb = "install-efi"
>+ entrycfg.write('options LABEL=%s ' % lb)
>+ if append:
>+ entrycfg.write('%s' % append)
>+ entrycfg.write('\n')
>+ entrycfg.close()
>+}
>+
>+python build_efi_cfg() {
>+ bb.build.exec_func("build_gummiboot_cfg", d)
>+}
>diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>index 9846637..ed3221b 100644
>--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>@@ -104,6 +104,7 @@ parted /dev/${device} mklabel gpt
>
> echo "Creating boot partition on $bootfs"
> parted /dev/${device} mkpart primary 0% $boot_size
>+parted /dev/${device} set 1 boot on
>
> echo "Creating rootfs partition on $rootfs"
> parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
>@@ -149,23 +150,41 @@ mount $bootfs /ssd
>
> EFIDIR="/ssd/EFI/BOOT"
> mkdir -p $EFIDIR
>-GRUBCFG="$EFIDIR/grub.cfg"
>-
> cp /media/$1/vmlinuz /ssd
>-# Copy the efi loader and config (booti*.efi and grub.cfg)
>-cp /media/$1/EFI/BOOT/* $EFIDIR
>-
>-# Update grub config for the installed image
>-# Delete the install entry
>-sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
>-# Delete the initrd lines
>-sed -i "/initrd /d" $GRUBCFG
>-# Delete any LABEL= strings
>-sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
>-# Delete any root= strings
>-sed -i "s/ root=[^ ]*/ /" $GRUBCFG
>-# Add the root= and other standard boot options
>-sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait
>quiet @" $GRUBCFG
>+# Copy the efi loader
>+cp /media/$1/EFI/BOOT/*.efi $EFIDIR
>+
>+if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
>+ GRUBCFG="$EFIDIR/grub.cfg"
>+ cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
>+ # Update grub config for the installed image
>+ # Delete the install entry
>+ sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
>+ # Delete the initrd lines
>+ sed -i "/initrd /d" $GRUBCFG
>+ # Delete any LABEL= strings
>+ sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
>+ # Delete any root= strings
>+ sed -i "s/ root=[^ ]*/ /" $GRUBCFG
>+ # Add the root= and other standard boot options
>+ sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait
>quiet @" $GRUBCFG
>+fi
>+
>+if [ -d /media/$1/loader ]; then
>+ GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
>+ # copy config files for gummiboot
>+ cp -dr /media/$1/loader /ssd
>+ # delete the install entry
>+ rm -f /ssd/loader/entries/install.conf
>+ # delete the initrd lines
>+ sed -i "/initrd /d" $GUMMIBOOT_CFGS
>+ # delete any LABEL= strings
>+ sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
>+ # delete any root= strings
>+ sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
>+ # add the root= and other standard boot options
>+ sed -i "s@options *@options root=$rootfs rw $rootwait quiet @"
>$GUMMIBOOT_CFGS
>+fi
>
> umount /ssd
> sync
>--
>1.8.5.3
>
>
--
Darren Hart
Yocto Project - Linux Kernel
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] classes: Add gummiboot class
2014-03-06 22:36 ` Darren Hart
@ 2014-03-07 9:57 ` Stanacar, StefanX
2014-03-11 21:38 ` Darren Hart
0 siblings, 1 reply; 14+ messages in thread
From: Stanacar, StefanX @ 2014-03-07 9:57 UTC (permalink / raw)
To: dvhart@linux.intel.com
Cc: koen@dominion.thruhere.net,
openembedded-core@lists.openembedded.org
On Thu, 2014-03-06 at 14:36 -0800, Darren Hart wrote:
> On 3/6/14, 10:15, "Stefan Stanacar" <stefanx.stanacar@intel.com> wrote:
>
> >Adds a gummiboot class similar to grub-efi class and makes the necessary
> >changes so it can be used for live/hddimg images as well.
> >
> >One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot
> >instead of grub-efi.
> >Gummiboot requires some kernel options that are not enabled by default,
> >so one has to build
> >with KERNEL_FEATURES_append = " cfg/efi-ext".
>
> cfg/efi is insufficient?
>
cfg/efi doesn't have CONFIG_EFI_STUB=y which is required by gummiboot.
cfg/efi-ext adds more than that, it's true.
It's also a good idea to enable CONFIG_EFIVARS_FS, which is the
newer/better interface than CONFIG_EFI_VARS that cfg/efi-ext enables.
> >
> >The install scripts have been updated too, keeping the old behaviour
> >around,
> >but accounting for the new boot loader config files (if they exist).
> >It can be argued that the installer and bootimg are a bit wierd and not
> >necessarily correct,
> >but I wanted to have the exact same behviour with gummiboot.
> >With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing
> >should be just as before.
> >
> >I've tested live boot, install and normal boot on:
> > - FRI2
> > - genericx86-64 on NUC
> >with:
> > EFI_PROVIDER = "gummiboot"
> > KERNEL_FEATURES_append = " cfg/efi-ext"
> >in local.conf.
> >
> >Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
>
>
> Generally looks good. My only reservation is the same as for 2/3, should
> we define an EFI interface rather than having to construct function names
> in the consumers of this class?
I don't have a strong opinion here, it just seemed the simplest way atm,
then adding another interface.
Cheers,
Stefan
>
> --
> Darren
>
> >---
> > meta/classes/gummiboot.bbclass | 112
> >+++++++++++++++++++++
> > .../initrdscripts/files/init-install-efi.sh | 51 +++++++---
> > 2 files changed, 147 insertions(+), 16 deletions(-)
> > create mode 100644 meta/classes/gummiboot.bbclass
> >
> >diff --git a/meta/classes/gummiboot.bbclass
> >b/meta/classes/gummiboot.bbclass
> >new file mode 100644
> >index 0000000..5c11286
> >--- /dev/null
> >+++ b/meta/classes/gummiboot.bbclass
> >@@ -0,0 +1,112 @@
> >+EFICLASS_FUNC_PREFIX = "gummiboot"
> >+
> >+do_bootimg[depends] += "gummiboot:do_deploy"
> >+do_bootdirectdisk[depends] += "gummiboot:do_deploy"
> >+
> >+EFIDIR = "/EFI/BOOT"
> >+
> >+GUMMIBOOT_CFG ?= "${S}/loader.conf"
> >+GUMMIBOOT_ENTRIES ?= ""
> >+GUMMIBOOT_TIMEOUT ?= "10"
> >+
> >+gummiboot_populate() {
> >+ DEST=$1
> >+
> >+ EFI_IMAGE="gummibootia32.efi"
> >+ DEST_EFI_IMAGE="bootia32.efi"
> >+ if [ "${TARGET_ARCH}" = "x86_64" ]; then
> >+ EFI_IMAGE="gummibootx64.efi"
> >+ DEST_EFI_IMAGE="bootx64.efi"
> >+ fi
> >+
> >+ install -d ${DEST}${EFIDIR}
> >+ # gummiboot 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}
> >+ install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
> >+ for i in ${GUMMIBOOT_ENTRIES}; do
> >+ install -m 0644 ${i} ${DEST}/loader/entries
> >+ done
> >+}
> >+
> >+gummiboot_iso_populate() {
> >+ iso_dir=$1
> >+ gummiboot_populate $iso_dir
> >+ mkdir -p ${EFIIMGDIR}/${EFIDIR}
> >+ cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
> >+ cp $iso_dir/vmlinuz ${EFIIMGDIR}
> >+ echo "${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
> >+ if [ -f "$iso_dir/initrd" ] ; then
> >+ cp $iso_dir/initrd ${EFIIMGDIR}
> >+ fi
> >+}
> >+
> >+gummiboot_hddimg_populate() {
> >+ gummiboot_populate $1
> >+}
> >+
> >+python build_gummiboot_cfg() {
> >+ s = d.getVar("S", True)
> >+ labels = d.getVar('LABELS', True)
> >+ 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('GUMMIBOOT_CFG', True)
> >+ try:
> >+ cfgfile = open(cfile, 'w')
> >+ except OSError:
> >+ raise bb.build.funcFailed('Unable to open %s' % (cfile))
> >+
> >+ cfgfile.write('# Automatically created by OE\n')
> >+ cfgfile.write('default %s\n' % (labels.split()[0]))
> >+ timeout = d.getVar('GUMMIBOOT_TIMEOUT', True)
> >+ 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', True)
> >+ if not overrides:
> >+ raise bb.build.FuncFailed('OVERRIDES not defined')
> >+
> >+ entryfile = "%s/%s.conf" % (s, label)
> >+ d.appendVar("GUMMIBOOT_ENTRIES", " " + entryfile)
> >+ try:
> >+ entrycfg = open(entryfile, "w")
> >+ except OSError:
> >+ raise bb.build.funcFailed('Unable to open %s' % (entryfile))
> >+ localdata.setVar('OVERRIDES', label + ':' + overrides)
> >+ bb.data.update_data(localdata)
> >+
> >+ entrycfg.write('title %s\n' % label)
> >+ entrycfg.write('linux /vmlinuz\n')
> >+
> >+ append = localdata.getVar('APPEND', True)
> >+ initrd = localdata.getVar('INITRD', True)
> >+
> >+ if initrd:
> >+ entrycfg.write('initrd /initrd\n')
> >+ lb = label
> >+ if label == "install":
> >+ lb = "install-efi"
> >+ entrycfg.write('options LABEL=%s ' % lb)
> >+ if append:
> >+ entrycfg.write('%s' % append)
> >+ entrycfg.write('\n')
> >+ entrycfg.close()
> >+}
> >+
> >+python build_efi_cfg() {
> >+ bb.build.exec_func("build_gummiboot_cfg", d)
> >+}
> >diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >index 9846637..ed3221b 100644
> >--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >@@ -104,6 +104,7 @@ parted /dev/${device} mklabel gpt
> >
> > echo "Creating boot partition on $bootfs"
> > parted /dev/${device} mkpart primary 0% $boot_size
> >+parted /dev/${device} set 1 boot on
> >
> > echo "Creating rootfs partition on $rootfs"
> > parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
> >@@ -149,23 +150,41 @@ mount $bootfs /ssd
> >
> > EFIDIR="/ssd/EFI/BOOT"
> > mkdir -p $EFIDIR
> >-GRUBCFG="$EFIDIR/grub.cfg"
> >-
> > cp /media/$1/vmlinuz /ssd
> >-# Copy the efi loader and config (booti*.efi and grub.cfg)
> >-cp /media/$1/EFI/BOOT/* $EFIDIR
> >-
> >-# Update grub config for the installed image
> >-# Delete the install entry
> >-sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
> >-# Delete the initrd lines
> >-sed -i "/initrd /d" $GRUBCFG
> >-# Delete any LABEL= strings
> >-sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
> >-# Delete any root= strings
> >-sed -i "s/ root=[^ ]*/ /" $GRUBCFG
> >-# Add the root= and other standard boot options
> >-sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait
> >quiet @" $GRUBCFG
> >+# Copy the efi loader
> >+cp /media/$1/EFI/BOOT/*.efi $EFIDIR
> >+
> >+if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
> >+ GRUBCFG="$EFIDIR/grub.cfg"
> >+ cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
> >+ # Update grub config for the installed image
> >+ # Delete the install entry
> >+ sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
> >+ # Delete the initrd lines
> >+ sed -i "/initrd /d" $GRUBCFG
> >+ # Delete any LABEL= strings
> >+ sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
> >+ # Delete any root= strings
> >+ sed -i "s/ root=[^ ]*/ /" $GRUBCFG
> >+ # Add the root= and other standard boot options
> >+ sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait
> >quiet @" $GRUBCFG
> >+fi
> >+
> >+if [ -d /media/$1/loader ]; then
> >+ GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
> >+ # copy config files for gummiboot
> >+ cp -dr /media/$1/loader /ssd
> >+ # delete the install entry
> >+ rm -f /ssd/loader/entries/install.conf
> >+ # delete the initrd lines
> >+ sed -i "/initrd /d" $GUMMIBOOT_CFGS
> >+ # delete any LABEL= strings
> >+ sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
> >+ # delete any root= strings
> >+ sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
> >+ # add the root= and other standard boot options
> >+ sed -i "s@options *@options root=$rootfs rw $rootwait quiet @"
> >$GUMMIBOOT_CFGS
> >+fi
> >
> > umount /ssd
> > sync
> >--
> >1.8.5.3
> >
> >
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes
2014-03-06 18:15 ` [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes Stefan Stanacar
2014-03-06 22:27 ` Darren Hart
@ 2014-03-09 8:00 ` Saul Wold
2014-03-09 15:34 ` Stanacar, StefanX
1 sibling, 1 reply; 14+ messages in thread
From: Saul Wold @ 2014-03-09 8:00 UTC (permalink / raw)
To: Stefan Stanacar, openembedded-core; +Cc: dvhart
On 03/06/2014 10:15 AM, Stefan Stanacar wrote:
> gummiboot is is a simple UEFI boot manager (not a boot loader ;-) )
>
> These recipes are imported from meta-intel with these changes:
> - drop PR and update configure options
> - gummiboot was upgraded to latest version
>
> A couple of notes:
> - If you wish you can install the gummiboot package on the target and
> use 'gummiboot install' to add the payload to the ESP (see gummiboot --help,
> just make sure the ESP partition has the boot flag on as gummiboot won't accept it
> otherwise). However the point of this recipe is to be used by bootimg.bbclass and
> generate images with gummiboot instead of grub-efi.
> - You need a kernel which has CONFIG_EFI_STUB=y at least
> - The default linux-yocto kernel config does not enable that, easiest way
> to enable is to build with KERNEL_FEATURES_append = " cfg/efi-ext" in local.conf
>
> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
> ---
> .../gnu-efi/gnu-efi/parallel-make-archives.patch | 48 ++++++++++++++++++++++
> .../gnu-efi/gnu-efi/parallel-make.patch | 22 ++++++++++
> meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb | 33 +++++++++++++++
> meta/recipes-bsp/gummiboot/gummiboot_git.bb | 25 +++++++++++
> 4 files changed, 128 insertions(+)
> create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
> create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
> create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
> create mode 100644 meta/recipes-bsp/gummiboot/gummiboot_git.bb
>
> diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
> new file mode 100644
> index 0000000..e5b47c1
> --- /dev/null
> +++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
> @@ -0,0 +1,48 @@
> +Fix parallel make failure for archives
> +
> +Upstream-Status: Pending
> +
> +The lib and gnuefi makefiles were using the lib.a() form which compiles
> +and ar's as a pair instead of compiling all and then ar'ing which can
> +parallelize better. This was resulting in build failures on larger values
> +of -j.
> +
> +See http://www.chemie.fu-berlin.de/chemnet/use/info/make/make_toc.html#TOC105
> +for details.
> +
> +Signed-off-by: Saul Wold <sgw@linux.intel.com>
> +Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> +---
> +---
> + gnuefi/Makefile | 3 ++-
> + lib/Makefile | 3 ++-
> + 2 files changed, 4 insertions(+), 2 deletions(-)
> +
> +Index: gnu-efi-3.0/lib/Makefile
> +===================================================================
> +--- gnu-efi-3.0.orig/lib/Makefile
> ++++ gnu-efi-3.0/lib/Makefile
> +@@ -66,7 +66,8 @@ all: libsubdirs libefi.a
> + libsubdirs:
> + for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
> +
> +-libefi.a: $(patsubst %,libefi.a(%),$(OBJS))
> ++libefi.a: $(OBJS)
> ++ $(AR) rv $@ $(OBJS)
> +
> + clean:
> + rm -f libefi.a *~ $(OBJS) */*.o
> +Index: gnu-efi-3.0/gnuefi/Makefile
> +===================================================================
> +--- gnu-efi-3.0.orig/gnuefi/Makefile
> ++++ gnu-efi-3.0/gnuefi/Makefile
> +@@ -51,7 +51,8 @@ TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
> +
> + all: $(TARGETS)
> +
> +-libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS))
> ++libgnuefi.a: $(OBJS)
> ++ $(AR) rv $@ $(OBJS)
> +
> + clean:
> + rm -f $(TARGETS) *~ *.o $(OBJS)
> diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
> new file mode 100644
> index 0000000..27c94e8
> --- /dev/null
> +++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
> @@ -0,0 +1,22 @@
> +Fix parallel make failure
> +
> +Upstream-Status: Submitted [Maintainer directly]
> +
> +Add a missing dependency which resulted in a race leading to failure
> +on larger values of -j.
> +
> +Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> +
> +Index: gnu-efi-3.0/Makefile
> +===================================================================
> +--- gnu-efi-3.0.orig/Makefile
> ++++ gnu-efi-3.0/Makefile
> +@@ -42,6 +42,8 @@ include $(SRCDIR)/Make.defaults
> +
> + SUBDIRS = lib gnuefi inc apps
> +
> ++gnuefi: lib
> ++
> + all: check_gcc $(SUBDIRS)
> +
> + $(SUBDIRS):
> diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
> new file mode 100644
> index 0000000..0dbdba2
> --- /dev/null
> +++ b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
> @@ -0,0 +1,33 @@
> +SUMMARY = "Libraries for producing EFI binaries"
> +HOMEPAGE = "http://sourceforge.net/projects/gnu-efi/"
> +SECTION = "devel"
> +LICENSE = "GPLv2+"
> +LIC_FILES_CHKSUM = "file://debian/copyright;md5=5fb358a180f484b285b0d99acdc29666"
> +
> +SRC_URI = "http://downloads.sourceforge.net/gnu-efi/gnu-efi_3.0u.orig.tar.gz \
> + file://parallel-make.patch \
> + file://parallel-make-archives.patch \
> + "
> +SRC_URI[md5sum] = "d15d3c700e79a1e2938544d73edc572d"
> +SRC_URI[sha256sum] = "3c0d450d5829204ca05dcb3b2aae772e52c379b7c7e09146759c6315606f934e"
> +
> +COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
> +
> +S = "${WORKDIR}/gnu-efi-3.0"
> +
> +def gnu_efi_arch(d):
> + import re
> + tarch = d.getVar("TARGET_ARCH", True)
> + if re.match("i[3456789]86", tarch):
> + return "ia32"
> + return tarch
> +
> +EXTRA_OEMAKE = "'ARCH=${@gnu_efi_arch(d)}' 'CC=${CC}' 'AS=${AS}' 'LD=${LD}' 'AR=${AR}' \
> + 'RANLIB=${RANLIB}' 'OBJCOPY=${OBJCOPY}' 'PREFIX=${prefix}'\
> + "
> +
> +do_install() {
> + oe_runmake install INSTALLROOT="${D}"
> +}
> +
> +FILES_${PN} += "${libdir}/*.lds"
> diff --git a/meta/recipes-bsp/gummiboot/gummiboot_git.bb b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
> new file mode 100644
> index 0000000..b55064f
> --- /dev/null
> +++ b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
> @@ -0,0 +1,25 @@
> +SUMMARY = "Gummiboot is a simple UEFI boot manager which executes configured EFI images."
> +HOMEPAGE = "http://freedesktop.org/wiki/Software/gummiboot"
> +
> +LICENSE = "LGPLv2.1"
> +LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c"
> +
> +DEPENDS = "gnu-efi util-linux"
> +
> +inherit autotools
> +inherit deploy
> +
> +PV = "43+git${SRCPV}"
> +SRCREV = "4062c51075ba054d4949c714fe06123f9ad3097d"
> +SRC_URI = "git://anongit.freedesktop.org/gummiboot"
> +
> +S = "${WORKDIR}/git"
> +
> +EXTRA_OECONF = "--disable-manpages --with-efi-includedir=${STAGING_INCDIR} \
> + --with-efi-ldsdir=${STAGING_LIBDIR} \
> + --with-efi-libdir=${STAGING_LIBDIR}"
> +
> +do_deploy () {
> + install ${S}/gummiboot*.efi ${DEPLOYDIR}/
> +}
With the potential introduction of split source (S) and build (B)
directories, this should be ${B} not ${S}.
This should be 2 commit.
Sau!
> +addtask deploy before do_build after do_compile
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes
2014-03-09 8:00 ` Saul Wold
@ 2014-03-09 15:34 ` Stanacar, StefanX
0 siblings, 0 replies; 14+ messages in thread
From: Stanacar, StefanX @ 2014-03-09 15:34 UTC (permalink / raw)
To: sgw@linux.intel.com
Cc: dvhart@linux.intel.com, openembedded-core@lists.openembedded.org
On Sun, 2014-03-09 at 00:00 -0800, Saul Wold wrote:
> On 03/06/2014 10:15 AM, Stefan Stanacar wrote:
> > gummiboot is is a simple UEFI boot manager (not a boot loader ;-) )
> >
> > These recipes are imported from meta-intel with these changes:
> > - drop PR and update configure options
> > - gummiboot was upgraded to latest version
> >
> > A couple of notes:
> > - If you wish you can install the gummiboot package on the target and
> > use 'gummiboot install' to add the payload to the ESP (see gummiboot --help,
> > just make sure the ESP partition has the boot flag on as gummiboot won't accept it
> > otherwise). However the point of this recipe is to be used by bootimg.bbclass and
> > generate images with gummiboot instead of grub-efi.
> > - You need a kernel which has CONFIG_EFI_STUB=y at least
> > - The default linux-yocto kernel config does not enable that, easiest way
> > to enable is to build with KERNEL_FEATURES_append = " cfg/efi-ext" in local.conf
> >
> > Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
> > ---
> > .../gnu-efi/gnu-efi/parallel-make-archives.patch | 48 ++++++++++++++++++++++
> > .../gnu-efi/gnu-efi/parallel-make.patch | 22 ++++++++++
> > meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb | 33 +++++++++++++++
> > meta/recipes-bsp/gummiboot/gummiboot_git.bb | 25 +++++++++++
> > 4 files changed, 128 insertions(+)
> > create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
> > create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
> > create mode 100644 meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
> > create mode 100644 meta/recipes-bsp/gummiboot/gummiboot_git.bb
> >
> > diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
> > new file mode 100644
> > index 0000000..e5b47c1
> > --- /dev/null
> > +++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make-archives.patch
> > @@ -0,0 +1,48 @@
> > +Fix parallel make failure for archives
> > +
> > +Upstream-Status: Pending
> > +
> > +The lib and gnuefi makefiles were using the lib.a() form which compiles
> > +and ar's as a pair instead of compiling all and then ar'ing which can
> > +parallelize better. This was resulting in build failures on larger values
> > +of -j.
> > +
> > +See http://www.chemie.fu-berlin.de/chemnet/use/info/make/make_toc.html#TOC105
> > +for details.
> > +
> > +Signed-off-by: Saul Wold <sgw@linux.intel.com>
> > +Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> > +---
> > +---
> > + gnuefi/Makefile | 3 ++-
> > + lib/Makefile | 3 ++-
> > + 2 files changed, 4 insertions(+), 2 deletions(-)
> > +
> > +Index: gnu-efi-3.0/lib/Makefile
> > +===================================================================
> > +--- gnu-efi-3.0.orig/lib/Makefile
> > ++++ gnu-efi-3.0/lib/Makefile
> > +@@ -66,7 +66,8 @@ all: libsubdirs libefi.a
> > + libsubdirs:
> > + for sdir in $(SUBDIRS); do mkdir -p $$sdir; done
> > +
> > +-libefi.a: $(patsubst %,libefi.a(%),$(OBJS))
> > ++libefi.a: $(OBJS)
> > ++ $(AR) rv $@ $(OBJS)
> > +
> > + clean:
> > + rm -f libefi.a *~ $(OBJS) */*.o
> > +Index: gnu-efi-3.0/gnuefi/Makefile
> > +===================================================================
> > +--- gnu-efi-3.0.orig/gnuefi/Makefile
> > ++++ gnu-efi-3.0/gnuefi/Makefile
> > +@@ -51,7 +51,8 @@ TARGETS = crt0-efi-$(ARCH).o libgnuefi.a
> > +
> > + all: $(TARGETS)
> > +
> > +-libgnuefi.a: $(patsubst %,libgnuefi.a(%),$(OBJS))
> > ++libgnuefi.a: $(OBJS)
> > ++ $(AR) rv $@ $(OBJS)
> > +
> > + clean:
> > + rm -f $(TARGETS) *~ *.o $(OBJS)
> > diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
> > new file mode 100644
> > index 0000000..27c94e8
> > --- /dev/null
> > +++ b/meta/recipes-bsp/gnu-efi/gnu-efi/parallel-make.patch
> > @@ -0,0 +1,22 @@
> > +Fix parallel make failure
> > +
> > +Upstream-Status: Submitted [Maintainer directly]
> > +
> > +Add a missing dependency which resulted in a race leading to failure
> > +on larger values of -j.
> > +
> > +Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> > +
> > +Index: gnu-efi-3.0/Makefile
> > +===================================================================
> > +--- gnu-efi-3.0.orig/Makefile
> > ++++ gnu-efi-3.0/Makefile
> > +@@ -42,6 +42,8 @@ include $(SRCDIR)/Make.defaults
> > +
> > + SUBDIRS = lib gnuefi inc apps
> > +
> > ++gnuefi: lib
> > ++
> > + all: check_gcc $(SUBDIRS)
> > +
> > + $(SUBDIRS):
> > diff --git a/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
> > new file mode 100644
> > index 0000000..0dbdba2
> > --- /dev/null
> > +++ b/meta/recipes-bsp/gnu-efi/gnu-efi_3.0u.bb
> > @@ -0,0 +1,33 @@
> > +SUMMARY = "Libraries for producing EFI binaries"
> > +HOMEPAGE = "http://sourceforge.net/projects/gnu-efi/"
> > +SECTION = "devel"
> > +LICENSE = "GPLv2+"
> > +LIC_FILES_CHKSUM = "file://debian/copyright;md5=5fb358a180f484b285b0d99acdc29666"
> > +
> > +SRC_URI = "http://downloads.sourceforge.net/gnu-efi/gnu-efi_3.0u.orig.tar.gz \
> > + file://parallel-make.patch \
> > + file://parallel-make-archives.patch \
> > + "
> > +SRC_URI[md5sum] = "d15d3c700e79a1e2938544d73edc572d"
> > +SRC_URI[sha256sum] = "3c0d450d5829204ca05dcb3b2aae772e52c379b7c7e09146759c6315606f934e"
> > +
> > +COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux"
> > +
> > +S = "${WORKDIR}/gnu-efi-3.0"
> > +
> > +def gnu_efi_arch(d):
> > + import re
> > + tarch = d.getVar("TARGET_ARCH", True)
> > + if re.match("i[3456789]86", tarch):
> > + return "ia32"
> > + return tarch
> > +
> > +EXTRA_OEMAKE = "'ARCH=${@gnu_efi_arch(d)}' 'CC=${CC}' 'AS=${AS}' 'LD=${LD}' 'AR=${AR}' \
> > + 'RANLIB=${RANLIB}' 'OBJCOPY=${OBJCOPY}' 'PREFIX=${prefix}'\
> > + "
> > +
> > +do_install() {
> > + oe_runmake install INSTALLROOT="${D}"
> > +}
> > +
> > +FILES_${PN} += "${libdir}/*.lds"
> > diff --git a/meta/recipes-bsp/gummiboot/gummiboot_git.bb b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
> > new file mode 100644
> > index 0000000..b55064f
> > --- /dev/null
> > +++ b/meta/recipes-bsp/gummiboot/gummiboot_git.bb
> > @@ -0,0 +1,25 @@
> > +SUMMARY = "Gummiboot is a simple UEFI boot manager which executes configured EFI images."
> > +HOMEPAGE = "http://freedesktop.org/wiki/Software/gummiboot"
> > +
> > +LICENSE = "LGPLv2.1"
> > +LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c"
> > +
> > +DEPENDS = "gnu-efi util-linux"
> > +
> > +inherit autotools
> > +inherit deploy
> > +
> > +PV = "43+git${SRCPV}"
> > +SRCREV = "4062c51075ba054d4949c714fe06123f9ad3097d"
> > +SRC_URI = "git://anongit.freedesktop.org/gummiboot"
> > +
> > +S = "${WORKDIR}/git"
> > +
> > +EXTRA_OECONF = "--disable-manpages --with-efi-includedir=${STAGING_INCDIR} \
> > + --with-efi-ldsdir=${STAGING_LIBDIR} \
> > + --with-efi-libdir=${STAGING_LIBDIR}"
> > +
> > +do_deploy () {
> > + install ${S}/gummiboot*.efi ${DEPLOYDIR}/
> > +}
>
> With the potential introduction of split source (S) and build (B)
> directories, this should be ${B} not ${S}.
>
> This should be 2 commit.
Okay, v2 incoming soon with:
- change that to ${B} in deploy
- split this in two commits, one for each recipe
- change the function names in bootimg/grub-efi instead of using a
prefix, as Darren suggested.
Cheers,
Stefan
>
> Sau!
>
> > +addtask deploy before do_build after do_compile
> >
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] classes: Add gummiboot class
2014-03-07 9:57 ` Stanacar, StefanX
@ 2014-03-11 21:38 ` Darren Hart
2014-03-12 6:18 ` Koen Kooi
2014-03-12 9:39 ` Matt Fleming
0 siblings, 2 replies; 14+ messages in thread
From: Darren Hart @ 2014-03-11 21:38 UTC (permalink / raw)
To: Stanacar, StefanX
Cc: koen@dominion.thruhere.net,
openembedded-core@lists.openembedded.org
On 3/7/14, 1:57, "Stanacar, StefanX" <stefanx.stanacar@intel.com> wrote:
>
>
>
>On Thu, 2014-03-06 at 14:36 -0800, Darren Hart wrote:
>> On 3/6/14, 10:15, "Stefan Stanacar" <stefanx.stanacar@intel.com> wrote:
>>
>> >Adds a gummiboot class similar to grub-efi class and makes the
>>necessary
>> >changes so it can be used for live/hddimg images as well.
>> >
>> >One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot
>> >instead of grub-efi.
>> >Gummiboot requires some kernel options that are not enabled by default,
>> >so one has to build
>> >with KERNEL_FEATURES_append = " cfg/efi-ext".
>>
>> cfg/efi is insufficient?
>>
>
>cfg/efi doesn't have CONFIG_EFI_STUB=y which is required by gummiboot.
>cfg/efi-ext adds more than that, it's true.
Weird... Although the STUB should probably be in efi rather than efi-ext.
I'm surprised gummiboot requires STUB... Since STUB is there to allow the
kernel to be booted directly, no bootloader required. I guess gummiboot is
slightly less than a boot loader :-)
I'd Ack a patch to move STUB from efi-ext to efi.
>
>It's also a good idea to enable CONFIG_EFIVARS_FS, which is the
>newer/better interface than CONFIG_EFI_VARS that cfg/efi-ext enables.
Hrm... OK, perhaps time to revisit those fragments and update them for
current usage.
--
Darren
>> >
>> >The install scripts have been updated too, keeping the old behaviour
>> >around,
>> >but accounting for the new boot loader config files (if they exist).
>> >It can be argued that the installer and bootimg are a bit wierd and not
>> >necessarily correct,
>> >but I wanted to have the exact same behviour with gummiboot.
>> >With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing
>> >should be just as before.
>> >
>> >I've tested live boot, install and normal boot on:
>> > - FRI2
>> > - genericx86-64 on NUC
>> >with:
>> > EFI_PROVIDER = "gummiboot"
>> > KERNEL_FEATURES_append = " cfg/efi-ext"
>> >in local.conf.
>> >
>> >Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
>>
>>
>> Generally looks good. My only reservation is the same as for 2/3, should
>> we define an EFI interface rather than having to construct function
>>names
>> in the consumers of this class?
>
>I don't have a strong opinion here, it just seemed the simplest way atm,
>then adding another interface.
>
>Cheers,
>Stefan
>
>>
>> --
>> Darren
>>
>> >---
>> > meta/classes/gummiboot.bbclass | 112
>> >+++++++++++++++++++++
>> > .../initrdscripts/files/init-install-efi.sh | 51 +++++++---
>> > 2 files changed, 147 insertions(+), 16 deletions(-)
>> > create mode 100644 meta/classes/gummiboot.bbclass
>> >
>> >diff --git a/meta/classes/gummiboot.bbclass
>> >b/meta/classes/gummiboot.bbclass
>> >new file mode 100644
>> >index 0000000..5c11286
>> >--- /dev/null
>> >+++ b/meta/classes/gummiboot.bbclass
>> >@@ -0,0 +1,112 @@
>> >+EFICLASS_FUNC_PREFIX = "gummiboot"
>> >+
>> >+do_bootimg[depends] += "gummiboot:do_deploy"
>> >+do_bootdirectdisk[depends] += "gummiboot:do_deploy"
>> >+
>> >+EFIDIR = "/EFI/BOOT"
>> >+
>> >+GUMMIBOOT_CFG ?= "${S}/loader.conf"
>> >+GUMMIBOOT_ENTRIES ?= ""
>> >+GUMMIBOOT_TIMEOUT ?= "10"
>> >+
>> >+gummiboot_populate() {
>> >+ DEST=$1
>> >+
>> >+ EFI_IMAGE="gummibootia32.efi"
>> >+ DEST_EFI_IMAGE="bootia32.efi"
>> >+ if [ "${TARGET_ARCH}" = "x86_64" ]; then
>> >+ EFI_IMAGE="gummibootx64.efi"
>> >+ DEST_EFI_IMAGE="bootx64.efi"
>> >+ fi
>> >+
>> >+ install -d ${DEST}${EFIDIR}
>> >+ # gummiboot 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}
>> >+ install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
>> >+ for i in ${GUMMIBOOT_ENTRIES}; do
>> >+ install -m 0644 ${i} ${DEST}/loader/entries
>> >+ done
>> >+}
>> >+
>> >+gummiboot_iso_populate() {
>> >+ iso_dir=$1
>> >+ gummiboot_populate $iso_dir
>> >+ mkdir -p ${EFIIMGDIR}/${EFIDIR}
>> >+ cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
>> >+ cp $iso_dir/vmlinuz ${EFIIMGDIR}
>> >+ echo "${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
>> >+ if [ -f "$iso_dir/initrd" ] ; then
>> >+ cp $iso_dir/initrd ${EFIIMGDIR}
>> >+ fi
>> >+}
>> >+
>> >+gummiboot_hddimg_populate() {
>> >+ gummiboot_populate $1
>> >+}
>> >+
>> >+python build_gummiboot_cfg() {
>> >+ s = d.getVar("S", True)
>> >+ labels = d.getVar('LABELS', True)
>> >+ 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('GUMMIBOOT_CFG', True)
>> >+ try:
>> >+ cfgfile = open(cfile, 'w')
>> >+ except OSError:
>> >+ raise bb.build.funcFailed('Unable to open %s' % (cfile))
>> >+
>> >+ cfgfile.write('# Automatically created by OE\n')
>> >+ cfgfile.write('default %s\n' % (labels.split()[0]))
>> >+ timeout = d.getVar('GUMMIBOOT_TIMEOUT', True)
>> >+ 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', True)
>> >+ if not overrides:
>> >+ raise bb.build.FuncFailed('OVERRIDES not defined')
>> >+
>> >+ entryfile = "%s/%s.conf" % (s, label)
>> >+ d.appendVar("GUMMIBOOT_ENTRIES", " " + entryfile)
>> >+ try:
>> >+ entrycfg = open(entryfile, "w")
>> >+ except OSError:
>> >+ raise bb.build.funcFailed('Unable to open %s' %
>>(entryfile))
>> >+ localdata.setVar('OVERRIDES', label + ':' + overrides)
>> >+ bb.data.update_data(localdata)
>> >+
>> >+ entrycfg.write('title %s\n' % label)
>> >+ entrycfg.write('linux /vmlinuz\n')
>> >+
>> >+ append = localdata.getVar('APPEND', True)
>> >+ initrd = localdata.getVar('INITRD', True)
>> >+
>> >+ if initrd:
>> >+ entrycfg.write('initrd /initrd\n')
>> >+ lb = label
>> >+ if label == "install":
>> >+ lb = "install-efi"
>> >+ entrycfg.write('options LABEL=%s ' % lb)
>> >+ if append:
>> >+ entrycfg.write('%s' % append)
>> >+ entrycfg.write('\n')
>> >+ entrycfg.close()
>> >+}
>> >+
>> >+python build_efi_cfg() {
>> >+ bb.build.exec_func("build_gummiboot_cfg", d)
>> >+}
>> >diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>> >b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>> >index 9846637..ed3221b 100644
>> >--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>> >+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>> >@@ -104,6 +104,7 @@ parted /dev/${device} mklabel gpt
>> >
>> > echo "Creating boot partition on $bootfs"
>> > parted /dev/${device} mkpart primary 0% $boot_size
>> >+parted /dev/${device} set 1 boot on
>> >
>> > echo "Creating rootfs partition on $rootfs"
>> > parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
>> >@@ -149,23 +150,41 @@ mount $bootfs /ssd
>> >
>> > EFIDIR="/ssd/EFI/BOOT"
>> > mkdir -p $EFIDIR
>> >-GRUBCFG="$EFIDIR/grub.cfg"
>> >-
>> > cp /media/$1/vmlinuz /ssd
>> >-# Copy the efi loader and config (booti*.efi and grub.cfg)
>> >-cp /media/$1/EFI/BOOT/* $EFIDIR
>> >-
>> >-# Update grub config for the installed image
>> >-# Delete the install entry
>> >-sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
>> >-# Delete the initrd lines
>> >-sed -i "/initrd /d" $GRUBCFG
>> >-# Delete any LABEL= strings
>> >-sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
>> >-# Delete any root= strings
>> >-sed -i "s/ root=[^ ]*/ /" $GRUBCFG
>> >-# Add the root= and other standard boot options
>> >-sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait
>> >quiet @" $GRUBCFG
>> >+# Copy the efi loader
>> >+cp /media/$1/EFI/BOOT/*.efi $EFIDIR
>> >+
>> >+if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
>> >+ GRUBCFG="$EFIDIR/grub.cfg"
>> >+ cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
>> >+ # Update grub config for the installed image
>> >+ # Delete the install entry
>> >+ sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
>> >+ # Delete the initrd lines
>> >+ sed -i "/initrd /d" $GRUBCFG
>> >+ # Delete any LABEL= strings
>> >+ sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
>> >+ # Delete any root= strings
>> >+ sed -i "s/ root=[^ ]*/ /" $GRUBCFG
>> >+ # Add the root= and other standard boot options
>> >+ sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw
>>$rootwait
>> >quiet @" $GRUBCFG
>> >+fi
>> >+
>> >+if [ -d /media/$1/loader ]; then
>> >+ GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
>> >+ # copy config files for gummiboot
>> >+ cp -dr /media/$1/loader /ssd
>> >+ # delete the install entry
>> >+ rm -f /ssd/loader/entries/install.conf
>> >+ # delete the initrd lines
>> >+ sed -i "/initrd /d" $GUMMIBOOT_CFGS
>> >+ # delete any LABEL= strings
>> >+ sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
>> >+ # delete any root= strings
>> >+ sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
>> >+ # add the root= and other standard boot options
>> >+ sed -i "s@options *@options root=$rootfs rw $rootwait quiet @"
>> >$GUMMIBOOT_CFGS
>> >+fi
>> >
>> > umount /ssd
>> > sync
>> >--
>> >1.8.5.3
>> >
>> >
>>
>>
>
>
--
Darren Hart
Yocto Project - Linux Kernel
Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] classes: Add gummiboot class
2014-03-11 21:38 ` Darren Hart
@ 2014-03-12 6:18 ` Koen Kooi
2014-03-12 10:04 ` Stanacar, StefanX
2014-03-12 9:39 ` Matt Fleming
1 sibling, 1 reply; 14+ messages in thread
From: Koen Kooi @ 2014-03-12 6:18 UTC (permalink / raw)
To: Darren Hart; +Cc: openembedded-core@lists.openembedded.org
Op 11 mrt. 2014, om 22:38 heeft Darren Hart <dvhart@linux.intel.com> het volgende geschreven:
> On 3/7/14, 1:57, "Stanacar, StefanX" <stefanx.stanacar@intel.com> wrote:
>
>>
>>
>>
>> On Thu, 2014-03-06 at 14:36 -0800, Darren Hart wrote:
>>> On 3/6/14, 10:15, "Stefan Stanacar" <stefanx.stanacar@intel.com> wrote:
>>>
>>>> Adds a gummiboot class similar to grub-efi class and makes the
>>> necessary
>>>> changes so it can be used for live/hddimg images as well.
>>>>
>>>> One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot
>>>> instead of grub-efi.
>>>> Gummiboot requires some kernel options that are not enabled by default,
>>>> so one has to build
>>>> with KERNEL_FEATURES_append = " cfg/efi-ext".
>>>
>>> cfg/efi is insufficient?
>>>
>>
>> cfg/efi doesn't have CONFIG_EFI_STUB=y which is required by gummiboot.
>> cfg/efi-ext adds more than that, it's true.
>
> Weird... Although the STUB should probably be in efi rather than efi-ext.
> I'm surprised gummiboot requires STUB... Since STUB is there to allow the
> kernel to be booted directly, no bootloader required. I guess gummiboot is
> slightly less than a boot loader :-)
The gummiboot docs still claim to support both 'linux' and 'efi', so it's supposed to work.
regards,
Koen
>
> I'd Ack a patch to move STUB from efi-ext to efi.
>
>
>>
>> It's also a good idea to enable CONFIG_EFIVARS_FS, which is the
>> newer/better interface than CONFIG_EFI_VARS that cfg/efi-ext enables.
>
>
> Hrm... OK, perhaps time to revisit those fragments and update them for
> current usage.
>
>
> --
> Darren
>
>>>>
>>>> The install scripts have been updated too, keeping the old behaviour
>>>> around,
>>>> but accounting for the new boot loader config files (if they exist).
>>>> It can be argued that the installer and bootimg are a bit wierd and not
>>>> necessarily correct,
>>>> but I wanted to have the exact same behviour with gummiboot.
>>>> With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing
>>>> should be just as before.
>>>>
>>>> I've tested live boot, install and normal boot on:
>>>> - FRI2
>>>> - genericx86-64 on NUC
>>>> with:
>>>> EFI_PROVIDER = "gummiboot"
>>>> KERNEL_FEATURES_append = " cfg/efi-ext"
>>>> in local.conf.
>>>>
>>>> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
>>>
>>>
>>> Generally looks good. My only reservation is the same as for 2/3, should
>>> we define an EFI interface rather than having to construct function
>>> names
>>> in the consumers of this class?
>>
>> I don't have a strong opinion here, it just seemed the simplest way atm,
>> then adding another interface.
>>
>> Cheers,
>> Stefan
>>
>>>
>>> --
>>> Darren
>>>
>>>> ---
>>>> meta/classes/gummiboot.bbclass | 112
>>>> +++++++++++++++++++++
>>>> .../initrdscripts/files/init-install-efi.sh | 51 +++++++---
>>>> 2 files changed, 147 insertions(+), 16 deletions(-)
>>>> create mode 100644 meta/classes/gummiboot.bbclass
>>>>
>>>> diff --git a/meta/classes/gummiboot.bbclass
>>>> b/meta/classes/gummiboot.bbclass
>>>> new file mode 100644
>>>> index 0000000..5c11286
>>>> --- /dev/null
>>>> +++ b/meta/classes/gummiboot.bbclass
>>>> @@ -0,0 +1,112 @@
>>>> +EFICLASS_FUNC_PREFIX = "gummiboot"
>>>> +
>>>> +do_bootimg[depends] += "gummiboot:do_deploy"
>>>> +do_bootdirectdisk[depends] += "gummiboot:do_deploy"
>>>> +
>>>> +EFIDIR = "/EFI/BOOT"
>>>> +
>>>> +GUMMIBOOT_CFG ?= "${S}/loader.conf"
>>>> +GUMMIBOOT_ENTRIES ?= ""
>>>> +GUMMIBOOT_TIMEOUT ?= "10"
>>>> +
>>>> +gummiboot_populate() {
>>>> + DEST=$1
>>>> +
>>>> + EFI_IMAGE="gummibootia32.efi"
>>>> + DEST_EFI_IMAGE="bootia32.efi"
>>>> + if [ "${TARGET_ARCH}" = "x86_64" ]; then
>>>> + EFI_IMAGE="gummibootx64.efi"
>>>> + DEST_EFI_IMAGE="bootx64.efi"
>>>> + fi
>>>> +
>>>> + install -d ${DEST}${EFIDIR}
>>>> + # gummiboot 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}
>>>> + install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
>>>> + for i in ${GUMMIBOOT_ENTRIES}; do
>>>> + install -m 0644 ${i} ${DEST}/loader/entries
>>>> + done
>>>> +}
>>>> +
>>>> +gummiboot_iso_populate() {
>>>> + iso_dir=$1
>>>> + gummiboot_populate $iso_dir
>>>> + mkdir -p ${EFIIMGDIR}/${EFIDIR}
>>>> + cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
>>>> + cp $iso_dir/vmlinuz ${EFIIMGDIR}
>>>> + echo "${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
>>>> + if [ -f "$iso_dir/initrd" ] ; then
>>>> + cp $iso_dir/initrd ${EFIIMGDIR}
>>>> + fi
>>>> +}
>>>> +
>>>> +gummiboot_hddimg_populate() {
>>>> + gummiboot_populate $1
>>>> +}
>>>> +
>>>> +python build_gummiboot_cfg() {
>>>> + s = d.getVar("S", True)
>>>> + labels = d.getVar('LABELS', True)
>>>> + 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('GUMMIBOOT_CFG', True)
>>>> + try:
>>>> + cfgfile = open(cfile, 'w')
>>>> + except OSError:
>>>> + raise bb.build.funcFailed('Unable to open %s' % (cfile))
>>>> +
>>>> + cfgfile.write('# Automatically created by OE\n')
>>>> + cfgfile.write('default %s\n' % (labels.split()[0]))
>>>> + timeout = d.getVar('GUMMIBOOT_TIMEOUT', True)
>>>> + 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', True)
>>>> + if not overrides:
>>>> + raise bb.build.FuncFailed('OVERRIDES not defined')
>>>> +
>>>> + entryfile = "%s/%s.conf" % (s, label)
>>>> + d.appendVar("GUMMIBOOT_ENTRIES", " " + entryfile)
>>>> + try:
>>>> + entrycfg = open(entryfile, "w")
>>>> + except OSError:
>>>> + raise bb.build.funcFailed('Unable to open %s' %
>>> (entryfile))
>>>> + localdata.setVar('OVERRIDES', label + ':' + overrides)
>>>> + bb.data.update_data(localdata)
>>>> +
>>>> + entrycfg.write('title %s\n' % label)
>>>> + entrycfg.write('linux /vmlinuz\n')
>>>> +
>>>> + append = localdata.getVar('APPEND', True)
>>>> + initrd = localdata.getVar('INITRD', True)
>>>> +
>>>> + if initrd:
>>>> + entrycfg.write('initrd /initrd\n')
>>>> + lb = label
>>>> + if label == "install":
>>>> + lb = "install-efi"
>>>> + entrycfg.write('options LABEL=%s ' % lb)
>>>> + if append:
>>>> + entrycfg.write('%s' % append)
>>>> + entrycfg.write('\n')
>>>> + entrycfg.close()
>>>> +}
>>>> +
>>>> +python build_efi_cfg() {
>>>> + bb.build.exec_func("build_gummiboot_cfg", d)
>>>> +}
>>>> diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>>>> b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>>>> index 9846637..ed3221b 100644
>>>> --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>>>> +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
>>>> @@ -104,6 +104,7 @@ parted /dev/${device} mklabel gpt
>>>>
>>>> echo "Creating boot partition on $bootfs"
>>>> parted /dev/${device} mkpart primary 0% $boot_size
>>>> +parted /dev/${device} set 1 boot on
>>>>
>>>> echo "Creating rootfs partition on $rootfs"
>>>> parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
>>>> @@ -149,23 +150,41 @@ mount $bootfs /ssd
>>>>
>>>> EFIDIR="/ssd/EFI/BOOT"
>>>> mkdir -p $EFIDIR
>>>> -GRUBCFG="$EFIDIR/grub.cfg"
>>>> -
>>>> cp /media/$1/vmlinuz /ssd
>>>> -# Copy the efi loader and config (booti*.efi and grub.cfg)
>>>> -cp /media/$1/EFI/BOOT/* $EFIDIR
>>>> -
>>>> -# Update grub config for the installed image
>>>> -# Delete the install entry
>>>> -sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
>>>> -# Delete the initrd lines
>>>> -sed -i "/initrd /d" $GRUBCFG
>>>> -# Delete any LABEL= strings
>>>> -sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
>>>> -# Delete any root= strings
>>>> -sed -i "s/ root=[^ ]*/ /" $GRUBCFG
>>>> -# Add the root= and other standard boot options
>>>> -sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait
>>>> quiet @" $GRUBCFG
>>>> +# Copy the efi loader
>>>> +cp /media/$1/EFI/BOOT/*.efi $EFIDIR
>>>> +
>>>> +if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
>>>> + GRUBCFG="$EFIDIR/grub.cfg"
>>>> + cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
>>>> + # Update grub config for the installed image
>>>> + # Delete the install entry
>>>> + sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
>>>> + # Delete the initrd lines
>>>> + sed -i "/initrd /d" $GRUBCFG
>>>> + # Delete any LABEL= strings
>>>> + sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
>>>> + # Delete any root= strings
>>>> + sed -i "s/ root=[^ ]*/ /" $GRUBCFG
>>>> + # Add the root= and other standard boot options
>>>> + sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw
>>> $rootwait
>>>> quiet @" $GRUBCFG
>>>> +fi
>>>> +
>>>> +if [ -d /media/$1/loader ]; then
>>>> + GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
>>>> + # copy config files for gummiboot
>>>> + cp -dr /media/$1/loader /ssd
>>>> + # delete the install entry
>>>> + rm -f /ssd/loader/entries/install.conf
>>>> + # delete the initrd lines
>>>> + sed -i "/initrd /d" $GUMMIBOOT_CFGS
>>>> + # delete any LABEL= strings
>>>> + sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
>>>> + # delete any root= strings
>>>> + sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
>>>> + # add the root= and other standard boot options
>>>> + sed -i "s@options *@options root=$rootfs rw $rootwait quiet @"
>>>> $GUMMIBOOT_CFGS
>>>> +fi
>>>>
>>>> umount /ssd
>>>> sync
>>>> --
>>>> 1.8.5.3
>>>>
>>>>
>>>
>>>
>>
>>
>
>
> --
> Darren Hart
> Yocto Project - Linux Kernel
> Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] classes: Add gummiboot class
2014-03-11 21:38 ` Darren Hart
2014-03-12 6:18 ` Koen Kooi
@ 2014-03-12 9:39 ` Matt Fleming
1 sibling, 0 replies; 14+ messages in thread
From: Matt Fleming @ 2014-03-12 9:39 UTC (permalink / raw)
To: Darren Hart
Cc: koen@dominion.thruhere.net,
openembedded-core@lists.openembedded.org
On Tue, 11 Mar, at 01:38:08PM, Darren Hart wrote:
>
> I'm surprised gummiboot requires STUB... Since STUB is there to allow the
> kernel to be booted directly, no bootloader required. I guess gummiboot is
> slightly less than a boot loader :-)
Gummiboot is an EFI application loader.
Since CONFIG_EFI_STUB sticks a PE/COFF header at the front of the
bzImage, it appears as an EFI application which gummiboot knows how to
load and run. This is also the reason you can execute the bzImage from
the EFI shell (or Boot Manager).
--
Matt Fleming, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 3/3] classes: Add gummiboot class
2014-03-12 6:18 ` Koen Kooi
@ 2014-03-12 10:04 ` Stanacar, StefanX
0 siblings, 0 replies; 14+ messages in thread
From: Stanacar, StefanX @ 2014-03-12 10:04 UTC (permalink / raw)
To: koen@dominion.thruhere.net
Cc: dvhart@linux.intel.com, openembedded-core@lists.openembedded.org
On Wed, 2014-03-12 at 07:18 +0100, Koen Kooi wrote:
> Op 11 mrt. 2014, om 22:38 heeft Darren Hart <dvhart@linux.intel.com> het volgende geschreven:
>
> > On 3/7/14, 1:57, "Stanacar, StefanX" <stefanx.stanacar@intel.com> wrote:
> >
> >>
> >>
> >>
> >> On Thu, 2014-03-06 at 14:36 -0800, Darren Hart wrote:
> >>> On 3/6/14, 10:15, "Stefan Stanacar" <stefanx.stanacar@intel.com> wrote:
> >>>
> >>>> Adds a gummiboot class similar to grub-efi class and makes the
> >>> necessary
> >>>> changes so it can be used for live/hddimg images as well.
> >>>>
> >>>> One can set EFI_PROVIDER = "gummiboot" in local.conf to use gummiboot
> >>>> instead of grub-efi.
> >>>> Gummiboot requires some kernel options that are not enabled by default,
> >>>> so one has to build
> >>>> with KERNEL_FEATURES_append = " cfg/efi-ext".
> >>>
> >>> cfg/efi is insufficient?
> >>>
> >>
> >> cfg/efi doesn't have CONFIG_EFI_STUB=y which is required by gummiboot.
> >> cfg/efi-ext adds more than that, it's true.
> >
> > Weird... Although the STUB should probably be in efi rather than efi-ext.
> > I'm surprised gummiboot requires STUB... Since STUB is there to allow the
> > kernel to be booted directly, no bootloader required. I guess gummiboot is
> > slightly less than a boot loader :-)
>
> The gummiboot docs still claim to support both 'linux' and 'efi', so it's supposed to work.
The site claims that Linux kernels need to be built with
CONFIG_EFI_STUB, and without that for me it wouldn't boot.
What you're saying is for the config file
From the site:
efi executable EFI image
options options to pass to the EFI image / kernel command line
linux linux kernel image (gummiboot still requires the kernel to have an
EFI stub)
initrd initramfs image (gummiboot just adds this as option initrd=)
Cheers,
Stefan
>
> regards,
>
> Koen
>
> >
> > I'd Ack a patch to move STUB from efi-ext to efi.
> >
> >
> >>
> >> It's also a good idea to enable CONFIG_EFIVARS_FS, which is the
> >> newer/better interface than CONFIG_EFI_VARS that cfg/efi-ext enables.
> >
> >
> > Hrm... OK, perhaps time to revisit those fragments and update them for
> > current usage.
> >
> >
> > --
> > Darren
> >
> >>>>
> >>>> The install scripts have been updated too, keeping the old behaviour
> >>>> around,
> >>>> but accounting for the new boot loader config files (if they exist).
> >>>> It can be argued that the installer and bootimg are a bit wierd and not
> >>>> necessarily correct,
> >>>> but I wanted to have the exact same behviour with gummiboot.
> >>>> With the default EFI_PROVIDER = "grub-efi" nothing changes, everthing
> >>>> should be just as before.
> >>>>
> >>>> I've tested live boot, install and normal boot on:
> >>>> - FRI2
> >>>> - genericx86-64 on NUC
> >>>> with:
> >>>> EFI_PROVIDER = "gummiboot"
> >>>> KERNEL_FEATURES_append = " cfg/efi-ext"
> >>>> in local.conf.
> >>>>
> >>>> Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
> >>>
> >>>
> >>> Generally looks good. My only reservation is the same as for 2/3, should
> >>> we define an EFI interface rather than having to construct function
> >>> names
> >>> in the consumers of this class?
> >>
> >> I don't have a strong opinion here, it just seemed the simplest way atm,
> >> then adding another interface.
> >>
> >> Cheers,
> >> Stefan
> >>
> >>>
> >>> --
> >>> Darren
> >>>
> >>>> ---
> >>>> meta/classes/gummiboot.bbclass | 112
> >>>> +++++++++++++++++++++
> >>>> .../initrdscripts/files/init-install-efi.sh | 51 +++++++---
> >>>> 2 files changed, 147 insertions(+), 16 deletions(-)
> >>>> create mode 100644 meta/classes/gummiboot.bbclass
> >>>>
> >>>> diff --git a/meta/classes/gummiboot.bbclass
> >>>> b/meta/classes/gummiboot.bbclass
> >>>> new file mode 100644
> >>>> index 0000000..5c11286
> >>>> --- /dev/null
> >>>> +++ b/meta/classes/gummiboot.bbclass
> >>>> @@ -0,0 +1,112 @@
> >>>> +EFICLASS_FUNC_PREFIX = "gummiboot"
> >>>> +
> >>>> +do_bootimg[depends] += "gummiboot:do_deploy"
> >>>> +do_bootdirectdisk[depends] += "gummiboot:do_deploy"
> >>>> +
> >>>> +EFIDIR = "/EFI/BOOT"
> >>>> +
> >>>> +GUMMIBOOT_CFG ?= "${S}/loader.conf"
> >>>> +GUMMIBOOT_ENTRIES ?= ""
> >>>> +GUMMIBOOT_TIMEOUT ?= "10"
> >>>> +
> >>>> +gummiboot_populate() {
> >>>> + DEST=$1
> >>>> +
> >>>> + EFI_IMAGE="gummibootia32.efi"
> >>>> + DEST_EFI_IMAGE="bootia32.efi"
> >>>> + if [ "${TARGET_ARCH}" = "x86_64" ]; then
> >>>> + EFI_IMAGE="gummibootx64.efi"
> >>>> + DEST_EFI_IMAGE="bootx64.efi"
> >>>> + fi
> >>>> +
> >>>> + install -d ${DEST}${EFIDIR}
> >>>> + # gummiboot 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}
> >>>> + install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
> >>>> + for i in ${GUMMIBOOT_ENTRIES}; do
> >>>> + install -m 0644 ${i} ${DEST}/loader/entries
> >>>> + done
> >>>> +}
> >>>> +
> >>>> +gummiboot_iso_populate() {
> >>>> + iso_dir=$1
> >>>> + gummiboot_populate $iso_dir
> >>>> + mkdir -p ${EFIIMGDIR}/${EFIDIR}
> >>>> + cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
> >>>> + cp $iso_dir/vmlinuz ${EFIIMGDIR}
> >>>> + echo "${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
> >>>> + if [ -f "$iso_dir/initrd" ] ; then
> >>>> + cp $iso_dir/initrd ${EFIIMGDIR}
> >>>> + fi
> >>>> +}
> >>>> +
> >>>> +gummiboot_hddimg_populate() {
> >>>> + gummiboot_populate $1
> >>>> +}
> >>>> +
> >>>> +python build_gummiboot_cfg() {
> >>>> + s = d.getVar("S", True)
> >>>> + labels = d.getVar('LABELS', True)
> >>>> + 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('GUMMIBOOT_CFG', True)
> >>>> + try:
> >>>> + cfgfile = open(cfile, 'w')
> >>>> + except OSError:
> >>>> + raise bb.build.funcFailed('Unable to open %s' % (cfile))
> >>>> +
> >>>> + cfgfile.write('# Automatically created by OE\n')
> >>>> + cfgfile.write('default %s\n' % (labels.split()[0]))
> >>>> + timeout = d.getVar('GUMMIBOOT_TIMEOUT', True)
> >>>> + 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', True)
> >>>> + if not overrides:
> >>>> + raise bb.build.FuncFailed('OVERRIDES not defined')
> >>>> +
> >>>> + entryfile = "%s/%s.conf" % (s, label)
> >>>> + d.appendVar("GUMMIBOOT_ENTRIES", " " + entryfile)
> >>>> + try:
> >>>> + entrycfg = open(entryfile, "w")
> >>>> + except OSError:
> >>>> + raise bb.build.funcFailed('Unable to open %s' %
> >>> (entryfile))
> >>>> + localdata.setVar('OVERRIDES', label + ':' + overrides)
> >>>> + bb.data.update_data(localdata)
> >>>> +
> >>>> + entrycfg.write('title %s\n' % label)
> >>>> + entrycfg.write('linux /vmlinuz\n')
> >>>> +
> >>>> + append = localdata.getVar('APPEND', True)
> >>>> + initrd = localdata.getVar('INITRD', True)
> >>>> +
> >>>> + if initrd:
> >>>> + entrycfg.write('initrd /initrd\n')
> >>>> + lb = label
> >>>> + if label == "install":
> >>>> + lb = "install-efi"
> >>>> + entrycfg.write('options LABEL=%s ' % lb)
> >>>> + if append:
> >>>> + entrycfg.write('%s' % append)
> >>>> + entrycfg.write('\n')
> >>>> + entrycfg.close()
> >>>> +}
> >>>> +
> >>>> +python build_efi_cfg() {
> >>>> + bb.build.exec_func("build_gummiboot_cfg", d)
> >>>> +}
> >>>> diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >>>> b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >>>> index 9846637..ed3221b 100644
> >>>> --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >>>> +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> >>>> @@ -104,6 +104,7 @@ parted /dev/${device} mklabel gpt
> >>>>
> >>>> echo "Creating boot partition on $bootfs"
> >>>> parted /dev/${device} mkpart primary 0% $boot_size
> >>>> +parted /dev/${device} set 1 boot on
> >>>>
> >>>> echo "Creating rootfs partition on $rootfs"
> >>>> parted /dev/${device} mkpart primary $rootfs_start $rootfs_end
> >>>> @@ -149,23 +150,41 @@ mount $bootfs /ssd
> >>>>
> >>>> EFIDIR="/ssd/EFI/BOOT"
> >>>> mkdir -p $EFIDIR
> >>>> -GRUBCFG="$EFIDIR/grub.cfg"
> >>>> -
> >>>> cp /media/$1/vmlinuz /ssd
> >>>> -# Copy the efi loader and config (booti*.efi and grub.cfg)
> >>>> -cp /media/$1/EFI/BOOT/* $EFIDIR
> >>>> -
> >>>> -# Update grub config for the installed image
> >>>> -# Delete the install entry
> >>>> -sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
> >>>> -# Delete the initrd lines
> >>>> -sed -i "/initrd /d" $GRUBCFG
> >>>> -# Delete any LABEL= strings
> >>>> -sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
> >>>> -# Delete any root= strings
> >>>> -sed -i "s/ root=[^ ]*/ /" $GRUBCFG
> >>>> -# Add the root= and other standard boot options
> >>>> -sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw $rootwait
> >>>> quiet @" $GRUBCFG
> >>>> +# Copy the efi loader
> >>>> +cp /media/$1/EFI/BOOT/*.efi $EFIDIR
> >>>> +
> >>>> +if [ -f /media/$1/EFI/BOOT/grub.cfg ]; then
> >>>> + GRUBCFG="$EFIDIR/grub.cfg"
> >>>> + cp /media/$1/EFI/BOOT/grub.cfg $GRUBCFG
> >>>> + # Update grub config for the installed image
> >>>> + # Delete the install entry
> >>>> + sed -i "/menuentry 'install'/,/^}/d" $GRUBCFG
> >>>> + # Delete the initrd lines
> >>>> + sed -i "/initrd /d" $GRUBCFG
> >>>> + # Delete any LABEL= strings
> >>>> + sed -i "s/ LABEL=[^ ]*/ /" $GRUBCFG
> >>>> + # Delete any root= strings
> >>>> + sed -i "s/ root=[^ ]*/ /" $GRUBCFG
> >>>> + # Add the root= and other standard boot options
> >>>> + sed -i "s@linux /vmlinuz *@linux /vmlinuz root=$rootfs rw
> >>> $rootwait
> >>>> quiet @" $GRUBCFG
> >>>> +fi
> >>>> +
> >>>> +if [ -d /media/$1/loader ]; then
> >>>> + GUMMIBOOT_CFGS="/ssd/loader/entries/*.conf"
> >>>> + # copy config files for gummiboot
> >>>> + cp -dr /media/$1/loader /ssd
> >>>> + # delete the install entry
> >>>> + rm -f /ssd/loader/entries/install.conf
> >>>> + # delete the initrd lines
> >>>> + sed -i "/initrd /d" $GUMMIBOOT_CFGS
> >>>> + # delete any LABEL= strings
> >>>> + sed -i "s/ LABEL=[^ ]*/ /" $GUMMIBOOT_CFGS
> >>>> + # delete any root= strings
> >>>> + sed -i "s/ root=[^ ]*/ /" $GUMMIBOOT_CFGS
> >>>> + # add the root= and other standard boot options
> >>>> + sed -i "s@options *@options root=$rootfs rw $rootwait quiet @"
> >>>> $GUMMIBOOT_CFGS
> >>>> +fi
> >>>>
> >>>> umount /ssd
> >>>> sync
> >>>> --
> >>>> 1.8.5.3
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
> > --
> > Darren Hart
> > Yocto Project - Linux Kernel
> > Intel Open Source Technology Center
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2014-03-12 10:05 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06 18:15 [PATCH 0/3] Add gummiboot boot manager alongside grub-efi Stefan Stanacar
2014-03-06 18:15 ` [PATCH 1/3] recipes-bsp: Add gummiboot and gnu-efi recipes Stefan Stanacar
2014-03-06 22:27 ` Darren Hart
2014-03-09 8:00 ` Saul Wold
2014-03-09 15:34 ` Stanacar, StefanX
2014-03-06 18:15 ` [PATCH 2/3] bootimg/grub-efi.bbclass: allow using a different class for EFI images Stefan Stanacar
2014-03-06 22:31 ` Darren Hart
2014-03-06 18:15 ` [PATCH 3/3] classes: Add gummiboot class Stefan Stanacar
2014-03-06 22:36 ` Darren Hart
2014-03-07 9:57 ` Stanacar, StefanX
2014-03-11 21:38 ` Darren Hart
2014-03-12 6:18 ` Koen Kooi
2014-03-12 10:04 ` Stanacar, StefanX
2014-03-12 9:39 ` Matt Fleming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox