Message ID | 20231013210841.153788-1-giulio.benetti@benettiengineering.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] board/bananapi/bananapi-m2-berry: switch to use extlinux.conf | expand |
Hello Giulio, Thanks for your work on this! On Fri, 13 Oct 2023 23:08:40 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote: > diff --git a/board/bananapi/bananapi-m2-berry/genimage.cfg b/board/bananapi/bananapi-m2-berry/genimage.cfg > index 535f3dffee..92c8677545 100644 > --- a/board/bananapi/bananapi-m2-berry/genimage.cfg > +++ b/board/bananapi/bananapi-m2-berry/genimage.cfg > @@ -1,15 +1,3 @@ > -image boot.vfat { > - vfat { > - files = { > - "zImage", > - "sun8i-v40-bananapi-m2-berry.dtb", > - "boot.scr" > - } > - } > - > - size = 64M > -} > - > image sdcard.img { > hdimage { > } > @@ -21,12 +9,6 @@ image sdcard.img { > size = 1016K # 1MB - 8KB > } > > - partition boot { > - partition-type = 0xC > - bootable = "true" > - image = "boot.vfat" > - } > - > partition rootfs { > partition-type = 0x83 > image = "rootfs.ext4" Are you sure this works? Indeed the FAT partition used to have the bootable = "true" flag. Now, no partition has this flag. But from what I remember, the heuristic that U-Boot uses to determine which partition has the extlinux.conf file is precisely this bootable flag. Could you double check this? Thanks! Thomas
Hi Thomas, On 02/11/23 19:07, Thomas Petazzoni wrote: > Hello Giulio, > > Thanks for your work on this! > > On Fri, 13 Oct 2023 23:08:40 +0200 > Giulio Benetti <giulio.benetti@benettiengineering.com> wrote: > >> diff --git a/board/bananapi/bananapi-m2-berry/genimage.cfg b/board/bananapi/bananapi-m2-berry/genimage.cfg >> index 535f3dffee..92c8677545 100644 >> --- a/board/bananapi/bananapi-m2-berry/genimage.cfg >> +++ b/board/bananapi/bananapi-m2-berry/genimage.cfg >> @@ -1,15 +1,3 @@ >> -image boot.vfat { >> - vfat { >> - files = { >> - "zImage", >> - "sun8i-v40-bananapi-m2-berry.dtb", >> - "boot.scr" >> - } >> - } >> - >> - size = 64M >> -} >> - >> image sdcard.img { >> hdimage { >> } >> @@ -21,12 +9,6 @@ image sdcard.img { >> size = 1016K # 1MB - 8KB >> } >> >> - partition boot { >> - partition-type = 0xC >> - bootable = "true" >> - image = "boot.vfat" >> - } >> - >> partition rootfs { >> partition-type = 0x83 >> image = "rootfs.ext4" > > Are you sure this works? Indeed the FAT partition used to have the > bootable = "true" flag. Now, no partition has this flag. But from what > I remember, the heuristic that U-Boot uses to determine which partition > has the extlinux.conf file is precisely this bootable flag. > > Could you double check this? Just rebuilt, flashed and given a run, this is the log, specifically in u-boot: ``` Bus usb@1c19000: USB EHCI 1.00 scanning bus usb@1c19000 for devices... 2 USB Device(s) found scanning usb for storage devices... 0 Storage Device(s) found Hit any key to stop autoboot: 0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found /boot/extlinux/extlinux.conf Retrieving file: /boot/extlinux/extlinux.conf 1: Bananapi M2 Berry linux Retrieving file: /boot/zImage append: console=ttyS0,115200n8 root=/dev/mmcblk0p1 rootwait Retrieving file: /boot/sun8i-v40-bananapi-m2-berry.dtb Kernel image @ 0x42000000 [ 0x000000 - 0x4ee608 ] ## Flattened Device Tree blob at 43000000 Booting using the fdt blob at 0x43000000 Working FDT set to 43000000 Loading Device Tree to 49ff6000, end 49fff231 ... OK Working FDT set to 49ff6000 Starting kernel ... [ 0.000000] Booting Linux on physical CPU 0x0 ``` It looks for /boot/extlinux/extlinux.conf among the medias and other scripts. So yes, it works. Kind regards
On Thu, 2 Nov 2023 19:30:48 +0100 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote: > Just rebuilt, flashed and given a run, this is the log, specifically in > u-boot: Hum, indeed, the U-Boot documentation says: "Note that in the absence of any partition that is explicitly marked bootable, U-Boot falls back to searching the first valid partition of a disk for boot configuration files." So, that's why it works. Thomas
On Fri, 13 Oct 2023 23:08:40 +0200 Giulio Benetti <giulio.benetti@benettiengineering.com> wrote: > While switching bump Linux version to 6.1.57 and U-Boot version to > 2023.10. > > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> > --- > board/bananapi/bananapi-m2-berry/boot.cmd | 7 ------- > board/bananapi/bananapi-m2-berry/extlinux.conf | 4 ++++ > board/bananapi/bananapi-m2-berry/genimage.cfg | 18 ------------------ > board/bananapi/bananapi-m2-berry/post-build.sh | 5 +++++ > configs/bananapi_m2_berry_defconfig | 9 ++++----- > 5 files changed, 13 insertions(+), 30 deletions(-) > delete mode 100644 board/bananapi/bananapi-m2-berry/boot.cmd > create mode 100644 board/bananapi/bananapi-m2-berry/extlinux.conf > create mode 100755 board/bananapi/bananapi-m2-berry/post-build.sh Series applied to master, thanks! Thomas
> Il giorno 4 nov 2023, alle ore 15:02, Thomas Petazzoni <thomas.petazzoni@bootlin.com> ha scritto: > > On Thu, 2 Nov 2023 19:30:48 +0100 > Giulio Benetti <giulio.benetti@benettiengineering.com> wrote: > >> Just rebuilt, flashed and given a run, this is the log, specifically in >> u-boot: > > Hum, indeed, the U-Boot documentation says: > > "Note that in the absence of any partition that is explicitly marked > bootable, U-Boot falls back to searching the first valid partition of a > disk for boot configuration files." Thank you for digging and finding the reason! Best regards Giulio > > So, that's why it works. > > Thomas > -- > Thomas Petazzoni, co-owner and CEO, Bootlin > Embedded Linux and Kernel engineering and training > https://bootlin.com
diff --git a/board/bananapi/bananapi-m2-berry/boot.cmd b/board/bananapi/bananapi-m2-berry/boot.cmd deleted file mode 100644 index 9efb6bc89d..0000000000 --- a/board/bananapi/bananapi-m2-berry/boot.cmd +++ /dev/null @@ -1,7 +0,0 @@ -setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait - -mmc dev 0 -fatload mmc 0 $kernel_addr_r zImage -fatload mmc 0 $fdt_addr_r sun8i-v40-bananapi-m2-berry.dtb - -bootz $kernel_addr_r - $fdt_addr_r diff --git a/board/bananapi/bananapi-m2-berry/extlinux.conf b/board/bananapi/bananapi-m2-berry/extlinux.conf new file mode 100644 index 0000000000..1f1b4f5cf3 --- /dev/null +++ b/board/bananapi/bananapi-m2-berry/extlinux.conf @@ -0,0 +1,4 @@ +label Bananapi M2 Berry linux + kernel /boot/zImage + devicetree /boot/sun8i-v40-bananapi-m2-berry.dtb + append console=ttyS0,115200n8 root=/dev/mmcblk0p1 rootwait diff --git a/board/bananapi/bananapi-m2-berry/genimage.cfg b/board/bananapi/bananapi-m2-berry/genimage.cfg index 535f3dffee..92c8677545 100644 --- a/board/bananapi/bananapi-m2-berry/genimage.cfg +++ b/board/bananapi/bananapi-m2-berry/genimage.cfg @@ -1,15 +1,3 @@ -image boot.vfat { - vfat { - files = { - "zImage", - "sun8i-v40-bananapi-m2-berry.dtb", - "boot.scr" - } - } - - size = 64M -} - image sdcard.img { hdimage { } @@ -21,12 +9,6 @@ image sdcard.img { size = 1016K # 1MB - 8KB } - partition boot { - partition-type = 0xC - bootable = "true" - image = "boot.vfat" - } - partition rootfs { partition-type = 0x83 image = "rootfs.ext4" diff --git a/board/bananapi/bananapi-m2-berry/post-build.sh b/board/bananapi/bananapi-m2-berry/post-build.sh new file mode 100755 index 0000000000..1f5ff6a611 --- /dev/null +++ b/board/bananapi/bananapi-m2-berry/post-build.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +BOARD_DIR="$(dirname $0)" + +install -m 0644 -D $BOARD_DIR/extlinux.conf $TARGET_DIR/boot/extlinux/extlinux.conf diff --git a/configs/bananapi_m2_berry_defconfig b/configs/bananapi_m2_berry_defconfig index 300261d07f..200257ac0d 100644 --- a/configs/bananapi_m2_berry_defconfig +++ b/configs/bananapi_m2_berry_defconfig @@ -2,21 +2,23 @@ BR2_arm=y BR2_cortex_a7=y BR2_TOOLCHAIN_EXTERNAL=y BR2_TARGET_GENERIC_ISSUE="Welcome to Bananapi M2 Berry" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/bananapi/bananapi-m2-berry/post-build.sh" BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/bananapi/bananapi-m2-berry/genimage.cfg" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y -BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.38" +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.57" BR2_LINUX_KERNEL_DEFCONFIG="sunxi" BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v40-bananapi-m2-berry" +BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y # BR2_TARGET_ROOTFS_TAR is not set BR2_TARGET_UBOOT=y BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y BR2_TARGET_UBOOT_CUSTOM_VERSION=y -BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2023.07" +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2023.10" BR2_TARGET_UBOOT_BOARD_DEFCONFIG="bananapi_m2_berry" BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y @@ -26,6 +28,3 @@ BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin" BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y -BR2_PACKAGE_HOST_UBOOT_TOOLS=y -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/bananapi/bananapi-m2-berry/boot.cmd"
While switching bump Linux version to 6.1.57 and U-Boot version to 2023.10. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com> --- board/bananapi/bananapi-m2-berry/boot.cmd | 7 ------- board/bananapi/bananapi-m2-berry/extlinux.conf | 4 ++++ board/bananapi/bananapi-m2-berry/genimage.cfg | 18 ------------------ board/bananapi/bananapi-m2-berry/post-build.sh | 5 +++++ configs/bananapi_m2_berry_defconfig | 9 ++++----- 5 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 board/bananapi/bananapi-m2-berry/boot.cmd create mode 100644 board/bananapi/bananapi-m2-berry/extlinux.conf create mode 100755 board/bananapi/bananapi-m2-berry/post-build.sh