From patchwork Tue Sep 2 01:58:20 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: 69364 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 3E4FBCA1002 for ; Tue, 2 Sep 2025 01:58:44 +0000 (UTC) Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by mx.groups.io with SMTP id smtpd.web11.67782.1756778315921740057 for ; Mon, 01 Sep 2025 18:58:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@underview.tech header.s=google header.b=AGE+YUcG; spf=pass (domain: underview.tech, ip: 209.85.219.46, mailfrom: vince@underview.tech) Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-71a7108d992so10504146d6.3 for ; Mon, 01 Sep 2025 18:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=underview.tech; s=google; t=1756778314; x=1757383114; 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=AGE+YUcGsk8ZAKc+Qs/4AhmgB0e37eYOPxdIdzeoHPb+pHvfEetVw/gVLjtzeSpZph A+PQ3UFcdt6vvmLDS4s6dpQXW8vrH64abMG5cjtVso8Zi6QoIth+uHZ0GBBX5g0D2vZS gt/3IbRipy7L/GdhmoFdKZQK/8vCQbiV4ijgRNFvqjSL8k1xpES/790VvQjZf1y/Orwy 4vqaHSGQj9QNriSkp+c/c5QQr8k2gzcv5ZFa7FNlP0FOW4Xx6U8r3XX7WbBg9axkEaXc LsT8Z+NCPwht96HCQsKjSmHIL9kWapy79qOIVyFA7/EczoAeeDv0ZCDPbQ6TfV7IXU1M e0Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756778314; x=1757383114; 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=eJPizughk/CMHCWix8bozlT0fa8EAdw/4qL3nZHLMdk+vVMh1AMwc8S3zvNSYfPRvU gZilxIiXce9WD4xbrbBPovBCATRA78/xwCGNR0emKevZJ274gRR+bZ4+kL/qc2LARmVl cONjXsb+3j1lqEV/rI9bDnfeyUyaXcvClqAhFRShIpfNqviYbpBaxPYyR7Dj+N28pDnQ I/Z8u7et8D5rYEEi2X9zUqhRXbC6l+FZZWIA+vQbanfE9kOy2Xgw3ONZ66R3XbY1oeO1 WHjIdiglneMVR3dwfUQPsjrD3FiNPAhwFrhdmyD7OJaAcNGL69ITXR/Q/l0wRBy18vuK J2Kw== X-Gm-Message-State: AOJu0Yxym2Z4iwkjDGVn43h+Rb+7RbY+H0uFQs5vzw8gw/SAxMMcktF5 yRMQMvE3RaQCKBHvDXWCXPATHdkSs/69FVFuZPp3p+tRZUvQFFSw398iNjhjuzfmDu40SbheyQS eltJkq0U= X-Gm-Gg: ASbGncswAsQEeKMwGwlLjrggbp85fv806RtUT1I94S9S4ZoA+VrAE2Da9w6tGXiwyzl shVXFSbbmwoSFdp5G8LlXnB9Uxr920yrG0qLDgVlDud2GUAQBK69XU7WJ6qcj1H/E26F4GXfsBb 0dNtOQReS5eX4PCK5wwTXwKR3sRG3yMhGTbrnFWOyvDfXrF3ifUraxpQIZkv8gx7BIgDH1eDHvK 5A0T7yg/pct4cbk5TCyNS7wowAYQS1Pl/vkHwHcHd4DffA2KNw57kCYdGKKG/qhdv1co3PYvOaK PrlckrTqIYW1dRZgStMGT7gKAJENDoEhuulp4mP3MbiRdszrxBvl3Ry72iZ9zZpaBdL86zJ4q7I zghjB8Pg0+EI= X-Google-Smtp-Source: AGHT+IF4ehGgBiS7u9HV0Td3YTY1ppP7w8bzQf2jMHBs6igqZyQg9Sg1+a+xw4GR4bx/82Xw86Jq0Q== X-Received: by 2002:ad4:5ae3:0:b0:720:4a66:d3df with SMTP id 6a1803df08f44-7204a66e19amr16240056d6.16.1756778314364; Mon, 01 Sep 2025 18:58:34 -0700 (PDT) Received: from vince-server.. ([2601:406:4d01:1820::7efe]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-720a30b79aesm4284666d6.0.2025.09.01.18.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Sep 2025 18:58:34 -0700 (PDT) From: Vincent Davis Jr To: openembedded-core@lists.openembedded.org Cc: Vincent Davis Jr Subject: [PATCH 2/7] bootimg_efi: support grub hybrid boot Date: Mon, 1 Sep 2025 21:58:20 -0400 Message-ID: <20250902015825.2785789-2-vince@underview.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250902015825.2785789-1-vince@underview.tech> References: <20250902015825.2785789-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 01:58:44 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/222684 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-")]: