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 Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
pingtoo
l33t
l33t


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

PostPosted: Fri Feb 03, 2023 6:27 pm    Post subject: Reply with quote

JumboAg,

Sorry, forgot that raw initrd need size parameter in order to be used.

So without modify boot.scr it is not possible to use your initramfs-5.15.88-gentoo-arm64.img directly.

Let's try wrap your initrd to u-boot wrapped format.
Code:

rm /mnt/gentoo/boot/uInitrd

mkimage -A arm -T ramdisk -C none -n "Gentoo initramfs 5.15.88" -d /mnt/gentoo/boot/initramfs-5.15.88-gentoo-arm64.img /mnt/gentoo/boot/uInitrd


Now please try to boot again.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Fri Feb 03, 2023 6:36 pm    Post subject: Reply with quote

The good news is it does appear to be using the new kernel

The bad news is that it appears I need to play around with said kernel. Once it starts the kernel, I lose serial access (I've seen this earlier in the thread. 99% sure its just a default gentoo configuration thing I need to track down) It also never gives me video so I cannot tell where its hanging.

I'll play around with the graphics and framebuffer settings and try another kernel or two.

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
9622680 bytes read in 964 ms (9.5 MiB/s)
27349504 bytes read in 2738 ms (9.5 MiB/s)
## Loading init Ramdisk from Legacy Image at 4fe00000 ...
   Image Name:   Gentoo initramfs 5.15.88
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    9622616 Bytes = 9.2 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 496d2000, end 49fff458 ... OK
   Loading Device Tree to 0000000049660000, end 00000000496d1fff ... OK

Starting kernel ...

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


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

PostPosted: Fri Feb 03, 2023 10:17 pm    Post subject: Reply with quote

JumboAg,

For your quest to getting Linux serial console I have a guess.

It is based on u-boot 2020.04. In your u-boot boot sequence it show your In:/Out:/Err: is at serial@5000000. So look at github.com:/u-boot/u-boot@v2022.04/arch/arm/dts/sun50i-h6.dtsi
Code:
uart0: serial@5000000 {
         compatible = "snps,dw-apb-uart";
         reg = <0x05000000 0x400>;
         interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
         reg-shift = <2>;
         reg-io-width = <4>;
         clocks = <&ccu CLK_BUS_UART0>;
         resets = <&ccu RST_BUS_UART0>;
         status = "disabled";
};
It show the compatible string is "snps,dw-apb-uart", so serach the string in github.com:/u-boot/u-boot@v2022.04/drivers/serial/ you will find ns16550.c have register itself as compatible with this device.
So in your u-boot's .config you should be able to find CONFIG_SYS_NS16550=y and/or CONFIG_SYS_NS16550_SERIAL=y.

Now switch mainline linux follow same logic above search github.com:torvalds/linux@v5.15/drivers/tty/serial, You will find 8250/8250_dw.c register itself for compatible with "snp,dw-apb-uart".

So for your linux config you should at least enable CONFIG_SERIAL_8250_CONSOLE=y and CONFIG_SERIAL_8250_DW=y.

Please be sure to use make menuconfig to find how to enable SERIAL_8250_DW, because there are other dependency required.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Sat Feb 04, 2023 4:35 am    Post subject: Reply with quote

BOOM..

got it.

I ended up finding the orangepi github repository and used their kernel files as my starting point but I did compile them myself and everything is now up and running. Next step will be to take that kernel config and merge it with the mainline gentoo-sources kernel but I'm now up and running with my own kernel in a gentoo rootfs.

Pingtoo I cannot thank you enough for all your help! I have several other SOC boards I'm messing around with and am going to try to replicate your advice to get gentoo running on each of them.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Fri Feb 10, 2023 8:10 pm    Post subject: Reply with quote

pingtoo wrote:
JumboAg,

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



Found a way to do this one better. It was convoluted but basically I recompiled the stock kernel source to include the necessary EFI flags and instead of the extlinux changes above, commented out the same lines but replaced with:
Code:

load ${devtype} ${devnum} ${kernel_addr_r} /efi/gentoo/grubaa64.efi
bootefi ${kernel_addr_r} ${fdt_addr_r}

I'm sure there's a way to avoid hardcoding the efi file but this will suffice for now. From there I can just let grub handle any number of kernel/initialramdisk combinations.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


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

PostPosted: Fri Feb 10, 2023 8:24 pm    Post subject: Reply with quote

JumboAg,

Just being curious :oops:

Why GRUB/EFI? In my mind U-boot is a lot more capable than GRUB and certainty better than EFI.

In your description, you want u-boot load a EFI application, then this EFI application (GRUB) in turn load kernel/initrd. This chain-loading is a lot of thing to go through. Is this a learning practice?
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Fri Feb 10, 2023 8:34 pm    Post subject: Reply with quote

pingtoo wrote:
JumboAg,

Just being curious :oops:

Why GRUB/EFI? In my mind U-boot is a lot more capable than GRUB and certainty better than EFI.

In your description, you want u-boot load a EFI application, then this EFI application (GRUB) in turn load kernel/initrd. This chain-loading is a lot of thing to go through. Is this a learning practice?


It may very well be. I don't know enough about it. For me, with u-boot I basically have to hardcode the boot parameters I want or break into its shell by connecting the serial port. With Grub/EFI I can set up as many different kernels as I want and pick between them inband without having to use a serial console. If u-boot can do the same, I merely just dont know how to do that.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


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

PostPosted: Fri Feb 10, 2023 8:59 pm    Post subject: Reply with quote

JumboAg,

Thanks for the information.

If you are not able to see u-boot output on your primary display but only on serial console, it might be matter of environment variable define. see your printenv output for stderr=,stdin=,stdout=

you can try by break into u-boot prompt and set env as follow
Code:
stderr=serial,vidconsole
stdin=serial,usbkbd
stdout=serial,vidconsole


I hope this will lead to display on you primary display. However during my reseach of your board I learn that 3 LTS board is not well known, so little support can be gather from Internet. So I am not sure if yout u-boot code have driver support your display.

In u-boot using the "method 2" I described in my previous post, it is possible to make u-boot present a extlinux menu. Or if your u-boot is modern enough it is possible to use u-boot environment variable setting to setup a menu as well. both menu system will allow your to define multiple entries for different kernel/initrd/fdt.
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 Previous  1, 2
Page 2 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