Aarch64 FDT source

I’m using core OS on an aarch64 SBC(rk3399-nanopi-r4s). The boot process seems to be uboot → grub.efi → efistub → linux. But from what I can tell, uboot ends up using it’s own internal devicetree when linux calls into efi_install_fdt:

While that seems to work, wouldn’t it be better if it GRUB would load the FDT from /boot/ostree/fedora-coreos-*/dtb/? That way it’d be ensured that the contents of the FDT are actually compatible with the selected kernel version.

I have to admit that the SBC/Arm world has a lot of corners that I’m not fully versed in so there’s a lot of things I don’t understand.

Nice! I’d actually really like to see the steps you used to do this (maybe a blog?). We do have the Raspberry Pi 4 docs. Did you use a similar workflow?

I actually have no idea :frowning: - Maybe @pwhalen would know.

ansible + podman-systemd-units are an awesome combination :stuck_out_tongue: , they allow me to publish my whole setup:

Basically you just have to build and flash uboot into the reserved partition. On rk3399 it’s more complicated because the reserved partition is too small for that. So I simply modified the image to increase the size. Updates are still possible since they don’t touch the partition table or firmware.

I also have a homeserver setup with the same SoC(but a different board: ROCK 4 Model A+). There I cheated by flashing uboot to the internal MMC so I don’t need the reserved partition on the eMMC :man_shrugging:


This is all really awesome! Thank you for sharing.

Thanks @m1cha for documenting a workaround. I’ve tried it for the NanoPi Neo2 board but unfortunately this did not work and I’m not knowledgeable enough in uboot to understand why :confused:.

The installation of Fedora IoT via the arm-image-installer worked however so there is likely something that I am missing.

Some logs:

$ cat layout.sfdisk                                                                                                                    ~/projects/boards|10:47
label: gpt
label-id: 00000000-0000-4000-A000-000000000001
device: fedora-coreos-38.20230819.3.0-metal.aarch64.raw
unit: sectors
first-lba: 34
last-lba: 5625822
sector-size: 512

fedora-coreos-38.20230819.3.0-metal.aarch64.raw1 : start=        2048, size=       30720, type=8DA63339-0007-60C0-C436-083AC8230908, uuid=67FE0990-A162-4641-BDA7-CD8F66226996, name="reserved"
fedora-coreos-38.20230819.3.0-metal.aarch64.raw2 : start=       32768, size=      260096, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=55688478-B2F7-40A3-A730-66ECA6F751C1, name="EFI-SYSTEM"
fedora-coreos-38.20230819.3.0-metal.aarch64.raw3 : start=      292864, size=      786432, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=69F3707F-449F-455C-BBBF-D999467DD5D7, name="boot"
fedora-coreos-38.20230819.3.0-metal.aarch64.raw4 : start=     1079296, size=     4507615, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=35DD1EEE-5A08-4254-B4CA-F5A6F6CB283D, name="root"

From https://pagure.io/arm-image-installer/blob/main/f/socs.d/AllWinner:

$ dnf download uboot-images-armv8.noarch
$ <extract "/usr/share/uboot/nanopi_neo2/u-boot-sunxi-with-spl.bin" from RPM archive above>
$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdXYZ bs=1024 seek=8; sync; sleep 5
$ <Update kernel command line "options" in BLS config with "console=..." argument>

uboot serial log:

U-Boot SPL 2023.04 (Jun 11 2023 - 00:00:00 +0000)                            
DRAM: 512 MiB                                                                
Trying to boot from MMC1                                                     
NOTICE:  BL31: v2.8(release):                                                
NOTICE:  BL31: Built : 00:00:00, Jan 18 2023                                 
NOTICE:  BL31: Detected Allwinner H5 SoC (1718)                              
NOTICE:  BL31: Found U-Boot DTB at 0x20a2c78, model: FriendlyARM NanoPi NEO 2
NOTICE:  PMIC: Assuming H5 reference regulator design                        
U-Boot 2023.04 (Jun 11 2023 - 00:00:00 +0000) Allwinner Technology           

CPU:   Allwinner H5 (SUN50I)
Model: FriendlyARM NanoPi NEO 2
DRAM:  512 MiB
Core:  62 devices, 19 uclasses, devicetree: separate
WDT:   Not starting watchdog@1c20ca0
MMC:   mmc@1c0f000: 0
Loading Environment from FAT... ** No valid partitions found **
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@1c30000
starting USB...
Bus usb@1c1a000: USB EHCI 1.00
Bus usb@1c1a400: USB OHCI 1.0
Bus usb@1c1d000: USB EHCI 1.00
Bus usb@1c1d400: USB OHCI 1.0
scanning bus usb@1c1a000 for devices... 1 USB Device(s) found
scanning bus usb@1c1a400 for devices... 1 USB Device(s) found
scanning bus usb@1c1d000 for devices... 1 USB Device(s) found
scanning bus usb@1c1d400 for devices... 1 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
** Invalid partition 1 **
Couldn't find partition mmc 0:1

Device 0: unknown device
ethernet@1c30000 Waiting for PHY auto negotiation to complete....... done
BOOTP broadcast 1
DHCP client bound to address (2047 ms)
*** ERROR: `serverip' not set
Cannot autoload with TFTPGET
missing environment variable: pxeuuid
Retrieving file: pxelinux.cfg/01-02-01-e5-49-3b-4f
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C0A80189
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C0A8018
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C0A801
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C0A80
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C0A8
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C0A
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C0
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/C
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/default-arm-sunxi-sunxi
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/default-arm-sunxi
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/default-arm
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/default
*** ERROR: `serverip' not set
Config file not found
BOOTP broadcast 1
DHCP client bound to address (2003 ms)
*** ERROR: `serverip' not set
Cannot autoload with TFTPGET
BOOTP broadcast 1
DHCP client bound to address (2003 ms)
*** ERROR: `serverip' not set
Cannot autoload with TFTPGET

Sorry for the late answer.

Just to be sure, are you booting from USB, SD or MMC? The uboot log shows that there are 4 USB devices, but none of them are a storage device. It did manage to find an mmc device but it was unable to detect any partitions. I’m not sure if Device 0: unknown device relates to MMC or something else.

My suggestion would be to get into the uboot shell to try and explore the available devices manually and see if you can list and read files from them.