Rock Pi 4C iPXE

Hi Folks,

I’m attempting to uboot to iPXE - I tried following this guide https://wiki.radxa.com/Rockpi4/dev/spi-install using the SPI loader and uboot linked and they were both quite old and out-of-date. None the less I tried them and they all failed; I could see the uboot reach to my TFTP server and pull down the ipxe-arm64.efi but no progress past that.

=> bootp
Speed: 100, full duplex                                                                     
BOOTP broadcast 1                                                                           
DHCP client bound to address 192.168.1.213 (4 ms)                                           
Using ethernet@fe300000 device                                                              
TFTP from server 192.168.1.121; our IP address is 192.168.1.213                             
Filename 'ipxe-arm64.efi'.                                                                  
Load address: 0x500000                                                                      
Loading: #################################################################                           
#################################################################                           
#################################################################
###                                                                                         
162.1 KiB/s                                                                        
done                                                                                        
Bytes transferred = 1012736 (f7400 hex)

I then tried compiling upstream uboot and had issues where it would go through the boot cycle of TPL and complete SPL and then would halt and not progress any further.

U-Boot SPL 2022.01 (Jan 24 2022 - 14:58:45 +0530)
Trying to boot from MMC2
Card did not respond to voltage select! : -110
spl: mmc init failed with error: -95
Trying to boot from MMC1
Card did not respond to voltage select! : -110
spl: mmc init failed with error: -95
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

U-Boot TPL 2022.01 (Jan 24 2022 - 14:58:45)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot TPL 2022.01 (Jan 24 2022 - 14:58:45)

My DHCP TPFP configuration has been configured to use the following: https://www.sidero.dev/docs/v0.5/getting-started/prereq-dhcp/

If there is any guide to how to compile upstream uboot that would be preferable at this point and if there is anything else I may be missing here.

@piter75 I did notice your responses on several similar threads - perhaps you’re able to answer some of my question

Update - attempted a lot of options and this is the furthest we can get. It appears iPXE is just stuck and doesn’t go any further.

U-Boot TPL 2022.01-dirty (Feb 24 2022 - 04:16:21)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2022.01-dirty (Feb 24 2022 - 04:16:21 +0530)
Trying to boot from SPI


U-Boot 2022.01-dirty (Feb 24 2022 - 04:16:21 +0530)

SoC: Rockchip rk3399
Reset cause: POR
Model: Radxa ROCK Pi 4B
DRAM:  3.9 GiB
PMIC:  RK808 
MMC:   mmc@fe310000: 2, mmc@fe320000: 1, mmc@fe330000: 0
Loading Environment from SPIFlash... SF: Detected XT25F32B with page size 256 Bytes, erase size 4 KiB, total 4 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Model: Radxa ROCK Pi 4B
Net:   eth0: ethernet@fe300000
Hit any key to stop autoboot:  0 
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc0(part 0) is current device
** No partition table - mmc 0 **
Couldn't find partition mmc 0:1
rockchip_pcie pcie@f8000000: PCIe link training gen1 timeout!

Device 0: unknown device
starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3c0000: USB EHCI 1.00
Bus usb@fe800000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fe900000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 1 USB Device(s) found
scanning bus usb@fe800000 for devices... 1 USB Device(s) found
scanning bus usb@fe900000 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
rockchip_pcie pcie@f8000000: failed to find ep-gpios property
Speed: 1000, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
DHCP client bound to address 192.168.15.154 (1005 ms)
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'hw_intfc.conf'.
Load address: 0x800800
Loading: #
	 92.8 KiB/s
done
Bytes transferred = 1721 (6b9 hex)
missing environment variable: pxeuuid
Retrieving file: pxelinux.cfg/01-26-96-b9-3c-b7-77
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/01-26-96-b9-3c-b7-77'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/01-26-96-b9-3c-b7-77: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C0A80F9A
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C0A80F9A'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C0A80F9A: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C0A80F9
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C0A80F9'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C0A80F9: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C0A80F
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C0A80F'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C0A80F: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C0A80
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C0A80'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C0A80: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C0A8
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C0A8'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C0A8: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C0A
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C0A'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C0A: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C0
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C0'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C0: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/C
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/C'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/C: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/default-arm-rk3399-evb_rk3399
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/default-arm-rk3399-evb_rk3399'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/default-arm-rk3399-evb_rk3399: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/default-arm-rk3399
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/default-arm-rk3399'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/default-arm-rk3399: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/default-arm
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/default-arm'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/default-arm: no such file or directory' (1)
Not retrying...
Retrieving file: pxelinux.cfg/default
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'pxelinux.cfg/default'.
Load address: 0x600000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/pxelinux.cfg/default: no such file or directory' (1)
Not retrying...
Config file not found
rockchip_pcie pcie@f8000000: failed to find ep-gpios property
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.15.154 (2 ms)
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'boot.scr.uimg'.
Load address: 0x500000
Loading: *
TFTP error: 'open /var/lib/sidero/tftp/boot.scr.uimg: no such file or directory' (1)
Not retrying...
Speed: 1000, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.15.154 (2 ms)
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'ipxe-arm64.efi'.
Load address: 0x2080000
Loading: #################################################################
	 #################################################################
	 #################################################################
	 ###
	 390.6 KiB/s
done
Bytes transferred = 1012736 (f7400 hex)
Speed: 1000, full duplex
Using ethernet@fe300000 device
TFTP from server 192.168.15.30; our IP address is 192.168.15.154
Filename 'dtb/rockchip/rk3399-rock-pi-4b.dtb'.
Load address: 0x1f00000
Loading: ############
	 447.3 KiB/s
done
Bytes transferred = 56406 (dc56 hex)
Card did not respond to voltage select! : -110
Scanning disk mmc@fe310000.blk...
Disk mmc@fe310000.blk not ready
Card did not respond to voltage select! : -110
Scanning disk mmc@fe320000.blk...
Disk mmc@fe320000.blk not ready
Scanning disk mmc@fe330000.blk...
Found 1 disks
No EFI system partition
Booting /ipxe-arm64.efi
Not a PE-COFF file
iPXE initialising devices...ok



iPXE 1.21.1+git+9062544+sidero -- Open Source Network Boot Firmware -- http://ipxe.org
Features: DNS HTTP HTTPS iSCSI TFTP SRP AoE EFI Menu
Press Ctrl-B for the iPXE command line...

I think the first thing is to make sure iPXE actually can boot on Rock Pi 4. Can you put it in the EFI partition and try booting it locally?

So I built iPXE myself and observed the same issue with U-Boot 2022.01 on 2 different boards (1 Rock Pi 4B v1.3 and 1 Radxa Zero 2 as seen below):

=> bootefi ${kernel_addr_r} ${fdt_addr_r}
Card did not respond to voltage select! : -110
Scanning disk sd@ffe03000.blk...
Disk sd@ffe03000.blk not ready
Scanning disk sd@ffe05000.blk...
** Unrecognized filesystem type **
** Unrecognized filesystem type **
** Unrecognized filesystem type **
Scanning disk mmc@ffe07000.blk...
** Unrecognized filesystem type **
Found 9 disks
** Unable to read file ubootefi.var **
Failed to load EFI variables
Booting /ipxe.efi
iPXE initialising devices...ok



iPXE 1.21.1+ (g2acdc) -- Open Source Network Boot Firmware -- https://ipxe.org
Features: DNS HTTP iSCSI TFTP SRP AoE EFI Menu

shell_banner
enter shell
read line...
iPXE> 

I modified the code so it can skip shell_banner() function and go straight to shell(). As you can see both stucked when they were waiting for user input (Ctrl-B for shell_banner), so there might be a bug here. Related commit for how iPXE handles EFI keyboard input.

I have created a thread in iPXE to see if we can identify the root cause of this issue.

Thanks @RadxaYuntian for following this up and hopefully we can resolve this issue.

So my early guess was correct. U-Boot didn’t implement the necessary timer interrupts, and as such when iPXE yields CPU it cannot be waked up again. A workaround is available in iPXE forum and I have verified that it works on Radxa Zero 2 that I have already connected to my computer:

=> bootefi ${kernel_addr_r} ${fdt_addr_r}
Booting /ipxe.efi
iPXE initialising devices...ok



iPXE 1.21.1+ (g2acdc) -- Open Source Network Boot Firmware -- https://ipxe.org
Features: DNS HTTP iSCSI TFTP SRP AoE EFI Menu

iPXE> echo success                       
success
iPXE>

The same workaround should work for Rock Pi 4 as well.

Perfect - I’ll try this patch and see if this solves the issue for the RockPi 4s.

A few questions / thoughts. Do you happen to know if there is a patch for this already built in upstream u-boot?

Also how come this isn’t a bug I can reproduce in other SBCs? Is it because of something low level in the u-boot for the rockchip or something?

No this issue was discovered by iPXE folks 5 years ago and today we still don’t have anything better. For other SBC I assume you mean Raspberry Pi? They have EDK2 implementation which has working EFI firmware so they are not affected. The issue is due to how U-Boot was designed and is likely very hard to fix.

Thanks for your investigation - any way to determine if this patch would negatively impact any other arm64 devices? Not sure our ipxe scripts can distinguish between RockPi vs other arm64 devices.

Is there any scope for RockPi to have a better story around stable EFI firmware that would support to avoid this at all?

This mostly affecting when a user is interacting with iPXE. The default behavior is to sleep the CPU and wait for keyboard interrupt to save energy. Since U-Boot won’t supply the required interruption iPXE with the workaround will instead spinning itself in place, so CPU doesn’t have a chance to sleep. In normal operation where user enters nothing and iPXE loads the boot target and then yields the control, this means very little difference.

As for EFI firmware I assume you are talking about EDK2. There is some work on RK3399 (Rock Pi 4) but that did not gain traction. For RK356X (ROCK 3) there is active work on it and looks promising. Hopefully we can reuse the work for RK356X to enable RK3399 in that project as well.