From f43af4ef31cd40270c7db94b98c0ff9f212e6448 Mon Sep 17 00:00:00 2001 From: "Fiona Klute (WIWA)" Date: Fri, 7 Feb 2025 18:14:58 +0100 Subject: [PATCH] configs/raspberrypicm4io_64_uboot_defconfig: new defconfig The new config deviates from the existing configs/raspberrypicm4io_64_defconfig only as far as necessary to demonstrate booting through U-Boot instead of having the firmware load the kernel directly. The sample boot script loads the kernel from the rootfs and uses the device tree provided by the firmware, and should be compatible with any RPi device that runs U-Boot. Signed-off-by: Fiona Klute (WIWA) [Arnout: update kernel to same as raspberrypicm4io_64_defconfig] Signed-off-by: Arnout Vandecappelle --- board/raspberrypi/boot.scr.in | 18 +++++++++ .../raspberrypi/config_cm4io_64bit_uboot.txt | 23 +++++++++++ board/raspberrypi/readme.txt | 4 ++ configs/raspberrypicm4io_64_uboot_defconfig | 40 +++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 board/raspberrypi/boot.scr.in create mode 100644 board/raspberrypi/config_cm4io_64bit_uboot.txt create mode 100644 configs/raspberrypicm4io_64_uboot_defconfig diff --git a/board/raspberrypi/boot.scr.in b/board/raspberrypi/boot.scr.in new file mode 100644 index 0000000000..1ba733ceaa --- /dev/null +++ b/board/raspberrypi/boot.scr.in @@ -0,0 +1,18 @@ +# Please note that this is only a sample, we recommend you to change +# it to fit your needs. You should override this file using +# BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE. + +# On most Raspberry Pi boards UART0 is ttyAMA0, Raspberry Pi 5 is +# different. +if test "$board_name" = "5 Model B"; then + env set serial_uart "ttyAMA10,115200" +else + env set serial_uart "ttyAMA0,115200" +fi +env set bootargs "root=/dev/mmcblk0p2 rootwait console=tty1 console=${serial_uart}" + +# load kernel from the root partition +load mmc 0:2 ${kernel_addr_r} boot/Image + +# boot using the FDT provided by firmware +booti ${kernel_addr_r} - ${fdt_addr} diff --git a/board/raspberrypi/config_cm4io_64bit_uboot.txt b/board/raspberrypi/config_cm4io_64bit_uboot.txt new file mode 100644 index 0000000000..eef929186c --- /dev/null +++ b/board/raspberrypi/config_cm4io_64bit_uboot.txt @@ -0,0 +1,23 @@ +# Please note that this is only a sample, we recommend you to change it to fit +# your needs. +# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE. +# See http://buildroot.org/manual.html#rootfs-custom +# and http://elinux.org/RPiconfig for a description of config.txt syntax + +start_file=start4.elf +fixup_file=fixup4.dat + +kernel=u-boot.bin + +# Enable UART0 for serial console on ttyAMA0 +dtoverlay=miniuart-bt + +# enable RTC +dtparam=i2c_vc=on +dtoverlay=i2c-rtc,pcf85063a,i2c_csi_dsi + +# enable dwc2 USB controller (USB 2.0) +dtoverlay=dwc2,dr_mode=host + +# enable 64bits support +arm_64bit=1 diff --git a/board/raspberrypi/readme.txt b/board/raspberrypi/readme.txt index 31ff424a83..8e1009f254 100644 --- a/board/raspberrypi/readme.txt +++ b/board/raspberrypi/readme.txt @@ -83,6 +83,10 @@ or for CM4 (on IO Board - 64 bit): $ make raspberrypicm4io_64_defconfig +or to boot CM4 (on IO Board - 64 bit) using U-Boot: + + $ make raspberrypicm4io_64_uboot_defconfig + For model 5 B and 500: $ make raspberrypi5_defconfig diff --git a/configs/raspberrypicm4io_64_uboot_defconfig b/configs/raspberrypicm4io_64_uboot_defconfig new file mode 100644 index 0000000000..84ce16b993 --- /dev/null +++ b/configs/raspberrypicm4io_64_uboot_defconfig @@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_cortex_a72=y +BR2_ARM_FPU_VFPV4=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y +BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_GLIBC_STABLE=y +BR2_GLOBAL_PATCH_DIR="board/raspberrypi/patches" +BR2_DOWNLOAD_FORCE_CHECK_HASHES=y +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypicm4io-64/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypicm4io-64/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL=y +BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,21b410140c47ffab5668399f6f143c7d7b935c8b)/linux-21b410140c47ffab5668399f6f143c7d7b935c8b.tar.gz" +BR2_LINUX_KERNEL_DEFCONFIG="bcm2711" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-cm4" +BR2_LINUX_KERNEL_INSTALL_TARGET=y +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y +BR2_PACKAGE_XZ=y +BR2_PACKAGE_RPI_FIRMWARE=y +BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y +BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE="board/raspberrypicm4io-64/config_cm4io_64bit_uboot.txt" +BR2_PACKAGE_KMOD=y +BR2_PACKAGE_KMOD_TOOLS=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_ROOTFS_EXT2_SIZE="120M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rpi_arm64" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_KMOD_XZ=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_RASPBERRYPI_USBBOOT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/raspberrypicm4io-64/boot.scr.in"