From patchwork Tue Sep 2 02:15:18 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: 69370 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 5C510CA1009 for ; Tue, 2 Sep 2025 02:15:44 +0000 (UTC) Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by mx.groups.io with SMTP id smtpd.web11.68035.1756779337447827893 for ; Mon, 01 Sep 2025 19:15:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=Dg5hgBOZ; spf=pass (domain: underview.tech, ip: 209.85.219.47, mailfrom: vince@underview.tech) Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-70df4418f98so42417806d6.0 for ; Mon, 01 Sep 2025 19:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1756779336; x=1757384136; 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=Cpgw4QovyeaadDer5Ue/TNRyQ9emj/RR1pKiQU0tvek=; b=Dg5hgBOZa0I/IO1T3HBtMz+1pVONrNJFQLkAbGgfEmIhsPmPlEpGWZkuGXNRk4zKPO mrDNKWOi1FsXWUM19wadu+A3XdoYZQSSIzROFmJ+9H6EJ25kZkmDfAvtfpQoQ9DrdeOB 7j1C9/FKv5vlVROCEl8thMe3TWJcc3Ph1UdfMILQuHhbruHfZGfr/UtO8YcyESIJz4Ml hJsNslD/BBWsOvgdigp7x6xCVd3+42wUr9lIOfi1Vp3liLq0KtoiOBoNKuCitvgJR9xS wCN+tBoFOtA49QOHVdaLTvbInI39Hh5AKg14uIJqYSJRZFwrLDisrtosmYKgLH9chgVP 0S7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756779336; x=1757384136; 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=Cpgw4QovyeaadDer5Ue/TNRyQ9emj/RR1pKiQU0tvek=; b=p+y7s209zysS6xiNwBBDyPQu3izurLs4zXl2KVLRJ8p4juOLc9ABPJKEINWzFewT2n RJYjzzbv9DNCEBAOFB9oWOgNdnB8hDyRNheRNwf7GqV6LX9khDpu7AzCSU7EnK6bah/+ YGabEPFZ4qLOh6eLggpBhtqbgzGTPjodxCe6K98Zw4IPtuqBvSPcVwsx3PfjdQiAkiHv kbtqMAnKwhJqo+StWlwWJ7Ufm49SwSgMD3NkhY+vobioecnm4D7JKMq/tytam5ncBq4u +jOMPlH3f2qsEF7RAkEvXCuzENTQ1eXUSkdqcIZ9PLCuVcEe6vBwJN66Ih6ZvHipDfxs bXGw== X-Gm-Message-State: AOJu0YzBERGeoUBF/Br3EKT22f/C33Vk8H6ssrK/nXETGyEiegItOWk8 6Ukgh3fRjTB7HbObiOekwmmfeg73uFGrc5nGn4P3GO3Jv+ckesgpWVm9kX/uA5ZD8OlwuzPjg9R thMo/SMc= X-Gm-Gg: ASbGncsQ+7qb36FyXcMZukwBUmCynS/FsGNNpJUKmp0jqkO+Zqz2XLEy6F2soFysuMD nkrvrzfaNMZeFOg3MgZQIoOZNe4feB0swxXR931+XlDAVvf997gK/nPMdPoA14AVl+3PQsx8gJF 3mudJpMbewk2UW7XvXnpFFtV3RPCraDHpa5FWp0K63DZtnnTlSlXcJWVWB/DUViuezPrH/kXUny p9ipbLn5ngymWsSpC2AwIMbE/HSANix9JwKMDCftfl9vmOk7n0IapZm+2LHvshxxyhoEYfz+H/N JnVbEhQ+a6ncpVNeIUjBL7bL+PgbFetLKyRjwqFBV4cXs/2Unu3erjLDIfJnY5HU/gjQjn9uCSa Is7I/R2IjnBUHL84lf6+M2W/wsXeIm7jNw3JR5Rp+9a7UyzAryvV6fiFO X-Google-Smtp-Source: AGHT+IFhCRVKjojM5053nDUpotQTIqxkNzDfm7+kEMCxPGs4O/Gq3JAvJHPX9I3pmioxDwnbapoWZQ== X-Received: by 2002:a05:6214:4102:b0:70f:a558:2955 with SMTP id 6a1803df08f44-70fa98b1f61mr124879086d6.22.1756779335651; Mon, 01 Sep 2025 19:15:35 -0700 (PDT) Received: from vince-B550I-AORUS-PRO-AX.. ([2601:406:4d01:1820:90ff:fb15:d573:4b27]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-720b55cf6c9sm4194436d6.49.2025.09.01.19.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Sep 2025 19:15:35 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [OE-core][PATCH v2 2/7] bootimg_efi: support grub hybrid boot Date: Mon, 1 Sep 2025 22:15:18 -0400 Message-Id: <20250902021523.25780-2-vince@underview.tech> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250902021523.25780-1-vince@underview.tech> References: <20250902021523.25780-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 ; Tue, 02 Sep 2025 02:15:44 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/222693 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-")]: