From patchwork Fri Dec 3 23:17:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1563416 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ajcYPjfa; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J5TJ407nZz9s0r for ; Sat, 4 Dec 2021 10:17:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9DF1E60BE9; Fri, 3 Dec 2021 23:17:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s8bPlBiO9lUB; Fri, 3 Dec 2021 23:17:36 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id CF01360BE7; Fri, 3 Dec 2021 23:17:35 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 71C0B1BF3FB for ; Fri, 3 Dec 2021 23:17:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 612DF41484 for ; Fri, 3 Dec 2021 23:17:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1mL-eIO8-25e for ; Fri, 3 Dec 2021 23:17:23 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by smtp4.osuosl.org (Postfix) with ESMTPS id 8868C410B4 for ; Fri, 3 Dec 2021 23:17:23 +0000 (UTC) Received: by mail-wm1-x32a.google.com with SMTP id p18so3514313wmq.5 for ; Fri, 03 Dec 2021 15:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=++4rfGp7OOX0xrbeCIZl1MRDSqTQ58ckFmxnebi4sYs=; b=ajcYPjfaWWfFtFpcPbnLT5c542d/LgAXpHNkoqCoYDDLM5dEf9j1uzPQEyA9t/tYYf NFIphx7HYew8srN2PDU92t1GXPHKUgwIchszW8XPDBN53b+XbT/y/oG/vVXqJM95d4UD Bd2HCyvm7CPfRxLe0WXEY1nxwWhcFrN4GDNrKX5y3Kh56CLKVDfoxYwiy1qW9dnX2uyK 0ZuSQerOLzgBeFkDXExwaPlX5F8wGK4WpruK+cbxYm9nVfRJuw+DBaZ1pidPNuvoyBes 1F3Up0UhPSKHHY3sylH7PcisTDUCgwOeouXK74GPXZuX6cvhwO0g15m4Xd85tNLgBuWb ANEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=++4rfGp7OOX0xrbeCIZl1MRDSqTQ58ckFmxnebi4sYs=; b=6AWGRTjQmDK9OdqtqyKRteLEkX/Veb/0B7/6xSv377MdGhS660Zk0FigiJdX1RNpE2 4/XPHEYAAxzOebBBg80UR/MwAMNT9TcmXMVcA/Q6l6DB/RcKfH+HU2g3LBuoZgv3juTi c32HtVu0W4PfLEZfphC9WFn/qlrX4dU01+1KpdrZmB8OB2dMRY6aIqdkmbH7h66mN7s1 4V1jdnDsG/OgXrzHXlFLBa637vejcnz4WsbJZOSFfzTvs9Is+6XPt0UoUcMw7zYLzXuX bJywO+VXafwcq6VLtKRmJPspQoMEQP6hM3+Bjq5BccIFqKs7LZegcqxB0aw2swK2fqVf kOfg== X-Gm-Message-State: AOAM531PO4EM44+duPqiTNLgGiRoR5n7qNdni4N7U8NUufdrYqWVGNN6 09K84jtAqydrkfD5Qy/M2YO9yTau8gE= X-Google-Smtp-Source: ABdhPJxGTt918f4wC0phCwTrbvw94taRw6KrwZ0YTjiAciKZhY794WUfk0Kp7aUw9nkjVa2aua3b5g== X-Received: by 2002:a1c:9d48:: with SMTP id g69mr19260277wme.188.1638573441646; Fri, 03 Dec 2021 15:17:21 -0800 (PST) Received: from scaer.home ([2a01:cb19:8b51:cb00:28e3:e36b:4389:5725]) by smtp.gmail.com with ESMTPSA id z6sm4684945wmp.9.2021.12.03.15.17.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 15:17:21 -0800 (PST) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 4 Dec 2021 00:17:18 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/3] boot/grub2/Config.in: add symbols to represent legacy and EFI boot X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?K=C3=B6ry_Maincent?= , "Yann E . MORIN" , Adam Duskett Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" From: Adam Duskett There are cases to want a synthetic information whether the legacy BIOS or U-Boot boot scheme, or the EFI boot scheme, are enabled, without resorting to testing all and each platforms. This is already the cae in grub2 itself, for the configuration of the BIOS/U-Boot boot partition, and builtin modules and configuration on one hand, and the EFI builtin modules and configuraiton on the other hand. It is also the case for mender-grubenv, which will want to know if either or both are enabled, but without having to resort to testing all the cases. Add two new symbols, that each represent those conditions: * BR2_TARGET_GRUB2_HAS_LEGACY_BOOT * BR2_TARGET_GRUB2_HAS_EFI_BOOT Each target selects the appropriate bool, which makes it much more simple for other packages such as mender-grubenv to check if grub legacy or EFI is selected. And of course, we also make use of those symbols in grub2 itself, to simplify the conditions for showing.hiding legacy and EFI options. Additionally (but that does not merit being in its own patch), add a comment on the closing 'endif' for the EFI part. Signed-off-by: Adam Duskett Signed-off-by: Yann E. MORIN Cc: Köry Maincent --- Changes v5 -> v6 (Adam): - new patch Changes v6 -> v7: (Yann): - s/BR2_TARGET_GRUB_/BR2_TARGET_GRUB2_/ - rename variables anyway - use variables in grub2 itself --- boot/grub2/Config.in | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in index 7bbe697932..92b5dd501b 100644 --- a/boot/grub2/Config.in +++ b/boot/grub2/Config.in @@ -34,12 +34,19 @@ config BR2_TARGET_GRUB2 if BR2_TARGET_GRUB2 +config BR2_TARGET_GRUB2_HAS_LEGACY_BOOT + bool + +config BR2_TARGET_GRUB2_HAS_EFI_BOOT + bool + config BR2_TARGET_GRUB2_HAS_PTF bool config BR2_TARGET_GRUB2_I386_PC bool "i386-pc" depends on BR2_i386 || BR2_x86_64 + select BR2_TARGET_GRUB2_HAS_LEGACY_BOOT help Select this option if the platform you're targetting is a x86 or x86-64 legacy BIOS based platform. @@ -48,6 +55,7 @@ config BR2_TARGET_GRUB2_I386_EFI bool "i386-efi" depends on BR2_i386 || BR2_x86_64 select BR2_TARGET_GRUB2_HAS_PTF + select BR2_TARGET_GRUB2_HAS_EFI_BOOT help Select this option if the platform you're targetting has a 32 bits EFI BIOS. Note that some x86-64 platforms use a 32 @@ -57,6 +65,7 @@ config BR2_TARGET_GRUB2_X86_64_EFI bool "x86-64-efi" depends on BR2_x86_64 select BR2_TARGET_GRUB2_HAS_PTF + select BR2_TARGET_GRUB2_HAS_EFI_BOOT help Select this option if the platform you're targetting has a 64 bits EFI BIOS. @@ -64,6 +73,7 @@ config BR2_TARGET_GRUB2_X86_64_EFI config BR2_TARGET_GRUB2_ARM_UBOOT bool "arm-uboot" depends on BR2_arm + select BR2_TARGET_GRUB2_HAS_LEGACY_BOOT help Select this option if the platform you're targetting is an ARM u-boot platform, and you want to boot Grub 2 as an u-boot @@ -73,6 +83,7 @@ config BR2_TARGET_GRUB2_ARM_EFI bool "arm-efi" depends on BR2_arm select BR2_TARGET_GRUB2_HAS_PTF + select BR2_TARGET_GRUB2_HAS_EFI_BOOT help Select this option if the platform you're targetting is an ARM platform and you want to boot Grub 2 as an EFI @@ -81,12 +92,13 @@ config BR2_TARGET_GRUB2_ARM_EFI config BR2_TARGET_GRUB2_ARM64_EFI bool "arm64-efi" depends on BR2_aarch64 + select BR2_TARGET_GRUB2_HAS_EFI_BOOT help Select this option if the platform you're targetting is an Aarch64 platform and you want to boot Grub 2 as an EFI application. -if BR2_TARGET_GRUB2_I386_PC || BR2_TARGET_GRUB2_ARM_UBOOT +if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT comment "Options for the x86 legacy BIOS or ARM U-Boot support" @@ -114,10 +126,9 @@ config BR2_TARGET_GRUB2_BUILTIN_CONFIG_PC device and other configuration parameters, but however menu entries cannot be described in this embedded configuration. -endif # BR2_TARGET_GRUB2_I386_PC || BR2_TARGET_GRUB2_ARM_UBOOT +endif # BR2_TARGET_GRUB2_HAS_LEGACY_BOOT -if BR2_TARGET_GRUB2_I386_EFI || BR2_TARGET_GRUB2_X86_64_EFI || \ - BR2_TARGET_GRUB2_ARM_EFI || BR2_TARGET_GRUB2_ARM64_EFI +if BR2_TARGET_GRUB2_HAS_EFI_BOOT comment "Options for the EFI BIOS or ARM EFI support" @@ -135,7 +146,8 @@ config BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI device and other configuration parameters, but however menu entries cannot be described in this embedded configuration. -endif +endif # BR2_TARGET_GRUB2_HAS_EFI_BOOT + config BR2_TARGET_GRUB2_INSTALL_TOOLS bool "install tools" help From patchwork Fri Dec 3 23:17:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1563419 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=nhejA1DQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J5TJW0kq7z9s0r for ; Sat, 4 Dec 2021 10:18:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 62ADF60BEF; Fri, 3 Dec 2021 23:18:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AvSoEF124d3m; Fri, 3 Dec 2021 23:18:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id CCD3E60BE9; Fri, 3 Dec 2021 23:17:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 0A3741BF3FB for ; Fri, 3 Dec 2021 23:17:26 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id EC941410B4 for ; Fri, 3 Dec 2021 23:17:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V9UEVsssF55r for ; Fri, 3 Dec 2021 23:17:24 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by smtp4.osuosl.org (Postfix) with ESMTPS id 122C341299 for ; Fri, 3 Dec 2021 23:17:23 +0000 (UTC) Received: by mail-wm1-x333.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so6003847wmj.5 for ; Fri, 03 Dec 2021 15:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R/cQR0ZIfEmqzqhTQixBzQKPc6Qnwd+RessOfd+AwoQ=; b=nhejA1DQP66KrFxmeY4cWeYQpG8tzaP+m5kGXVQSXEetspunk+e7q8vzXI1nK8y3Ra Ez5bk8D8q8SfXcbVV4V4BQfVw5aASOnV8PxqafTTpj+C85FfOll23niU0ae0ZWcdLWVO esWvjrN/t9r/wPhW8H5IQ3Z4pLuyhiUv6yX8HFmM0CItKMnEUF+dtEZsI3/KHh5J9m77 R9leBdmOFhjZMUYw8PgdZ0d+5UbmKGXmBUpJQFMGC/NYjg4nNdICTV5MAyAr9S0Gj8E4 PgR0IrGXFHY+Gq+aFKasO/SAuor6uBOcZZrxA75HNRUOJIG8fWRRaQx1KBr6AcJHMPMK BzxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=R/cQR0ZIfEmqzqhTQixBzQKPc6Qnwd+RessOfd+AwoQ=; b=uedfIvbmSLeF+/ty5yPX02t68Z1eTUoYr5dr3cgIx9iDeiousYWvbMkRYP7cLR6+y2 8P7OqzYs+JHNsQ9AqHzfPP4JGRsdTXi9lv2L+EdhVHaxLS5yECDWNoF1GXgVbyKqhf9I vm/CLY2+f+HEcvVa6Uwfqz6+y3eDw1Cr4uKotKw2u9NTnKI42Kl3mqjGp+jceCoD7p4J ZeFHXzv+qahTC0D8r4vltsK9vVcmHRETayqYyKlFA+ZkfJhmrEOaHTv9I65ewF3N/wLh gHhOOEgnbtsyHCpepuTC5L8B4mF4bE8lobtl5CWcihQaQ0Z1Ydl7hsdJsr0jlyHdiEcC UnQw== X-Gm-Message-State: AOAM531X159B6cuozu6Rlm/2eYzPcz7oa8lhGtTDWRCBMny4qh6RQ+BY IBCJ7lbJs1aEsMRdttBh2/cXaqWvDcA= X-Google-Smtp-Source: ABdhPJwiZSjF7NAgMMabt+qeQxhb2363K5E0ozdZPvrw0QtFCCzcAkz7NJIbPfJffuIrgpT/+IiPdA== X-Received: by 2002:a1c:1fc2:: with SMTP id f185mr17272796wmf.149.1638573442380; Fri, 03 Dec 2021 15:17:22 -0800 (PST) Received: from scaer.home ([2a01:cb19:8b51:cb00:28e3:e36b:4389:5725]) by smtp.gmail.com with ESMTPSA id z6sm4684945wmp.9.2021.12.03.15.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 15:17:22 -0800 (PST) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 4 Dec 2021 00:17:19 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/3] package/mender-grubenv: fix modules list help and variable X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?K=C3=B6ry_Maincent?= , "Yann E. MORIN" , Adam Duskett Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" The help was missing the regexp module. The variable assignment was missing spaces around the equal sign. Signed-off-by: Adam Duskett [yann.morin.1998@free.fr: - split to its own patch - fix assignment too ] Signed-off-by: Yann E. MORIN Cc: Köry Maincent --- package/mender-grubenv/Config.in | 2 +- package/mender-grubenv/mender-grubenv.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package/mender-grubenv/Config.in b/package/mender-grubenv/Config.in index 97f785ad3f..38da5b84fe 100644 --- a/package/mender-grubenv/Config.in +++ b/package/mender-grubenv/Config.in @@ -8,7 +8,7 @@ config BR2_PACKAGE_MENDER_GRUBENV integrate with the GRUB bootloader. The following Grub modules must be selected for this package: - loadenv hashsum echo halt gcry_sha256 test + loadenv hashsum echo halt gcry_sha256 test regexp https://github.com/mendersoftware/grub-mender-grubenv diff --git a/package/mender-grubenv/mender-grubenv.mk b/package/mender-grubenv/mender-grubenv.mk index 07df25512c..d7bdcc99eb 100644 --- a/package/mender-grubenv/mender-grubenv.mk +++ b/package/mender-grubenv/mender-grubenv.mk @@ -30,7 +30,7 @@ MENDER_GRUBENV_DEFINES = \ # These grub modules must be built in for the grub scripts to work properly. # Without them, the system will not boot. -MENDER_GRUBENV_MANDATORY_MODULES=loadenv hashsum echo halt gcry_sha256 test regexp +MENDER_GRUBENV_MANDATORY_MODULES = loadenv hashsum echo halt gcry_sha256 test regexp MENDER_GRUBENV_MODULES_MISSING = \ $(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES)),\ $(MENDER_GRUBENV_MANDATORY_MODULES)) From patchwork Fri Dec 3 23:17:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1563417 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=k4hIm4PW; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4J5TJH71CMz9s0r for ; Sat, 4 Dec 2021 10:17:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C5B0683E12; Fri, 3 Dec 2021 23:17:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pB4rQFAJZ2P2; Fri, 3 Dec 2021 23:17:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id C9F3983E04; Fri, 3 Dec 2021 23:17:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id C20B01BF3FB for ; Fri, 3 Dec 2021 23:17:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id BE9A360BE7 for ; Fri, 3 Dec 2021 23:17:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7KxN_HBwwXwW for ; Fri, 3 Dec 2021 23:17:25 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by smtp3.osuosl.org (Postfix) with ESMTPS id E25E760BE2 for ; Fri, 3 Dec 2021 23:17:24 +0000 (UTC) Received: by mail-wm1-x332.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so3349541wmd.1 for ; Fri, 03 Dec 2021 15:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XCDWoDaVElGAX5rtqfBmez/TScvlfu8V5lUQ5esLc9E=; b=k4hIm4PWIRLtyhQGqc/TKm5aOxwem8HUJ4HIus2ZU4L0qSB5/m7S6ZM7L9TkTGKoHL ISWu1bJytOCnam7VVp3yU3e/+vNmUiNVYpAv2gO2eS5KqChXA5qB+JJ7KhXcmkTJggU8 s4elkd3AOCczSVTpYl3su0rO7YAhK4L7cOHxAZ0KlNOAdvvgcMj/6QAVXXXZlRzkjKm+ egERSJMAfeVVW84oyVIDxxPAIRyB93xwBw8mGHZjtZwpoxx17JUtC4EkZFwWLJJ+MNgy KdbkRN6wRtu4oFxak8gTB6RbzhC0obVzDh9XruezlP+IgDIhImlGNF7d21zjyjZow3qp j7Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XCDWoDaVElGAX5rtqfBmez/TScvlfu8V5lUQ5esLc9E=; b=U15cmRhyRixsgdP9wftnapCMQOEMvvBDg1KgA+G3adFjQ9VFgKWRqE9MgWWgsHHCLa wQSdgR8DhaSw5CAb+dQMZR2jY7fPXMjvS0PtDBDsBduIb68N7FXgmzpyRJlsZp31lycX yBFmeIrP6To7S59Rf+ulhx5szSrgmXo8pqaSQAtKcE+Qk/26nOd9mtO3CvitR8Raqryd /DvhQb4Yf4XQTC5CqdNTFnebCdjOrHuO5k3xryvvr1zzetLsF2NbGkGNUlvzvEFl7E09 z3X6DMYGj76Is2O5jWFY7k404TRt78lNfsUQilX4cs6yjca4T1WqdPBWVEZdoSQy8AO9 Z6jQ== X-Gm-Message-State: AOAM530eO12PaUWbDMyrPmM8SR0Vq056su3A6IL50aEroCN05MZFapXG ZUt5d8ns7GGN8kr5NZF5FDU6qfPzaLE= X-Google-Smtp-Source: ABdhPJwjGAZVuaxDnrlIfKC740yFz7K2ZZQ3utuoHzSqQVyt9qO56ddNg6pnDXWeBeOUPRp4/Pk82A== X-Received: by 2002:a1c:6a04:: with SMTP id f4mr18791547wmc.56.1638573443198; Fri, 03 Dec 2021 15:17:23 -0800 (PST) Received: from scaer.home ([2a01:cb19:8b51:cb00:28e3:e36b:4389:5725]) by smtp.gmail.com with ESMTPSA id z6sm4684945wmp.9.2021.12.03.15.17.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 15:17:22 -0800 (PST) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 4 Dec 2021 00:17:20 +0100 Message-Id: <82bf2ffa3ad531e8e93cf4b2f65193438b8b7199.1638573387.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/3] package/mender-grubenv: fix grub module checks X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?K=C3=B6ry_Maincent?= , "Yann E . MORIN" , Adam Duskett Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" From: Adam Duskett Commit b68810e70cbd (boot/grub2: add support to build multiple Grub2 configurations in the same build) broke mender-grubenv by splititng up BR2_TARGET_GRUB2_BUILTIN_MODULES into two separate symbols, one for legacy boot and one for EFI boot. This change causes a systematic build failure now, as the legacy variable BR2_TARGET_GRUB2_BUILTIN_MODULES is now always empty (during build). We fix that by supplicating the missing modules to check: one for EFI and one for legacy boot. The EFI check is tricky: Indeed, there can be more than one EFI platform enabled simultaneously; indeed, on x86_64, we can have both the 32-bit and 64-bit EFI platforms enabled. So the check is inverted, and we check that no platform is not enabled (yeah, double negation). For consistency, we do the same for the legacy boot, even though in that case, there can only ever be only one enabled at once at most. Furthermore, mender-grubenv does not support multiple installations of grub concurrently; it can only be installed for either legacy or EFI, not both at the same time: /etc/mender-grubenv.cfg, its configuration file, can only contain settings for one or the other, not both. So we add a new check to Config.in to support only one grub installation type at a time. Signed-off-by: Adam Duskett Signed-off-by: Yann E. MORIN Cc: Köry Maincent --- changes v1 -> v2: - Change ifeq ($(BR2_TARGET_GRUB2_X86_64_EFI),y) to ifneq ($(BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI),) to cover all grub2 efi scenarios. (Thomas) - Change BR2_TARGET_GRUB2_BUILTIN_MODULES to BR2_TARGET_GRUB2_BUILTIN_MODULES_PC (thomas) Changes v2 -> v3: - Check for both MODULES_EFI and MODULES_PC (Thomas) Changes v3 -> v4: - Add qstrips to needed variables (Thomas) - Check for empty module lists (Thomas) - Split up MENDER_GRUBENV_INSTALL_IMAGES_CMDS to work with pc and efi at the same time. Changes v4 -> v5 (Yann): - drop superfluous check on empty modules lists - move EFI and legacy commands under same condition as checks Changes v5 -> v6 (Adam): - Add a check in Config.in to ensure only one grub target is selected - Clean up the commit grammar. Changes v6 -> v7: - variables were renamed - misc eye-candy --- package/mender-grubenv/Config.in | 5 +++ package/mender-grubenv/mender-grubenv.mk | 55 +++++++++++++++--------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/package/mender-grubenv/Config.in b/package/mender-grubenv/Config.in index 38da5b84fe..33d63fbfa3 100644 --- a/package/mender-grubenv/Config.in +++ b/package/mender-grubenv/Config.in @@ -3,6 +3,8 @@ config BR2_PACKAGE_MENDER_GRUBENV depends on BR2_TARGET_GRUB2_ARCH_SUPPORTS depends on BR2_PACKAGE_MENDER # runtime depends on BR2_TARGET_GRUB2 + depends on (BR2_TARGET_GRUB2_HAS_LEGACY_BOOT && !BR2_TARGET_GRUB2_HAS_EFI_BOOT) || \ + (BR2_TARGET_GRUB2_HAS_LEGACY_BOOT && !BR2_TARGET_GRUB2_HAS_EFI_BOOT) help Contains the boot scripts and tools used by Mender to integrate with the GRUB bootloader. @@ -34,3 +36,6 @@ comment "mender-grubenv needs a grub2 bootloader" depends on BR2_TARGET_GRUB2_ARCH_SUPPORTS depends on BR2_PACKAGE_MENDER depends on !BR2_TARGET_GRUB2 + +comment "mender-grubenv does not support both legacy and EFI grub2 bootloaders at the same time" + depends on BR2_TARGET_GRUB2_HAS_LEGACY_BOOT && BR2_TARGET_GRUB2_HAS_EFI_BOOT diff --git a/package/mender-grubenv/mender-grubenv.mk b/package/mender-grubenv/mender-grubenv.mk index d7bdcc99eb..dd0cf7e4f9 100644 --- a/package/mender-grubenv/mender-grubenv.mk +++ b/package/mender-grubenv/mender-grubenv.mk @@ -13,7 +13,7 @@ MENDER_GRUBENV_LICENSE_FILES = LICENSE MENDER_GRUBENV_DEPENDENCIES = grub2 MENDER_GRUBENV_INSTALL_IMAGES = YES -ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y) +ifeq ($(BR2_TARGET_GRUB_LEGACY)$(BR2_TARGET_GRUB2_ARM_UBOOT),y) MENDER_GRUBENV_ENV_DIR = /boot/grub else MENDER_GRUBENV_ENV_DIR = /boot/EFI/BOOT @@ -31,14 +31,41 @@ MENDER_GRUBENV_DEFINES = \ # These grub modules must be built in for the grub scripts to work properly. # Without them, the system will not boot. MENDER_GRUBENV_MANDATORY_MODULES = loadenv hashsum echo halt gcry_sha256 test regexp -MENDER_GRUBENV_MODULES_MISSING = \ - $(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES)),\ + +ifeq ($(BR2_TARGET_GRUB2_HAS_LEGACY_BOOT),y) +MENDER_GRUBENV_MODULES_MISSING_PC = \ + $(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES_PC)),\ $(MENDER_GRUBENV_MANDATORY_MODULES)) +define MENDER_GRUBENV_INSTALL_I386_CFG + mkdir -p $(BINARIES_DIR)/boot-part/grub + cp -dpfr $(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/grub.cfg \ + $(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/mender_grubenv* \ + $(BINARIES_DIR)/boot-part/grub +endef +endif # BR2_TARGET_GRUB2_HAS_LEGACY_BOOT + +ifeq ($(BR2_TARGET_GRUB2_HAS_EFI_BOOT),y) +MENDER_GRUBENV_MODULES_MISSING_EFI = \ + $(filter-out $(call qstrip,$(BR2_TARGET_GRUB2_BUILTIN_MODULES_EFI)),\ + $(MENDER_GRUBENV_MANDATORY_MODULES)) + +define MENDER_GRUBENV_INSTALL_EFI_CFG + mkdir -p $(BINARIES_DIR)/efi-part/EFI/BOOT + cp -dpfr $(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/grub.cfg \ + $(TARGET_DIR)$(MENDER_GRUBENV_ENV_DIR)/mender_grubenv* \ + $(BINARIES_DIR)/efi-part/EFI/BOOT +endef +endif # BR2_TARGET_GRUB2_HAS_EFI_BOOT + ifeq ($(BR2_PACKAGE_MENDER_GRUBENV)$(BR_BUILDING),yy) -ifneq ($(MENDER_GRUBENV_MODULES_MISSING),) -$(error The following missing grub2 modules must be enabled for mender-grubenv \ - to work: $(MENDER_GRUBENV_MODULES_MISSING)) +ifneq ($(MENDER_GRUBENV_MODULES_MISSING_EFI),) +$(error The following missing grub2 efi modules must be enabled for mender-grubenv \ + to work: $(MENDER_GRUBENV_MODULES_MISSING_EFI)) +endif +ifneq ($(MENDER_GRUBENV_MODULES_MISSING_PC),) +$(error The following missing grub2 pc modules must be enabled for mender-grubenv \ + to work: $(MENDER_GRUBENV_MODULES_MISSING_PC)) endif endif @@ -54,21 +81,9 @@ define MENDER_GRUBENV_INSTALL_TARGET_CMDS $(MENDER_GRUBENV_MAKE_ENV) $(MAKE) DESTDIR=$(TARGET_DIR) -C $(@D) install endef -# Overwrite the default grub2 config files with the ones in this package. -ifeq ($(BR2_TARGET_GRUB2_I386_PC)$(BR2_TARGET_GRUB2_ARM_UBOOT),y) define MENDER_GRUBENV_INSTALL_IMAGES_CMDS - mkdir -p $(BINARIES_DIR)/boot-part/grub - cp -dpfr $(TARGET_DIR)/boot/grub/grub.cfg \ - $(TARGET_DIR)/boot/grub/mender_grubenv* \ - $(BINARIES_DIR)/boot-part/grub + $(MENDER_GRUBENV_INSTALL_I386_CFG) + $(MENDER_GRUBENV_INSTALL_EFI_CFG) endef -else -define MENDER_GRUBENV_INSTALL_IMAGES_CMDS - mkdir -p $(BINARIES_DIR)/efi-part/EFI/BOOT - cp -dpfr $(TARGET_DIR)/boot/EFI/BOOT/grub.cfg \ - $(TARGET_DIR)/boot/EFI/BOOT/mender_grubenv* \ - $(BINARIES_DIR)/efi-part/EFI/BOOT -endef -endif $(eval $(generic-package))