From patchwork Sun Jun 6 20:13:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 1488342 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=2605:bc80:3010::137; helo=smtp4.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=libero.it header.i=@libero.it header.a=rsa-sha256 header.s=s2021 header.b=Mwitvqcz; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (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 ozlabs.org (Postfix) with ESMTPS id 4Fynww4Wr6z9sRN for ; Mon, 7 Jun 2021 06:22:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 78BFB40370; Sun, 6 Jun 2021 20:22:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org 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 LNhc02tAkEHS; Sun, 6 Jun 2021 20:22:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 14E4A4036F; Sun, 6 Jun 2021 20:22:16 +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 BA8C51BF3EC for ; Sun, 6 Jun 2021 20:22:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A99CA606E6 for ; Sun, 6 Jun 2021 20:22:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=libero.it 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 KPEWCe_gTf55 for ; Sun, 6 Jun 2021 20:22:13 +0000 (UTC) X-Greylist: delayed 00:08:17 by SQLgrey-1.8.0 Received: from libero.it (smtp-35.italiaonline.it [213.209.10.35]) by smtp3.osuosl.org (Postfix) with ESMTPS id 25F1C605D0 for ; Sun, 6 Jun 2021 20:22:12 +0000 (UTC) Received: from passgat-Modern-14-A10M.homenet.telecomitalia.it ([79.17.119.101]) by smtp-35.iol.local with ESMTPA id pz9Yl3Tlmsptipz9dlrtEr; Sun, 06 Jun 2021 22:13:53 +0200 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libero.it; s=s2021; t=1623010433; bh=1vxo8dIod1kJ+1rx8iV/WWnCwZitIxyVLdn+bq2UKVE=; h=From; b=MwitvqczVstZtMkN8zu4JKXsZukqUTgZnxAxc6bDDzgR4aEoXH8SlsljUAOQtUpny bn+j27/n6177dUUF7LuzgqlBoO9izRzXSJeS3r2jEaYVXyRhkZUjsBb9i+OSSBVr1I zIoQHdamM+fxIpjsBe82iaPk3OHzt8s1Gk3bR4p1ZzAdd0r6UI504pcUrsTcyZ4qAU WQYMZT7UoZ+pR/232oBpv3X39n1t7KiFkewgesilNOXYk0p8T0H/8NEljV3EcPvHB6 FNkTU56FeX09TPa+npN788L7L01BehjS4xz1LTrWutt4jtTu7SxSVyIUZT/pefyxo5 Y2rB9LfndD0+g== X-CNFS-Analysis: v=2.4 cv=Bo1Yfab5 c=1 sm=1 tr=0 ts=60bd2c81 cx=a_exe a=do1bHx4A/kh2kuTIUQHSxQ==:117 a=do1bHx4A/kh2kuTIUQHSxQ==:17 a=9I5xiGouAAAA:8 a=8b9GpE9nAAAA:8 a=uP1ucDPQAAAA:8 a=kOa7hdaWzsTVf3QFBoMA:9 a=J7shsdt8cnAA:10 a=ARFN2YZ7Uv8kHtb7LS-q:22 a=T3LWEMljR5ZiDmsYVIUa:22 a=9a9ggB8z3XFZH39hjkD6:22 To: buildroot@buildroot.org Date: Sun, 6 Jun 2021 22:13:39 +0200 Message-Id: <20210606201339.30855-1-dariobin@libero.it> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4xfOlzF4ufDm/14CZNlhYFRPZCXpShx8TpClRPSXXfTiAjufW0rC9q/Fu0llkjf7AhpNZSP2Y6oQk8Vf/61sor0u21KmI/SBm1pdoVMFHzc+bgolrhjjvw eFE4Hbax1VcegL8oTP5K6XEYWjwomYFRHP/lT09QRReOcv7iZrTSwhrb42uOFWhLmYdAHuWSgIltmzHfdYKbz8+noOCaJCKzRGox6tQJUNlDqBPx1O0jxmD0 AFoRDZG7M+9n7fcGVNucG7OFylTssnWTCLn75v1otIDT+ccKKSyc4i+dKAKg1UVboYi/Vo18RgTrocbhXMKTyA== Subject: [Buildroot] [PATCH 1/1] configs/stm32f429_disco: fix kernel bootup 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: , From: Dario Binacchi via buildroot Reply-To: Dario Binacchi Cc: Christophe Priouzeau , Dario Binacchi MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" As described by [1], the kernel generated by the configuration for the STM32f469 Discovery board is buggy. Using a newer kernel, as suggested by [1], increases the dtb and Kernel image size. In particular, the 5.12 version of the kernel generates a dtb and a kernel image whose sum exceeds the 2 MByte of the flash module. So I decided to replace the afboot-stm32 bootloader in the flash with U-boot to easily boot the system from sdcard without having to worry about the size of dtb, kernel and rootfs generated by the configuration. This solution allows you to fix the kernel boot issue and makes it possible to use its future versions. [1] http://buildroot-busybox.2317881.n4.nabble.com/Bug-11746-New-stm32f469-didn-t-work-correctly-td219644.html Signed-off-by: Dario Binacchi --- .../stm32f469-disco/extlinux.conf | 4 +++ .../stm32f469-disco/flash.sh | 4 +-- .../stm32f469-disco/genimage.cfg | 27 +++++++++++++++ .../stm32f469-disco/linux.fragment | 1 + ...sco-don-t-force-init-in-chosen-boota.patch | 33 ------------------- .../stm32f469-disco/post-build.sh | 4 +++ .../stm32f469-disco/readme.txt | 16 +++++++-- configs/stm32f469_disco_defconfig | 19 ++++++----- 8 files changed, 62 insertions(+), 46 deletions(-) create mode 100644 board/stmicroelectronics/stm32f469-disco/extlinux.conf create mode 100644 board/stmicroelectronics/stm32f469-disco/genimage.cfg create mode 100644 board/stmicroelectronics/stm32f469-disco/linux.fragment delete mode 100644 board/stmicroelectronics/stm32f469-disco/patches/linux/0001-ARM-stm32f249-disco-don-t-force-init-in-chosen-boota.patch create mode 100755 board/stmicroelectronics/stm32f469-disco/post-build.sh diff --git a/board/stmicroelectronics/stm32f469-disco/extlinux.conf b/board/stmicroelectronics/stm32f469-disco/extlinux.conf new file mode 100644 index 0000000000..1c2db4383b --- /dev/null +++ b/board/stmicroelectronics/stm32f469-disco/extlinux.conf @@ -0,0 +1,4 @@ +label stm32f469-disco-buildroot + kernel /zImage + devicetree /stm32f469-disco.dtb + append console=ttySTM0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext2 rootwait earlyprintk consoleblank=0 ignore_loglevel diff --git a/board/stmicroelectronics/stm32f469-disco/flash.sh b/board/stmicroelectronics/stm32f469-disco/flash.sh index 0ec0beb2de..984d2b2599 100755 --- a/board/stmicroelectronics/stm32f469-disco/flash.sh +++ b/board/stmicroelectronics/stm32f469-disco/flash.sh @@ -13,8 +13,6 @@ ${OUTPUT_DIR}/host/bin/openocd -f board/stm32f469discovery.cfg \ -c "reset init" \ -c "flash probe 0" \ -c "flash info 0" \ - -c "flash write_image erase ${OUTPUT_DIR}/images/stm32f469i-disco.bin 0x08000000" \ - -c "flash write_image erase ${OUTPUT_DIR}/images/stm32f469-disco.dtb 0x08004000" \ - -c "flash write_image erase ${OUTPUT_DIR}/images/xipImage 0x08008000" \ + -c "flash write_image erase ${OUTPUT_DIR}/images/u-boot.bin 0x08000000" \ -c "reset run" \ -c "shutdown" diff --git a/board/stmicroelectronics/stm32f469-disco/genimage.cfg b/board/stmicroelectronics/stm32f469-disco/genimage.cfg new file mode 100644 index 0000000000..bc945955fa --- /dev/null +++ b/board/stmicroelectronics/stm32f469-disco/genimage.cfg @@ -0,0 +1,27 @@ +image boot.vfat { + vfat { + files = { + "zImage", + "stm32f469-disco.dtb", + "extlinux" + } + } + size = 16M +} + +image sdcard.img { + hdimage { + } + + partition u-boot { + partition-type = 0xC + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + size = 32M + } +} + diff --git a/board/stmicroelectronics/stm32f469-disco/linux.fragment b/board/stmicroelectronics/stm32f469-disco/linux.fragment new file mode 100644 index 0000000000..90f5e8a8ff --- /dev/null +++ b/board/stmicroelectronics/stm32f469-disco/linux.fragment @@ -0,0 +1 @@ +# CONFIG_XIP_KERNEL is not set \ No newline at end of file diff --git a/board/stmicroelectronics/stm32f469-disco/patches/linux/0001-ARM-stm32f249-disco-don-t-force-init-in-chosen-boota.patch b/board/stmicroelectronics/stm32f469-disco/patches/linux/0001-ARM-stm32f249-disco-don-t-force-init-in-chosen-boota.patch deleted file mode 100644 index 750e477dfc..0000000000 --- a/board/stmicroelectronics/stm32f469-disco/patches/linux/0001-ARM-stm32f249-disco-don-t-force-init-in-chosen-boota.patch +++ /dev/null @@ -1,33 +0,0 @@ -From c8f8f33c2f0460a34c9545b01a7972a7ed2df0e9 Mon Sep 17 00:00:00 2001 -From: Christophe Priouzeau -Date: Mon, 29 May 2017 13:38:16 +0200 -Subject: [PATCH] ARM: stm32f249-disco: don't force init= in /chosen/bootargs - -There is no reason to override the kernel's default init= value, as -this breaks userspace that assumes the kernel default of /init is -used. Since stm32 is often used with a minimal bootloader -(afboot-stm32) that doesn't provide any mechanism to override the DTB, -we need to adjust the kernel command line in the Device Tree source. - -Signed-off-by: Thomas Petazzoni -Signed-off-by: Christophe Priouzeau ---- - arch/arm/boot/dts/stm32f469-disco.dts | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/boot/dts/stm32f469-disco.dts b/arch/arm/boot/dts/stm32f469-disco.dts -index 0dd56ef..93ee1b2 100644 ---- a/arch/arm/boot/dts/stm32f469-disco.dts -+++ b/arch/arm/boot/dts/stm32f469-disco.dts -@@ -53,7 +53,7 @@ - compatible = "st,stm32f469i-disco", "st,stm32f469"; - - chosen { -- bootargs = "root=/dev/ram rdinit=/linuxrc"; -+ bootargs = "root=/dev/ram"; - stdout-path = "serial0:115200n8"; - }; - --- -2.7.4 - diff --git a/board/stmicroelectronics/stm32f469-disco/post-build.sh b/board/stmicroelectronics/stm32f469-disco/post-build.sh new file mode 100755 index 0000000000..ec20fca7d9 --- /dev/null +++ b/board/stmicroelectronics/stm32f469-disco/post-build.sh @@ -0,0 +1,4 @@ +#!/bin/sh +BOARD_DIR="$(dirname $0)" + +install -m 0644 -D $BOARD_DIR/extlinux.conf $BINARIES_DIR/extlinux/extlinux.conf diff --git a/board/stmicroelectronics/stm32f469-disco/readme.txt b/board/stmicroelectronics/stm32f469-disco/readme.txt index 888bff08a1..c1e1d30e69 100644 --- a/board/stmicroelectronics/stm32f469-disco/readme.txt +++ b/board/stmicroelectronics/stm32f469-disco/readme.txt @@ -15,5 +15,17 @@ Flashing ./board/stmicroelectronics/stm32f469-disco/flash.sh output/ -It will flash the minimal bootloader, the Device Tree Blob, and the -kernel image which includes the root filesystem as initramfs. +It will flash the U-boot bootloader. + +Creating SD card +---------------- + +Buildroot prepares an"sdcard.img" image in the output/images/ directory, +ready to be dumped on a SD card. Launch the following command as root: + + dd if=output/images/sdcard.img of=/dev/ + +*** WARNING! This will destroy all the card content. Use with care! *** + +For details about the medium image layout and its content, see the +definition in board/stmicroelectronics/stm32f469-disco/genimage.cfg. diff --git a/configs/stm32f469_disco_defconfig b/configs/stm32f469_disco_defconfig index 9760d51878..8701ccbc02 100644 --- a/configs/stm32f469_disco_defconfig +++ b/configs/stm32f469_disco_defconfig @@ -1,19 +1,22 @@ BR2_arm=y BR2_cortex_m4=y -BR2_GLOBAL_PATCH_DIR="board/stmicroelectronics/stm32f469-disco/patches" -BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_11=y -BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/common/stm32f4xx/stm32-post-build.sh" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/stmicroelectronics/common/stm32f4xx/stm32-post-build.sh board/stmicroelectronics/stm32f469-disco/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32f469-disco/genimage.cfg" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.11" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.12" BR2_LINUX_KERNEL_DEFCONFIG="stm32" -BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0x00000000.config" +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(LINUX_DIR)/arch/arm/configs/dram_0x00000000.config board/stmicroelectronics/stm32f469-disco/linux.fragment" BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM=y -BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="xipImage" +BR2_LINUX_KERNEL_IMAGE_TARGET_NAME="zImage" BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="stm32f469-disco" BR2_PACKAGE_BUSYBOX_CONFIG="package/busybox/busybox-minimal.config" -BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_SIZE="32M" # BR2_TARGET_ROOTFS_TAR is not set -BR2_TARGET_AFBOOT_STM32=y +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="stm32f469-discovery" +BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_OPENOCD=y