diff mbox series

image-live.bbclass: support to enable/disable isohybrid

Message ID 20250605143728.4000790-1-hongxu.jia@windriver.com
State New
Headers show
Series image-live.bbclass: support to enable/disable isohybrid | expand

Commit Message

Hongxu Jia June 5, 2025, 2:37 p.m. UTC
While NO PCBIOS and EFI only for ISO 9660 image, burn the image
to SandDisk USB stick, plug it into laptop, then boot laptop and
enter UEFI mode, there are two boot options in UEFI system.

Here is the steps:

$ echo 'MACHINE = "genericx86-64"' >> conf/local.conf
$ echo 'MACHINE_FEATURES:remove = "pcbios"' >> conf/local.conf
$ echo 'IMAGE_FSTYPES:pn-core-image-minimal = " live"' >> conf/local.conf
$ bitbake core-image-minimal
$ sudo dd if=tmp/deploy/images/genericx86-64/core-image-minimal-genericx86-64.rootfs.iso of=/dev/sda

Boot laptop and entery UEFI mode
...
Boot mode is set to: UEFI

UEFI BOOT:
    UEFI: SanDisk
    UEFI: SanDisk 2
...

In this case, PCBIOS is not used, calling isohybrid for ISO 9660 image
is not necessary, and do not call isohybrid for ISO 9660 image could
remove duplicated boot option in UEFI mode.

Add var-NO_ISOHYBRID to disable or enable isohybrid, but still enable
isohybrid by default as usual. User could set NO_ISOHYBRID = "1" in
local.conf to disable it

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 meta/classes-recipe/image-live.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Gyorgy Sarvari June 5, 2025, 2:51 p.m. UTC | #1
On 6/5/25 16:37, hongxu via lists.openembedded.org wrote:
> Add var-NO_ISOHYBRID to disable or enable isohybrid, but still enable
> isohybrid by default as usual. User could set NO_ISOHYBRID = "1" in
> local.conf to disable it

Could this be please reversed? Like call it ISOHYBRID (or
ENABLE_ISOHYBRID, USE_ISOHYBRID...) instead of NO_ISOHYBRID and reverse
the current logic also accordingly? Possibly I'm dense, but I always
have to think 3 times when I face double-negation-enablements (and I
still set it incorrectly half of the time).
Hongxu Jia June 18, 2025, 2:23 a.m. UTC | #2
Ping

//Hongxu
On 6/9/25 10:25, hongxu via lists.openembedded.org wrote:
> While NO PCBIOS and EFI only for ISO 9660 image, burn the image
> to SandDisk USB stick, plug it into laptop, then boot laptop and
> enter UEFI mode, there are two boot options in UEFI system.
>
> Here is the steps:
>
> $ echo 'MACHINE = "genericx86-64"' >> conf/local.conf
> $ echo 'MACHINE_FEATURES:remove = "pcbios"' >> conf/local.conf
> $ echo 'IMAGE_FSTYPES:pn-core-image-minimal = " live"' >> conf/local.conf
> $ bitbake core-image-minimal
> $ sudo dd if=tmp/deploy/images/genericx86-64/core-image-minimal-genericx86-64.rootfs.iso of=/dev/sda
>
> Boot laptop and entery UEFI mode
> ...
> Boot mode is set to: UEFI
>
> UEFI BOOT:
>      UEFI: SanDisk
>      UEFI: SanDisk 2
> ...
>
> In this case, PCBIOS is not used, calling isohybrid for ISO 9660 image
> is not necessary, and do not call isohybrid for ISO 9660 image could
> remove duplicated boot option in UEFI mode.
>
> Add var-ENABLE_ISOHYBRID to disable or enable isohybrid, but still enable
> isohybrid by default as usual. User could set ENABLE_ISOHYBRID = "0" in
> local.conf to disable it
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> ---
>   meta/classes-recipe/image-live.bbclass | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/image-live.bbclass b/meta/classes-recipe/image-live.bbclass
> index d2e95ef51c3..cf8efb2c9b2 100644
> --- a/meta/classes-recipe/image-live.bbclass
> +++ b/meta/classes-recipe/image-live.bbclass
> @@ -63,6 +63,8 @@ ISODIR = "${S}/iso"
>   EFIIMGDIR = "${S}/efi_img"
>   COMPACT_ISODIR = "${S}/iso.z"
>   
> +
> +ENABLE_ISOHYBRID ??= "1"
>   ISOLINUXDIR ?= "/isolinux"
>   ISO_BOOTIMG = "isolinux/isolinux.bin"
>   ISO_BOOTCAT = "isolinux/boot.cat"
> @@ -147,7 +149,9 @@ build_iso() {
>   		isohybrid_args="-u"
>   	fi
>   
> -	isohybrid $isohybrid_args ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso
> +	if [ "${ENABLE_ISOHYBRID}" = "1" ]; then
> +		isohybrid $isohybrid_args ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso
> +	fi
>   }
>   
>   build_fat_img() {
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#218238): https://lists.openembedded.org/g/openembedded-core/message/218238
> Mute This Topic: https://lists.openembedded.org/mt/113544470/3617049
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [hongxu.jia@eng.windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Ross Burton June 18, 2025, 9:31 a.m. UTC | #3
On 5 Jun 2025, at 15:37, hongxu via lists.openembedded.org <hongxu.jia=eng.windriver.com@lists.openembedded.org> wrote:
> $ echo 'MACHINE_FEATURES:remove = "pcbios"' >> conf/local.conf

So what you’re saying here is that there’s an existing way to determine if a machine should use legacy BIOS.

> +NO_ISOHYBRID ?= "0"

Apart from the lack of documentation, why not just look at the MACHINE_FEATURES?

Ross
diff mbox series

Patch

diff --git a/meta/classes-recipe/image-live.bbclass b/meta/classes-recipe/image-live.bbclass
index d2e95ef51c3..743b7394d72 100644
--- a/meta/classes-recipe/image-live.bbclass
+++ b/meta/classes-recipe/image-live.bbclass
@@ -63,6 +63,8 @@  ISODIR = "${S}/iso"
 EFIIMGDIR = "${S}/efi_img"
 COMPACT_ISODIR = "${S}/iso.z"
 
+
+NO_ISOHYBRID ?= "0"
 ISOLINUXDIR ?= "/isolinux"
 ISO_BOOTIMG = "isolinux/isolinux.bin"
 ISO_BOOTCAT = "isolinux/boot.cat"
@@ -147,7 +149,9 @@  build_iso() {
 		isohybrid_args="-u"
 	fi
 
-	isohybrid $isohybrid_args ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso
+	if [ "${NO_ISOHYBRID}" != "1" ]; then
+		isohybrid $isohybrid_args ${IMGDEPLOYDIR}/${IMAGE_NAME}.iso
+	fi
 }
 
 build_fat_img() {