Skip to content

Instantly share code, notes, and snippets.

@raqbit

raqbit/fel.txt Secret

Last active May 9, 2024 15:10
Show Gist options
  • Save raqbit/165eaf49c739a28b604101f955781c70 to your computer and use it in GitHub Desktop.
Save raqbit/165eaf49c739a28b604101f955781c70 to your computer and use it in GitHub Desktop.
$ sunxi-fel -v -p uboot ./u-boot-sunxi-with-spl.bin
found DT name in SPL header: sun50i-h700-anbernic-rg35xxplus
Stack pointers: sp_irq=0x00021400, sp=0x00053FD4
MMU is not enabled by BROM
=> Executing the SPL... done.
loading image "ARM Trusted Firmware" (49265 bytes) to 0x40000000
loading image "U-Boot" (592480 bytes) to 0x4a000000
loading DTB "sun50i-h700-anbernic-rg35xxplus" (27928 bytes)
Starting U-Boot (0x40000000).
Store entry point 0x40000000 to RVBAR 0x09010040, and request warm reset with RMR mode 3... done.
U-Boot SPL 2024.04-rc3-g24aafd7efc (May 01 2024 - 22:28:53 +0200)
DRAM: 1024 MiB
Trying to boot from FEL
@raqbit
Copy link
Author

raqbit commented May 1, 2024

$ export CROSS_COMPILE=aarch64-linux-gnu-

$ aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

A-TF:

git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git
cd trusted-firmware-a
make PLAT=sun50i_h616 DEBUG=1 -j12

export BL31=$(pwd)/build/sun50i_h616/debug/bl31.bin

U-boot:

git clone 'https://git.sr.ht/~tokyovigilante/u-boot'
cd u-boot
make anbernic_rg35xxh_defconfig
make -j12

@raqbit
Copy link
Author

raqbit commented May 3, 2024

Now with https://git.sr.ht/~tokyovigilante/u-boot/tree/rg35xx-upstream (07ec7f3f1279c30408b725013767a8a1b76e72e3)
&
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/27326 (81b2eafe04a84e3b825005716f9ca5dad4b4c4d2)

Note: I also realized there's a rg35xxh defconfig in the u-boot branch, so I built with that instead of the rg35xxplus one.

$ sunxi-fel -v -p uboot ./u-boot-sunxi-with-spl.bin
found DT name in SPL header: sun50i-h700-anbernic-rg35xx-h
Stack pointers: sp_irq=0x00021400, sp=0x00053FD4
MMU is not enabled by BROM
=> Executing the SPL... done.
loading image "ARM Trusted Firmware" (53361 bytes) to 0x40000000
loading image "U-Boot" (593736 bytes) to 0x4a000000
loading DTB "sun50i-h700-anbernic-rg35xx-h" (29672 bytes)
Starting U-Boot (0x40000000).
Store entry point 0x40000000 to RVBAR 0x09010040, and request warm reset with RMR mode 3... done.

UART output:

U-Boot SPL 2024.07-rc1-g07ec7f3f12 (May 03 2024 - 21:25:47 +0200)
DRAM: 1024 MiB
Trying to boot from FEL

@raqbit
Copy link
Author

raqbit commented May 4, 2024

u-boot binary by tokyovigilante: https://paste.c-net.org/LuridApology

sudo dd if=$(pwd)/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1k seek=256
751+1 records in

UART:

U-Boot SPL 2024.07-rc1-00164-g6093597991 (May 04 2024 - 23:34:47 +1200)
DRAM: 1024 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.10.0(debug):v2.10.0-712-g2afe50a63
NOTICE:  BL31: Built : 16:39:02, Apr 13 2024
NOTICE:  BL31: Detected Allwinner H616 SoC (1823)
NOTICE:  BL31: Found U-Boot DTB at 0x4a09e7b8, model: Anbernic RG35XX H
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
INFO:    Probing for PMIC on RSB:
INFO:    PMIC: found AXP717
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
INFO:    BL31: cortex_a53: CPU workaround for erratum 855873 was applied
INFO:    BL31: cortex_a53: CPU workaround for erratum 1530924 was applied
INFO:    PSCI: Suspend is unavailable
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x4a000000
INFO:    SPSR = 0x3c9
INFO:    Changed devicetree.


U-Boot 2024.07-rc1-00164-g6093597991 (May 04 2024 - 23:34:47 +1200) Allwinner Technology

CPU:   Allwinner H616 (SUN50I)
Model: Anbernic RG35XX H
DRAM:  1 GiB
Core:  79 devices, 19 uclasses, devicetree: separate
WDT:   Not starting watchdog@30090a0
MMC:   mmc@4020000: 0, mmc@4021000: 1, mmc@4022000: 2
Loading Environment from FAT... Unable to use mmc 0:1...
In:    serial@5000000
Out:   serial@5000000
Err:   serial@5000000
Net:   using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC de:ad:be:ef:00:01
HOST MAC de:ad:be:ef:00:00
eth0: usb_ether
Hit any key to stop autoboot:  0 
=> 

@raqbit
Copy link
Author

raqbit commented May 4, 2024

https://git.sr.ht/~tokyovigilante/u-boot/tree/rg35xx-upstream (07ec7f3f1279c30408b725013767a8a1b76e72e3)
+ https://gist.githubusercontent.com/apritzel/423f96d84599d107383b557ca79bbf96/raw/91a284741f2f8610728a3de502cdd309edbad67b/u-boot_h616_high_boot.patch

&
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/27326 (81b2eafe04a84e3b825005716f9ca5dad4b4c4d2)

Written to an SD card at 256k offset:

sudo dd if=$(pwd)/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1k seek=256
U-Boot SPL 2024.07-rc1-g07ec7f3f12-dirty (May 04 2024 - 17:12:20 +0200)
DRAM: 1024 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.10.0(debug):v2.10.0-764-g81b2eafe0
NOTICE:  BL31: Built : 21:29:21, May  3 2024
NOTICE:  BL31: Detected Allwinner H616 SoC (1823)
NOTICE:  BL31: Found U-Boot DTB at 0x4a090f50, model: Anbernic RG35XX H
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
INFO:    Probing for PMIC on RSB:
INFO:    PMIC: found AXP717
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
INFO:    BL31: cortex_a53: CPU workaround for erratum 855873 was applied
INFO:    BL31: cortex_a53: CPU workaround for erratum 1530924 was applied
INFO:    PSCI: Suspend is unavailable
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x4a000000
INFO:    SPSR = 0x3c9
INFO:    Changed devicetree.


U-Boot 2024.07-rc1-g07ec7f3f12-dirty (May 04 2024 - 17:12:20 +0200) Allwinner Technology

CPU:   Allwinner H616 (SUN50I)
Model: Anbernic RG35XX H
DRAM:  1 GiB
Core:  78 devices, 18 uclasses, devicetree: separate
WDT:   Not starting watchdog@30090a0
MMC:   mmc@4020000: 0, mmc@4021000: 1, mmc@4022000: 2
Loading Environment from FAT... Unable to use mmc 0:1...
In:    serial@5000000
Out:   serial@5000000
Err:   serial@5000000
Net:   No ethernet found.
Hit any key to stop autoboot:  0 

@mfgbhatti
Copy link

Hey!
I followed your conversation from #linux-sunxi. If I may ask which board you are targeting?

@raqbit
Copy link
Author

raqbit commented May 7, 2024

Hey! I followed your conversation from #linux-sunxi. If I may ask which board you are targeting?

I'm targeting the Anbernic RG35XX-H, which is based on the Alwinner H700 SoC (which is a package-variant of the H616/H618)

@mfgbhatti
Copy link

I'm targeting the Anbernic RG35XX-H, which is based on the Alwinner H700 SoC (which is a package-variant of the H616/H618)

I would love to read about all the steps you took to achieve this. If you already wrote it. Please share a link. My board is using H616 sun50i.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment