Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
<SOLVED> Orange Pi 3 LTS gentoo install
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Tue Jan 24, 2023 2:30 pm    Post subject: <SOLVED> Orange Pi 3 LTS gentoo install Reply with quote

Has anyone successfully installed gentoo on a recent 64bit Orange Pi? I found the wiki for the older ones but my concern is that I can't confirm what bootloader if any its using. The Orange Pi 3 linux images only have a single partition (no boot partition) and based on the starting location, I dont think there's a standalone bootloader in unpartitioned space like the older Pi PCs have.

Last edited by JumboAg on Sat Feb 04, 2023 4:35 am; edited 1 time in total
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Tue Jan 24, 2023 2:44 pm    Post subject: Reply with quote

Based on User manual, it talk about u-boot, so I believe it use u-boot as boot loader. If you have UART connected you should be able to see u-boot sequence.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Tue Jan 24, 2023 9:11 pm    Post subject: Reply with quote

looks like uboot puts its stuff at the very beginning of the drive before the start point of the first partition.

Guess I'm going to try to follow the u-boot installation site docs to compile and build and see what happens from there. Doesnt look too complicated. Thank you for the info.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Fri Jan 27, 2023 4:46 pm    Post subject: Reply with quote

I *think* I got u-boot installed. It's missing a few compilation options but I believe I have the concept down. Here's where I'm currently stuck:

* I have a debian image running fine on its internal flash storage.
* I installed u-boot and a stage 3 tarball on a SD card. For now, just ported the existing kernel and tree info from the debian /boot.

Here's why I think I have u-boot successfully installed:
* If I reboot with the SD card inserted, the system DOES boot. Its taking the kernel and OS off the internal flash and not the SD but it is booting. With the card inserted, I get a ton of errors in dmesg and have no working networking. It shows eth0 but getting cannot attach errors (hence my above comment that I need to continue to play with the compile options in u-boot).

Trying to leap to the next step. No clue why its not even trying to boot off the SD. I'd take a kernel panic message at this point. At least that would show I'm on the right track. My goal is to get it booting off the debian provided kernel on the SD card and once I have all of that stable, THEN work on building a custom kernel for it from either gentoo or vanilla sources.

There's very little wiki info out there for the Orange Pi's on gentoo and what is available is for older 32bit boards. Flying a bit blind here but quite happy that after a couple of days it appears I did compile and install u-boot well enough for it to actually bring a system up.

Anyone got a ORPi 3 4 or 5 that has any suggestions/advice?
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Fri Jan 27, 2023 9:02 pm    Post subject: Reply with quote

I don't have Orange Pi, but I am playing around using u-boot for RPI 1b.

Do you have UART connect to your ORPi? if not can you share what was displayed? when you boot with internal, does u-boot message displayed before kernel?

It would be a lot easier if you can get UART (usb2uart connection, for example This USB to TTL UART converter

If remember correctly, the board use SUNXi based firmware(AllWinner), so it is possible boot off SD card on 4k address. with SPL+U-boot.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Fri Jan 27, 2023 10:02 pm    Post subject: Reply with quote

I do not have a UART converter but was already considering grabbing one for it. You are correct, its an Allwinner H6 so SUNxi.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Fri Jan 27, 2023 10:33 pm    Post subject: Reply with quote

You can try https://linux-sunxi.org/Xunlong_Orange_Pi_3 for more information. I don't know if that is same device as your's.

If you need more help, I can give it a shot to help you boot into linux. I don't necessary know better after you got login prompt, but I been playing u-boot recently so I should be able to get you started.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Sat Jan 28, 2023 9:05 pm    Post subject: Reply with quote

well, the good news is that it appears I have u-boot figured out. The config file included in U-Boot's own repository isnt valid for my 3 LTS board (only the original 3). I did find a github repository maintained by the orange pi manufacturers that did have the LTS config and was able to compile what I needed.

I now appear to be reading the u-boot bootloader from the SD card. It's still then swinging over to the onboard flash to load the OS, but I consider this progress. Will continue playing with it.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Mon Jan 30, 2023 9:05 pm    Post subject: Reply with quote

Code:
U-Boot 2020.04-gc97dbbcad (Jan 28 2023 - 15:01:42 -0600) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: OrangePi 3 LTS
DRAM:  2 GiB
MMC:   mmc@4020000: 0, mmc@4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial@5000000
Out:   serial@5000000
Err:   serial@5000000
Net:   No ethernet found.
starting USB...
No working controllers found
Autoboot in 2 seconds, press <Space> to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3206 bytes read in 3 ms (1 MiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
203 bytes read in 2 ms (98.6 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
Bad Linux ARM64 Image magic!
SCRIPT FAILED: continuing...
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
3206 bytes read in 2 ms (1.5 MiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
203 bytes read in 1 ms (198.2 KiB/s)
37593 bytes read in 6 ms (6 MiB/s)
3844 bytes read in 3 ms (1.2 MiB/s)
Applying kernel provided DT fixup script (sun50i-h6-fixup.scr)
## Executing script at 45000000
13042247 bytes read in 1306 ms (9.5 MiB/s)
25868296 bytes read in 2589 ms (9.5 MiB/s)
## Loading init Ramdisk from Legacy Image at 4fe00000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    13042183 Bytes = 12.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 4fa00000
   Booting using the fdt blob at 0x4fa00000
   Loading Ramdisk to 4938f000, end 49fff207 ... OK
   Loading Device Tree to 000000004931d000, end 000000004938efff ... OK

Starting kernel ...


If I am interpreting the above serial output correctly, My u-boot is good. Its a slightly different version than the one I see if I remove my SD card, so I have definitely confirmed its using the one from the SD card, not the internal storage. It's just not liking something in my boot partition. I'm either missing a necessary configuration file or it doesnt like my kernel (either is possible, will continue to troubleshoot). The kernel I'm trying right now is an arm64 genkernel built one so in theory, it should have anything the SOC board needs.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Mon Jan 30, 2023 9:16 pm    Post subject: Reply with quote

Did you make your kernel wrapped in u-boot image format? i.e. uImage?

It looks to me you have two mmc from your u-boot point of view. do you know which mmc (i.e mmc0 or mmc1) is your SD card? If you not sure would you able to break autoboot and issue u-boot command
Code:
mmc list
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Mon Jan 30, 2023 9:34 pm    Post subject: Reply with quote

pingtoo wrote:
Did you make your kernel wrapped in u-boot image format? i.e. uImage?

It looks to me you have two mmc from your u-boot point of view. do you know which mmc (i.e mmc0 or mmc1) is your SD card? If you not sure would you able to break autoboot and issue u-boot command
Code:
mmc list




To your first question... no, no I did not. If I recall, the mkimage command is in the u-boot tools package. I'll look that up and find out how to convert to it.


0 Appears to be the external SD, 1 appears to be the internal storage.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Wed Feb 01, 2023 2:20 am    Post subject: Reply with quote

The good news: I was able to boot into a gentoo Linux system

The bad news: I had to do so by stealing the contents of a "stock" Orange Pi 3 LTS ubuntu /boot partition.

I just cannot get it to boot yet off a mainline kernel. Can't figure out what I'm doing wrong but will keep playing. Gives me a fdt error and falls back to the internal storage.


I do have one new problem: If I boot into Gentoo on the external SD, I lose the TTL over USB serial connection as soon as it gets to "Starting kernel" . Its just... dead. No clue why. With the ubuntu image, I still can log in over that serial session. Anyone know what I need to edit in /etc or enable on startup (and in boot or default runlevel?)
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Wed Feb 01, 2023 12:09 pm    Post subject: Reply with quote

JumboAg wrote:
The good news: I was able to boot into a gentoo Linux system

The bad news: I had to do so by stealing the contents of a "stock" Orange Pi 3 LTS ubuntu /boot partition.

I just cannot get it to boot yet off a mainline kernel. Can't figure out what I'm doing wrong but will keep playing. Gives me a fdt error and falls back to the internal storage.


I do have one new problem: If I boot into Gentoo on the external SD, I lose the TTL over USB serial connection as soon as it gets to "Starting kernel" . Its just... dead. No clue why. With the ubuntu image, I still can log in over that serial session. Anyone know what I need to edit in /etc or enable on startup (and in boot or default runlevel?)


It seems to me there are two different issues,
  • Boot mainline kernel
  • Boot into Gentoo rootfs
However It is not clear to me which happen what.
  • Not able boot mainline kernel, what happen?
  • "Starting kernel..." is u-boot message, there are more than one possibility
    • Kernel does not have right console setting
    • missing necessary kernel serial drive
    • kernel not started because it is on wrong starting address
  • fdt error, maybe boot use wrong memory address for fdt
It would be better we can break into u-boot prompt and issue commands to examine state to understand each error condition.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Wed Feb 01, 2023 2:08 pm    Post subject: Reply with quote

Correct that I have two issues.

The booting into gentoo rootfs issue is (I assume) just a minor config thing and not a kernel issue since the same kernel gives me serial access without the gentoo rootfs. Probably something in /etc/ to change.

I dont recall ever trying to escape to a command prompt in u-boot before. If you have anything you recommend I run from it to gather info I can definitely try to do so today.
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Wed Feb 01, 2023 2:44 pm    Post subject: Reply with quote

JumboAg wrote:
Correct that I have two issues.

The booting into gentoo rootfs issue is (I assume) just a minor config thing and not a kernel issue since the same kernel gives me serial access without the gentoo rootfs. Probably something in /etc/ to change.

I dont recall ever trying to escape to a command prompt in u-boot before. If you have anything you recommend I run from it to gather info I can definitely try to do so today.


Which kernel used for boot into gentoo rootfs? I guess ubuntu's?

To break in to u-boot, when you see the count down of autoboot, try to press any key, it should break the u-boot autoboot sequence and give you a u-boot prompt.

At u-boot prompt, please enter
Code:
printenv
and share the result. I am trying to understand what is your current u-boot setting. Is this u-boot your custom build or it is stock default?
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Thu Feb 02, 2023 3:48 pm    Post subject: Reply with quote

Here's an example of it not finding anything acceptable on the SD card and rolling back to the internal storage to boot off ubuntu:

Code:

U-Boot SPL 2020.04-gc97dbbcad (Jan 28 2023 - 15:01:42 -0600)
DRAM: 2048 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.8(debug):v2.8-312-g1678bbb57
NOTICE:  BL31: Built : 09:26:15, Jan 27 2023
NOTICE:  BL31: Detected Allwinner H6 SoC (1728)
NOTICE:  BL31: Found U-Boot DTB at 0xa07a870, model: OrangePi 3 LTS
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
INFO:    PMIC: Probing AXP805 on RSB
INFO:    PMIC: aldo1 voltage: 3.300V
INFO:    PMIC: aldo2 voltage: 3.300V
INFO:    PMIC: aldo3 voltage: 3.300V
INFO:    PMIC: bldo1 voltage: 1.800V
INFO:    PMIC: bldo2 voltage: 1.800V
INFO:    PMIC: bldo3 voltage: 1.800V
INFO:    PMIC: cldo1 voltage: 3.300V
INFO:    PMIC: dcdcd voltage: 0.960V
INFO:    PMIC: dcdce voltage: 1.200V
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
INFO:    BL31: cortex_a53: CPU workaround for 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


U-Boot 2020.04-gc97dbbcad (Jan 28 2023 - 15:01:42 -0600) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: OrangePi 3 LTS
DRAM:  2 GiB
MMC:   mmc@4020000: 0, mmc@4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial@5000000
Out:   serial@5000000
Err:   serial@5000000
Net:   No ethernet found.
starting USB...
No working controllers found
Autoboot in 2 seconds, press <Space> to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3206 bytes read in 4 ms (782.2 KiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
203 bytes read in 3 ms (65.4 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
No FDT memory address configured. Please configure
the FDT address via "fdt addr <address>" command.
Aborting!
Bad Linux ARM64 Image magic!
SCRIPT FAILED: continuing...
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
3206 bytes read in 2 ms (1.5 MiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
203 bytes read in 1 ms (198.2 KiB/s)
37593 bytes read in 6 ms (6 MiB/s)
3844 bytes read in 3 ms (1.2 MiB/s)
Applying kernel provided DT fixup script (sun50i-h6-fixup.scr)
## Executing script at 45000000
13042247 bytes read in 1306 ms (9.5 MiB/s)
25868296 bytes read in 2590 ms (9.5 MiB/s)
## Loading init Ramdisk from Legacy Image at 4fe00000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    13042183 Bytes = 12.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 4fa00000
   Booting using the fdt blob at 0x4fa00000
   Loading Ramdisk to 4938f000, end 49fff207 ... OK
   Loading Device Tree to 000000004931d000, end 000000004938efff ... OK

Starting kernel ...


Orange Pi 3.0.8 Jammy ttyS0

orangepi3-lts login:




Here's a dump of the u-boot environment.
Code:
=> printenv
arch=arm
baudrate=115200
board=sunxi
board_name=sunxi
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr ${fdtcontroladdr};fi;load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=fel mmc_auto usb0 pxe dhcp
bootcmd=run distro_bootcmd
bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_fel=if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then echo '(FEL boot)'; source ${fel_scriptaddr}; fi
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_mmc_auto=if test ${mmc_bootdev} -eq 1; then run bootcmd_mmc1; run bootcmd_mmc0; elif test ${mmc_bootdev} -eq 0; then run bootcmd_mmc0; run bootcmd_mmc1; fi
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=devnum=0; run usb_boot
bootdelay=2
bootm_size=0xa000000
console=ttyS0,115200
cpu=armv8
dfu_alt_info_ram=kernel ram 0x40080000 0x1000000;fdt ram 0x4FA00000 0x100000;ramdisk ram 0x4FE00000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
ethaddr=02:07:49:8a:f9:19
fdt_addr_r=0x4FA00000
fdtcontroladdr=bbf356d0
fdtfile=allwinner/sun50i-h6-orangepi-3-lts.dtb
kernel_addr_r=0x40080000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadsplash= for prefix in ${boot_prefixes}; do if test -e mmc 0 ${prefix}boot.bmp; then load mmc 0 ${splashimage} ${prefix}boot.bmp; bmp d ${splashimage}; fi; done
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
mmc_bootdev=0
partitions=name=loader1,start=8k,size=32k,uuid=${uuid_gpt_loader1};name=loader2,size=984k,uuid=${uuid_gpt_loader2};name=esp,size=128M,bootable,uuid=${uuid_gpt_esp};name=system,size=-,uuid=${uuid_gpt_system};
preboot=usb start
pxefile_addr_r=0x4FD00000
ramdisk_addr_r=0x4FE00000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x4FC00000
serial#=82c00007498af919
soc=sunxi
splashimage=66000000
splashpos=m,m
stderr=serial@5000000
stdin=serial@5000000
stdout=serial@5000000
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
uuid_gpt_esp=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
uuid_gpt_system=b921b045-1df0-41c3-af44-4c6f280d3fae

Environment size: 4645/131068 bytes
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Thu Feb 02, 2023 8:00 pm    Post subject: Reply with quote

JumboAg,

Thanks for the information.

We need a little bit more information in order to get parameters correct. :o

Please share
Code:
load mmc 1:1 4fc00000 /boot/boot.scr
md.b 4fc00000 cb
the 4fc00000 is memory address where /boot/boot.scr content loaded. the md.b is to display memory in byte count. the cb is the count in hexadecimal, it is the number 203 from your post.
There may be a second script need to investigate, but we will review first boot.scr to see if we need more information from second script.

The good news is your u-boot (2020.4) should be good enough to boot kernel >5.x (Because support Device Tree (DT)) as well support using a simple menu system to locate and boot kernel.
The not so good news is :lol: we need information from boot script in order to set parameters.

the boot menu configure is modified extlinux.conf (see doc here) You can create a file on your SD card as /extlinux/extlinux.conf with content
Code:
TIMEOUT 10
PROMPT 0
DEFAULT my-kernel
MENU TITLE SDcard /extlinux/extlinux.conf
LABEL my-kernel
   MENU LABEL My Gentoo Kernel 5.xx.yy
   KERNEL   /                              \
   APPEND  < Depends on what is in boot.scr >
   INITRD   \                              /
   FDT       \                            /


Another notes, with BL31 (Arm Trusted Firmware(ATF)) I am not sure if there is need to sign kernel or anything else. I have not play with ATF before.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Thu Feb 02, 2023 8:22 pm    Post subject: Reply with quote

Here's the output:

Code:
=> load mmc 1:1 4fc00000 /boot/boot.scr
3206 bytes read in 2 ms (1.5 MiB/s)
=> md.b 4fc00000 cb
4fc00000: 27 05 19 56 ae fe 53 82 63 17 2c 9c 00 00 0c 46    '..V..S.c.,....F
4fc00010: 00 00 00 00 00 00 00 00 09 24 1f 38 05 02 06 00    .........$.8....
4fc00020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
4fc00030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
4fc00040: 00 00 0c 3e 00 00 00 00 23 20 44 4f 20 4e 4f 54    ...>....# DO NOT
4fc00050: 20 45 44 49 54 20 54 48 49 53 20 46 49 4c 45 0a     EDIT THIS FILE.
4fc00060: 23 0a 23 20 50 6c 65 61 73 65 20 65 64 69 74 20    #.# Please edit
4fc00070: 2f 62 6f 6f 74 2f 6f 72 61 6e 67 65 70 69 45 6e    /boot/orangepiEn
4fc00080: 76 2e 74 78 74 20 74 6f 20 73 65 74 20 73 75 70    v.txt to set sup
4fc00090: 70 6f 72 74 65 64 20 70 61 72 61 6d 65 74 65 72    ported parameter
4fc000a0: 73 0a 23 0a 0a 23 20 64 65 66 61 75 6c 74 20 76    s.#..# default v
4fc000b0: 61 6c 75 65 73 0a 73 65 74 65 6e 76 20 6c 6f 61    alues.setenv loa
4fc000c0: 64 5f 61 64 64 72 20 22 30 78 34                   d_addr "0x4

Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Thu Feb 02, 2023 8:29 pm    Post subject: Reply with quote

JumboAg,

Thanks,

apparently I pick wrong line in your first post, the boot.scr is 3206 (0xC86). so please do
Code:
md.b 4fc00000 c86
and share.

Thanks.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Thu Feb 02, 2023 8:54 pm    Post subject: Reply with quote

Code:
=> load mmc 1:1 4fc00000 /boot/boot.scr
3206 bytes read in 1 ms (3.1 MiB/s)
=> md.b 4fc00000 c86
4fc00000: 27 05 19 56 ae fe 53 82 63 17 2c 9c 00 00 0c 46    '..V..S.c.,....F
4fc00010: 00 00 00 00 00 00 00 00 09 24 1f 38 05 02 06 00    .........$.8....
4fc00020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
4fc00030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
4fc00040: 00 00 0c 3e 00 00 00 00 23 20 44 4f 20 4e 4f 54    ...>....# DO NOT
4fc00050: 20 45 44 49 54 20 54 48 49 53 20 46 49 4c 45 0a     EDIT THIS FILE.
4fc00060: 23 0a 23 20 50 6c 65 61 73 65 20 65 64 69 74 20    #.# Please edit
4fc00070: 2f 62 6f 6f 74 2f 6f 72 61 6e 67 65 70 69 45 6e    /boot/orangepiEn
4fc00080: 76 2e 74 78 74 20 74 6f 20 73 65 74 20 73 75 70    v.txt to set sup
4fc00090: 70 6f 72 74 65 64 20 70 61 72 61 6d 65 74 65 72    ported parameter
4fc000a0: 73 0a 23 0a 0a 23 20 64 65 66 61 75 6c 74 20 76    s.#..# default v
4fc000b0: 61 6c 75 65 73 0a 73 65 74 65 6e 76 20 6c 6f 61    alues.setenv loa
4fc000c0: 64 5f 61 64 64 72 20 22 30 78 34 35 30 30 30 30    d_addr "0x450000
4fc000d0: 30 30 22 0a 73 65 74 65 6e 76 20 6f 76 65 72 6c    00".setenv overl
4fc000e0: 61 79 5f 65 72 72 6f 72 20 22 66 61 6c 73 65 22    ay_error "false"
4fc000f0: 0a 73 65 74 65 6e 76 20 72 6f 6f 74 64 65 76 20    .setenv rootdev
4fc00100: 22 2f 64 65 76 2f 6d 6d 63 62 6c 6b 30 70 31 22    "/dev/mmcblk0p1"
4fc00110: 0a 73 65 74 65 6e 76 20 76 65 72 62 6f 73 69 74    .setenv verbosit
4fc00120: 79 20 22 31 22 0a 73 65 74 65 6e 76 20 72 6f 6f    y "1".setenv roo
4fc00130: 74 66 73 74 79 70 65 20 22 65 78 74 34 22 0a 73    tfstype "ext4".s
4fc00140: 65 74 65 6e 76 20 63 6f 6e 73 6f 6c 65 20 22 62    etenv console "b
4fc00150: 6f 74 68 22 0a 73 65 74 65 6e 76 20 64 6f 63 6b    oth".setenv dock
4fc00160: 65 72 5f 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73    er_optimizations
4fc00170: 20 22 6f 6e 22 0a 73 65 74 65 6e 76 20 62 6f 6f     "on".setenv boo
4fc00180: 74 6c 6f 67 6f 20 22 66 61 6c 73 65 22 0a 0a 23    tlogo "false"..#
4fc00190: 20 50 72 69 6e 74 20 62 6f 6f 74 20 73 6f 75 72     Print boot sour
4fc001a0: 63 65 0a 69 74 65 73 74 2e 62 20 2a 30 78 31 30    ce.itest.b *0x10
4fc001b0: 30 32 38 20 3d 3d 20 30 78 30 30 20 26 26 20 65    028 == 0x00 && e
4fc001c0: 63 68 6f 20 22 55 2d 62 6f 6f 74 20 6c 6f 61 64    cho "U-boot load
4fc001d0: 65 64 20 66 72 6f 6d 20 53 44 22 0a 69 74 65 73    ed from SD".ites
4fc001e0: 74 2e 62 20 2a 30 78 31 30 30 32 38 20 3d 3d 20    t.b *0x10028 ==
4fc001f0: 30 78 30 32 20 26 26 20 65 63 68 6f 20 22 55 2d    0x02 && echo "U-
4fc00200: 62 6f 6f 74 20 6c 6f 61 64 65 64 20 66 72 6f 6d    boot loaded from
4fc00210: 20 65 4d 4d 43 20 6f 72 20 73 65 63 6f 6e 64 61     eMMC or seconda
4fc00220: 72 79 20 53 44 22 0a 69 74 65 73 74 2e 62 20 2a    ry SD".itest.b *
4fc00230: 30 78 31 30 30 32 38 20 3d 3d 20 30 78 30 33 20    0x10028 == 0x03
4fc00240: 26 26 20 65 63 68 6f 20 22 55 2d 62 6f 6f 74 20    && echo "U-boot
4fc00250: 6c 6f 61 64 65 64 20 66 72 6f 6d 20 53 50 49 22    loaded from SPI"
4fc00260: 0a 0a 65 63 68 6f 20 22 42 6f 6f 74 20 73 63 72    ..echo "Boot scr
4fc00270: 69 70 74 20 6c 6f 61 64 65 64 20 66 72 6f 6d 20    ipt loaded from
4fc00280: 24 7b 64 65 76 74 79 70 65 7d 22 0a 0a 69 66 20    ${devtype}"..if
4fc00290: 74 65 73 74 20 2d 65 20 24 7b 64 65 76 74 79 70    test -e ${devtyp
4fc002a0: 65 7d 20 24 7b 64 65 76 6e 75 6d 7d 20 24 7b 70    e} ${devnum} ${p
4fc002b0: 72 65 66 69 78 7d 6f 72 61 6e 67 65 70 69 45 6e    refix}orangepiEn
4fc002c0: 76 2e 74 78 74 3b 20 74 68 65 6e 0a 09 6c 6f 61    v.txt; then..loa
4fc002d0: 64 20 24 7b 64 65 76 74 79 70 65 7d 20 24 7b 64    d ${devtype} ${d
4fc002e0: 65 76 6e 75 6d 7d 20 24 7b 6c 6f 61 64 5f 61 64    evnum} ${load_ad
4fc002f0: 64 72 7d 20 24 7b 70 72 65 66 69 78 7d 6f 72 61    dr} ${prefix}ora
4fc00300: 6e 67 65 70 69 45 6e 76 2e 74 78 74 0a 09 65 6e    ngepiEnv.txt..en
4fc00310: 76 20 69 6d 70 6f 72 74 20 2d 74 20 24 7b 6c 6f    v import -t ${lo
4fc00320: 61 64 5f 61 64 64 72 7d 20 24 7b 66 69 6c 65 73    ad_addr} ${files
4fc00330: 69 7a 65 7d 0a 66 69 0a 0a 69 66 20 74 65 73 74    ize}.fi..if test
4fc00340: 20 22 24 7b 63 6f 6e 73 6f 6c 65 7d 22 20 3d 20     "${console}" =
4fc00350: 22 64 69 73 70 6c 61 79 22 20 7c 7c 20 74 65 73    "display" || tes
4fc00360: 74 20 22 24 7b 63 6f 6e 73 6f 6c 65 7d 22 20 3d    t "${console}" =
4fc00370: 20 22 62 6f 74 68 22 3b 20 74 68 65 6e 20 73 65     "both"; then se
4fc00380: 74 65 6e 76 20 63 6f 6e 73 6f 6c 65 61 72 67 73    tenv consoleargs
4fc00390: 20 22 63 6f 6e 73 6f 6c 65 3d 74 74 79 53 30 2c     "console=ttyS0,
4fc003a0: 31 31 35 32 30 30 20 63 6f 6e 73 6f 6c 65 3d 74    115200 console=t
4fc003b0: 74 79 31 22 3b 20 66 69 0a 69 66 20 74 65 73 74    ty1"; fi.if test
4fc003c0: 20 22 24 7b 63 6f 6e 73 6f 6c 65 7d 22 20 3d 20     "${console}" =
4fc003d0: 22 73 65 72 69 61 6c 22 3b 20 74 68 65 6e 20 73    "serial"; then s
4fc003e0: 65 74 65 6e 76 20 63 6f 6e 73 6f 6c 65 61 72 67    etenv consolearg
4fc003f0: 73 20 22 63 6f 6e 73 6f 6c 65 3d 74 74 79 53 30    s "console=ttyS0
4fc00400: 2c 31 31 35 32 30 30 22 3b 20 66 69 0a 69 66 20    ,115200"; fi.if
4fc00410: 74 65 73 74 20 22 24 7b 62 6f 6f 74 6c 6f 67 6f    test "${bootlogo
4fc00420: 7d 22 20 3d 20 22 74 72 75 65 22 3b 20 74 68 65    }" = "true"; the
4fc00430: 6e 20 73 65 74 65 6e 76 20 63 6f 6e 73 6f 6c 65    n setenv console
4fc00440: 61 72 67 73 20 22 62 6f 6f 74 73 70 6c 61 73 68    args "bootsplash
4fc00450: 2e 62 6f 6f 74 66 69 6c 65 3d 62 6f 6f 74 73 70    .bootfile=bootsp
4fc00460: 6c 61 73 68 2e 6f 72 61 6e 67 65 70 69 20 24 7b    lash.orangepi ${
4fc00470: 63 6f 6e 73 6f 6c 65 61 72 67 73 7d 22 3b 20 66    consoleargs}"; f
4fc00480: 69 0a 0a 23 20 67 65 74 20 50 41 52 54 55 55 49    i..# get PARTUUI
4fc00490: 44 20 6f 66 20 66 69 72 73 74 20 70 61 72 74 69    D of first parti
4fc004a0: 74 69 6f 6e 20 6f 6e 20 53 44 2f 65 4d 4d 43 20    tion on SD/eMMC
4fc004b0: 69 74 20 77 61 73 20 6c 6f 61 64 65 64 20 66 72    it was loaded fr
4fc004c0: 6f 6d 0a 23 20 6d 6d 63 20 30 20 69 73 20 61 6c    om.# mmc 0 is al
4fc004d0: 77 61 79 73 20 6d 61 70 70 65 64 20 74 6f 20 64    ways mapped to d
4fc004e0: 65 76 69 63 65 20 75 2d 62 6f 6f 74 20 28 32 30    evice u-boot (20
4fc004f0: 31 36 2e 30 39 2b 29 20 77 61 73 20 6c 6f 61 64    16.09+) was load
4fc00500: 65 64 20 66 72 6f 6d 0a 69 66 20 74 65 73 74 20    ed from.if test
4fc00510: 22 24 7b 64 65 76 74 79 70 65 7d 22 20 3d 20 22    "${devtype}" = "
4fc00520: 6d 6d 63 22 3b 20 74 68 65 6e 20 70 61 72 74 20    mmc"; then part
4fc00530: 75 75 69 64 20 6d 6d 63 20 30 3a 31 20 70 61 72    uuid mmc 0:1 par
4fc00540: 74 75 75 69 64 3b 20 66 69 0a 0a 73 65 74 65 6e    tuuid; fi..seten
4fc00550: 76 20 62 6f 6f 74 61 72 67 73 20 22 72 6f 6f 74    v bootargs "root
4fc00560: 3d 24 7b 72 6f 6f 74 64 65 76 7d 20 72 6f 6f 74    =${rootdev} root
4fc00570: 77 61 69 74 20 72 6f 6f 74 66 73 74 79 70 65 3d    wait rootfstype=
4fc00580: 24 7b 72 6f 6f 74 66 73 74 79 70 65 7d 20 24 7b    ${rootfstype} ${
4fc00590: 63 6f 6e 73 6f 6c 65 61 72 67 73 7d 20 63 6f 6e    consoleargs} con
4fc005a0: 73 6f 6c 65 62 6c 61 6e 6b 3d 30 20 6c 6f 67 6c    soleblank=0 logl
4fc005b0: 65 76 65 6c 3d 24 7b 76 65 72 62 6f 73 69 74 79    evel=${verbosity
4fc005c0: 7d 20 75 62 6f 6f 74 70 61 72 74 3d 24 7b 70 61    } ubootpart=${pa
4fc005d0: 72 74 75 75 69 64 7d 20 75 73 62 2d 73 74 6f 72    rtuuid} usb-stor
4fc005e0: 61 67 65 2e 71 75 69 72 6b 73 3d 24 7b 75 73 62    age.quirks=${usb
4fc005f0: 73 74 6f 72 61 67 65 71 75 69 72 6b 73 7d 20 24    storagequirks} $
4fc00600: 7b 65 78 74 72 61 61 72 67 73 7d 20 24 7b 65 78    {extraargs} ${ex
4fc00610: 74 72 61 62 6f 61 72 64 61 72 67 73 7d 22 0a 0a    traboardargs}"..
4fc00620: 69 66 20 74 65 73 74 20 22 24 7b 64 6f 63 6b 65    if test "${docke
4fc00630: 72 5f 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 7d    r_optimizations}
4fc00640: 22 20 3d 20 22 6f 6e 22 3b 20 74 68 65 6e 20 73    " = "on"; then s
4fc00650: 65 74 65 6e 76 20 62 6f 6f 74 61 72 67 73 20 22    etenv bootargs "
4fc00660: 24 7b 62 6f 6f 74 61 72 67 73 7d 20 63 67 72 6f    ${bootargs} cgro
4fc00670: 75 70 5f 65 6e 61 62 6c 65 3d 6d 65 6d 6f 72 79    up_enable=memory
4fc00680: 20 73 77 61 70 61 63 63 6f 75 6e 74 3d 31 22 3b     swapaccount=1";
4fc00690: 20 66 69 0a 0a 6c 6f 61 64 20 24 7b 64 65 76 74     fi..load ${devt
4fc006a0: 79 70 65 7d 20 24 7b 64 65 76 6e 75 6d 7d 20 24    ype} ${devnum} $
4fc006b0: 7b 66 64 74 5f 61 64 64 72 5f 72 7d 20 24 7b 70    {fdt_addr_r} ${p
4fc006c0: 72 65 66 69 78 7d 64 74 62 2f 24 7b 66 64 74 66    refix}dtb/${fdtf
4fc006d0: 69 6c 65 7d 0a 66 64 74 20 61 64 64 72 20 24 7b    ile}.fdt addr ${
4fc006e0: 66 64 74 5f 61 64 64 72 5f 72 7d 0a 66 64 74 20    fdt_addr_r}.fdt
4fc006f0: 72 65 73 69 7a 65 20 36 35 35 33 36 0a 66 6f 72    resize 65536.for
4fc00700: 20 6f 76 65 72 6c 61 79 5f 66 69 6c 65 20 69 6e     overlay_file in
4fc00710: 20 24 7b 6f 76 65 72 6c 61 79 73 7d 3b 20 64 6f     ${overlays}; do
4fc00720: 0a 09 69 66 20 6c 6f 61 64 20 24 7b 64 65 76 74    ..if load ${devt
4fc00730: 79 70 65 7d 20 24 7b 64 65 76 6e 75 6d 7d 20 24    ype} ${devnum} $
4fc00740: 7b 6c 6f 61 64 5f 61 64 64 72 7d 20 24 7b 70 72    {load_addr} ${pr
4fc00750: 65 66 69 78 7d 64 74 62 2f 61 6c 6c 77 69 6e 6e    efix}dtb/allwinn
4fc00760: 65 72 2f 6f 76 65 72 6c 61 79 2f 24 7b 6f 76 65    er/overlay/${ove
4fc00770: 72 6c 61 79 5f 70 72 65 66 69 78 7d 2d 24 7b 6f    rlay_prefix}-${o
4fc00780: 76 65 72 6c 61 79 5f 66 69 6c 65 7d 2e 64 74 62    verlay_file}.dtb
4fc00790: 6f 3b 20 74 68 65 6e 0a 09 09 65 63 68 6f 20 22    o; then...echo "
4fc007a0: 41 70 70 6c 79 69 6e 67 20 6b 65 72 6e 65 6c 20    Applying kernel
4fc007b0: 70 72 6f 76 69 64 65 64 20 44 54 20 6f 76 65 72    provided DT over
4fc007c0: 6c 61 79 20 24 7b 6f 76 65 72 6c 61 79 5f 70 72    lay ${overlay_pr
4fc007d0: 65 66 69 78 7d 2d 24 7b 6f 76 65 72 6c 61 79 5f    efix}-${overlay_
4fc007e0: 66 69 6c 65 7d 2e 64 74 62 6f 22 0a 09 09 66 64    file}.dtbo"...fd
4fc007f0: 74 20 61 70 70 6c 79 20 24 7b 6c 6f 61 64 5f 61    t apply ${load_a
4fc00800: 64 64 72 7d 20 7c 7c 20 73 65 74 65 6e 76 20 6f    ddr} || setenv o
4fc00810: 76 65 72 6c 61 79 5f 65 72 72 6f 72 20 22 74 72    verlay_error "tr
4fc00820: 75 65 22 0a 09 66 69 0a 64 6f 6e 65 0a 66 6f 72    ue"..fi.done.for
4fc00830: 20 6f 76 65 72 6c 61 79 5f 66 69 6c 65 20 69 6e     overlay_file in
4fc00840: 20 24 7b 75 73 65 72 5f 6f 76 65 72 6c 61 79 73     ${user_overlays
4fc00850: 7d 3b 20 64 6f 0a 09 69 66 20 6c 6f 61 64 20 24    }; do..if load $
4fc00860: 7b 64 65 76 74 79 70 65 7d 20 24 7b 64 65 76 6e    {devtype} ${devn
4fc00870: 75 6d 7d 20 24 7b 6c 6f 61 64 5f 61 64 64 72 7d    um} ${load_addr}
4fc00880: 20 24 7b 70 72 65 66 69 78 7d 6f 76 65 72 6c 61     ${prefix}overla
4fc00890: 79 2d 75 73 65 72 2f 24 7b 6f 76 65 72 6c 61 79    y-user/${overlay
4fc008a0: 5f 66 69 6c 65 7d 2e 64 74 62 6f 3b 20 74 68 65    _file}.dtbo; the
4fc008b0: 6e 0a 09 09 65 63 68 6f 20 22 41 70 70 6c 79 69    n...echo "Applyi
4fc008c0: 6e 67 20 75 73 65 72 20 70 72 6f 76 69 64 65 64    ng user provided
4fc008d0: 20 44 54 20 6f 76 65 72 6c 61 79 20 24 7b 6f 76     DT overlay ${ov
4fc008e0: 65 72 6c 61 79 5f 66 69 6c 65 7d 2e 64 74 62 6f    erlay_file}.dtbo
4fc008f0: 22 0a 09 09 66 64 74 20 61 70 70 6c 79 20 24 7b    "...fdt apply ${
4fc00900: 6c 6f 61 64 5f 61 64 64 72 7d 20 7c 7c 20 73 65    load_addr} || se
4fc00910: 74 65 6e 76 20 6f 76 65 72 6c 61 79 5f 65 72 72    tenv overlay_err
4fc00920: 6f 72 20 22 74 72 75 65 22 0a 09 66 69 0a 64 6f    or "true"..fi.do
4fc00930: 6e 65 0a 69 66 20 74 65 73 74 20 22 24 7b 6f 76    ne.if test "${ov
4fc00940: 65 72 6c 61 79 5f 65 72 72 6f 72 7d 22 20 3d 20    erlay_error}" =
4fc00950: 22 74 72 75 65 22 3b 20 74 68 65 6e 0a 09 65 63    "true"; then..ec
4fc00960: 68 6f 20 22 45 72 72 6f 72 20 61 70 70 6c 79 69    ho "Error applyi
4fc00970: 6e 67 20 44 54 20 6f 76 65 72 6c 61 79 73 2c 20    ng DT overlays,
4fc00980: 72 65 73 74 6f 72 69 6e 67 20 6f 72 69 67 69 6e    restoring origin
4fc00990: 61 6c 20 44 54 22 0a 09 6c 6f 61 64 20 24 7b 64    al DT"..load ${d
4fc009a0: 65 76 74 79 70 65 7d 20 24 7b 64 65 76 6e 75 6d    evtype} ${devnum
4fc009b0: 7d 20 24 7b 66 64 74 5f 61 64 64 72 5f 72 7d 20    } ${fdt_addr_r}
4fc009c0: 24 7b 70 72 65 66 69 78 7d 64 74 62 2f 24 7b 66    ${prefix}dtb/${f
4fc009d0: 64 74 66 69 6c 65 7d 0a 65 6c 73 65 0a 09 69 66    dtfile}.else..if
4fc009e0: 20 6c 6f 61 64 20 24 7b 64 65 76 74 79 70 65 7d     load ${devtype}
4fc009f0: 20 24 7b 64 65 76 6e 75 6d 7d 20 24 7b 6c 6f 61     ${devnum} ${loa
4fc00a00: 64 5f 61 64 64 72 7d 20 24 7b 70 72 65 66 69 78    d_addr} ${prefix
4fc00a10: 7d 64 74 62 2f 61 6c 6c 77 69 6e 6e 65 72 2f 6f    }dtb/allwinner/o
4fc00a20: 76 65 72 6c 61 79 2f 24 7b 6f 76 65 72 6c 61 79    verlay/${overlay
4fc00a30: 5f 70 72 65 66 69 78 7d 2d 66 69 78 75 70 2e 73    _prefix}-fixup.s
4fc00a40: 63 72 3b 20 74 68 65 6e 0a 09 09 65 63 68 6f 20    cr; then...echo
4fc00a50: 22 41 70 70 6c 79 69 6e 67 20 6b 65 72 6e 65 6c    "Applying kernel
4fc00a60: 20 70 72 6f 76 69 64 65 64 20 44 54 20 66 69 78     provided DT fix
4fc00a70: 75 70 20 73 63 72 69 70 74 20 28 24 7b 6f 76 65    up script (${ove
4fc00a80: 72 6c 61 79 5f 70 72 65 66 69 78 7d 2d 66 69 78    rlay_prefix}-fix
4fc00a90: 75 70 2e 73 63 72 29 22 0a 09 09 73 6f 75 72 63    up.scr)"...sourc
4fc00aa0: 65 20 24 7b 6c 6f 61 64 5f 61 64 64 72 7d 0a 09    e ${load_addr}..
4fc00ab0: 66 69 0a 09 69 66 20 74 65 73 74 20 2d 65 20 24    fi..if test -e $
4fc00ac0: 7b 64 65 76 74 79 70 65 7d 20 24 7b 64 65 76 6e    {devtype} ${devn
4fc00ad0: 75 6d 7d 20 24 7b 70 72 65 66 69 78 7d 66 69 78    um} ${prefix}fix
4fc00ae0: 75 70 2e 73 63 72 3b 20 74 68 65 6e 0a 09 09 6c    up.scr; then...l
4fc00af0: 6f 61 64 20 24 7b 64 65 76 74 79 70 65 7d 20 24    oad ${devtype} $
4fc00b00: 7b 64 65 76 6e 75 6d 7d 20 24 7b 6c 6f 61 64 5f    {devnum} ${load_
4fc00b10: 61 64 64 72 7d 20 24 7b 70 72 65 66 69 78 7d 66    addr} ${prefix}f
4fc00b20: 69 78 75 70 2e 73 63 72 0a 09 09 65 63 68 6f 20    ixup.scr...echo
4fc00b30: 22 41 70 70 6c 79 69 6e 67 20 75 73 65 72 20 70    "Applying user p
4fc00b40: 72 6f 76 69 64 65 64 20 66 69 78 75 70 20 73 63    rovided fixup sc
4fc00b50: 72 69 70 74 20 28 66 69 78 75 70 2e 73 63 72 29    ript (fixup.scr)
4fc00b60: 22 0a 09 09 73 6f 75 72 63 65 20 24 7b 6c 6f 61    "...source ${loa
4fc00b70: 64 5f 61 64 64 72 7d 0a 09 66 69 0a 66 69 0a 0a    d_addr}..fi.fi..
4fc00b80: 6c 6f 61 64 20 24 7b 64 65 76 74 79 70 65 7d 20    load ${devtype}
4fc00b90: 24 7b 64 65 76 6e 75 6d 7d 20 24 7b 72 61 6d 64    ${devnum} ${ramd
4fc00ba0: 69 73 6b 5f 61 64 64 72 5f 72 7d 20 24 7b 70 72    isk_addr_r} ${pr
4fc00bb0: 65 66 69 78 7d 75 49 6e 69 74 72 64 0a 6c 6f 61    efix}uInitrd.loa
4fc00bc0: 64 20 24 7b 64 65 76 74 79 70 65 7d 20 24 7b 64    d ${devtype} ${d
4fc00bd0: 65 76 6e 75 6d 7d 20 24 7b 6b 65 72 6e 65 6c 5f    evnum} ${kernel_
4fc00be0: 61 64 64 72 5f 72 7d 20 24 7b 70 72 65 66 69 78    addr_r} ${prefix
4fc00bf0: 7d 49 6d 61 67 65 0a 0a 62 6f 6f 74 69 20 24 7b    }Image..booti ${
4fc00c00: 6b 65 72 6e 65 6c 5f 61 64 64 72 5f 72 7d 20 24    kernel_addr_r} $
4fc00c10: 7b 72 61 6d 64 69 73 6b 5f 61 64 64 72 5f 72 7d    {ramdisk_addr_r}
4fc00c20: 20 24 7b 66 64 74 5f 61 64 64 72 5f 72 7d 0a 0a     ${fdt_addr_r}..
4fc00c30: 23 20 52 65 63 6f 6d 70 69 6c 65 20 77 69 74 68    # Recompile with
4fc00c40: 3a 0a 23 20 6d 6b 69 6d 61 67 65 20 2d 43 20 6e    :.# mkimage -C n
4fc00c50: 6f 6e 65 20 2d 41 20 61 72 6d 20 2d 54 20 73 63    one -A arm -T sc
4fc00c60: 72 69 70 74 20 2d 64 20 2f 62 6f 6f 74 2f 62 6f    ript -d /boot/bo
4fc00c70: 6f 74 2e 63 6d 64 20 2f 62 6f 6f 74 2f 62 6f 6f    ot.cmd /boot/boo
4fc00c80: 74 2e 73 63 72 0a                                  t.scr.
=>

(Matches the boot.cmd contents)

Code:
orangepi@orangepi3-lts:/mnt/gentoo/boot$ ls -la
total 41510
drwxr-xr-x  2 root root     1536 Jan  1  1970 .
drwxr-xr-x 22 root root     4096 Feb  1 18:21 ..
-rwxr-xr-x  1 root root   230456 Sep  6 11:18 boot.bmp
-rwxr-xr-x  1 root root     3134 Sep  6 11:18 boot.cmd
-rwxr-xr-x  1 root root     3206 Sep  6 11:18 boot.scr
-rwxr-xr-x  1 root root  9622616 Feb  2 02:47 initramfs-5.15.88-gentoo-arm64.img
-rwxr-xr-x  1 root root      203 Feb  1 02:08 orangepiEnv.txt
-rwxr-xr-x  1 root root     1542 Sep  6 11:18 orangepi_first_run.txt.template
-rwxr-xr-x  1 root root  5287345 Feb  1 14:54 System.map-5.15.88-gentoo-arm64
-rwxr-xr-x  1 root root 27349504 Feb  1 14:54 vmlinuz-5.15.88-gentoo-arm64
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Thu Feb 02, 2023 10:58 pm    Post subject: Reply with quote

JumboAg,

Thanks for the information.

This will be two parts post. First post (this one) just the boot/boot.scr content in better format for human. The second post have some explanation and request for more information.

/boot/boot.scr:
# DO NOT EDIT THIS FILE.
#
# Please edit
/boot/orangepiEnv.txt to set supported parameters
#

# default values
setenv load_addr "0x45000000"
setenv overlay_error "false"
setenv rootdev "/dev/mmcblk0p1"
setenv verbosity "1"
setenv rootfstype "ext4"
setenv console "both"
setenv docker_optimizations "on"
setenv bootlogo "false"

# Print boot source
itest.b *0x10028 == 0x00 && echo "U-boot loaded from SD"
itest.b *0x10028 == 0x02 && echo "U-boot loaded from eMMC or secondary SD"
itest.b *0x10028 == 0x03 && echo "U-boot loaded from SPI"

echo "Boot script loaded from ${devtype}"

if test -e ${devtype} ${devnum} ${prefix}orangepiEnv.txt; then
  load ${devtype} ${devnum} ${load_addr} ${prefix}orangepiEnv.txt
  env import -t ${load_addr} ${filesize}
fi

if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=ttyS0,115200 console=tty1"; fi
if test "${console}" = "serial"; then setenv consoleargs "console=ttyS0,115200"; fi
if test "${bootlogo}" = "true"; then setenv consoleargs "bootsplash.bootfile=bootsplash.orangepi ${consoleargs}"; fi

# get PARTUUID of first partition on SD/eMMC it was loaded from
# mmc 0 is always mapped to device u-boot (2016.09+) was loaded from
if test "${devtype}" = "mmc"; then part uuid mmc 0:1 partuuid; fi

setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} consoleblank=0 loglevel=${verbosity} ubootpart=${partuuid} usb-storage.quirks=${usbstoragequirks} ${extraargs} ${extraboardargs}"

if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=memory swapaccount=1"; fi

load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
for overlay_file in ${overlays}; do
  if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-${overlay_file}.dtbo; then
    echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo"
    fdt apply ${load_addr} || setenv overlay_error "true"
  fi
done
for overlay_file in ${user_overlays}; do
  if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then
    echo "Applying user provided DT overlay ${overlay_file}.dtbo"
    fdt apply ${load_addr} || setenv overlay_error "true"
  fi
done
if test "${overlay_error}" = "true"; then
  echo "Error applying DT overlays, restoring original DT"
  load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
else
  if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-fixup.scr; then
    echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
    source ${load_addr}
  fi
  if test -e ${devtype} ${devnum} ${prefix}fixup.scr; then
    load ${devtype} ${devnum} ${load_addr} ${prefix}fixup.scr
    echo "Applying user provided fixup script (fixup.scr)"
    source ${load_addr}
  fi
fi

load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image
booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}

# Recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Thu Feb 02, 2023 11:23 pm    Post subject: Reply with quote

JumboAg,

We need to know what is in internal eMMC. There are several key factors will determine how we proceed.
  • Kernel load address and entry point address
  • orangepiEnv.txt content
  • sun50i-h6-fixup.scr content -- another script. most likely used to setup live DT
  • u-boot partition UUID -- not sure if this one is needed, I think gentoo openrc don't care but may be it is useful later.

JumboAg wrote:
Code:
orangepi@orangepi3-lts:/mnt/gentoo/boot$ ls -la
total 41510
drwxr-xr-x  2 root root     1536 Jan  1  1970 .
drwxr-xr-x 22 root root     4096 Feb  1 18:21 ..
-rwxr-xr-x  1 root root   230456 Sep  6 11:18 boot.bmp
-rwxr-xr-x  1 root root     3134 Sep  6 11:18 boot.cmd
-rwxr-xr-x  1 root root     3206 Sep  6 11:18 boot.scr
-rwxr-xr-x  1 root root  9622616 Feb  2 02:47 initramfs-5.15.88-gentoo-arm64.img
-rwxr-xr-x  1 root root      203 Feb  1 02:08 orangepiEnv.txt
-rwxr-xr-x  1 root root     1542 Sep  6 11:18 orangepi_first_run.txt.template
-rwxr-xr-x  1 root root  5287345 Feb  1 14:54 System.map-5.15.88-gentoo-arm64
-rwxr-xr-x  1 root root 27349504 Feb  1 14:54 vmlinuz-5.15.88-gentoo-arm64
is from SD card, Am I right?

It looks to me your /mnt/gentoo/boot/vmlinuz-5.15.88-gentoo-arm64 is not wrapped in u-boot image format as well as /mnt/gentoo/boot/initramfs-5.15.88-gentoo-arm64.img also not u-boot image format. This might work if your u-boot support "booti" and have CONFIG_SUPPORT_RAW_INITRD in your u-boot build. Otherwise you need to wrapped both in to u-boot image format. i.e mkimage ...

If you boot into ubunto, as root run
Code:
lsblk -f /dev/mmcblk1
I think mmcblk1 is the internal emmc. if I am wrong about mmcblk1 is internal eMMC please try same command on mmcblk0. Please mount the eMMC boot partition and ls -lR <eMMC/boot/mountpoint> so we know the directory structure.

Back to boot into u-boot.

At u-boot prompt, do
Code:
load mmc 1 $kernel_addr_r /boot/Image
iminfo $kernel_addr_r
This will give us kernel's load address and entrypoint address, so it can be used later in the mkimage command.

Please try to see if the "sun50i-h6-fixup.scr" source code is on the eMMC, share if it is, if it is not please try to do the same for loading boot.scr in memory and share the hex dump, I will try to decode it.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Fri Feb 03, 2023 2:08 am    Post subject: Reply with quote

I cannot thank you enough for this. I'm hoping to replicate what I learn across different SOCs from various vendors once I get through this once.


1) Yes, the ls output is the boot partition on my SD card.

2) I stil have the .config file for when I compiled u-boot... :)
CONFIG_SUPPORT_RAW_INITRD=y
CONFIG_CMD_BOOTI=y


3) mmcblk2 = internal emmc
mmcblk0 = SD card

Code:

orangepi@orangepi3-lts:~$ lsblk -f /dev/mmcblk2
NAME FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
mmcblk2

└─mmcblk2p1
     ext4   1.0         69e4cc7f-278c-467f-a040-793c97570f42    1.5G    73% /var/log.hdd

orangepi@orangepi3-lts:~$ ls -lR /boot
/boot:
total 55640
-rw-r--r-- 1 root root   230456 Sep  6 11:18 boot.bmp
-rw-r--r-- 1 root root     3134 Sep  6 11:18 boot.cmd
-rw-r--r-- 1 root root     3206 Sep  6 11:18 boot.scr
-rw-r--r-- 1 root root   199032 Sep  6 11:18 config-5.16.17-sun50iw6
lrwxrwxrwx 1 root root       20 Sep  6 11:18 dtb -> dtb-5.16.17-sun50iw6
drwxr-xr-x 3 root root     4096 Sep  6 11:18 dtb-5.16.17-sun50iw6
lrwxrwxrwx 1 root root       24 Sep  6 11:18 Image -> vmlinuz-5.16.17-sun50iw6
-rw-r--r-- 1 root root 13042183 Sep  6 11:18 initrd.img-5.16.17-sun50iw6
-rw-r--r-- 1 root root      203 Feb  3 01:32 orangepiEnv.txt
-rw-r--r-- 1 root root     1542 Sep  6 11:18 orangepi_first_run.txt.template
-rw-r--r-- 1 root root  4555421 Sep  6 11:18 System.map-5.16.17-sun50iw6
lrwxrwxrwx 1 root root       24 Sep  6 11:18 uInitrd -> uInitrd-5.16.17-sun50iw6
-rw-r--r-- 1 root root 13042247 Sep  6 11:18 uInitrd-5.16.17-sun50iw6
-rw-r--r-- 1 root root 25868296 Sep  6 11:18 vmlinuz-5.16.17-sun50iw6

/boot/dtb-5.16.17-sun50iw6:
total 4
drwxr-xr-x 3 root root 4096 Sep  6 11:18 allwinner

/boot/dtb-5.16.17-sun50iw6/allwinner:
total 456
drwxr-xr-x 2 root root  4096 Sep  6 11:18 overlay
-rw-r--r-- 1 root root 43112 Sep  6 11:18 sun50i-a64-orangepi-win.dtb
-rw-r--r-- 1 root root 32160 Sep  6 11:18 sun50i-h5-orangepi-pc2.dtb
-rw-r--r-- 1 root root 32061 Sep  6 11:18 sun50i-h5-orangepi-prime.dtb
-rw-r--r-- 1 root root 31254 Sep  6 11:18 sun50i-h5-orangepi-zero-plus2.dtb
-rw-r--r-- 1 root root 31329 Sep  6 11:18 sun50i-h5-orangepi-zero-plus.dtb
-rw-r--r-- 1 root root 38047 Sep  6 11:18 sun50i-h616-orangepi-zero2-b.dtb
-rw-r--r-- 1 root root 37897 Sep  6 11:18 sun50i-h616-orangepi-zero2.dtb
-rw-r--r-- 1 root root 38051 Sep  6 11:18 sun50i-h616-orangepi-zero2-lts.dtb
-rw-r--r-- 1 root root 37998 Sep  6 11:18 sun50i-h6-orangepi-3.dtb
-rw-r--r-- 1 root root 37593 Sep  6 11:18 sun50i-h6-orangepi-3-lts.dtb
-rw-r--r-- 1 root root 37599 Sep  6 11:18 sun50i-h6-orangepi-lite2.dtb
-rw-r--r-- 1 root root 37125 Sep  6 11:18 sun50i-h6-orangepi-one-plus.dtb

/boot/dtb-5.16.17-sun50iw6/allwinner/overlay:
total 264
-rw-r--r-- 1 root root 3998 Sep  6 11:18 README.sun50i-a64-overlays
-rw-r--r-- 1 root root 4737 Sep  6 11:18 README.sun50i-h5-overlays
-rw-r--r-- 1 root root 3821 Sep  6 11:18 sun50i-a64-fixup.scr
-rw-r--r-- 1 root root  794 Sep  6 11:18 sun50i-a64-i2c0.dtbo
-rw-r--r-- 1 root root  496 Sep  6 11:18 sun50i-a64-i2c1.dtbo
-rw-r--r-- 1 root root 2364 Sep  6 11:18 sun50i-a64-pine64-7inch-lcd.dtbo
-rw-r--r-- 1 root root  778 Sep  6 11:18 sun50i-a64-pps-gpio.dtbo
-rw-r--r-- 1 root root 1173 Sep  6 11:18 sun50i-a64-spi-add-cs1.dtbo
-rw-r--r-- 1 root root  668 Sep  6 11:18 sun50i-a64-spi-jedec-nor.dtbo
-rw-r--r-- 1 root root  792 Sep  6 11:18 sun50i-a64-spi-spidev.dtbo
-rw-r--r-- 1 root root  506 Sep  6 11:18 sun50i-a64-uart1.dtbo
-rw-r--r-- 1 root root  963 Sep  6 11:18 sun50i-a64-uart2.dtbo
-rw-r--r-- 1 root root  804 Sep  6 11:18 sun50i-a64-uart3.dtbo
-rw-r--r-- 1 root root  963 Sep  6 11:18 sun50i-a64-uart4.dtbo
-rw-r--r-- 1 root root  777 Sep  6 11:18 sun50i-a64-w1-gpio.dtbo
-rw-r--r-- 1 root root  339 Sep  6 11:18 sun50i-h5-analog-codec.dtbo
-rw-r--r-- 1 root root  384 Sep  6 11:18 sun50i-h5-cir.dtbo
-rw-r--r-- 1 root root  477 Sep  6 11:18 sun50i-h5-cpu-clock-1.0GHz-1.1v.dtbo
-rw-r--r-- 1 root root  477 Sep  6 11:18 sun50i-h5-cpu-clock-1.2GHz-1.3v.dtbo
-rw-r--r-- 1 root root  897 Sep  6 11:18 sun50i-h5-cpu-clock-1.3GHz-1.3v.dtbo
-rw-r--r-- 1 root root 4191 Sep  6 11:18 sun50i-h5-fixup.scr
-rw-r--r-- 1 root root 1020 Sep  6 11:18 sun50i-h5-gpio-regulator-1.3v.dtbo
-rw-r--r-- 1 root root  374 Sep  6 11:18 sun50i-h5-i2c0.dtbo
-rw-r--r-- 1 root root  374 Sep  6 11:18 sun50i-h5-i2c1.dtbo
-rw-r--r-- 1 root root  374 Sep  6 11:18 sun50i-h5-i2c2.dtbo
-rw-r--r-- 1 root root  778 Sep  6 11:18 sun50i-h5-pps-gpio.dtbo
-rw-r--r-- 1 root root  862 Sep  6 11:18 sun50i-h5-pwm.dtbo
-rw-r--r-- 1 root root 1040 Sep  6 11:18 sun50i-h5-spdif-out.dtbo
-rw-r--r-- 1 root root 1177 Sep  6 11:18 sun50i-h5-spi-add-cs1.dtbo
-rw-r--r-- 1 root root  804 Sep  6 11:18 sun50i-h5-spi-jedec-nor.dtbo
-rw-r--r-- 1 root root  788 Sep  6 11:18 sun50i-h5-spi-spidev.dtbo
-rw-r--r-- 1 root root  502 Sep  6 11:18 sun50i-h5-uart1.dtbo
-rw-r--r-- 1 root root  794 Sep  6 11:18 sun50i-h5-uart2.dtbo
-rw-r--r-- 1 root root  798 Sep  6 11:18 sun50i-h5-uart3.dtbo
-rw-r--r-- 1 root root  504 Sep  6 11:18 sun50i-h5-usbhost0.dtbo
-rw-r--r-- 1 root root  504 Sep  6 11:18 sun50i-h5-usbhost1.dtbo
-rw-r--r-- 1 root root  504 Sep  6 11:18 sun50i-h5-usbhost2.dtbo
-rw-r--r-- 1 root root  504 Sep  6 11:18 sun50i-h5-usbhost3.dtbo
-rw-r--r-- 1 root root  777 Sep  6 11:18 sun50i-h5-w1-gpio.dtbo
-rw-r--r-- 1 root root 4203 Sep  6 11:18 sun50i-h616-fixup.scr
-rw-r--r-- 1 root root  540 Sep  6 11:18 sun50i-h616-i2c1.dtbo
-rw-r--r-- 1 root root  378 Sep  6 11:18 sun50i-h616-i2c2.dtbo
-rw-r--r-- 1 root root  378 Sep  6 11:18 sun50i-h616-i2c3.dtbo
-rw-r--r-- 1 root root  378 Sep  6 11:18 sun50i-h616-i2c4.dtbo
-rw-r--r-- 1 root root  222 Sep  6 11:18 sun50i-h616-pwm12.dtbo
-rw-r--r-- 1 root root  344 Sep  6 11:18 sun50i-h616-pwm34.dtbo
-rw-r--r-- 1 root root  808 Sep  6 11:18 sun50i-h616-spi-spidev.dtbo
-rw-r--r-- 1 root root  387 Sep  6 11:18 sun50i-h616-uart2.dtbo
-rw-r--r-- 1 root root  509 Sep  6 11:18 sun50i-h616-uart5.dtbo
-rw-r--r-- 1 root root 3844 Sep  6 11:18 sun50i-h6-fixup.scr
-rw-r--r-- 1 root root  374 Sep  6 11:18 sun50i-h6-i2c0.dtbo
-rw-r--r-- 1 root root  374 Sep  6 11:18 sun50i-h6-i2c1.dtbo
-rw-r--r-- 1 root root  374 Sep  6 11:18 sun50i-h6-i2c2.dtbo
-rw-r--r-- 1 root root  671 Sep  6 11:18 sun50i-h6-pwm.dtbo
-rw-r--r-- 1 root root  268 Sep  6 11:18 sun50i-h6-ruart.dtbo
-rw-r--r-- 1 root root 1177 Sep  6 11:18 sun50i-h6-spi-add-cs1.dtbo
-rw-r--r-- 1 root root  804 Sep  6 11:18 sun50i-h6-spi-jedec-nor.dtbo
-rw-r--r-- 1 root root  523 Sep  6 11:18 sun50i-h6-spi-spidev1.dtbo
-rw-r--r-- 1 root root  808 Sep  6 11:18 sun50i-h6-spi-spidev.dtbo
-rw-r--r-- 1 root root  502 Sep  6 11:18 sun50i-h6-uart1.dtbo
-rw-r--r-- 1 root root  798 Sep  6 11:18 sun50i-h6-uart2.dtbo
-rw-r--r-- 1 root root  798 Sep  6 11:18 sun50i-h6-uart3.dtbo
-rw-r--r-- 1 root root  773 Sep  6 11:18 sun50i-h6-w1-gpio.dtbo



4)
Code:

 => load mmc 1 $kernel_addr_r /boot/Image
25868296 bytes read in 2590 ms (9.5 MiB/s)
=> iminfo $kernel_addr_r

## Checking Image at 40080000 ...
Unknown image format!                                                              /


5) Here's where I think the source code for that SCR is, but cannot guarantee its the exact version w/o any additional components; https://github.com/armbian/sunxi-DT-overlays

Code:

=> load mmc 1 45000000 boot/dtb/allwinner/overlay/sun50i-h6-fixup.scr
3844 bytes read in 3 ms (1.2 MiB/s)
=> md.b 45000000 f04
45000000: 27 05 19 56 63 d2 51 cc 62 fb 6e e2 00 00 0e c4    '..Vc.Q.b.n.....
45000010: 00 00 00 00 00 00 00 00 4a 2b 05 ea 05 16 06 00    ........J+......
45000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
45000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
45000040: 00 00 0e bc 00 00 00 00 23 20 6f 76 65 72 6c 61    ........# overla
45000050: 79 73 20 66 69 78 75 70 20 73 63 72 69 70 74 0a    ys fixup script.
45000060: 23 20 69 6d 70 6c 65 6d 65 6e 74 73 20 28 6f 72    # implements (or
45000070: 20 72 61 74 68 65 72 20 73 75 62 73 74 69 74 75     rather substitu
45000080: 74 65 73 29 20 6f 76 65 72 6c 61 79 20 61 72 67    tes) overlay arg
45000090: 75 6d 65 6e 74 73 20 66 75 6e 63 74 69 6f 6e 61    uments functiona
450000a0: 6c 69 74 79 0a 23 20 75 73 69 6e 67 20 75 2d 62    lity.# using u-b
450000b0: 6f 6f 74 20 73 63 72 69 70 74 69 6e 67 2c 20 65    oot scripting, e
450000c0: 6e 76 69 72 6f 6e 6d 65 6e 74 20 76 61 72 69 61    nvironment varia
450000d0: 62 6c 65 73 20 61 6e 64 20 22 66 64 74 22 20 63    bles and "fdt" c
450000e0: 6f 6d 6d 61 6e 64 0a 0a 23 20 73 65 74 65 78 70    ommand..# setexp
450000f0: 72 20 74 65 73 74 5f 76 61 72 20 24 7b 74 6d 70    r test_var ${tmp
45000100: 5f 62 61 6e 6b 7d 20 2d 20 41 0a 23 20 77 6f 72    _bank} - A.# wor
45000110: 6b 73 20 6f 6e 6c 79 20 66 6f 72 20 68 65 78 20    ks only for hex
45000120: 6e 75 6d 62 65 72 73 20 28 41 2d 46 29 0a 0a 73    numbers (A-F)..s
45000130: 65 74 65 6e 76 20 64 65 63 6f 6d 70 6f 73 65 5f    etenv decompose_
45000140: 70 69 6e 20 27 73 65 74 65 78 70 72 20 74 6d 70    pin 'setexpr tmp
45000150: 5f 62 61 6e 6b 20 73 75 62 20 22 50 28 41 7c 43    _bank sub "P(A|C
45000160: 7c 44 7c 47 29 5c 5c 64 2b 22 20 22 5c 5c 31 22    |D|G)\\d+" "\\1"
45000170: 3b 0a 73 65 74 65 78 70 72 20 74 6d 70 5f 70 69    ;.setexpr tmp_pi
45000180: 6e 20 73 75 62 20 22 50 5c 5c 53 28 5c 5c 64 2b    n sub "P\\S(\\d+
45000190: 29 22 20 22 5c 5c 31 22 3b 0a 74 65 73 74 20 22    )" "\\1";.test "
450001a0: 24 7b 74 6d 70 5f 62 61 6e 6b 7d 22 20 3d 20 22    ${tmp_bank}" = "
450001b0: 41 22 20 26 26 20 73 65 74 65 6e 76 20 74 6d 70    A" && setenv tmp
450001c0: 5f 62 61 6e 6b 20 30 3b 0a 74 65 73 74 20 22 24    _bank 0;.test "$
450001d0: 7b 74 6d 70 5f 62 61 6e 6b 7d 22 20 3d 20 22 43    {tmp_bank}" = "C
450001e0: 22 20 26 26 20 73 65 74 65 6e 76 20 74 6d 70 5f    " && setenv tmp_
450001f0: 62 61 6e 6b 20 32 3b 0a 74 65 73 74 20 22 24 7b    bank 2;.test "${
45000200: 74 6d 70 5f 62 61 6e 6b 7d 22 20 3d 20 22 44 22    tmp_bank}" = "D"
45000210: 20 26 26 20 73 65 74 65 6e 76 20 74 6d 70 5f 62     && setenv tmp_b
45000220: 61 6e 6b 20 33 3b 0a 74 65 73 74 20 22 24 7b 74    ank 3;.test "${t
45000230: 6d 70 5f 62 61 6e 6b 7d 22 20 3d 20 22 47 22 20    mp_bank}" = "G"
45000240: 26 26 20 73 65 74 65 6e 76 20 74 6d 70 5f 62 61    && setenv tmp_ba
45000250: 6e 6b 20 36 27 0a 0a 69 66 20 74 65 73 74 20 2d    nk 6'..if test -
45000260: 6e 20 22 24 7b 70 61 72 61 6d 5f 73 70 69 6e 6f    n "${param_spino
45000270: 72 5f 73 70 69 5f 62 75 73 7d 22 3b 20 74 68 65    r_spi_bus}"; the
45000280: 6e 0a 09 74 65 73 74 20 22 24 7b 70 61 72 61 6d    n..test "${param
45000290: 5f 73 70 69 6e 6f 72 5f 73 70 69 5f 62 75 73 7d    _spinor_spi_bus}
450002a0: 22 20 3d 20 22 30 22 20 26 26 20 73 65 74 65 6e    " = "0" && seten
450002b0: 76 20 74 6d 70 5f 73 70 69 5f 70 61 74 68 20 22    v tmp_spi_path "
450002c0: 73 70 69 40 35 30 31 30 30 30 30 22 0a 09 74 65    spi@5010000"..te
450002d0: 73 74 20 22 24 7b 70 61 72 61 6d 5f 73 70 69 6e    st "${param_spin
450002e0: 6f 72 5f 73 70 69 5f 62 75 73 7d 22 20 3d 20 22    or_spi_bus}" = "
450002f0: 31 22 20 26 26 20 73 65 74 65 6e 76 20 74 6d 70    1" && setenv tmp
45000300: 5f 73 70 69 5f 70 61 74 68 20 22 73 70 69 40 35    _spi_path "spi@5
45000310: 30 31 31 30 30 30 22 0a 09 66 64 74 20 73 65 74    011000"..fdt set
45000320: 20 2f 73 6f 63 2f 24 7b 74 6d 70 5f 73 70 69 5f     /soc/${tmp_spi_
45000330: 70 61 74 68 7d 20 73 74 61 74 75 73 20 22 6f 6b    path} status "ok
45000340: 61 79 22 0a 09 66 64 74 20 73 65 74 20 2f 73 6f    ay"..fdt set /so
45000350: 63 2f 24 7b 74 6d 70 5f 73 70 69 5f 70 61 74 68    c/${tmp_spi_path
45000360: 7d 2f 73 70 69 66 6c 61 73 68 40 30 20 73 74 61    }/spiflash@0 sta
45000370: 74 75 73 20 22 6f 6b 61 79 22 0a 09 69 66 20 74    tus "okay"..if t
45000380: 65 73 74 20 2d 6e 20 22 24 7b 70 61 72 61 6d 5f    est -n "${param_
45000390: 73 70 69 6e 6f 72 5f 6d 61 78 5f 66 72 65 71 7d    spinor_max_freq}
450003a0: 22 3b 20 74 68 65 6e 0a 09 09 66 64 74 20 73 65    "; then...fdt se
450003b0: 74 20 2f 73 6f 63 2f 24 7b 74 6d 70 5f 73 70 69    t /soc/${tmp_spi
450003c0: 5f 70 61 74 68 7d 2f 73 70 69 66 6c 61 73 68 40    _path}/spiflash@
450003d0: 30 20 73 70 69 2d 6d 61 78 2d 66 72 65 71 75 65    0 spi-max-freque
450003e0: 6e 63 79 20 22 3c 24 7b 70 61 72 61 6d 5f 73 70    ncy "<${param_sp
450003f0: 69 6e 6f 72 5f 6d 61 78 5f 66 72 65 71 7d 3e 22    inor_max_freq}>"
45000400: 0a 09 66 69 0a 09 69 66 20 74 65 73 74 20 22 24    ..fi..if test "$
45000410: 7b 70 61 72 61 6d 5f 73 70 69 6e 6f 72 5f 73 70    {param_spinor_sp
45000420: 69 5f 63 73 7d 22 20 3d 20 22 31 22 3b 20 74 68    i_cs}" = "1"; th
45000430: 65 6e 0a 09 09 66 64 74 20 73 65 74 20 2f 73 6f    en...fdt set /so
45000440: 63 2f 24 7b 74 6d 70 5f 73 70 69 5f 70 61 74 68    c/${tmp_spi_path
45000450: 7d 2f 73 70 69 66 6c 61 73 68 40 30 20 72 65 67    }/spiflash@0 reg
45000460: 20 22 3c 31 3e 22 0a 09 66 69 0a 09 65 6e 76 20     "<1>"..fi..env
45000470: 64 65 6c 65 74 65 20 74 6d 70 5f 73 70 69 5f 70    delete tmp_spi_p
45000480: 61 74 68 0a 66 69 0a 0a 69 66 20 74 65 73 74 20    ath.fi..if test
45000490: 2d 6e 20 22 24 7b 70 61 72 61 6d 5f 73 70 69 64    -n "${param_spid
450004a0: 65 76 5f 73 70 69 5f 62 75 73 7d 22 3b 20 74 68    ev_spi_bus}"; th
450004b0: 65 6e 0a 09 74 65 73 74 20 22 24 7b 70 61 72 61    en..test "${para
450004c0: 6d 5f 73 70 69 64 65 76 5f 73 70 69 5f 62 75 73    m_spidev_spi_bus
450004d0: 7d 22 20 3d 20 22 30 22 20 26 26 20 73 65 74 65    }" = "0" && sete
450004e0: 6e 76 20 74 6d 70 5f 73 70 69 5f 70 61 74 68 20    nv tmp_spi_path
450004f0: 22 73 70 69 40 35 30 31 30 30 30 30 22 0a 09 74    "spi@5010000"..t
45000500: 65 73 74 20 22 24 7b 70 61 72 61 6d 5f 73 70 69    est "${param_spi
45000510: 64 65 76 5f 73 70 69 5f 62 75 73 7d 22 20 3d 20    dev_spi_bus}" =
45000520: 22 31 22 20 26 26 20 73 65 74 65 6e 76 20 74 6d    "1" && setenv tm
45000530: 70 5f 73 70 69 5f 70 61 74 68 20 22 73 70 69 40    p_spi_path "spi@
45000540: 35 30 31 31 30 30 30 22 0a 09 66 64 74 20 73 65    5011000"..fdt se
45000550: 74 20 2f 73 6f 63 2f 24 7b 74 6d 70 5f 73 70 69    t /soc/${tmp_spi
45000560: 5f 70 61 74 68 7d 20 73 74 61 74 75 73 20 22 6f    _path} status "o
45000570: 6b 61 79 22 0a 09 66 64 74 20 73 65 74 20 2f 73    kay"..fdt set /s
45000580: 6f 63 2f 24 7b 74 6d 70 5f 73 70 69 5f 70 61 74    oc/${tmp_spi_pat
45000590: 68 7d 2f 73 70 69 64 65 76 20 73 74 61 74 75 73    h}/spidev status
450005a0: 20 22 6f 6b 61 79 22 0a 09 69 66 20 74 65 73 74     "okay"..if test
450005b0: 20 2d 6e 20 22 24 7b 70 61 72 61 6d 5f 73 70 69     -n "${param_spi
450005c0: 64 65 76 5f 6d 61 78 5f 66 72 65 71 7d 22 3b 20    dev_max_freq}";
450005d0: 74 68 65 6e 0a 09 09 66 64 74 20 73 65 74 20 2f    then...fdt set /
450005e0: 73 6f 63 2f 24 7b 74 6d 70 5f 73 70 69 5f 70 61    soc/${tmp_spi_pa
450005f0: 74 68 7d 2f 73 70 69 64 65 76 20 73 70 69 2d 6d    th}/spidev spi-m
45000600: 61 78 2d 66 72 65 71 75 65 6e 63 79 20 22 3c 24    ax-frequency "<$
45000610: 7b 70 61 72 61 6d 5f 73 70 69 64 65 76 5f 6d 61    {param_spidev_ma
45000620: 78 5f 66 72 65 71 7d 3e 22 0a 09 66 69 0a 09 69    x_freq}>"..fi..i
45000630: 66 20 74 65 73 74 20 22 24 7b 70 61 72 61 6d 5f    f test "${param_
45000640: 73 70 69 64 65 76 5f 73 70 69 5f 63 73 7d 22 20    spidev_spi_cs}"
45000650: 3d 20 22 31 22 3b 20 74 68 65 6e 0a 09 09 66 64    = "1"; then...fd
45000660: 74 20 73 65 74 20 2f 73 6f 63 2f 24 7b 74 6d 70    t set /soc/${tmp
45000670: 5f 73 70 69 5f 70 61 74 68 7d 2f 73 70 69 64 65    _spi_path}/spide
45000680: 76 20 72 65 67 20 22 3c 31 3e 22 0a 09 66 69 0a    v reg "<1>"..fi.
45000690: 09 65 6e 76 20 64 65 6c 65 74 65 20 74 6d 70 5f    .env delete tmp_
450006a0: 73 70 69 5f 70 61 74 68 0a 66 69 0a 0a 69 66 20    spi_path.fi..if
450006b0: 74 65 73 74 20 2d 6e 20 22 24 7b 70 61 72 61 6d    test -n "${param
450006c0: 5f 70 70 73 5f 70 69 6e 7d 22 3b 20 74 68 65 6e    _pps_pin}"; then
450006d0: 0a 09 73 65 74 65 6e 76 20 74 6d 70 5f 62 61 6e    ..setenv tmp_ban
450006e0: 6b 20 22 24 7b 70 61 72 61 6d 5f 70 70 73 5f 70    k "${param_pps_p
450006f0: 69 6e 7d 22 0a 09 73 65 74 65 6e 76 20 74 6d 70    in}"..setenv tmp
45000700: 5f 70 69 6e 20 22 24 7b 70 61 72 61 6d 5f 70 70    _pin "${param_pp
45000710: 73 5f 70 69 6e 7d 22 0a 09 72 75 6e 20 64 65 63    s_pin}"..run dec
45000720: 6f 6d 70 6f 73 65 5f 70 69 6e 0a 09 66 64 74 20    ompose_pin..fdt
45000730: 73 65 74 20 2f 73 6f 63 2f 70 69 6e 63 74 72 6c    set /soc/pinctrl
45000740: 40 33 30 30 62 30 30 30 2f 70 70 73 5f 70 69 6e    @300b000/pps_pin
45000750: 73 20 70 69 6e 73 20 22 24 7b 70 61 72 61 6d 5f    s pins "${param_
45000760: 70 70 73 5f 70 69 6e 7d 22 0a 09 66 64 74 20 67    pps_pin}"..fdt g
45000770: 65 74 20 76 61 6c 75 65 20 74 6d 70 5f 70 68 61    et value tmp_pha
45000780: 6e 64 6c 65 20 2f 73 6f 63 2f 70 69 6e 63 74 72    ndle /soc/pinctr
45000790: 6c 40 33 30 30 62 30 30 30 20 70 68 61 6e 64 6c    l@300b000 phandl
450007a0: 65 0a 09 66 64 74 20 73 65 74 20 2f 70 70 73 40    e..fdt set /pps@
450007b0: 30 20 67 70 69 6f 73 20 22 3c 24 7b 74 6d 70 5f    0 gpios "<${tmp_
450007c0: 70 68 61 6e 64 6c 65 7d 20 24 7b 74 6d 70 5f 62    phandle} ${tmp_b
450007d0: 61 6e 6b 7d 20 24 7b 74 6d 70 5f 70 69 6e 7d 20    ank} ${tmp_pin}
450007e0: 30 3e 22 0a 09 65 6e 76 20 64 65 6c 65 74 65 20    0>"..env delete
450007f0: 74 6d 70 5f 70 69 6e 20 74 6d 70 5f 62 61 6e 6b    tmp_pin tmp_bank
45000800: 20 74 6d 70 5f 70 68 61 6e 64 6c 65 0a 66 69 0a     tmp_phandle.fi.
45000810: 0a 69 66 20 74 65 73 74 20 22 24 7b 70 61 72 61    .if test "${para
45000820: 6d 5f 70 70 73 5f 66 61 6c 6c 69 6e 67 5f 65 64    m_pps_falling_ed
45000830: 67 65 7d 22 20 3d 20 22 31 22 3b 20 74 68 65 6e    ge}" = "1"; then
45000840: 0a 09 66 64 74 20 73 65 74 20 2f 70 70 73 40 30    ..fdt set /pps@0
45000850: 20 61 73 73 65 72 74 2d 66 61 6c 6c 69 6e 67 2d     assert-falling-
45000860: 65 64 67 65 0a 66 69 0a 0a 69 66 20 74 65 73 74    edge.fi..if test
45000870: 20 2d 6e 20 22 24 7b 70 61 72 61 6d 5f 77 31 5f     -n "${param_w1_
45000880: 70 69 6e 7d 22 3b 20 74 68 65 6e 0a 09 73 65 74    pin}"; then..set
45000890: 65 6e 76 20 74 6d 70 5f 62 61 6e 6b 20 22 24 7b    env tmp_bank "${
450008a0: 70 61 72 61 6d 5f 77 31 5f 70 69 6e 7d 22 0a 09    param_w1_pin}"..
450008b0: 73 65 74 65 6e 76 20 74 6d 70 5f 70 69 6e 20 22    setenv tmp_pin "
450008c0: 24 7b 70 61 72 61 6d 5f 77 31 5f 70 69 6e 7d 22    ${param_w1_pin}"
450008d0: 0a 09 72 75 6e 20 64 65 63 6f 6d 70 6f 73 65 5f    ..run decompose_
450008e0: 70 69 6e 0a 09 66 64 74 20 73 65 74 20 2f 73 6f    pin..fdt set /so
450008f0: 63 2f 70 69 6e 63 74 72 6c 40 33 30 30 62 30 30    c/pinctrl@300b00
45000900: 30 2f 77 31 5f 70 69 6e 73 20 70 69 6e 73 20 22    0/w1_pins pins "
45000910: 24 7b 70 61 72 61 6d 5f 77 31 5f 70 69 6e 7d 22    ${param_w1_pin}"
45000920: 0a 09 66 64 74 20 67 65 74 20 76 61 6c 75 65 20    ..fdt get value
45000930: 74 6d 70 5f 70 68 61 6e 64 6c 65 20 2f 73 6f 63    tmp_phandle /soc
45000940: 2f 70 69 6e 63 74 72 6c 40 33 30 30 62 30 30 30    /pinctrl@300b000
45000950: 20 70 68 61 6e 64 6c 65 0a 09 66 64 74 20 73 65     phandle..fdt se
45000960: 74 20 2f 6f 6e 65 77 69 72 65 40 30 20 67 70 69    t /onewire@0 gpi
45000970: 6f 73 20 22 3c 24 7b 74 6d 70 5f 70 68 61 6e 64    os "<${tmp_phand
45000980: 6c 65 7d 20 24 7b 74 6d 70 5f 62 61 6e 6b 7d 20    le} ${tmp_bank}
45000990: 24 7b 74 6d 70 5f 70 69 6e 7d 20 30 3e 22 0a 09    ${tmp_pin} 0>"..
450009a0: 65 6e 76 20 64 65 6c 65 74 65 20 74 6d 70 5f 70    env delete tmp_p
450009b0: 69 6e 20 74 6d 70 5f 62 61 6e 6b 20 74 6d 70 5f    in tmp_bank tmp_
450009c0: 70 68 61 6e 64 6c 65 0a 66 69 0a 0a 69 66 20 74    phandle.fi..if t
450009d0: 65 73 74 20 22 24 7b 70 61 72 61 6d 5f 77 31 5f    est "${param_w1_
450009e0: 70 69 6e 5f 69 6e 74 5f 70 75 6c 6c 75 70 7d 22    pin_int_pullup}"
450009f0: 20 3d 20 22 31 22 3b 20 74 68 65 6e 0a 09 66 64     = "1"; then..fd
45000a00: 74 20 73 65 74 20 2f 73 6f 63 2f 70 69 6e 63 74    t set /soc/pinct
45000a10: 72 6c 40 33 30 30 62 30 30 30 2f 77 31 5f 70 69    rl@300b000/w1_pi
45000a20: 6e 73 20 62 69 61 73 2d 70 75 6c 6c 2d 75 70 0a    ns bias-pull-up.
45000a30: 66 69 0a 0a 69 66 20 74 65 73 74 20 22 24 7b 70    fi..if test "${p
45000a40: 61 72 61 6d 5f 75 61 72 74 31 5f 72 74 73 63 74    aram_uart1_rtsct
45000a50: 73 7d 22 20 3d 20 22 31 22 3b 20 74 68 65 6e 0a    s}" = "1"; then.
45000a60: 09 66 64 74 20 67 65 74 20 76 61 6c 75 65 20 74    .fdt get value t
45000a70: 6d 70 5f 70 68 61 6e 64 6c 65 31 20 2f 73 6f 63    mp_phandle1 /soc
45000a80: 2f 70 69 6e 63 74 72 6c 40 33 30 30 62 30 30 30    /pinctrl@300b000
45000a90: 2f 75 61 72 74 31 2d 70 69 6e 73 20 70 68 61 6e    /uart1-pins phan
45000aa0: 64 6c 65 0a 09 66 64 74 20 67 65 74 20 76 61 6c    dle..fdt get val
45000ab0: 75 65 20 74 6d 70 5f 70 68 61 6e 64 6c 65 32 20    ue tmp_phandle2
45000ac0: 2f 73 6f 63 2f 70 69 6e 63 74 72 6c 40 33 30 30    /soc/pinctrl@300
45000ad0: 62 30 30 30 2f 75 61 72 74 31 2d 72 74 73 2d 63    b000/uart1-rts-c
45000ae0: 74 73 2d 70 69 6e 73 20 70 68 61 6e 64 6c 65 0a    ts-pins phandle.
45000af0: 09 66 64 74 20 73 65 74 20 2f 73 6f 63 2f 73 65    .fdt set /soc/se
45000b00: 72 69 61 6c 40 35 30 30 30 34 30 30 20 70 69 6e    rial@5000400 pin
45000b10: 63 74 72 6c 2d 6e 61 6d 65 73 20 22 64 65 66 61    ctrl-names "defa
45000b20: 75 6c 74 22 20 22 64 65 66 61 75 6c 74 22 0a 09    ult" "default"..
45000b30: 66 64 74 20 73 65 74 20 2f 73 6f 63 2f 73 65 72    fdt set /soc/ser
45000b40: 69 61 6c 40 35 30 30 30 34 30 30 20 70 69 6e 63    ial@5000400 pinc
45000b50: 74 72 6c 2d 30 20 22 3c 24 7b 74 6d 70 5f 70 68    trl-0 "<${tmp_ph
45000b60: 61 6e 64 6c 65 31 7d 3e 22 0a 09 66 64 74 20 73    andle1}>"..fdt s
45000b70: 65 74 20 2f 73 6f 63 2f 73 65 72 69 61 6c 40 35    et /soc/serial@5
45000b80: 30 30 30 34 30 30 20 70 69 6e 63 74 72 6c 2d 31    000400 pinctrl-1
45000b90: 20 22 3c 24 7b 74 6d 70 5f 70 68 61 6e 64 6c 65     "<${tmp_phandle
45000ba0: 32 7d 3e 22 0a 09 65 6e 76 20 64 65 6c 65 74 65    2}>"..env delete
45000bb0: 20 74 6d 70 5f 70 68 61 6e 64 6c 65 31 20 74 6d     tmp_phandle1 tm
45000bc0: 70 5f 70 68 61 6e 64 6c 65 32 0a 66 69 0a 0a 69    p_phandle2.fi..i
45000bd0: 66 20 74 65 73 74 20 22 24 7b 70 61 72 61 6d 5f    f test "${param_
45000be0: 75 61 72 74 32 5f 72 74 73 63 74 73 7d 22 20 3d    uart2_rtscts}" =
45000bf0: 20 22 31 22 3b 20 74 68 65 6e 0a 09 66 64 74 20     "1"; then..fdt
45000c00: 67 65 74 20 76 61 6c 75 65 20 74 6d 70 5f 70 68    get value tmp_ph
45000c10: 61 6e 64 6c 65 31 20 2f 73 6f 63 2f 70 69 6e 63    andle1 /soc/pinc
45000c20: 74 72 6c 40 33 30 30 62 30 30 30 2f 75 61 72 74    trl@300b000/uart
45000c30: 32 2d 70 69 6e 73 20 70 68 61 6e 64 6c 65 0a 09    2-pins phandle..
45000c40: 66 64 74 20 67 65 74 20 76 61 6c 75 65 20 74 6d    fdt get value tm
45000c50: 70 5f 70 68 61 6e 64 6c 65 32 20 2f 73 6f 63 2f    p_phandle2 /soc/
45000c60: 70 69 6e 63 74 72 6c 40 33 30 30 62 30 30 30 2f    pinctrl@300b000/
45000c70: 75 61 72 74 32 2d 72 74 73 2d 63 74 73 2d 70 69    uart2-rts-cts-pi
45000c80: 6e 73 20 70 68 61 6e 64 6c 65 0a 09 66 64 74 20    ns phandle..fdt
45000c90: 73 65 74 20 2f 73 6f 63 2f 73 65 72 69 61 6c 40    set /soc/serial@
45000ca0: 35 30 30 30 38 30 30 20 70 69 6e 63 74 72 6c 2d    5000800 pinctrl-
45000cb0: 6e 61 6d 65 73 20 22 64 65 66 61 75 6c 74 22 20    names "default"
45000cc0: 22 64 65 66 61 75 6c 74 22 0a 09 66 64 74 20 73    "default"..fdt s
45000cd0: 65 74 20 2f 73 6f 63 2f 73 65 72 69 61 6c 40 35    et /soc/serial@5
45000ce0: 30 30 30 38 30 30 20 70 69 6e 63 74 72 6c 2d 30    000800 pinctrl-0
45000cf0: 20 22 3c 24 7b 74 6d 70 5f 70 68 61 6e 64 6c 65     "<${tmp_phandle
45000d00: 31 7d 3e 22 0a 09 66 64 74 20 73 65 74 20 2f 73    1}>"..fdt set /s
45000d10: 6f 63 2f 73 65 72 69 61 6c 40 35 30 30 30 38 30    oc/serial@500080
45000d20: 30 20 70 69 6e 63 74 72 6c 2d 31 20 22 3c 24 7b    0 pinctrl-1 "<${
45000d30: 74 6d 70 5f 70 68 61 6e 64 6c 65 32 7d 3e 22 0a    tmp_phandle2}>".
45000d40: 09 65 6e 76 20 64 65 6c 65 74 65 20 74 6d 70 5f    .env delete tmp_
45000d50: 70 68 61 6e 64 6c 65 31 20 74 6d 70 5f 70 68 61    phandle1 tmp_pha
45000d60: 6e 64 6c 65 32 0a 66 69 0a 0a 69 66 20 74 65 73    ndle2.fi..if tes
45000d70: 74 20 22 24 7b 70 61 72 61 6d 5f 75 61 72 74 33    t "${param_uart3
45000d80: 5f 72 74 73 63 74 73 7d 22 20 3d 20 22 31 22 3b    _rtscts}" = "1";
45000d90: 20 74 68 65 6e 0a 09 66 64 74 20 67 65 74 20 76     then..fdt get v
45000da0: 61 6c 75 65 20 74 6d 70 5f 70 68 61 6e 64 6c 65    alue tmp_phandle
45000db0: 31 20 2f 73 6f 63 2f 70 69 6e 63 74 72 6c 40 33    1 /soc/pinctrl@3
45000dc0: 30 30 62 30 30 30 2f 75 61 72 74 33 2d 70 69 6e    00b000/uart3-pin
45000dd0: 73 20 70 68 61 6e 64 6c 65 0a 09 66 64 74 20 67    s phandle..fdt g
45000de0: 65 74 20 76 61 6c 75 65 20 74 6d 70 5f 70 68 61    et value tmp_pha
45000df0: 6e 64 6c 65 32 20 2f 73 6f 63 2f 70 69 6e 63 74    ndle2 /soc/pinct
45000e00: 72 6c 40 33 30 30 62 30 30 30 2f 75 61 72 74 33    rl@300b000/uart3
45000e10: 2d 72 74 73 2d 63 74 73 2d 70 69 6e 73 20 70 68    -rts-cts-pins ph
45000e20: 61 6e 64 6c 65 0a 09 66 64 74 20 73 65 74 20 2f    andle..fdt set /
45000e30: 73 6f 63 2f 73 65 72 69 61 6c 40 35 30 30 30 63    soc/serial@5000c
45000e40: 30 30 20 70 69 6e 63 74 72 6c 2d 6e 61 6d 65 73    00 pinctrl-names
45000e50: 20 22 64 65 66 61 75 6c 74 22 20 22 64 65 66 61     "default" "defa
45000e60: 75 6c 74 22 0a 09 66 64 74 20 73 65 74 20 2f 73    ult"..fdt set /s
45000e70: 6f 63 2f 73 65 72 69 61 6c 40 35 30 30 30 63 30    oc/serial@5000c0
45000e80: 30 20 70 69 6e 63 74 72 6c 2d 30 20 22 3c 24 7b    0 pinctrl-0 "<${
45000e90: 74 6d 70 5f 70 68 61 6e 64 6c 65 31 7d 3e 22 0a    tmp_phandle1}>".
45000ea0: 09 66 64 74 20 73 65 74 20 2f 73 6f 63 2f 73 65    .fdt set /soc/se
45000eb0: 72 69 61 6c 40 35 30 30 30 63 30 30 20 70 69 6e    rial@5000c00 pin
45000ec0: 63 74 72 6c 2d 31 20 22 3c 24 7b 74 6d 70 5f 70    ctrl-1 "<${tmp_p
45000ed0: 68 61 6e 64 6c 65 32 7d 3e 22 0a 09 65 6e 76 20    handle2}>"..env
45000ee0: 64 65 6c 65 74 65 20 74 6d 70 5f 70 68 61 6e 64    delete tmp_phand
45000ef0: 6c 65 31 20 74 6d 70 5f 70 68 61 6e 64 6c 65 32    le1 tmp_phandle2
45000f00: 0a 66 69 0a                                        .fi.
=>


I think I did that dump correctly...
Back to top
View user's profile Send private message
pingtoo
Veteran
Veteran


Joined: 10 Sep 2021
Posts: 1248
Location: Richmond Hill, Canada

PostPosted: Fri Feb 03, 2023 4:52 pm    Post subject: Reply with quote

JumboAg,

You are very welcome!, And thanks for give me the opportunity for testing my u-boot knowhow.

In my mind, I see two opportunities for getting your board boot Gentoo.
1. Simple and close to standard (How ubuntu work).
2. Somewhat experimental but if work as expect will give much more flexibility.

Method 1.
The primary reason your SD card not able to work is missing overlay, so if you copy mmc2:dtb-5.16.17-sun50iw6 to SD card and rename kernel and initd to match boot.scr.
This should bring your system to the point where kernel can boot and try load rootfs. However I am not sure what other challenges of loading rootfs.
First the "SD card" I refereed herein is SD card with Gentoo kernel and Gentoo rootfs.
Second if SD card is boot partition is formatted with FAT then symbolic link is not supported, So you will need to name the destination exactly. or if SD card boot partition is formatted with extX you can copy as is and create symbolic file to match boot.scr.
Three key objects we need on the SD card are,
1. dtb directory -- overlay
2. uInitrd -- linux initramfs
3. Image -- linux kernel
Code:
# rough logic, please modify to meet your SD card format
# /boot is mmcblk2pX (Copy source)
# /mnt/gentoo/boot is mmcblk0pX (Copy destination)
cp -a /boot/dtb-5.16.17-sun50iw6 /mnt/gentoo/boot

# if /mnt/gentoo/boot is FAT
mv /mnt/gentoo/boot/dtb-5.16.17-sun50iw6 /mnt/gentoo/boot/dtb

# else if /mnt/gentoo/boot is extX
ln -s /mnt/gentoo/dtb-5.16.17-sun50iw6 /mnt/gentoo/boot/dtb
# NOTE: only do one of mv or ln -s, not both

# Kernel setup
# if /mnt/gentoo/boot is FAT
cp -a /mnt/gentoo/boot/initramfs-5.15.88-gentoo-arm64.img /mnt/gentoo/boot/uInitrd
cp -a /mnt/gentoo/boot/vmlinuz-5.15.88-gentoo-arm64 /mnt/gentoo/boot/Image

# else if /mnt/gentoo/boot is extX
ln -s /mnt/gentoo/boot/initramfs-5.15.88-gentoo-arm64.img /mnt/gentoo/boot/uInitrd
ln -s /mnt/gentoo/boot/vmlinuz-5.15.88-gentoo-arm64 /mnt/gentoo/boot/Image


Now the SD card ready to test boot. (Remember clean umount /mnt/gentoo/boot before proceed to take out SD card)

Method 2.
This idea is build on top of method 1. Use configuration file extlinux.conf to gain flexibility.
Your u-boot must build with CONFIG_CMD_SYSBOOT.
Once this work later you can even try to boot over network with little modification.
the boot.scr on SD need to modify in order to support boot with configuration.
The key objective we need to perform are,
1. modify (or copy of) boot.scr remove bottom three command lines. So this script will not actually perform booting kernel.
2. create configuration file support on SD card.
3. modify "preboot" environment variable.
1. Modify boot.scr:
# Use boot.scr source code file boot.cmd
src=/mnt/gentoo/boot/boot.cmd
# Delete following three lines in boot.scr
#   load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd
#   load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image
#   booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
sed -i -E -e '/^load .*uInitrd$/d' -e '/^load .*Image$/d' -e '/^booti .*}$/d' $src

mkimage -C none -A arm -T script -d $src /mnt/gentoo/boot/boot.scr

2. Support use extlinux.conf:

src=/mnt/gentoo/boot
mkdir $src/extlinux

cat <<_EOF>$src/extlinux/extlinux.conf
TIMEOUT 10
PROMPT 0
DEFAULT my-kernel
MENU TITLE SDcard /extlinux/extlinux.conf
LABEL my-kernel
   MENU LABEL My Gentoo Kernel 5.xx.yy
   KERNEL  /vmlinuz-5.15.88-gentoo-arm64
   APPEND  root=/dev/mmcblk0p1 rootwait rootfstype=ext4 console=ttyS0,115200 console=tty1
   INITRD  /initramfs-5.15.88-gentoo-arm64.img
_EOF

you may want to play around the "APPEND" line, that is kernel command arguments. please modify to match your setup.

3. Modify preboot environment variable wrote:

There are two way to make modify. One is modify u-boot build configuration CONFIG_PREBOOT, from "usb start" to "usb start; load mmc 0 0x4FC00000 boot.scr; source 0x4FC00000". Flush this newly build u-boot on to SD card.
Or the other day is create a file name "uboot.env" on the root of SD card with content
uboot.env:
preboot=usb start; load mmc 0 0x4FC0000 boot.scr; source 0x4FC00000

using uboot.env depend on u-boot was configured with CONFIG_ENV_(EXT4|FAT)_FILE value and CONFIG_ENV_IS_IN_(EXT4|FAT) is set to y.

Please note, this method I have not tried myself. so if you want to pursue this we likely need to debug the entire process.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


Joined: 03 Mar 2007
Posts: 205
Location: Dallas, TX

PostPosted: Fri Feb 03, 2023 5:53 pm    Post subject: Reply with quote

Getting closer. Looks like it doesnt like something with my initramfs.

My boot partition is ext4 so I was able to use symlinks.


Code:
U-Boot SPL 2020.04-gc97dbbcad (Jan 28 2023 - 15:01:42 -0600)
DRAM: 2048 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.8(debug):v2.8-312-g1678bbb57
NOTICE:  BL31: Built : 09:26:15, Jan 27 2023
NOTICE:  BL31: Detected Allwinner H6 SoC (1728)
NOTICE:  BL31: Found U-Boot DTB at 0xa07a870, model: OrangePi 3 LTS
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
INFO:    PMIC: Probing AXP805 on RSB
INFO:    PMIC: aldo1 voltage: 3.300V
INFO:    PMIC: aldo2 voltage: 3.300V
INFO:    PMIC: aldo3 voltage: 3.300V
INFO:    PMIC: bldo1 voltage: 1.800V
INFO:    PMIC: bldo2 voltage: 1.800V
INFO:    PMIC: bldo3 voltage: 1.800V
INFO:    PMIC: cldo1 voltage: 3.300V
INFO:    PMIC: dcdcd voltage: 0.960V
INFO:    PMIC: dcdce voltage: 1.200V
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
INFO:    BL31: cortex_a53: CPU workaround for 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


U-Boot 2020.04-gc97dbbcad (Jan 28 2023 - 15:01:42 -0600) Allwinner Technology

CPU:   Allwinner H6 (SUN50I)
Model: OrangePi 3 LTS
DRAM:  2 GiB
MMC:   mmc@4020000: 0, mmc@4022000: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial@5000000
Out:   serial@5000000
Err:   serial@5000000
Net:   No ethernet found.
starting USB...
No working controllers found
Autoboot in 2 seconds, press <Space> to stop
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
3206 bytes read in 1 ms (3.1 MiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
203 bytes read in 1 ms (198.2 KiB/s)
37593 bytes read in 6 ms (6 MiB/s)
3844 bytes read in 4 ms (938.5 KiB/s)
Applying kernel provided DT fixup script (sun50i-h6-fixup.scr)
## Executing script at 45000000
9622616 bytes read in 964 ms (9.5 MiB/s)
27349504 bytes read in 2737 ms (9.5 MiB/s)
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
SCRIPT FAILED: continuing...
37593 bytes read in 6 ms (6 MiB/s)
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Found U-Boot script /boot/boot.scr
3206 bytes read in 2 ms (1.5 MiB/s)
## Executing script at 4fc00000
U-boot loaded from SD
Boot script loaded from mmc
203 bytes read in 1 ms (198.2 KiB/s)
37593 bytes read in 6 ms (6 MiB/s)
3844 bytes read in 4 ms (938.5 KiB/s)
Applying kernel provided DT fixup script (sun50i-h6-fixup.scr)
## Executing script at 45000000
13042247 bytes read in 1306 ms (9.5 MiB/s)
25868296 bytes read in 2589 ms (9.5 MiB/s)
## Loading init Ramdisk from Legacy Image at 4fe00000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    13042183 Bytes = 12.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 4fa00000
   Booting using the fdt blob at 0x4fa00000
   Loading Ramdisk to 4938f000, end 49fff207 ... OK
   Loading Device Tree to 000000004931d000, end 000000004938efff ... OK

Starting kernel ...



Code:
root@orangepi3-lts:/mnt/gentoo/boot# ls -la
total 41548
drwxr-xr-x  4 root root     4096 Feb  3 17:45 .
drwxr-xr-x 22 root root     4096 Feb  3 17:18 ..
-rwxr-xr-x  1 root root   230456 Sep  6 11:18 boot.bmp
-rwxr-xr-x  1 root root     3134 Sep  6 11:18 boot.cmd
-rwxr-xr-x  1 root root     3206 Sep  6 11:18 boot.scr
lrwxrwxrwx  1 root root       20 Feb  3 17:44 dtb -> dtb-5.16.17-sun50iw6
drwxr-xr-x  3 root root     4096 Sep  6 11:18 dtb-5.16.17-sun50iw6
lrwxrwxrwx  1 root root       28 Feb  3 17:45 Image -> vmlinuz-5.15.88-gentoo-arm64
-rwxr-xr-x  1 root root  9622616 Feb  2 02:47 initramfs-5.15.88-gentoo-arm64.img
drwx------  2 root root    16384 Feb  3 17:18 lost+found
-rwxr-xr-x  1 root root      203 Feb  1 02:08 orangepiEnv.txt
-rwxr-xr-x  1 root root     1542 Sep  6 11:18 orangepi_first_run.txt.template
-rwxr-xr-x  1 root root  5287345 Feb  1 14:54 System.map-5.15.88-gentoo-arm64
lrwxrwxrwx  1 root root       34 Feb  3 17:44 uInitrd -> initramfs-5.15.88-gentoo-arm64.img
-rwxr-xr-x  1 root root 27349504 Feb  1 14:54 vmlinuz-5.15.88-gentoo-arm64
root@orangepi3-lts:/mnt/gentoo/boot# file vmlinuz-5.15.88-gentoo-arm64
vmlinuz-5.15.88-gentoo-arm64: Linux kernel ARM64 boot executable Image, little-endian, 4K pages
root@orangepi3-lts:/mnt/gentoo/boot# file initramfs-5.15.88-gentoo-arm64.img
initramfs-5.15.88-gentoo-arm64.img: XZ compressed data, checksum NONE
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum