Skip to contentSkip to conversation

Deploy startup.nsh for wic's bootimg-efi plugin

PATCH In review Christopher Larson 3 participants 7 messages May 25, 2016 – May 30, 2016

lore
Share & tools
lore
#0 lore raw

cover Deploy startup.nsh for wic's bootimg-efi plugin

From: Christopher Larson <[email protected]>

Currently, wic EFI images don't end up with startup.nsh, so the user has to type in the correct bits into the EFI command-line, which isn't very user-friendly. mkefidisk.sh in oe-core writes it for us, but we don't get it for wic images.

Alter grub-efi.bbclass and gummiboot.bbclass to write it for the non-iso case, not only iso, so wic can grab and use it, and alter wic's bootimg-efi plugin to do so.

The following changes since commit bb4ead9b7b1400c37a72d148d9775bdf4210ec37:

linux-yocto/4.4: integrate v4.4.11 (2016-05-25 07:49:55 +0100)

are available in the git repository at:

git://github.com/kergoth/openembedded-core yocto-9556
https://github.com/kergoth/openembedded-core/tree/yocto-9556

Christopher Larson (3):
grub-efi.bbclass: also write startup.nsh for non-iso gummiboot.bbclass: also write startup.nsh for non-iso
wic: bootimg-efi: include startup.nsh if it's available

 meta/classes/grub-efi.bbclass                 | 2 ++
 meta/classes/gummiboot.bbclass                | 2 ++
 scripts/lib/wic/plugins/source/bootimg-efi.py | 5 +++++
 3 files changed, 9 insertions(+)
Signature · 1 line
2.8.0
#1 lore raw

PATCH 1/3 grub-efi.bbclass: also write startup.nsh for non-iso

From: Christopher Larson <[email protected]>

wic will be needing this for its bootimg-efi plugin.

[YOCTO #9556]

---
 meta/classes/grub-efi.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/grub-efi.bbclass +2 -0
index d0ae6c9..b8c20dd 100644
@@ -45,6 +45,8 @@ efi_populate() {
 		GRUB_IMAGE="bootx64.efi"
 	fi
 	install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}
+	EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
+	printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" >${DEST}/startup.nsh
 
 	install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
 }
Signature · 1 line
2.8.0
#2 lore raw

PATCH 2/3 gummiboot.bbclass: also write startup.nsh for non-iso

From: Christopher Larson <[email protected]>

wic will be needing this for its bootimg-efi plugin.

[YOCTO #9556]

---
 meta/classes/gummiboot.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/gummiboot.bbclass +2 -0
index 1ebb946..14fa4cf 100644
@@ -34,6 +34,8 @@ efi_populate() {
         install -d ${DEST}/loader
         install -d ${DEST}/loader/entries
         install -m 0644 ${DEPLOY_DIR_IMAGE}/${EFI_IMAGE} ${DEST}${EFIDIR}/${DEST_EFI_IMAGE}
+        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
+        printf 'fs0:%s\%s\n' "$EFIPATH" "$DEST_EFI_IMAGE" >${DEST}/startup.nsh
         install -m 0644 ${GUMMIBOOT_CFG} ${DEST}/loader/loader.conf
         for i in ${GUMMIBOOT_ENTRIES}; do
             install -m 0644 ${i} ${DEST}/loader/entries
Signature · 1 line
2.8.0
#3 lore raw

PATCH 3/3 wic: bootimg-efi: include startup.nsh if it's available

In reply to Christopher Larson

From: Christopher Larson <[email protected]>

We want the system to boot on its own, rather than the user having to manually input the correct file at the EFI prompt.

[YOCTO #9556]

---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 5 +++++
 1 file changed, 5 insertions(+)
scripts/lib/wic/plugins/source/bootimg-efi.py +5 -0
index a4734c9..ec13f6d 100644
@@ -197,6 +197,11 @@ class BootimgEFIPlugin(SourcePlugin):
         except KeyError:
             msger.error("bootimg-efi requires a loader, none specified")
 
+        startup = os.path.join(bootimg_dir, "startup.nsh")
+        if os.path.exists(startup):
+            cp_cmd = "cp %s %s/" % (startup, hdddir)
+            exec_cmd(cp_cmd, True)
+
         du_cmd = "du -bks %s" % hdddir
         out = exec_cmd(du_cmd)
         blocks = int(out.split()[0])
Signature · 1 line
2.8.0
#4 lore raw
In reply to Christopher Larson
Quoted 8 lines · Christopher Larson

From: Christopher Larson <[email protected]>

Currently, wic EFI images don't end up with startup.nsh, so the user has to type in the correct bits into the EFI command-line, which isn't very user-friendly. mkefidisk.sh in oe-core writes it for us, but we don't get it
for wic images.

Quoted 5 lines

Alter grub-efi.bbclass and gummiboot.bbclass to write it for the non-iso case,
not only iso, so wic can grab and use it, and alter wic's bootimg-efi plugin to
do so.

I tested this with success on the MinnowMax board, but that's the only EFI device I have to test it on, so would appreciate testing from others on this, if possible.

Signature · 5 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#5 lore raw

On Wed, May 25, 2016 at 1:33 PM, Christopher Larson <[email protected]

Quoted 21 lines

wrote:

Quoted 9 lines · Christopher Larson

From: Christopher Larson <[email protected]>

Currently, wic EFI images don't end up with startup.nsh, so the user has to
type in the correct bits into the EFI command-line, which isn't very user-friendly. mkefidisk.sh in oe-core writes it for us, but we don't get it
for wic images.

Quoted 5 lines

Alter grub-efi.bbclass and gummiboot.bbclass to write it for the non-iso case,
not only iso, so wic can grab and use it, and alter wic's bootimg-efi plugin to
do so.

Quoted 4 lines

I tested this with success on the MinnowMax board, but that's the only EFI device I have to test it on, so would appreciate testing from others on this, if possible.

I do think a better approach than this would be to make bootimg-efi directly pull from DEPLOY_DIR_IMAGE rather than HDDDIR, since it duplicates the bootloader config writing logic anyway, rather than using some but not all the artifacts from image-live / HDDDIR. Either that, or it should stop writing the bootloader config and rely entirely on the bbclass to set it up. Currently it's partially one and partially the other, which isn't ideal, in my opinion.

That said, I think this patch series is worthwhile for now, and we can improve bootimg-efi further from there.

Signature · 5 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#6 lore raw
In reply to Christopher Larson
Quoted 25 lines · Christopher Larson

From: Christopher Larson <[email protected]>

Currently, wic EFI images don't end up with startup.nsh, so the user has to type in the correct bits into the EFI command-line, which isn't very user-friendly. mkefidisk.sh in oe-core writes it for us, but we don't get it for wic images.

Alter grub-efi.bbclass and gummiboot.bbclass to write it for the non-iso case, not only iso, so wic can grab and use it, and alter wic's bootimg-efi plugin to do so.

The following changes since commit bb4ead9b7b1400c37a72d148d9775bdf4210ec37:

linux-yocto/4.4: integrate v4.4.11 (2016-05-25 07:49:55 +0100)

are available in the git repository at:

git://github.com/kergoth/openembedded-core yocto-9556
https://github.com/kergoth/openembedded-core/tree/yocto-9556

Christopher Larson (3):
grub-efi.bbclass: also write startup.nsh for non-iso gummiboot.bbclass: also write startup.nsh for non-iso
wic: bootimg-efi: include startup.nsh if it's available

Quoted 5 lines
 meta/classes/grub-efi.bbclass                 | 2 ++
 meta/classes/gummiboot.bbclass                | 2 ++
 scripts/lib/wic/plugins/source/bootimg-efi.py | 5 +++++
 3 files changed, 9 insertions(+)

+1
The patchset looks good to me.

--
Regards,
Ed