From patchwork Fri Sep 5 16:41:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69760 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75144CA0FED for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by mx.groups.io with SMTP id smtpd.web11.126.1757090534914151450 for ; Fri, 05 Sep 2025 09:42:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=JFDA+44C; spf=pass (domain: underview.tech, ip: 209.85.222.182, mailfrom: vince@underview.tech) Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-8117aef2476so72883785a.1 for ; Fri, 05 Sep 2025 09:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090533; x=1757695333; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=erDmI44TaPwCg8OY7OyOsBj1dsMGf9ZjmAhlCNcV5/s=; b=JFDA+44Cln8LWltGRreQVPJHW0mEEcc7WtQe5vi4LrC14pG/OQO7WYfJMT5m2MqX/x LDPLDnijmw1i6G7PlTHq/FHtyMIozK+74JC4fJeWCGuGlRcZjG7Wgpx/avt/LdGIV8QB szm7mpd44cWaQbVzw100q728+RvNDjRLTgYijuPqGHA6zShjfytkOWqlYyM8JX8A3Bp3 neXs5ekzY6xz6oo3myqWZvqrY/YG5flzAgyj+LKgczg/9BV28vEZFv6bJa2ig6gusYBb c55md4HXvNSWIPyOaavFDJISPV035+8hAc6HzmjdH4wAS969LdzhmnQsoVM0tqLBsSxG EHzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090533; x=1757695333; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=erDmI44TaPwCg8OY7OyOsBj1dsMGf9ZjmAhlCNcV5/s=; b=ff0b2SLEIZFJm7GKpp30VJWWZg5R7+ao5la2sVbbLX4TqUZllOtM7G55N0J+EUpUDi jD4KuyZdhM2OX8E9ASQYnpGK1YBOm0aLJEjqrC6qtzte6m16ooCTjZet8vVjS8mpdbHI l44wFVcKlTMwuVlXSAONBTdc3X4dGPX+fHjeldERvUtb/gvinlppKJh4/wknqFyLw2R8 uoVGL3TjWsLuEGFwYlF1aerwEdE5DHcbXLolXfZhaZGFBdsg0UMk/HhW6b90jYrihl/G /deuzJexaRQaXceG+WMfVSq9YpeUONq5OgZMi0bQUURaMjLlZyHE3wX3ABS/Q8Oedrou KSJA== X-Gm-Message-State: AOJu0YxFik2QYh5+48OWyMAHf28oBuZ9Qrp4gxPCiC+U1OZCTQdUwmPS TfPtPGyQ1NZE9vM+ehOT+hALA+n9uVga/UQD3d/QBhM34yaNEknsAGR9meZ1NAF4YeuGr9fAaje ynbey X-Gm-Gg: ASbGncv3ah1Rh6A+gML9eVAHzXw8SLHat/knLorgaCE+VICKOwC0EJqQYspc86XjWnm AHR8wUTXaMqrh85LyVPNMn29p5T9FEvbC6Qo6M9Pc2ofAJEric2oejH5WJQkAmuQ3+L9MVj1y+P SyJwOMDGnm3pihszLQJEuh+ye4QUAAGEoPyJxeudrnCQNVZNTNE5XRNF1Yd92hF0YtUyjzDUjSZ LtTiKxHuAcuurELB9w5wtJPVaArOrr8SG1NVqzy3CY/ibA1moNuJkBW2kRXwbcVueGU/Zmuo9L5 Fj3Yf6o/WebdscCY7O3IVCSZ9n07PrFq/zYvN/UV28m78KQhtFzzzUxWHBPcBejtjONAN1oxw0S d3wna1edXKDgKE62iaYJX2g== X-Google-Smtp-Source: AGHT+IHBldigouxr5XwQN8OTWnSl6OiYOVKRSHVRJgaLEjIeHewux8FfTt09XkdT9GKl0t2zADc40Q== X-Received: by 2002:a05:620a:a018:b0:80d:6f37:ed3d with SMTP id af79cd13be357-80d6f37f091mr1004623685a.42.1757090533333; Fri, 05 Sep 2025 09:42:13 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:12 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 1/8] bootimg_pcbios: support grub hybrid boot Date: Fri, 5 Sep 2025 12:41:29 -0400 Message-ID: <20250905164136.2896809-1-vince@underview.tech> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223017 If caller wants to primarily leverage grub as the primary boot loader current oe-core doesn't support booting grub when the boot firmware is legacy BIOS based and the partition table format is GPT based. Issue GPT header reside where core.img should be located (at byte 512). To navigate around issue core.img was moved to a seperate partition. If disk is a GPT disk caller must specify the file system type as none and set the partition type as BIOS boot. No filesystem will be created on partition. This also allows wic plugin to know where to dd core.img. Unfortunately No deep dive into grub-install was perform to know the exact bytes changed in hybrid boot case. To see the change in bytes generated boot.img + core.img was compared to boot.img + core.img after grub-install was executed using the xxd command. Signed-off-by: Vincent Davis Jr --- .../lib/wic/plugins/source/bootimg_pcbios.py | 55 ++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/plugins/source/bootimg_pcbios.py b/scripts/lib/wic/plugins/source/bootimg_pcbios.py index caabda6318..a7fb2eca4e 100644 --- a/scripts/lib/wic/plugins/source/bootimg_pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg_pcbios.py @@ -101,7 +101,7 @@ class BootimgPcbiosPlugin(SourcePlugin): disk_name, full_path, disk.min_size) if cls.loader == 'grub': - cls._do_install_grub(creator, kernel_dir, + cls._do_install_grub(disk, creator, kernel_dir, native_sysroot, full_path) elif cls.loader == 'syslinux': cls._do_install_syslinux(creator, bootimg_dir, @@ -340,6 +340,12 @@ class BootimgPcbiosPlugin(SourcePlugin): @classmethod def _do_configure_grub(cls, part, creator, cr_workdir): + # If partition type is either EFI System or + # BIOS boot no need to generate/copy grub config. + if part.part_type == '21686148-6449-6E6F-744E-656564454649' or \ + part.part_type == 'C12A7328-F81F-11D2-BA4B-00A0C93EC93B': + return 0 + hdddir = "%s/hdd" % cr_workdir bootloader = creator.ks.bootloader @@ -438,6 +444,12 @@ class BootimgPcbiosPlugin(SourcePlugin): grub_mods_path, core_img, builtin_modules) exec_native_cmd(grub_mkimage, native_sysroot) + # If partition type is either EFI System or + # BIOS boot no need to copy in grub modules. + if part.part_type == '21686148-6449-6E6F-744E-656564454649' or \ + part.part_type == 'C12A7328-F81F-11D2-BA4B-00A0C93EC93B': + return 0 + # Copy grub modules install_dir = '%s/%s/%s' % (hdddir, grub_prefix_path, grub_format) os.makedirs(install_dir, exist_ok=True) @@ -454,7 +466,7 @@ class BootimgPcbiosPlugin(SourcePlugin): native_sysroot, False) @classmethod - def _do_install_grub(cls, creator, kernel_dir, + def _do_install_grub(cls, disk, creator, kernel_dir, native_sysroot, full_path): core_img = '%s/grub-bios-core.img' % (kernel_dir) @@ -478,6 +490,45 @@ class BootimgPcbiosPlugin(SourcePlugin): # Install core.img or grub stage 1.5 dd_cmd = "dd if=%s of=%s conv=notrunc bs=1 seek=512" % (core_img, full_path) exec_cmd(dd_cmd, native_sysroot) + elif creator.ptable_format == 'gpt': + # Issue GPT headers reside where core.img should be (at byte 512). + # To navigate around issue core.img was moved to a seperate partition. + # + # If disk is a GPT disk caller must specify the file system + # type as none. As no filesystem may be created. Caller must + # also set the partition type to BIOS boot. So, the plugin + # may embed core.img there. + + # Replicates what grub-install does to boot.img + # Found by comparing xxd output of generated boot.img + # to boot.img after grub-install. + dd_cmd = "echo -ne '\\x00\\x08' | dd of=%s conv=notrunc bs=1 count=2 seek=92" % (full_path) + exec_native_cmd(dd_cmd, native_sysroot) + + dd_cmd = "echo -ne '\\x90\\x90' | dd of=%s conv=notrunc bs=1 count=2 seek=102" % (full_path) + exec_native_cmd(dd_cmd, native_sysroot) + + for part in creator.parts: + if part.part_type == '21686148-6449-6E6F-744E-656564454649': + part_start_byte = part.start * disk.sector_size + + # Install core.img or grub stage 1.5 + dd_cmd = "dd if=%s of=%s conv=notrunc bs=1 seek=%s" % \ + (core_img, full_path, part_start_byte) + exec_cmd(dd_cmd, native_sysroot) + + # Replicates what grub-install does to core.img + # Found by comparing xxd output of generated + # core.img to core.img ater grub install. + dd_cmd = "echo -ne '\\x01\\x08' | dd of=%s conv=notrunc bs=1 count=2 seek=%d" % \ + (full_path, part_start_byte + 500) + exec_native_cmd(dd_cmd, native_sysroot) + + dd_cmd = "echo -ne '\\x2f\\x02' | dd of=%s conv=notrunc bs=1 count=2 seek=%d" % \ + (full_path, part_start_byte + 508) + exec_native_cmd(dd_cmd, native_sysroot) + + break else: raise WicError("Unsupported partition table: %s" % creator.ptable_format) From patchwork Fri Sep 5 16:41:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8224ACA101F for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by mx.groups.io with SMTP id smtpd.web10.121.1757090535540172715 for ; Fri, 05 Sep 2025 09:42:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=HHgGvIgt; spf=pass (domain: underview.tech, ip: 209.85.219.43, mailfrom: vince@underview.tech) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-7251e6b2f9eso13391976d6.1 for ; Fri, 05 Sep 2025 09:42:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090534; x=1757695334; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fgqK7w5ur3QXMrtpVRzJI/TyAhGTkklkIlH3sCinApo=; b=HHgGvIgtGuQyz5WpPBrhjU/rjuZM81WtzRUDiiGofGVAcAIXw+nJuUEny8gV9EgwIg Xe8ckUnpW3MaYRkWTOrrzk4u+AuNVEaUzaQyaXBF94Ou/UbmTVFPOPIo088OK6DWcdh1 LYkfny7FILi7+52mZT1O+5c+oZLXmn7DDQWIp0Do+1OpStxRG+tDSYfVe7DABY3E/1tQ 8k3gtfMK3AaV+T01kMKcaTzLS3TrCWV9UyD32wo4gR/INlNoZcVkmUCxVCCDYzYShyY+ jAi88xwzM6nytLo1hwDnMEkOTITgZzM5PQmQN+rJNAEmWlJMozjK4JWUMkLLJafFjs3v z3ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090534; x=1757695334; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fgqK7w5ur3QXMrtpVRzJI/TyAhGTkklkIlH3sCinApo=; b=BfZSd+QqPfxpRKmcKEleLO5vh/QKhbH9fRW1FeGBbu9d4jQIsIihql/fqW9BX/WaF3 1E0vP1hGiSl2Ew2W6lXYc16W4zqJXIbhnuZDO4FL+L+HnOj4pTwH4qGDGPvQnjQpvPxe 88UXmdepkS4iOrVarYbdZzYKMFtTMokWSni+JC1+JF1xxz+ue/6BHempNgEY/ijvoT0v B02yhLTm/NUW5C8l/scbZMRL+OaEOUyGCYdi4IsDr1e8btEkrwdQTpe47WzhiYahPNB5 vJoIYRI+G8WT6PADBHOcahieuwBX0+/CFIhabudz9//h8FBOAjH+E5SvXrudI5lMBFMJ RfFQ== X-Gm-Message-State: AOJu0YyoSg2QCy7BNoBdoSGvRl+2tyQxHrnxL3wfBITa9v5qWGlxqoQ/ We6vuhGB61bIqbxX6YUvkv4aNBxPSO7XxBOZE1S91uIkUNl3ahplluB7egX/E8u7uqNOiiINbUJ AqOvB X-Gm-Gg: ASbGncuvx1GMu8ghdHv+FnvgK/mExycxUrLw1aV9NgRZqCct5Ygb3OOmkf/FYi32VP+ Hzh3S+doQGwak+ZyNLADMKpcitL8N4fiFBbcl6MuTFInnj4M0L2txDvroAEghp/5EFP2tbms6I/ WVWPSy9u7QpO5gq9M0Pas8HAf7DZqC8LzRhVDiPy8z7hGPwUgX9hJK15ZDoQ48K43UZ6nUe536m WdlOuRhj8K84/VYDOOkKYSMKzRqUajPZJXI3yqa74RXCppvOU1r3YZCzpR0h3NBkYDQKa7oE6Q6 BXdnPQYmLktyHR359p66cJOBShwNKyGPl0Vf/Iun3fuJ5co3xgP+pQRNdX6QD+rZWObV/pBOJKR 25Vr7Wonpoti6ONL5E3jnow== X-Google-Smtp-Source: AGHT+IEJX1TYrsd85jMHct/X1ACZ82bxeLqA2af029JV+G4XFLKisbIlpGkJDowJXNq5TIMuCXcAxg== X-Received: by 2002:a05:6214:4017:b0:707:3cb1:3fac with SMTP id 6a1803df08f44-70fac740196mr253805676d6.15.1757090534081; Fri, 05 Sep 2025 09:42:14 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:13 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 2/8] bootimg_efi: support grub hybrid boot Date: Fri, 5 Sep 2025 12:41:30 -0400 Message-ID: <20250905164136.2896809-2-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905164136.2896809-1-vince@underview.tech> References: <20250905164136.2896809-1-vince@underview.tech> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223018 If bootimg_biosplusefi wics plugin is used check for loader-bios in sourceparam. The grub config is copied by the bootimg_pcbios wic's plugin. The reason is it's autogenerated grub config is generic enough to support both legacy boot and hybrid boot. Thus, no need to update it. If partition type marked as EFI System only copy in UEFI application boot*.efi (core.img). It appears the EFI directory resides after initial population of the EFI System partition. If bootimg_efi called again and the partiton type not marked as EFI System remove any unwanted files. Signed-off-by: Vincent Davis Jr --- scripts/lib/wic/plugins/source/bootimg_efi.py | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/plugins/source/bootimg_efi.py b/scripts/lib/wic/plugins/source/bootimg_efi.py index cf16705a28..98be12160c 100644 --- a/scripts/lib/wic/plugins/source/bootimg_efi.py +++ b/scripts/lib/wic/plugins/source/bootimg_efi.py @@ -223,7 +223,13 @@ class BootimgEFIPlugin(SourcePlugin): exec_cmd(install_cmd) try: - if source_params['loader'] == 'grub-efi': + # In grub hybrid boot case bootimg_pcbios generates/copies the grub.cfg + # that will be stored on same partitions as the grub modules. + if 'loader-bios' in source_params and \ + source_params['loader-bios'] == 'grub' and \ + source_params['loader'] == 'grub-efi': + pass + elif source_params['loader'] == 'grub-efi': cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params) elif source_params['loader'] == 'systemd-boot': cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) @@ -328,7 +334,25 @@ class BootimgEFIPlugin(SourcePlugin): logger.debug("Installed IMAGE_EFI_BOOT_FILES:\n%s" % out) try: - if source_params['loader'] == 'grub-efi': + if 'loader-bios' in source_params and \ + source_params['loader-bios'] == 'grub' and \ + source_params['loader'] == 'grub-efi': + + # If partition type is Bios Boot return + if part.part_type == '21686148-6449-6E6F-744E-656564454649': + return 0 + + # The grub config in the hybrid grub boot setup is + # copied by the bootimg_pcbios wics plugin. + if part.part_type == 'C12A7328-F81F-11D2-BA4B-00A0C93EC93B': + for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: + cp_cmd = "cp -v -p %s/%s %s/EFI/BOOT/%s" % \ + (kernel_dir, mod, hdddir, mod[9:]) + exec_cmd(cp_cmd, True) + else: + shutil.rmtree("%s/EFI" % hdddir) + return 0 + elif source_params['loader'] == 'grub-efi': shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, "%s/grub.cfg" % cr_workdir) for mod in [x for x in os.listdir(kernel_dir) if x.startswith("grub-efi-")]: From patchwork Fri Sep 5 16:41:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC1ACA1010 for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by mx.groups.io with SMTP id smtpd.web10.122.1757090536596999760 for ; Fri, 05 Sep 2025 09:42:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=ckat/1vP; spf=pass (domain: underview.tech, ip: 209.85.219.54, mailfrom: vince@underview.tech) Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-70ddadde494so19474266d6.1 for ; Fri, 05 Sep 2025 09:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090535; x=1757695335; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FXzuSotpMMnOjSPlL3MDTuoRfm/HOvDccvynxqGewg4=; b=ckat/1vPPu9+4qJSCLR98PynnV6+dqTuQ48vKC7ltbTpdR9xDAfVa9jJDDkGEvaPo/ 0O2aYr/Szx0h32M4wYm5gGYzN3HdyjNbfgRo05g+5yj5A0cRy2EkNMLymn6FZn/9Wdm8 POObyG6FjVCMAZwdkMnpIdn1znaAlzu9IF2HpfOKgdK5kEgY0SQgw46hihXpTSQ/WKdf 8UAthqqGmtjjmMOxec8mgUIHzm4nLJPv7VcC+WO/haWhxn6S79/9O85hajsbiK8zyqYA xb2lswg6sjcvV14ExdciIQLMerl4ZXkwSCIxeEWGYYfQBvk3pqVN5Np6tXlPFGZaNH8a 5Nwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090535; x=1757695335; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FXzuSotpMMnOjSPlL3MDTuoRfm/HOvDccvynxqGewg4=; b=JCfYgSZjcOPw9svLBysf/eOBDydQjH2yI896idXL/oWnno370RiC0/8a31zkI1HsT3 Bnb6pqglyXW03ruSdW/ZP3/XCs7VT7iAy0rMz9Qw5TME6Rq3XnryX8hRWUCxSMAqAnHK YGaNYLIF3Si4WCFmZ8M0VWIuFmjfW/JvvH8rbfPvEAt+TWUdSdND6YBkLO5U8g3uWMYI i8Z0/taFjkBLxAjx4B4t9nO+3U9G/nFYMN+SVu2zNIubDcvBbk5X9vvutvFj5tivT1FU 64LqeKB9PtCscaDfjy4/KVN3m9BnlNnuhLWHCAKYpb2wgJxw51AodmOChwL+8k1/SUyd 33bQ== X-Gm-Message-State: AOJu0YzgqwxygFRwo+OA2S1ddTlxJ3m7OHOMYwiezY0ypUAihg/Ov+1r 7Elmu4IahMXAUo7pohFmuf/ATsoDg3XTdPyKxMTipjbE5GxE1Cmvj9kPeNo9+80duITAkkq2dQC 91O7G X-Gm-Gg: ASbGncuHfAcvOY6RF9CZrvEruHsLVptpxBciOrIGJuuC32xFkDyG8JZhr6TtSUH6PcM 5P90Zh68te6kIqtS5HVs8rDBaxpL3rTf7COi/R56o5PiilKoZhxR7yq+Jqrqf1oV8OV6CniaMdE H4eJL3kcxVP6VhWhgR6dGWuX/IWYXOMgot1yiWpIu9vjiMMk9EG0VHUEAlMBZ5e5UfZB8A1uryZ TRbHwH2DcGAme9/AojbaVAy+MrximCYYbXCfk741pLEXNIn4Fx3661B56WimeR9nBdjYmZCxr7u jMHejNpFHQZe13bVkaqJyHPpscGqMZc/JlUJ0hFXnsTftx5WbPDeOSKoPfXmy2hfWnlQslt9Iou AIj6PEVk7z7NIzsljcHREbA== X-Google-Smtp-Source: AGHT+IFNliCutcjq+97danY3DqeZ4PBvCB2XbKe9oQnbcz59GXrxhA/FzKAmW99okLW0UKwz21DmMw== X-Received: by 2002:a05:6214:2485:b0:733:74d3:5fda with SMTP id 6a1803df08f44-73374d37ce9mr18895596d6.28.1757090535068; Fri, 05 Sep 2025 09:42:15 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:14 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 3/8] bootimg_efi: copy grub modules Date: Fri, 5 Sep 2025 12:41:31 -0400 Message-ID: <20250905164136.2896809-3-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905164136.2896809-1-vince@underview.tech> References: <20250905164136.2896809-1-vince@underview.tech> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223019 Assumming all grub modules weren't embedded into boot*.efi (core.img) copy them now. This commit populates the common partition used to store the grub config and grub modules for both PCBIOS and EFI. Signed-off-by: Vincent Davis Jr --- scripts/lib/wic/plugins/source/bootimg_efi.py | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/scripts/lib/wic/plugins/source/bootimg_efi.py b/scripts/lib/wic/plugins/source/bootimg_efi.py index 98be12160c..c3254033d6 100644 --- a/scripts/lib/wic/plugins/source/bootimg_efi.py +++ b/scripts/lib/wic/plugins/source/bootimg_efi.py @@ -350,7 +350,39 @@ class BootimgEFIPlugin(SourcePlugin): (kernel_dir, mod, hdddir, mod[9:]) exec_cmd(cp_cmd, True) else: + # Assumming all grub modules weren't embedded + # into grub.efi or core.img copy them now. + copy_types = [ '*.mod', '*.o', '*.lst' ] + + # It appears the EFI directory resides after + # initial population of the EFI System partition + # in the if statement above. Remove so that the + # partition doesn't contain any unrequired files. shutil.rmtree("%s/EFI" % hdddir) + + hdddir = "%s/hdd" % cr_workdir + + staging_libdir = cls._get_staging_libdir() + + grub_format = get_bitbake_var('GRUB_MKIMAGE_FORMAT_EFI') + if not grub_format: + grub_format = 'x86_64-efi' + + grub_prefix_path = get_bitbake_var('GRUB_PREFIX_PATH') + if not grub_prefix_path: + grub_prefix_path = '/boot/grub' + + # Copy grub modules + install_dir = '%s/%s/%s' % (hdddir, grub_prefix_path, grub_format) + os.makedirs(install_dir, exist_ok=True) + + for ctype in copy_types: + files = glob('%s/grub/%s/%s' % \ + (staging_libdir, grub_format, ctype)) + for file in files: + shutil.copy2(file, install_dir, follow_symlinks=True) + + # bootimg_pcbios calles prepare_rootfs no need to here. return 0 elif source_params['loader'] == 'grub-efi': shutil.copyfile("%s/hdd/boot/EFI/BOOT/grub.cfg" % cr_workdir, @@ -457,3 +489,24 @@ class BootimgEFIPlugin(SourcePlugin): part.size = int(bootimg_size) part.source_file = bootimg + + @classmethod + def _get_staging_libdir(cls): + """ + For unknown reasons when running test with poky + STAGING_LIBDIR gets unset when wic create is executed. + Bellow is a hack to determine what STAGING_LIBDIR should + be if not specified. + """ + + staging_libdir = get_bitbake_var('STAGING_LIBDIR') + staging_dir_target = get_bitbake_var('STAGING_DIR_TARGET') + + if not staging_libdir: + staging_libdir = '%s/usr/lib64' % staging_dir_target + if not os.path.isdir(staging_libdir): + staging_libdir = '%s/usr/lib32' % staging_dir_target + if not os.path.isdir(staging_libdir): + staging_libdir = '%s/usr/lib' % staging_dir_target + + return staging_libdir From patchwork Fri Sep 5 16:41:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B3FECAC583 for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by mx.groups.io with SMTP id smtpd.web11.130.1757090537318151594 for ; Fri, 05 Sep 2025 09:42:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=HLByQDeR; spf=pass (domain: underview.tech, ip: 209.85.219.48, mailfrom: vince@underview.tech) Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-71b9d805f2fso21803496d6.0 for ; Fri, 05 Sep 2025 09:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090536; x=1757695336; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gdpDUPDLztMtIDTj0lJa2dehuwTfcBO0wGysqlJh+Yg=; b=HLByQDeRXWXUBHh1A/gkWS8+CtuB48wl+lgLi4e1V6ic/KgGBPRAaZLOK3iZlOTelX iqpCkE46yNHhv85IRqpwoMhU7pqlDRuJrjetIBs8gq/i5GwIP8WVbTXn/zpH8UJrhLUd 4TtR7xEoR51cNvydYbw1Ant23VTmbePRvqSjgwXR1SQF4XOD3fPvsj10ovsMJKpfEeDV hswGgk9aM7EaZ31D5UURauhvoNfqFVsjFAMCIvYlrS8HQfjesIfg00bzbzL+w++cHXM8 LgOMLUSQY/l0npsPDOOzSqKspJjUwY696l9V20gleNohTdwXOTgaPa84Xc5X9ILXK0n+ tmdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090536; x=1757695336; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gdpDUPDLztMtIDTj0lJa2dehuwTfcBO0wGysqlJh+Yg=; b=BVv9Hlecgo41CKpiZ+JXJwSL+t1HCuxaGpDYAI9OrTUlPRx7Ko6CH+G1DzE8JCc7P9 0OYOfPRCGT9tf06CFTJYPtvXSGhxjjORRz3pMV4ufgXJtvfkmTYaPIExvcEEMtUqGxAJ RuWFwDO3faFvnZRHt/kQYWgH4dqe+VZyBHdeultwrBj3iNfAbTwyXN8Bc65bV3A3oEer vVIxNNE8WHvGxs/79i6b7o1pRtuXloDsCAZ9E3CGeuQVatAGA18RkN7x/S/PEH1+P0JR BYr12i/0U6zpRfeEc//im4O9lda6JemwGKn0vTkJrXd8aSvzgRjuKX9ILwxrElDCTr/y mPrQ== X-Gm-Message-State: AOJu0YxdvmF0++01m50aIUvXiIZZcPUN4Wk4O5PMbuvMeuBHvlJMA75x sScogW8mO0Qfc8M0HPKyB/1k11NkxybcuFIeaH70d5nTInV9w1TtUCHzyHXzwqCJioaS0ahMgJS zzZR+ X-Gm-Gg: ASbGncsXnFr5VpbWCXHRDdR/SZHbSF3JR+1iOVQRX/SWy5SP45wWnDkHeOXXz4smJdD HI+5EA+u4xkI/kbZIFIulR7ObmHbZsCHio5Ec8W20wEnvqIhqSVkbOxLKvLFsKAnW4gzQH6Lv5H 8XzfioPUoteKtE/EA84x48npRu9rLtEjqvWAbjIYo9BFV6KWlxugysIHYOdmZFDLt3/k9e/5gL9 EhrSeFM/LczyXwJ+DOEnkaZk3YLnCkN1kYMdKR+y+ss1kb/3H57MpGwDEIsfXkrrieWqbxewPgp YYCdDFw4hpD4jIHKScRYFBWnfdMfBhdvDRTkt0Mv5z6hi279N+9S32Pgo0jno8TSdLrhELMNIC+ sTPjS5kRJLlg= X-Google-Smtp-Source: AGHT+IFT9QCu8JmOYA2oEOcRQngAXvAHMYF8+i1bj15yZzhddF6MtDbJ/4310ankkot7RP5Zq29LVQ== X-Received: by 2002:a05:6214:1cc4:b0:709:8665:f839 with SMTP id 6a1803df08f44-70fac89df73mr262595766d6.43.1757090535795; Fri, 05 Sep 2025 09:42:15 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:15 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 4/8] bootimg_pcbios: update default boot timeout to zero Date: Fri, 5 Sep 2025 12:41:32 -0400 Message-ID: <20250905164136.2896809-4-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905164136.2896809-1-vince@underview.tech> References: <20250905164136.2896809-1-vince@underview.tech> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223020 If caller doesn't specify a timeout more than likely because caller doesn't want one. Set it to zero. This also fixes boot time issues related to OE selftest that leverage boot testing with qemu. Signed-off-by: Vincent Davis Jr --- scripts/lib/wic/plugins/source/bootimg_pcbios.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/plugins/source/bootimg_pcbios.py b/scripts/lib/wic/plugins/source/bootimg_pcbios.py index a7fb2eca4e..2fdca98848 100644 --- a/scripts/lib/wic/plugins/source/bootimg_pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg_pcbios.py @@ -208,7 +208,7 @@ class BootimgPcbiosPlugin(SourcePlugin): # 'None' being the value placed within the configuration # file. if not bootloader.timeout: - bootloader.timeout = 500 + bootloader.timeout = 0 # Set a default kernel params string if none specified # to avoid 'None' being the value placed within the @@ -364,7 +364,7 @@ class BootimgPcbiosPlugin(SourcePlugin): # 'None' being the value placed within the configuration # file. if not bootloader.timeout: - bootloader.timeout = 500 + bootloader.timeout = 0 # Set a default kernel params string if none specified # to avoid 'None' being the value placed within the From patchwork Fri Sep 5 16:41:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B2BECAC581 for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by mx.groups.io with SMTP id smtpd.web10.124.1757090538422980089 for ; Fri, 05 Sep 2025 09:42:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=TejnOyhn; spf=pass (domain: underview.tech, ip: 209.85.219.43, mailfrom: vince@underview.tech) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-7221ce7e814so17821646d6.0 for ; Fri, 05 Sep 2025 09:42:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090537; x=1757695337; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=muIkAhajL310B+tHVnSzlhmDPJ+ZoBA5H89wnfQNDsE=; b=TejnOyhn6C7Mpe9VrPvLJsvMMljcSWgNDuA4tdRfjTa6TNKPra+Geu13PhjS4d9Q1W rHsxXoD84a+yxGtUovPE5trJznOL/0D7LB2xymwxCmzHuTlQ3UUX5/kzdSP6CR7t0Rph UYK0JGxVWkoGlXZSpDR3Jz6dAavX0yFSUzApH5l9qrZf0JtCRX+mnpNGzSxd5GTlESZH HO9svCA6k5XgYTjjPmZ7Ph1rozRrQVaWa72h+SPHk6zYy6jb1Di+svjty1GjmahAEYhE +GjdV5wtUroNIJQoyNRtd9bpo5MJqEAuOTBsJ1wUHpA4hbo8AlGblY88GQ/ahPYquOLK o9wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090537; x=1757695337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=muIkAhajL310B+tHVnSzlhmDPJ+ZoBA5H89wnfQNDsE=; b=e1PT5xKjpW8RJ36rdp5084wfJ3DgJGz+oz95/by/TD8alOUNr8qxfaTy6dy3KZga+s xQ92n/rARNMY4r07oh/1JPuIwF3dFUCbXd+GIS7MTdxCdjlAUsD/PEW+UvrPj+OF6I7N IVzx0Thr3sEdyF8J3JktJY8b74oQP17pa+G3tZD6l1cIX2A6xs48gzzvQjvPseoKIjSR mSwSlUUv48c73a5LgqoeZRC5PoyQEGMxWbDWe0gSrm6Ep1juFZIPSwU57UKKP4m+V6Fi KuQ4QBzIOri2Kh80qU6XkmNcs1QF1uKIxineAszLTR8Yc9lwgLL0qx3nJTN2qzp6V62W Vhew== X-Gm-Message-State: AOJu0YyGxEPfL5u0Z+A1MUV3j8M8fSEqMZV+ap6O+kX1GjMb64g8AwLk +AYUlDikFjKD6ly89Zv1b5BRmFiGh3axoA863KY33gggkILOScC2midbAiGi9kn1varPJtAaLYt Q+BKs X-Gm-Gg: ASbGncsuUgCjMmxvvHhtej6jPIsH92rifOvrUkesI0P6H+dTWoYEnRBxTOofxdB3cjB mx9KZpRLAiuQQh6qhK8spHRSnZmni83KbgGfRzraY4GoxnsXoAQ6kvnIBrkNsBNoppzn6htg+1V LO7oar2dY7d5OdjhUzvJfjNY0KlTzmF1MFqh/MnuqMbE8H1V3me+ROuCh2L7zXGFjIEYuhJmO/E meL+pqRMaDbrOs/9/S7NkMNQQ0vsXTX+kD1vSqhvMCCc00H3XsUWCjz2ZA1NVhnKJZSRomH7W9T Ljuv793mBGOKrkBeZ4gQYkMGj27IV+X6Ku0Bq4juzy33TBERYfhMu9X4/yc3X5D6x4SY3Qb/ErK naKh6NfrsRYg= X-Google-Smtp-Source: AGHT+IGGAT4W/2oTdcxRy71EIPT4eK0eK2NMhUEYAfNvdK6sEXYugOv7tf7z36IQ30Tdmk4Sd572JA== X-Received: by 2002:ad4:5767:0:b0:734:8eac:3541 with SMTP id 6a1803df08f44-7348eac386bmr17576206d6.63.1757090536888; Fri, 05 Sep 2025 09:42:16 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:16 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 5/8] bootimg_biosplusefi: add grub only examples Date: Fri, 5 Sep 2025 12:41:33 -0400 Message-ID: <20250905164136.2896809-5-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905164136.2896809-1-vince@underview.tech> References: <20250905164136.2896809-1-vince@underview.tech> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223021 Updates the comments section to explain new usage of wic plugins. Signed-off-by: Vincent Davis Jr --- .../wic/plugins/source/bootimg_biosplusefi.py | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/scripts/lib/wic/plugins/source/bootimg_biosplusefi.py b/scripts/lib/wic/plugins/source/bootimg_biosplusefi.py index 4279ddded8..ad4c0e1768 100644 --- a/scripts/lib/wic/plugins/source/bootimg_biosplusefi.py +++ b/scripts/lib/wic/plugins/source/bootimg_biosplusefi.py @@ -27,7 +27,7 @@ class BootimgBiosPlusEFIPlugin(SourcePlugin): """ Create MBR + EFI boot partition - This plugin creates a boot partition that contains both + This plugin creates a boot partition(s) that contains both legacy BIOS and EFI content. It will be able to boot from both. This is useful when managing PC fleet with some older machines without EFI support. @@ -50,7 +50,9 @@ class BootimgBiosPlusEFIPlugin(SourcePlugin): not turn the rootfs into an initramfs RAM image. This plugin is made to put everything into a single /boot partition so it - does not have the limitations listed above. + does not have the limitations listed above. Unless GRUB is the primary + bootloader. We have to seperate it into multiple partitions because + of core.img. The plugin is made so it does tries not to reimplement what's already been done in other plugins; as such it imports "bootimg_pcbios" @@ -70,9 +72,33 @@ class BootimgBiosPlusEFIPlugin(SourcePlugin): Plugin options, such as "--sourceparams" can still be passed to a plugin, as long they does not cause issue in the other plugin. - Example wic configuration: + Example wic configurations: + + ************ Example kickstart GRUB/Syslinux Hybrid Legacy Bios Or Newer UEFI Boot ************ part /boot --source bootimg_biosplusefi --sourceparams="loader=grub-efi"\\ --ondisk sda --label os_boot --active --align 1024 --use-uuid + ************ Example kickstart GRUB/Syslinux Hybrid Legacy Bios Or Newer UEFI Boot ************ + + + ********************** Example kickstart GRUB Hybrid Legacy Bios Or Newer UEFI Boot ********************** + # See https://wiki.archlinux.org/title/GPT_fdisk#Partition_type + + part bios_boot --label bios_boot --fstype none --offset 1024 --fixed-size 1M \\ + --part-type 21686148-6449-6E6F-744E-656564454649 --source bootimg_biosplusefi \\ + --sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false" + + part efi_system --label efi_system --fstype vfat --fixed-size 48M \\ + --part-type C12A7328-F81F-11D2-BA4B-00A0C93EC93B --source bootimg_biosplusefi \\ + --sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false" + + part grub_data --label grub_data --fstype ext4 --fixed-size 78M \\ + --part-type 0FC63DAF-8483-4772-8E79-3D69D8477DE4 --source bootimg_biosplusefi \\ + --sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false" + + part roots --label rootfs --fstype ext4 --source rootfs --part-type 0FC63DAF-8483-4772-8E79-3D69D8477DE4 + + bootloader --ptable gpt --source bootimg_biosplusefi + ********************** Example kickstart GRUB Hybrid Legacy Bios Or Newer UEFI Boot ********************** """ name = 'bootimg_biosplusefi' From patchwork Fri Sep 5 16:41:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7FADCAC582 for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by mx.groups.io with SMTP id smtpd.web11.131.1757090539117967386 for ; Fri, 05 Sep 2025 09:42:19 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=Lz/xyR+d; spf=pass (domain: underview.tech, ip: 209.85.219.49, mailfrom: vince@underview.tech) Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-7240eb21ccaso25616506d6.0 for ; Fri, 05 Sep 2025 09:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090538; x=1757695338; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mjfMfBdxyLebbwDgPMPC5T4UWLf7dF4GlEqze820sYU=; b=Lz/xyR+dLP/vermeT0aLvGftg+TQAQQIoQfNjv4dn9WlHOJ4zZ2HpEkBsmbXLkiRwt HayobWOgbYKB7/S2I9L1ZgEoTSAkyPuCtfajs3LmzCQPguXzbxRDVh86sy+aEJLEBGW0 FwJ8QEnVUYufUBQZvUeEqiv01StmeoEchghzzVQvcM6i8eRrwyE1QjM7bOXIwini043x +PkLWvs70pyLHJD6+jBMEt4Zgo4062PC3NepvBh0uidCpOu8Rg/8O5Tb6UIkFIficOs4 26M+mMlr6E8Ape/QZeNKs3LTXbv/kqsBkyOfkD+KzZayLDhSFdvnlkr0IgqcQjVGgcMW 0X6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090538; x=1757695338; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mjfMfBdxyLebbwDgPMPC5T4UWLf7dF4GlEqze820sYU=; b=YaXWCTz+ZEARcEnZOp1i4eWqIgmRVnLgtCTHEEmY7v4GMT/bG5AOsXKZoLId39SwT+ SN9OASryd7str9r0OCIkM3cMFaHEQ096dFL0H1ACBTsk1yeR9I/T6BCtPxkEEUM/I5yi 6x2Adfg6Ltq4XfuzFY0/xdKTESvykwgun513KID/Tv25kVWE+kdPGjpZTmqBhXVv2MwY rzkWZEl/SJrninQofUIXexx8u0qN4LwtEdZG3tYL9ZaSjhblJSZkSKnlfkvcKI7cboY/ n4QXSu79OW3QvmTFf1rS01i5GxYFO1h77WDuczq1w/k50d0DKovtq4N24IsjQjdxqdcU yIIA== X-Gm-Message-State: AOJu0Ywn6iq9lwkU0/bzbwR3OjvTWkIOr+7c1N2r2olKdv5KCUEMZqAX 3L2oRovFmhzpVW9Nz0hXFACwaG7rBp9vhjdUP/057+7ejdsMJ4mdV1+vQtcHV+0wW8f1DsQb/7M DDnIW X-Gm-Gg: ASbGncsx0QajVwoyxo2HVMW1qMdOCpYjTrXbsOc+pefIRhgGuoV9GiD1aY50Y2XD81I oSiC58fea/ZCgYyp2vKVKF8rNfplHaGF5Y9zuZQlhPaTU9J57UpBw1/jNyGhneBUztc6KZ0c8ql wBPkoIR0++mX5YdMCWhHHaHUJ6NCmCn5xZzNzApQt3pQXFAenpzEfJsum7hy/A6Ts45Sit6RfIV mMCUiGZUie3zRWd+E2eKFw4fKQfX+du7KhPCUk06+TYmBcVfuUAcxbzGrQEwPH3VmtXRnJLdlyX 35zGeZ8fwUsKL07Bf/JEn+3kwodZwZ+hyxWgjwSeLSPcA2re4GEQ3l0+9asf3jBKlDa4o1zcU/m yzELdeYDDt2NErAnDNmTmdw== X-Google-Smtp-Source: AGHT+IG7l9+hOhfxMETSCNEzNXfV8YQXmjPi1hS5zW5qgUyt2do5kHp/0nAwILTTjTu9L0P4QKa+cw== X-Received: by 2002:a05:6214:f0f:b0:70d:cc9d:7ed4 with SMTP id 6a1803df08f44-72bbf402e04mr61620206d6.11.1757090537664; Fri, 05 Sep 2025 09:42:17 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:17 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 6/8] grub-efi: support custom embedded grub configs Date: Fri, 5 Sep 2025 12:41:34 -0400 Message-ID: <20250905164136.2896809-6-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905164136.2896809-1-vince@underview.tech> References: <20250905164136.2896809-1-vince@underview.tech> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223022 Commit: Adds support for including custom embedded grub configs. The default one provided in OE-core is limited to everything being in the /EFI/BOOT directory. Adds an embedded grub config that sets root and prefix based upon the /boot/grub directory. Adds probe to the list of default builtin grub modules. Probe is required by the bootimg_pcbios wic plugin generated grub config. Signed-off-by: Vincent Davis Jr --- meta/recipes-bsp/grub/files/cfg-boot-grub | 3 +++ meta/recipes-bsp/grub/grub-efi_2.12.bb | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-bsp/grub/files/cfg-boot-grub diff --git a/meta/recipes-bsp/grub/files/cfg-boot-grub b/meta/recipes-bsp/grub/files/cfg-boot-grub new file mode 100644 index 0000000000..ab370479af --- /dev/null +++ b/meta/recipes-bsp/grub/files/cfg-boot-grub @@ -0,0 +1,3 @@ +search.file /boot/grub/grub.cfg root +set prefix=($root) +configfile ($root)/boot/grub/grub.cfg diff --git a/meta/recipes-bsp/grub/grub-efi_2.12.bb b/meta/recipes-bsp/grub/grub-efi_2.12.bb index 6354b43989..91748c8d04 100644 --- a/meta/recipes-bsp/grub/grub-efi_2.12.bb +++ b/meta/recipes-bsp/grub/grub-efi_2.12.bb @@ -9,6 +9,7 @@ RDEPENDS:${PN} = "grub-common virtual-grub-bootconf" SRC_URI += " \ file://cfg \ + file://cfg-boot-grub \ " S = "${UNPACKDIR}/grub-${PV}" @@ -48,6 +49,7 @@ EXTRA_OECONF += "--enable-efiemu=no" # Define GRUB_MKIMAGE_OPTS variable for additional grub-mkimage options (e.g., disabling shim lock) GRUB_MKIMAGE_OPTS ?= "" +EMBEDDED_GRUB_CONFIG ?= "${UNPACKDIR}/cfg" do_mkimage() { cd ${B} @@ -63,7 +65,7 @@ do_mkimage() { # Search for the grub.cfg on the local boot media by using the # built in cfg file provided via this recipe - grub-mkimage -v -c ${UNPACKDIR}/cfg -p ${EFIDIR} -d ./grub-core/ \ + grub-mkimage -v -c ${EMBEDDED_GRUB_CONFIG} -p ${EFIDIR} -d ./grub-core/ \ -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} \ ${GRUB_MKIMAGE_OPTS} ${GRUB_MKIMAGE_MODULES} } @@ -87,7 +89,7 @@ do_install() { # To include all available modules, add 'all' to GRUB_BUILDIN GRUB_BUILDIN ?= "boot linux ext2 fat serial part_msdos part_gpt normal \ - efi_gop iso9660 configfile search loadenv test" + efi_gop iso9660 configfile search probe loadenv test" # 'xen_boot' is a module valid only for aarch64 GRUB_BUILDIN:append:aarch64 = "${@bb.utils.contains('DISTRO_FEATURES', 'xen', ' xen_boot', '', d)}" From patchwork Fri Sep 5 16:41:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7517FCA1016 for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by mx.groups.io with SMTP id smtpd.web11.134.1757090540365918705 for ; Fri, 05 Sep 2025 09:42:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=Tghw7NMo; spf=pass (domain: underview.tech, ip: 209.85.219.45, mailfrom: vince@underview.tech) Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-726549f8161so21108146d6.0 for ; Fri, 05 Sep 2025 09:42:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090539; x=1757695339; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FvG99qTrAmjSaLoPwqOTPkdhf+GS6D//ePb0cA3Nblk=; b=Tghw7NMoPSc8fH6mTLLNUNb9fUK935GoQfQ+MoRrL8r7wIHbQapmoZeiY8OqLIttgQ 1nvcLGwayLYrleq6Gc8eimCIQh5taFrQy6/PBcyeBA6MtWQiaVUy/+62TVqwzxAyCD/+ I8qAvmjnSfdiR2WP7pkuH9zcRi+OuNOFtrxPGYzrpbZi3Dk3JImEspfAjxPGTJ3iAcVy X72j42yB/U/t7XLXDsPvQIggF7l5y8jxO+RqE/lqS4R4NUah7uTfEyyoRiw8mlxw+SdY FKJABViuQJewR8hZd0aqqWlpw5G70QkUfoOKU02DdPRWNDZVhG0OQAqQNDskIrrLkM/a P8aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090539; x=1757695339; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FvG99qTrAmjSaLoPwqOTPkdhf+GS6D//ePb0cA3Nblk=; b=aAnjxC0E7Wbf+CTmAxr8nXT96x0LJTs1cZcrhJnc6y5hfpBL3esDijuvoev8zRLIjI eNSIC7IXwIobIFu3YtMLtOo2yVuldRuxlhaEFpMHsktYuILo2L7+GUWG0UuXSgymfbFe SKJqFU6rX+ivgIc+swaQuXetuK/hPAulaP0pvJaTuvuk/rKhdR60kTNB5fJlDzmZqyPL 6Pf1q8sXDH9ZJ1/XvKlVUI/ht9pnY53sDHzMF/qeUklGpflS3+6A1Ns45pzKXXFoOfjJ i3wyRmi24ur96XHXLlgfeHFiVmA3Bc9XIdc7OWQsY6I8U+/qOBuG0KH5WY1R7tfecdoL aOYQ== X-Gm-Message-State: AOJu0YyE70Dn47f5rwxx+P/0bPpPL54lPTcvqe4/yRLNcxtuQyMnfDMS vc0uL+m4genewU3f7c2NDuNbAmdid77k6KSxWqL0CuG2N6Mr/GSxZgebkEMbxeoqX1cm9dDShQm SVJOH X-Gm-Gg: ASbGncswYOf+TUBI4NtcVv+qpPFMkS5kdt2axkMIFdGKeFlvgI91G8rZEKWepTaouM6 PpnWOaRqEV/S3fb/XjbvtYiVKv6wDXbK05UQsmi8UklaNGF/b0ws7gkENZTEkNVLXS+PxOpsGcQ kx/8xpJqcvT9JfsUlZqpFg3i53V6Fll8pZ+wtjg3YgvjZPXDz2rDAqZeOk8zo5KkAcWbQiRPGNh TSYIhohFUTeHjZfwJE0nat4gk21COV8Q1Zg0Q5NQOSfobRM6I8qdM3NelQZV549M1o5iTYIxM3N sOs3azf37kFR69/7d+WHOZYK2vTGd7N9YoncI2KoT8Lzf2WgDzDeiaUI8IqsU/JdJP9p3o1WfDn l2jOQpNe5DnBxR8pIdPQ7uDNCyL/nqlVc X-Google-Smtp-Source: AGHT+IF5sAkdhkVI8L67oUAWVhZPmLgw7j6bm2XoLnFq0e/G7MdVwQmA/bbm8m1L8JxhgOVjWUF9NA== X-Received: by 2002:a05:6214:1c82:b0:709:b92d:e84 with SMTP id 6a1803df08f44-70fac75c92amr272095676d6.16.1757090538690; Fri, 05 Sep 2025 09:42:18 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:18 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 7/8] oe-selftest[wic]: add test_grub_install_biosplusefi Date: Fri, 5 Sep 2025 12:41:35 -0400 Message-ID: <20250905164136.2896809-7-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905164136.2896809-1-vince@underview.tech> References: <20250905164136.2896809-1-vince@underview.tech> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223023 Commit adds test to check if required files are found in the EFI directory and that grub modules for both EFI and BIOS are found on the same partition as the grub config. Signed-off-by: Vincent Davis Jr --- meta/lib/oeqa/selftest/cases/wic.py | 54 +++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index 44442e402d..10c3497519 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -1456,6 +1456,60 @@ run_wic_cmd() { out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname)) self.assertEqual(1, len(out)) + @skipIfNotArch(['x86_64']) + def test_grub_install_biosplusefi(self): + """ + Test the installation of the grub in hybrid boot mode. + """ + + # create a temporary file for the WKS content + with NamedTemporaryFile("w", suffix=".wks") as wks: + wks.write( + 'part bios_boot --label bios_boot --fstype none --offset 1024 --fixed-size 1M ' \ + '--part-type 21686148-6449-6E6F-744E-656564454649 --source bootimg_biosplusefi ' \ + '--sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false"\n' \ + 'part efi_system --label efi_system --fstype vfat --fixed-size 48M ' \ + '--part-type C12A7328-F81F-11D2-BA4B-00A0C93EC93B --source bootimg_biosplusefi ' \ + '--sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false"\n' \ + 'part grub_data --label grub_data --fstype ext4 --fixed-size 78M ' \ + '--part-type 0FC63DAF-8483-4772-8E79-3D69D8477DE4 --source bootimg_biosplusefi ' \ + '--sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false"\n' \ + 'bootloader --ptable gpt --source bootimg_biosplusefi\n' + ) + wks.flush() + + img = "core-image-minimal" + config = 'DEPENDS:pn-%s += "grub-native grub grub-efi"' % (img) + + self.append_config(config) + bitbake(img) + self.remove_config(config) + + cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + runCmd(cmd) + + wksname = os.path.splitext(os.path.basename(wks.name))[0] + out = glob(os.path.join(self.resultdir, "%s-*.direct" % wksname)) + self.assertEqual(1, len(out)) + + sysroot = get_bb_var('RECIPE_SYSROOT_NATIVE', 'wic-tools') + + # Check if grub UEFI application (core.img) installed + result = runCmd("wic ls %s:2/EFI/BOOT -n %s" % (out[0], sysroot)) + self.assertIn('bootx64', result.output) + + # Check if grub.cfg is installed + result = runCmd("wic ls %s:3/boot/grub -n %s" % (out[0], sysroot)) + self.assertIn('grub', result.output) + + # Check if normal.mod is installed + result = runCmd("wic ls %s:3/boot/grub/i386-pc -n %s" % (out[0], sysroot)) + self.assertIn('normal', result.output) + + # Check if normal.mod is installed + result = runCmd("wic ls %s:3/boot/grub/x86_64-efi -n %s" % (out[0], sysroot)) + self.assertIn('normal', result.output) + @skipIfNotArch(['i586', 'i686', 'x86_64', 'aarch64']) def test_uefi_kernel(self): """ Test uefi-kernel in wic """ From patchwork Fri Sep 5 16:41:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Davis Jr X-Patchwork-Id: 69763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82303CAC580 for ; Fri, 5 Sep 2025 16:42:24 +0000 (UTC) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by mx.groups.io with SMTP id smtpd.web11.135.1757090541298289336 for ; Fri, 05 Sep 2025 09:42:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=ABi7nITJ; spf=pass (domain: underview.tech, ip: 209.85.219.43, mailfrom: vince@underview.tech) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-72816012c5cso19711806d6.0 for ; Fri, 05 Sep 2025 09:42:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1757090540; x=1757695340; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WAr2jUuf31unGa7pEo72YuJRETTe006dI512TTExHKs=; b=ABi7nITJR4PowQaZo7fX5DyWimOHehcZT7XopRMr+whnqcSO9Lvn1eo2J1J1OcoA9i Mtz5iD1TkAQUViWEpNKqcE2q6tpiOI3yqcelUzH7Tjc5I6HUCyEILA08OYjMaRgXfT3n ZKp9UNz4B5744cGu++8FQNTtTD4Bt9lQXPF5vWwybxDIADSWNGbXTBXFTJ14vv4UqWzv 4srGNafGUaZdYpGhBflX3tRtwGh07VgSqtTHzXmnd0tR7tXOHwT/he/7FQuIGu7DJril LZGMyr032bCvr5jlYiROE3BpxG0Kk3/x+DBTdGTGKUZeFb0gQx7Zy8yP8nna0UrgNaGS vsvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757090540; x=1757695340; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WAr2jUuf31unGa7pEo72YuJRETTe006dI512TTExHKs=; b=FhQDiOapp2N7YmKCDCMt8j/M7QXRkIMQnLReKoUjaPyaGO6NyBEwoPAzaKZ944JrFH dXmIDQ9i7vJYaTJnhaoVt68Mgfmg6mGcKfPXofAU5KxnPhXl2YTebWah2Op8vDDIpEvh Ub/9F4aJYDLD9lpzmoa71q7Rvv0yz5tHjSU5uuxTxjrVrST425QDC+TH3b2EEr586Anu qw06yKDK1lsFC8cXr2FnGYDS4wcI+VvfYWS2g4hK8Oo6gm2KbarYC5H9HMbu+tN4obS2 XbrM701YoaobB8YallF0TTTtUF/EjpxuY3zDrxUx1MxyOG5uWHvqUSh5PnpZZ5wZSyGU FEdQ== X-Gm-Message-State: AOJu0YxQwg014VevUUzsY346tbZb1ld6ZoxSgkmhlvG1JDqcpV3ScTd1 +may6K4KX/URxz6Bx8j5/7DNxZ4iiZ+wvQhoBhHVz7qlomNAYch+1iqL7q60oeOl3FkMWaIfi1h lrd0+ X-Gm-Gg: ASbGncvxISwF06NvN1qIjXYhmQusU8q/BFlmPibiTygbgRg+qk3zMRA7WvNstsmsBoq BEyaU8QfL6+kDtl96wt2UbCJadYhJuwMHwTOxRU4X3R69YpEeDbi0KtjuXQxVPVQEebd8LoLC0N LolMtVdPnlBJa7vPCO0dKOzJxYBN8ncB538SHAv22ZWLiJ/c+HaQl8vxiOQLlBMvNs3mlZl1XgR tmtnT1CznbkF7R52KXh5KAO8FlJkMu7k6aU1iyDOEwgLT9vqO1/rIzs7dOA6mbWp052awF4Ihie JLLdYQ+7G/D4eyVpR0SccyHJgudo0INYWLalxgozhKM/hkMOqj177v1vTBZp4/+AIS3kJC+ZalF 4jU6SEczSuoQFy1DBtGsKjxn+4VaKUOhV X-Google-Smtp-Source: AGHT+IEO5U47UZ9zJhBnGyK1R7dY8XczRhoxEcIH/QYHZy0eqHSCNsdVgcm/JYp7zOxW0TJa7YaXfQ== X-Received: by 2002:a05:6214:f6b:b0:728:7d77:63ba with SMTP id 6a1803df08f44-7287d7769b8mr68698326d6.33.1757090539585; Fri, 05 Sep 2025 09:42:19 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::d1ea]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-727b2c047dcsm39595046d6.59.2025.09.05.09.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Sep 2025 09:42:19 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v3 8/8] oe-selftest[wic]: add test_grub_install_biosplusefi_qemu Date: Fri, 5 Sep 2025 12:41:36 -0400 Message-ID: <20250905164136.2896809-8-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250905164136.2896809-1-vince@underview.tech> References: <20250905164136.2896809-1-vince@underview.tech> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 05 Sep 2025 16:42:24 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/223024 Test runs qemu given wic file and checks to see if the resulting wic image boots with either legacy bios or newer UEFI frimware whilst grub is the primary bootloader. Signed-off-by: Vincent Davis Jr --- meta/lib/oeqa/selftest/cases/wic.py | 61 +++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index 10c3497519..efd1f5e6f0 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -1510,6 +1510,67 @@ run_wic_cmd() { result = runCmd("wic ls %s:3/boot/grub/x86_64-efi -n %s" % (out[0], sysroot)) self.assertIn('normal', result.output) + @skipIfNotArch(['x86_64']) + @OETestTag("runqemu") + def test_grub_install_biosplusefi_qemu(self): + """Test biosplusefi plugin grub only in qemu""" + + img = "core-image-minimal" + + # create a temporary file for the WKS content + with NamedTemporaryFile("w", suffix=".wks") as wks: + wks.write( + 'part bios_boot --label bios_boot --fstype none --offset 1024 --fixed-size 1M ' \ + '--part-type 21686148-6449-6E6F-744E-656564454649 --source bootimg_biosplusefi ' \ + '--sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false"\n' \ + 'part efi_system --label efi_system --fstype vfat --fixed-size 48M ' \ + '--part-type C12A7328-F81F-11D2-BA4B-00A0C93EC93B --source bootimg_biosplusefi ' \ + '--sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false"\n' \ + 'part grub_data --label grub_data --fstype ext4 --fixed-size 78M ' \ + '--part-type 0FC63DAF-8483-4772-8E79-3D69D8477DE4 --source bootimg_biosplusefi ' \ + '--sourceparams="loader=grub-efi,loader-bios=grub,install-kernel-into-boot-dir=false"\n' \ + 'part roots --label rootfs --fstype ext4 --source rootfs ' \ + '--part-type 0FC63DAF-8483-4772-8E79-3D69D8477DE4\n' \ + 'bootloader --timeout=1 --ptable gpt --source bootimg_biosplusefi\n' + ) + wks.flush() + + config = 'DEPENDS:pn-%s += "grub-native grub grub-efi ovmf"\n' % (img) + config += 'IMAGE_FSTYPES:pn-%s += "wic"\n' % (img) + #config += 'MACHINE_FEATURES:append = " efi"\n' + config += 'IMAGE_CLASSES += "qemuboot"\n' + config += 'WKS_FILE = "%s"\n' % (os.path.basename(wks.name)) + config += 'WKS_SEARCH_PATH = "%s"\n' % (os.path.dirname(wks.name)) + + self.append_config(config) + bitbake(img) + self.remove_config(config) + + cmd = "wic create %s -e %s -o %s" % (wks.name, img, self.resultdir) + runCmd(cmd) + + # Test legacy bios boot + runqemu_params = get_bb_var('TEST_RUNQEMUPARAMS', img) or "" + with runqemu(img, ssh=False, runqemuparams='%s nographic' % (runqemu_params), + image_fstype='wic') as qemu: + # Check that we have all four /dev/sda* partitions (/boot and /) + cmd = "grep sda. /proc/partitions | wc -l" + status, output = qemu.run_serial(cmd) + self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + self.assertEqual(output, '4') + + # Test UEFI boot + # Can't test as it requires swapping the grub-efi*.bb + # embedded grub config. With one that works in the + # hybrid boot case. + #with runqemu(img, ssh=False, runqemuparams='%s ovmf nographic' % (runqemu_params), + # image_fstype='wic') as qemu: + # Check that we have all four /dev/sda* partitions (/boot and /) + # cmd = "grep sda. /proc/partitions | wc -l" + # status, output = qemu.run_serial(cmd) + # self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) + # self.assertEqual(output, '4') + @skipIfNotArch(['i586', 'i686', 'x86_64', 'aarch64']) def test_uefi_kernel(self): """ Test uefi-kernel in wic """