embedded-linuxraspberry-pi4u-bootdevice-tree

issue in Rpi4-8gb When I try change bcm2711-rpi-4-b.dtb in Debian-12 64 bits


neuberfran@raspberrypi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:    12
Codename:   bookworm
neuberfran@raspberrypi:~$ arch
aarch64
neuberfran@raspberrypi:~$ uname -a
Linux raspberrypi 6.6.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux
neuberfran@raspberrypi:~$ uname -m
aarch64

U-Boot> printenv bootcmd
bootcmd=fatload mmc 0 ${kernel_addr_r} kernel8.img;fatload mmc 0 ${fdt_addr} ${fdtfile}; booti ${kernel_addr_r} - ${fdt_addr}

I have rpi4 with debian 12 (as above) and I'm trying to change bcm2711-rpi-4-b.dtb, starting with the commands below:

mkdir rasp_arm64
cd rasp_arm64/
git clone --depth=1 https://github.com/raspberrypi/linux
sudo apt-get install qemu-system-arm
sudo apt-get install lzop
sudo apt-get install gcc-aarch64-linux-gnu
cd linux/
make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- mrproper
make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig
make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs
make -j8 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs
ls -lha arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb
-rw-rw-r-- 1 neuuberfran neuuberfran 55K Jul 12 13:02 arch/arm64/boot/dts/broadcom/bcm2711-rpi-4-b.dtb

config.txt (file) 
enable_uart=1
kernel=u-boot.bin
arm_64bit=1

git branch 
  master
* my6.6.20

Issue I'm having, right in U-boot, described below:

2024.04-rc4-0004

0-gbd0aedde3e-dirty (Mar 23 2024 - 10:37:01 -0300)

DRAM: 948 MiB (effective 7.9 GiB)
RPI 4 Model B (0xd03115)
Core: 210 devices, 15 uclasses, devicetree: board
MMC:  mmcnr@7e300000: 1, mmc@7e340000: 0
Loading Environment from FAT... OK
In:  serial,usbkbd
Out:  serial,vidconsole
Err:  serial,vidconsole
Net:  eth0: ethernet@7d580000
starting USB...
No working controllers found
Hit any key to stop autoboot: 0 
9259827 bytes read in 413 ms (21.4 MiB/s)
Failed to load 'broadcom/bcm2711-rpi-4-b.dtb'
  Uncompressing Kernel Image to 0
Moving Image from 0x80000 to 0x200000, end=1b60000
ERROR: Did not find a cmdline Flattened Device Tree
Could not find a valid device tree

Note.: https://forums.raspberrypi.com/viewtopic.php?t=314845 Similar issue, but in CM4 module

Can anyone help-me?


Solution

  • First of all, to resolve my issue I recreated an image (with SSH, Wifi, etc) for my rpi4 8gb, using Imager App (version 1.8.5) on Ubuntu 20.04:

    Imager 1.8.5 App

    https://hechao.li/2021/12/20/Boot-Raspberry-Pi-4-Using-uboot-and-Initramfs/

    1. Then, based on the website above, I created U-boot 2024.04 and boot.scr (specifically) as below:

    cat << EOF > boot_cmd.txt fatload mmc 0:1 ${kernel_addr_r} Image setenv bootargs "8250.nr_uarts=1 console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait rw" booti ${kernel_addr_r} - ${fdt_addr} EOF

    ~/u-boot/tools/mkimage -A arm64 -O linux -T script -C none -d boot_cmd.txt boot.scr

    1. config.txt (I don`t need more cmdline.txt, I delete it)

      1.enable_uart=1 2.arm_64bit=1 3.kernel=u-boot.bin 4.#dtoverlay=disable-bt

    2. I put files: config.txt, bcm2711-rpi-4-b.dtb (already with the necessary changes for RPMsg), Image, boot.scr and u-boot.bin in bootfs partition.

    3. I insert sdcard in rpi4 8gb and access it using sudo picocom -b 115200 /dev/ttyUSB0: Commands showing the success of the final result