Buildroot + u-boot + raspberry-pi Zero W
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello *,
Quoted 4 lines · uhmgawa
I have a vanilla build of gitlab.com/buildroot.org/buildroot.git @
b200632b1abforraspberrypi0w_defconfig
which seems fine directly booting the kernel using the stock Broadcom binary bootloader. However
changing the Buildroot bootloader config to BR2_TARGET_UBOOT=y, several issues appear:
• While output/images/u-boot.bin is generated, it is not present in output/images/boot.vfat nor does the file/boot/config.txtreflect the expected launch of u-boot with "kernel=u-boot.bin" but rather remains set to directly boot the kernel zImage.
The buildroot defconfigs are very minimal starting points for your own development (mostly simple booting with minimal feature set and console output/login via serial line)..., everything more special has to be done by (local) adjustments..., e.g. in your case:
- providing an adjusted genimage.cfg (more straight forward before autogenerated, see commit [1] and [2]) to include (additional) u-boot.bin to boot.vfat
- providing an adjusted config.txt (see [1] and BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE):
enable_uart=1
kernel=u-boot.bin
After copying u-booot.bin manually to the boot partition and overwriting the config.txt my RPi zero w boots u-boot with the following output via serial line:
U-Boot 2024.01 (Jan 24 2024 - 16:37:26 +0100)
DRAM: 448 MiB
RPI Zero W (0x9000c1)
Core: 67 devices, 14 uclasses, devicetree: embed
MMC: mmc@7e202000: 0, mmc@7e300000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
In: serial,usbkbd
Out: serial,vidconsole
Err: serial,vidconsole
Net: No ethernet found.
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
Card did not respond to voltage select! : -110
No ethernet found.
No ethernet found.
Quoted 9 lines
• Implementing #1 manually (which is the drill for grafting a standalone u-boot into an existing PI install) does not result in u-boot coming up out of reset.
• If I take the same Buildroot built u-boot and install it (per #2) in a creaky Raspbian 9 install, u-boot functions just fine.
• If I take a git.denx.de/u-boot.git standalome build of u-boot.bin which known to work on the above Raspbian 9, it similarly fails in the Buildroot generated install.
So a few thoughts:
• I may be missing some configuration step given the seeming lack of image preparation in #1.
• Otherwise #1 may imply full Buildroot + u-boot integration remains a WIP, at least for a Raspberry Pi Zero W.
• The actual root cause may be an incompatible holy binary Broadcom firmware package being selected as the only other source of root cause appears to be the /boot installed bootcode.bin and/or start.elf. I do find a limited set of config knobs in the form "BR2_PACKAGE_RPI_FIRMWARE*" but at this point would like to have some sense of where in this problem space I may be. For reference, this is the Buildroot .config content change from a successful direct boot of the kernel zImage to the selection of u-boot as an intermediate boot loader:
Quoted 16 lines
dot-config-default ? .config
---------------------------------------------------------------------------------------------------
#BR2_TARGET_UBOOTis not set | BR2_TARGET_UBOOT=y
> BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="" > BR2_TARGET_UBOOT_PATCH=""
> BR2_TARGET_UBOOT_CUSTOM_DTS_PATH="" > BR2_TARGET_UBOOT_FORMAT_BIN=y > BR2_TARGET_UBOOT_VERSION="2024.01" > BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y > BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_0_w" > BR2_TARGET_UBOOT_LATEST_VERSION=y > BR2_TARGET_UBOOT_USE_DEFCONFIG=y > BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="" Any illumination here much appreciated.
Regards,
Peter
[1] https://gitlab.com/buildroot.org/buildroot/-/commit/e37ee5acdcebb59c0bcc89eca69540cea2ed441d
[2] https://gitlab.com/buildroot.org/buildroot/-/commit/fc5cdeed724174d248dd1f979acea40af6e344ce
[3] https://hechao.li/2021/12/20/Boot-Raspberry-Pi-4-Using-uboot-and-Initramfs/
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 14 lines · Peter Seiderer via buildroot
Hello *,
Quoted 4 lines · uhmgawa
I have a vanilla build of gitlab.com/buildroot.org/buildroot.git @
b200632b1abforraspberrypi0w_defconfig
which seems fine directly booting the kernel using the stock Broadcom binary bootloader. However
changing the Buildroot bootloader config to BR2_TARGET_UBOOT=y, several issues appear:
• While output/images/u-boot.bin is generated, it is not present in output/images/boot.vfat nor does the file/boot/config.txtreflect the expected launch of u-boot with "kernel=u-boot.bin" but rather remains set to directly boot the kernel zImage.The buildroot defconfigs are very minimal starting points for your own development (mostly simple booting with minimal feature set and console output/login via serial line)..., everything more special has to be done by (local) adjustments..., e.g. in your case:
Quoted 7 lines
- providing an adjusted genimage.cfg (more straight forward before autogenerated, see commit [1] and [2]) to include (additional) u-boot.bin to boot.vfat
- providing an adjusted config.txt (see [1] and
BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE):enable_uart=1
kernel=u-boot.bin
I actually tried the above as a direct modification of /boot/config.txt before my prior mail. Still didn't resolve my issue (below). Anyway after capturing the changes as prescribed above, it took some rattling around to find a "make rpi-firmware-reinstall" was also required to percolate the change into the buildroot's make scope.
Quoted 16 lines
After copying u-booot.bin manually to the boot partition and overwriting the config.txt my RPi zero w boots u-boot with the following output via serial line:
U-Boot 2024.01 (Jan 24 2024 - 16:37:26 +0100)
DRAM: 448 MiB
RPI Zero W (0x9000c1)
Core: 67 devices, 14 uclasses, devicetree: embed
MMC: mmc@7e202000: 0, mmc@7e300000: 1
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
In: serial,usbkbd
Out: serial,vidconsole
Err: serial,vidconsole
Net: No ethernet found.
Quoted 8 lines
starting USB...
Bus usb@7e980000: USB DWC2
scanning bus usb@7e980000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot: 0
Card did not respond to voltage select! : -110
No ethernet found.
No ethernet found.
I'd hazard your config.txt doesn't have "dtoverlay=miniuart-bt" which was the root cause of my issue as by default the miniuart is intended to serve as the u-boot console. Once that's gone both u-boot and the kernel (via u-boot bootargs) successfully speak to the miniuart. I started to get suspicious after realizing /boot/cmdline.txt contained "console=ttyAMA0,115200" which was successfully booting the default kernel directly from the bootcode.bin/start.elf firmware.
Quoted 3 lines
[1] https://gitlab.com/buildroot.org/buildroot/-/commit/e37ee5acdcebb59c0bcc89eca69540cea2ed441d
[2] https://gitlab.com/buildroot.org/buildroot/-/commit/fc5cdeed724174d248dd1f979acea40af6e344ce
[3] https://hechao.li/2021/12/20/Boot-Raspberry-Pi-4-Using-uboot-and-Initramfs/
All of the above was very helpful. Thanks!
-john (AKA '*')
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot