Skip to contentSkip to conversation

meta: classes-recipe: uki: Make initramfs optional

PATCH In review Leonard Anderweit 2 participants 3 messages Apr 16, 2025 – Apr 24, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meta: classes-recipe: uki: Make initramfs optional

Make it possible to build an uki without initramfs. The initramfs is now optional and will only be included if INITRAMFS_IMAGE is set.

Additionally, remove do_image_complete dependency on INITRAMFS_IMAGE:do_image_complete since do_uki already depends on that and is executed first.

---
 meta/classes-recipe/uki.bbclass | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meta/classes-recipe/uki.bbclass +3 -4
index d9a7fb0e6fe0..4db5f614b96f 100644
@@ -75,8 +75,6 @@ INITRAMFS_IMAGE ?= "core-image-minimal-initramfs"
 
 INITRD_ARCHIVE ?= "${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES}"
 
-do_image_complete[depends] += "${INITRAMFS_IMAGE}:do_image_complete"
-
 UKIFY_CMD ?= "ukify build"
 UKI_CONFIG_FILE ?= "${UNPACKDIR}/uki.conf"
 UKI_FILENAME ?= "uki.efi"
@@ -127,8 +125,9 @@ python do_uki() {
     ukify_cmd += " --stub %s" % (stub)
 
     # initrd
-    initramfs_image = "%s" % (d.getVar('INITRD_ARCHIVE'))
-    ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image, initramfs_image))
+    if d.getVar('INITRAMFS_IMAGE'):
+        initramfs_image = "%s" % (d.getVar('INITRD_ARCHIVE'))
+        ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image, initramfs_image))
 
     # kernel
     kernel_filename = d.getVar('UKI_KERNEL_FILENAME') or None

---
base-commit: 183e043de423fd3f7833366ca524a6f7d17e6d14
change-id: 20250416-master-5da9e74b8fc2

Best regards,

Signature · 1 line
Leonard Anderweit <[email protected]>
#1 lore raw

Hi,

Quoted 2 lines · Leonard Anderweit via lists.openembedded.org

Make it possible to build an uki without initramfs. The initramfs is now optional and will only be included if INITRAMFS_IMAGE is set.

I had considered this but decided not since to me UKI without initrd isn't very useful compared to booting just a kernel EFI binary directly.

Can you disclose your usecase a bit more?

Quoted 3 lines

Additionally, remove do_image_complete dependency on INITRAMFS_IMAGE:do_image_complete since do_uki already depends on that and is executed first.

I remember hitting race conditions without this, but you may be right.

Cheers,

-Mikko

Quoted 49 lines
---
 meta/classes-recipe/uki.bbclass | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
meta/classes-recipe/uki.bbclass +3 -5
index d9a7fb0e6fe0..4db5f614b96f 100644
@@ -75,8 +75,6 @@ INITRAMFS_IMAGE ?= "core-image-minimal-initramfs"
 
 INITRD_ARCHIVE ?= "${INITRAMFS_IMAGE}-${MACHINE}.${INITRAMFS_FSTYPES}"
 
-do_image_complete[depends] += "${INITRAMFS_IMAGE}:do_image_complete"
-
 UKIFY_CMD ?= "ukify build"
 UKI_CONFIG_FILE ?= "${UNPACKDIR}/uki.conf"
 UKI_FILENAME ?= "uki.efi"
@@ -127,8 +125,9 @@ python do_uki() {
     ukify_cmd += " --stub %s" % (stub)
 
     # initrd
-    initramfs_image = "%s" % (d.getVar('INITRD_ARCHIVE'))
-    ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image, initramfs_image))
+    if d.getVar('INITRAMFS_IMAGE'):
+        initramfs_image = "%s" % (d.getVar('INITRD_ARCHIVE'))
+        ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image, initramfs_image))
 
     # kernel
     kernel_filename = d.getVar('UKI_KERNEL_FILENAME') or None
 
---

base-commit: 183e043de423fd3f7833366ca524a6f7d17e6d14
change-id: 20250416-master-5da9e74b8fc2

Best regards,

Signature · 11 lines
Leonard Anderweit <[email protected]>



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#214990): https://lists.openembedded.org/g/openembedded-core/message/214990
Mute This Topic: https://lists.openembedded.org/mt/112294799/7159507
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#2 lore raw

Hi,

Am Mittwoch, dem 16.04.2025 um 17:48 +0300 schrieb Mikko Rapeli:

Quoted 8 lines

Hi,

Quoted 3 lines · Leonard Anderweit via lists.openembedded.org

Make it possible to build an uki without initramfs. The initramfs is now
optional and will only be included if INITRAMFS_IMAGE is set.

Quoted 5 lines

I had considered this but decided not since to me UKI without initrd isn't very useful compared to booting just a kernel EFI binary directly.

Can you disclose your usecase a bit more?

There is no real usecase here apart from me testing the uki feature and not wanting to deal with initramfs.

Also the uki documentation [1] states that the initrd is optional.

[1] https://uapi-group.org/specifications/specs/unified_kernel_image/

Leonard

Quoted 72 lines
Quoted 5 lines

Additionally, remove do_image_complete dependency on INITRAMFS_IMAGE:do_image_complete since do_uki already depends on that
and is executed first.

I remember hitting race conditions without this, but you may be right.

Cheers,

-Mikko

Quoted 58 lines

---
 meta/classes-recipe/uki.bbclass | 7 +++----

 1 file changed, 3 insertions(+), 4 deletions(-)
meta/classes- renamed from meta/classes-recipe/uki.bbclass +0 -0

recipe/uki.bbclass
index d9a7fb0e6fe0..4db5f614b96f 100644

meta/classes-recipe/uki.bbclass +0 -0
@@ -75,8 +75,6 @@ INITRAMFS_IMAGE ?= "core-image-minimal-initramfs"


 INITRD_ARCHIVE ?= "${INITRAMFS_IMAGE}-
${MACHINE}.${INITRAMFS_FSTYPES}"

-do_image_complete[depends] +=
"${INITRAMFS_IMAGE}:do_image_complete"
-
 UKIFY_CMD ?= "ukify build"
 UKI_CONFIG_FILE ?= "${UNPACKDIR}/uki.conf"
 UKI_FILENAME ?= "uki.efi"

meta/classes-recipe/uki.bbclass +0 -0
@@ -127,8 +125,9 @@ python do_uki() {
      ukify_cmd += " --stub %s" % (stub)

     # initrd
-    initramfs_image = "%s" % (d.getVar('INITRD_ARCHIVE'))
-    ukify_cmd += " --initrd=%s" % (os.path.join(deploy_dir_image,
initramfs_image))
+    if d.getVar('INITRAMFS_IMAGE'):
+        initramfs_image = "%s" % (d.getVar('INITRD_ARCHIVE'))
+        ukify_cmd += " --initrd=%s" %
(os.path.join(deploy_dir_image, initramfs_image))
 
     # kernel
     kernel_filename = d.getVar('UKI_KERNEL_FILENAME') or None

---
base-commit: 183e043de423fd3f7833366ca524a6f7d17e6d14
change-id: 20250416-master-5da9e74b8fc2

Best regards,

Signature · 15 lines
Leonard Anderweit <[email protected]>



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#214990):
https://lists.openembedded.org/g/openembedded-core/message/214990
Mute This Topic:
https://lists.openembedded.org/mt/112294799/7159507
Group Owner: [email protected]
Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-