From patchwork Mon Jan 23 13:44:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1730464 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ISIgShaB; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=wAoucISU; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P0rxg5NHcz23gd for ; Tue, 24 Jan 2023 00:47:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=POFqhjz57bnrmhwEeptvyhBuy1OCT0gz5dTdO2V8mow=; b=ISIgShaBDLJhHa F65TpWkVrzIh618ZzgoY300g5mTAGvdRSW6mTYU2w/9uu9UQIbAXAGMM7IZxFZx+m8IeC+kfX8IdP t8Tf6HoGVXsTVPypuoWg4v47jVJtSmLP7EOUHnxC314PzdkaqLfy9lFZKeHgQPnimvGBGNEtzwImd sg9pUTE09UJBMMk38L2NcixjgIUB+EOylpgQGx20gmPh2u+wiy21mpED8Xi0BhP6dzcWYE2BD/oY9 /UiZenkE2MozyiSwizfmHB4ixl9PdwjikR70csw22NoBnE1+Qz4I1VqwX86MO+NpFTlsuWYJlLb7U bLi+0Xn0aU/7L+yGU4BQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJx8E-00HOrZ-Tk; Mon, 23 Jan 2023 13:45:07 +0000 Received: from mail.terefe.re ([5.255.96.200]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJx8B-00HOq3-CK for openwrt-devel@lists.openwrt.org; Mon, 23 Jan 2023 13:45:04 +0000 Received: from localhost.localdomain (unknown [212.106.161.74]) by mail.terefe.re (Postfix) with ESMTPSA id 12A0620C7A; Mon, 23 Jan 2023 14:45:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1674481502; bh=2FqLhQKTe5eNd05I+3c98aHsJhdR5W5ylRlsROB+1Yo=; h=From:To:Cc:Subject:Date:From; b=wAoucISUtfWnUdIwbZQz5sUPavjg9oBcveBvygO1BB+8KNWvl3ihdc4zAt1Meax12 P4DoBl89AP9Oeovf4VYCZuCTqBjyySgRB3jmn4R4yv/en90Zfr5WiuXWjsOVlRMFov XXuLOwpvGV2uC1NPibT01msHtqSABElZZjRXujVSXZjCbu0+jsHV4HpBgoA2up4rQ+ eb8pBquWe8wxgKHd08u0F8K5To0q5xmW1wewYLyFv7oTHfrjiUVJ2M10wJnu3k5eyP n0qVl5wKTIvrpe0TSVHz2+K9NaSl6lBYrkfv7m5/BrQhFWFMftFFtofczbPPHR8EHS lqFQWxVq5wRNw== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Tomasz Maciej Nowak Subject: [PATCH 1/2] x86: remove bootloader upgrade from preinit Date: Mon, 23 Jan 2023 14:44:49 +0100 Message-Id: <20230123134450.10623-1-tmn505@terefe.re> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_054503_619458_20C5F104 X-CRM114-Status: UNSURE ( 9.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Tomasz Maciej Nowak This hack was to bring all existing installations to the newest GRUB version as fast as possible. Since 19.07.x is EoL we can assume this task is completed. Now sysupgrade will solely be responsible f [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Tomasz Maciej Nowak This hack was to bring all existing installations to the newest GRUB version as fast as possible. Since 19.07.x is EoL we can assume this task is completed. Now sysupgrade will solely be responsible for bootloader upgrade. Signed-off-by: Tomasz Maciej Nowak --- .../lib/preinit/81_upgrade_bootloader | 18 ------------------ .../x86/base-files/lib/upgrade/platform.sh | 3 +-- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader diff --git a/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader b/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader deleted file mode 100644 index 42f04d76a7ec..000000000000 --- a/target/linux/x86/base-files/lib/preinit/81_upgrade_bootloader +++ /dev/null @@ -1,18 +0,0 @@ -upgrade_bootloader() { - local diskdev - - . /lib/upgrade/common.sh - - if [ ! -f /boot/grub/upgraded ] && export_bootdevice && export_partdevice diskdev 0; then - part_magic_efi "/dev/$diskdev" && return 0 - echo "(hd0) /dev/$diskdev" > /tmp/device.map - /usr/sbin/grub-bios-setup \ - -m "/tmp/device.map" \ - -d "/boot/grub" \ - -r "hd0,msdos1" \ - "/dev/$diskdev" \ - && touch /boot/grub/upgraded - fi -} - -[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main upgrade_bootloader diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh index d8f2eba97ecb..5dad7a538a59 100644 --- a/target/linux/x86/base-files/lib/upgrade/platform.sh +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -62,8 +62,7 @@ platform_do_bootloader_upgrade() { -m "/tmp/device.map" \ -d "/tmp/boot/boot/grub" \ -r "hd0,${parttable}1" \ - "/dev/$diskdev" \ - && touch /tmp/boot/boot/grub/upgraded + "/dev/$diskdev" umount /tmp/boot fi From patchwork Mon Jan 23 13:44:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 1730465 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EUwmbQ5x; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=terefe.re header.i=@terefe.re header.a=rsa-sha256 header.s=default header.b=0pC1ix76; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P0rxn4q0Nz23gd for ; Tue, 24 Jan 2023 00:47:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1nbJ4KRoGuZbOA5oQrSSA0W9r/V2eA6rt9DBs1BJpo8=; b=EUwmbQ5xKnEgjs xFqJbXaBUZWGx1bonVb7LnrRMG/cN1NjNzV7RWqjniTvyeK5Unis3OI6BagAzJI6vJJh4pB30jLbY 3hFcTAIMUzgnHRk5NmdDoILGpqbx5EhVwYdzu6zHvnhIkZNookbHaiWspq5PHzMZJ0uu47Dvci7oQ cjmzIy+sJE9rWGj0aamGc+UTNm/MRIz7gb7knDqwkQ3uQF8E80R1OZpj+7mPwVABP4qoQFdIYauFE VhYJekodAebx+poL2U29qINLmLasGh5JpTtWhiiQu+JtPhN3osbQxwaHVYiV70CmgUR/6eCJyNkQn vLXsQ3UJ7sqrLT5WNhkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJx8S-00HOuz-AY; Mon, 23 Jan 2023 13:45:20 +0000 Received: from mail.terefe.re ([5.255.96.200]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJx8G-00HOs1-Jl for openwrt-devel@lists.openwrt.org; Mon, 23 Jan 2023 13:45:10 +0000 Received: from localhost.localdomain (unknown [212.106.161.74]) by mail.terefe.re (Postfix) with ESMTPSA id 53F1920C7B; Mon, 23 Jan 2023 14:45:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=terefe.re; s=default; t=1674481502; bh=yDYBuf/PFxBFvGqGxYmmtFOgIO2/g8aQ7i/+lC6/GWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0pC1ix76YQK8zsCUvAPy7h/honm65PhFD0OvJubCnlBP75F9u+z3pA/N44oRMRDuH bR8TD3JyPEv4IDdVvzTK+ihnNq10bMCiPdDDdq738OTFxcEv1WfVSb7oSpd849VnXd FL+9jtcuTIf08cYTvTs2VpWr1c4l06NTNzDh1FV66iZj7Ic7ryPxYtS2jcHDeGv4X5 RSguYagDCuzqhhfFba5GJouIe55tLtAJBPSOLJVS5sS0wk2VNtxjG9blb3fqTL1mns P046fDzrnQCZGOOLXCMfJoFa2t+efTNRv534/2NLT0LwHZdb+DA4Nf1s0wqoGArBQL g7+XLMru6dYLw== From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Cc: Tomasz Maciej Nowak Subject: [PATCH 2/2] grub2: re-add test module Date: Mon, 23 Jan 2023 14:44:50 +0100 Message-Id: <20230123134450.10623-2-tmn505@terefe.re> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230123134450.10623-1-tmn505@terefe.re> References: <20230123134450.10623-1-tmn505@terefe.re> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_054508_842303_F2E304DA X-CRM114-Status: GOOD ( 12.05 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Tomasz Maciej Nowak It seems more hardware needs early load of firmware when initialised to work properly (at least Intel hardware). One of previous case is CPU microcode, which this series[1] tried to change. The second [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Tomasz Maciej Nowak It seems more hardware needs early load of firmware when initialised to work properly (at least Intel hardware). One of previous case is CPU microcode, which this series[1] tried to change. The second one is Intel graphics IC, which needs firmware for controlling DMC circuit (switch conncted display to DC6 power state). As it stands, the i915 module is built-in and it seems the hardware can't cope with firmware loaded later from rootfs, it needs to be supplied when the module is loaded. Unfortunately we need bootloader to handle the load of firmware in this case, but as previously mentioned series[1], there was an error when initrd was hardcoded, instead of testing existence for it and then loading. To remedy this in later the 55b808e0c4be ('x86: image: add test module to bootloader') was commited. Which was later accidentally dropped when grub2 image creation was moved to packages. Therefore bring back test module, so we can test for cases of existing firmware in grub.cfg. 1. https://patchwork.ozlabs.org/project/openwrt/cover/20181120162044.16371-1-tomek_n@o2.pl Fixes: 5a5df62d95f5 ("x86/grub2: move grub2 image creation to package") Signed-off-by: Tomasz Maciej Nowak --- package/boot/grub2/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/boot/grub2/Makefile b/package/boot/grub2/Makefile index c4cc43de2e60..7d6cfd539594 100644 --- a/package/boot/grub2/Makefile +++ b/package/boot/grub2/Makefile @@ -122,14 +122,14 @@ define Package/grub2/install -O i386-pc \ -c $(PKG_BUILD_DIR)/grub-early.cfg \ -o $(STAGING_DIR_IMAGE)/grub2/gpt-core.img \ - at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial vga + at_keyboard biosdisk boot chain configfile fat linux ls part_gpt reboot search serial test vga $(STAGING_DIR_HOST)/bin/grub-mkimage \ -d $(PKG_BUILD_DIR)/grub-core \ -p /boot/grub \ -O i386-pc \ -c ./files/grub-early.cfg \ -o $(STAGING_DIR_IMAGE)/grub2/generic-core.img \ - at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial vga + at_keyboard biosdisk boot chain configfile ext2 linux ls part_msdos reboot search serial test vga $(STAGING_DIR_HOST)/bin/grub-mkimage \ -d $(PKG_BUILD_DIR)/grub-core \ -p /boot/grub \ @@ -154,7 +154,7 @@ define Package/grub2-efi/install -O $(CONFIG_ARCH)-efi \ -c $(PKG_BUILD_DIR)/grub-early.cfg \ -o $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_x86_64),x64,ia32).efi \ - at_keyboard boot chain configfile fat linux ls part_gpt reboot serial efi_gop efi_uga + at_keyboard boot chain configfile fat linux ls part_gpt reboot serial test efi_gop efi_uga $(STAGING_DIR_HOST)/bin/grub-mkimage \ -d $(PKG_BUILD_DIR)/grub-core \ -p /boot/grub \