From patchwork Sat Jan 30 20:44:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Matyukevich X-Patchwork-Id: 1433744 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: 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=20161025 header.b=kI1MvnNB; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DSmRs47gXz9sVJ for ; Sun, 31 Jan 2021 07:45:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B17E685F32; Sat, 30 Jan 2021 20:45:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3DC4p9Wy59qI; Sat, 30 Jan 2021 20:45:06 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 52EC985F0E; Sat, 30 Jan 2021 20:45:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id C75A21BF2E4 for ; Sat, 30 Jan 2021 20:45:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B7135203D3 for ; Sat, 30 Jan 2021 20:45:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YaZg0Gxc3cUs for ; Sat, 30 Jan 2021 20:45:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by silver.osuosl.org (Postfix) with ESMTPS id 2B60020398 for ; Sat, 30 Jan 2021 20:45:01 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id m22so7276536ljj.4 for ; Sat, 30 Jan 2021 12:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nVj8gg/VQqdmJ0saXzMiXuKRdk6boHKsSEkVVxnjBnk=; b=kI1MvnNBf1wxOAo7QS8RvK9rcbmc/+UUT6KeGj7tYDQn+YlMoOevgdjjXidtJ7cJAW DQVl2IeUHChcdl6u+DiRxXhJCKM7bAuXJZqt61/NC5xHGyFRmvBMGxWixlaVYB/8nCZe sVeA9a4fZZSLfTMX98PbZ3Gcye+Msal/Co3pgvSLp75ryQruDPQxudbOokPb8jMyrBV2 ECmNMzuaa/3umOVHY1Iwq89wAd0UlWdTJdpnJo1iiE+jD1f90ft0mmq8lyq+Ioj4KpTJ CJC1/mlKT21nKl2pzV2md4CSNCsQp8sE7xN2y7HspqjZWQk+LyEjZ42p4xzesBy9NmM6 EGPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nVj8gg/VQqdmJ0saXzMiXuKRdk6boHKsSEkVVxnjBnk=; b=MaPEjgT9nIeyjTD5WFht9RUr5VNQHb0kLavmN0g4p7b/MQENoKQFvHID4jFmsa/wp/ JPOCZiEGZxekySTPb/avGwxA8WD+0+GhFZ5TxEpE16xF1vwbiIJPH0HhN/WmOjlsk7Ge f5mLWoIBPxxM2FXL0Pc12uKyFQ8Zm1Hgl/mMjuYWQGK5vYAQ6ILbmRtIDmEiMtEi6cuI VxwVg7Tfcdu7nbUQYGm5xXDQICTCz1hwIrKUgY8WgzP+N7BZx6wdQB+83DcTIvFbZ7W7 3BGdNX8BNkTHuDxQ2vjToODME1GWL1WDdpzwomGt/6IZK3+COGGTa7Z9tT+pemB3wyhq 4vUw== X-Gm-Message-State: AOAM530y/ytsnhHOBc0LWTERd1S7EOTHxDfmiC5CWEDma6a4uwOoBCwv xLXTVjdtgKMA9AkjsYgN0Bf3pf2EJM1i7w== X-Google-Smtp-Source: ABdhPJzDMQLiIPTEESYXRK6OO5xB6phlSaYIB/txymPxHYj6EE5DoP3jrZ7Y/LJEuHm0guxzYGpPaA== X-Received: by 2002:a2e:3c0a:: with SMTP id j10mr5754632lja.376.1612039498701; Sat, 30 Jan 2021 12:44:58 -0800 (PST) Received: from localhost.localdomain ([5.188.167.245]) by smtp.googlemail.com with ESMTPSA id w13sm3077245ljw.115.2021.01.30.12.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jan 2021 12:44:58 -0800 (PST) From: Sergey Matyukevich To: buildroot@buildroot.org Date: Sat, 30 Jan 2021 23:44:55 +0300 Message-Id: <20210130204456.793098-1-geomatsi@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Subject: [Buildroot] [RFC PATCH] stm32mp1: modify gpt partitions to fix BSP update X-BeenThere: buildroot@busybox.net 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: Bartosz Bilas , Sergey Matyukevich , Christophe Priouzeau , Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Hi all, BSP update for stm32mp1 boards does not work right out of the box. The first boot is ok, but the second boot fails: NOTICE: CPU: STM32MP157CAC Rev.B NOTICE: Model: STMicroelectronics STM32MP157C-DK2 Discovery Board NOTICE: Board: MB1272 Var2.0 Rev.C-01 NOTICE: BL2: v2.4(release):2020.11-1087-g8fac193e6d-dirty NOTICE: BL2: Built : 20:58:09, Jan 27 2021 ERROR: Checksum: 0x5023a37 (awaited: 0x5046ea4) ERROR: Header check failed ERROR: BL2: Failed to load image id 5 (-12) The root cause is in changes for stm32mp1 trusted defconfig in updated U-Boot: see U-Boot commit 76db1681da52 ("stm32mp1: use a specific SD/eMMC partition for U-Boot enviromnent"). Starting from that commit, U-Boot environment is stored at the end of the U-Boot partition. As a result, saving environment changes GPT partition checksum verified by ATF. IIUC at least the following two approaches can be implemented to make updated BSP work smoothly. The first approach is to modify U-Boot config fragment for stm32mp1 boards and to re-enable saving U-Boot environment on ext4. However this choice implies certain restriction on rootfs ext4 features since it should be writable by U-Boot. See the mentioned U-Boot commit message for details. Another approach is implemented by the attached patch: keep U-Boot environment on a dedicated GPT partition. Thoughts ? Comments ? Regards, Sergey --- .../common/stm32mp157/genimage.cfg.template | 4 ++++ .../overlay/boot/extlinux/extlinux.conf | 2 +- .../uboot/0001-uboot-stm32mp1-uboot-env.patch | 13 +++++++++++++ .../overlay/boot/extlinux/extlinux.conf | 2 +- .../uboot/0001-uboot-stm32mp1-uboot-env.patch | 13 +++++++++++++ configs/stm32mp157a_dk1_defconfig | 9 +++++---- configs/stm32mp157c_dk2_defconfig | 9 +++++---- 7 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 board/stmicroelectronics/stm32mp157a-dk1/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch create mode 100644 board/stmicroelectronics/stm32mp157c-dk2/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch diff --git a/board/stmicroelectronics/common/stm32mp157/genimage.cfg.template b/board/stmicroelectronics/common/stm32mp157/genimage.cfg.template index f341c19f2f..12f79efa90 100644 --- a/board/stmicroelectronics/common/stm32mp157/genimage.cfg.template +++ b/board/stmicroelectronics/common/stm32mp157/genimage.cfg.template @@ -15,6 +15,10 @@ image sdcard.img { image = "u-boot.stm32" } + partition env { + size = 16K + } + partition rootfs { image = "rootfs.ext4" bootable = "yes" diff --git a/board/stmicroelectronics/stm32mp157a-dk1/overlay/boot/extlinux/extlinux.conf b/board/stmicroelectronics/stm32mp157a-dk1/overlay/boot/extlinux/extlinux.conf index 437e80fdeb..62cc58d7e2 100644 --- a/board/stmicroelectronics/stm32mp157a-dk1/overlay/boot/extlinux/extlinux.conf +++ b/board/stmicroelectronics/stm32mp157a-dk1/overlay/boot/extlinux/extlinux.conf @@ -1,4 +1,4 @@ label stm32mp157a-dk1-buildroot kernel /boot/zImage devicetree /boot/stm32mp157a-dk1.dtb - append root=/dev/mmcblk0p4 rootwait + append root=/dev/mmcblk0p5 rootwait diff --git a/board/stmicroelectronics/stm32mp157a-dk1/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch b/board/stmicroelectronics/stm32mp157a-dk1/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch new file mode 100644 index 0000000000..9582974caf --- /dev/null +++ b/board/stmicroelectronics/stm32mp157a-dk1/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch @@ -0,0 +1,13 @@ +diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +index 6787619290..85c0e1d0a3 100644 +--- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi ++++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +@@ -16,7 +16,7 @@ + config { + u-boot,boot-led = "heartbeat"; + u-boot,error-led = "error"; +- u-boot,mmc-env-partition = "ssbl"; ++ u-boot,mmc-env-partition = "env"; + st,adc_usb_pd = <&adc1 18>, <&adc1 19>; + st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; + st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>; diff --git a/board/stmicroelectronics/stm32mp157c-dk2/overlay/boot/extlinux/extlinux.conf b/board/stmicroelectronics/stm32mp157c-dk2/overlay/boot/extlinux/extlinux.conf index 5b7f56ee77..e1b3ca9f61 100644 --- a/board/stmicroelectronics/stm32mp157c-dk2/overlay/boot/extlinux/extlinux.conf +++ b/board/stmicroelectronics/stm32mp157c-dk2/overlay/boot/extlinux/extlinux.conf @@ -1,4 +1,4 @@ label stm32mp157c-dk2-buildroot kernel /boot/zImage devicetree /boot/stm32mp157c-dk2.dtb - append root=/dev/mmcblk0p4 rootwait + append root=/dev/mmcblk0p5 rootwait diff --git a/board/stmicroelectronics/stm32mp157c-dk2/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch b/board/stmicroelectronics/stm32mp157c-dk2/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch new file mode 100644 index 0000000000..9582974caf --- /dev/null +++ b/board/stmicroelectronics/stm32mp157c-dk2/patches/uboot/0001-uboot-stm32mp1-uboot-env.patch @@ -0,0 +1,13 @@ +diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +index 6787619290..85c0e1d0a3 100644 +--- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi ++++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +@@ -16,7 +16,7 @@ + config { + u-boot,boot-led = "heartbeat"; + u-boot,error-led = "error"; +- u-boot,mmc-env-partition = "ssbl"; ++ u-boot,mmc-env-partition = "env"; + st,adc_usb_pd = <&adc1 18>, <&adc1 19>; + st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; + st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>; diff --git a/configs/stm32mp157a_dk1_defconfig b/configs/stm32mp157a_dk1_defconfig index 6883aaba7b..4f34456e9d 100644 --- a/configs/stm32mp157a_dk1_defconfig +++ b/configs/stm32mp157a_dk1_defconfig @@ -1,11 +1,12 @@ BR2_arm=y BR2_cortex_a7=y -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_8=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y BR2_ROOTFS_OVERLAY="board/stmicroelectronics/stm32mp157a-dk1/overlay/" +BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32mp157a-dk1/patches/" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/stmicroelectronics/common/stm32mp157/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.13" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.10" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/stmicroelectronics/stm32mp157a-dk1/linux.config" BR2_LINUX_KERNEL_DTS_SUPPORT=y @@ -17,7 +18,7 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ARM_TRUSTED_FIRMWARE=y BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y -BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.2" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.4" BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="stm32mp1" BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="STM32MP_SDMMC=1 AARCH32_SP=sp_min DTB_FILE_NAME=stm32mp157a-dk1.dtb" BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES="*.stm32" @@ -25,7 +26,7 @@ BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC=y BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y -BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.07" +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10" BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32mp15_trusted" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/stmicroelectronics/stm32mp157a-dk1/uboot-fragment.config" # BR2_TARGET_UBOOT_FORMAT_BIN is not set diff --git a/configs/stm32mp157c_dk2_defconfig b/configs/stm32mp157c_dk2_defconfig index 50d875749b..1f3028dcd1 100644 --- a/configs/stm32mp157c_dk2_defconfig +++ b/configs/stm32mp157c_dk2_defconfig @@ -1,11 +1,12 @@ BR2_arm=y BR2_cortex_a7=y -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_8=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y BR2_ROOTFS_OVERLAY="board/stmicroelectronics/stm32mp157c-dk2/overlay/" +BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32mp157c-dk2/patches/" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/stmicroelectronics/common/stm32mp157/post-image.sh" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.13" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.10" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/stmicroelectronics/stm32mp157c-dk2/linux.config" BR2_LINUX_KERNEL_DTS_SUPPORT=y @@ -17,7 +18,7 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="120M" # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_ARM_TRUSTED_FIRMWARE=y BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y -BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.2" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.4" BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="stm32mp1" BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="STM32MP_SDMMC=1 AARCH32_SP=sp_min DTB_FILE_NAME=stm32mp157c-dk2.dtb" BR2_TARGET_ARM_TRUSTED_FIRMWARE_IMAGES="*.stm32" @@ -25,7 +26,7 @@ BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC=y BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y -BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.07" +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10" BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32mp15_trusted" BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/stmicroelectronics/stm32mp157c-dk2/uboot-fragment.config" # BR2_TARGET_UBOOT_FORMAT_BIN is not set