Page 1 of 1
Gentoo on the Orange Pi 5
Posted: Mon Nov 27, 2023 8:47 pm
by Gladdle
I didn't get a Raspberry Pi 5, so i take a different Product with a better Core and more RAM: The Orange Pi.
I can Download the "Orange Pi 5 OS (Arch)" or an debian image, but i preffer Linux Gentoo. To install that i have a few Options, but i think that one is the best:
https://wiki.gentoo.org/wiki/Raspberry_PI_Install_Guide - It's an installation routine for the Raspberry Pi Series, but i'll think it's possible for the Orange Pi, too.
But there are a few questions:
- Point 4.3.1 is for the RasPi Firmare, can i use the kernel from the orange Pi devs, because of the kernel patches? Seems like it's also on github:
https://github.com/orangepi-xunlong/u-boot-orangepi
- Do i need the arm64 stage3 for the Orange Pi 5 (Rockchip RK3588S 8-core 64-bit processor) or the ARMv$X and what should i use for the make.conf COMMON_FLAGS / CFLAGS?
- Shall i use the Orange Pi 5 Overlay found on reddit:
https://www.reddit.com/r/Gentoo/comment ... ange_pi_5/
Am i wrong with that? Is there a better solution?
If i had created a Gentoo for the Orange Pi can i make a Image for everyone who want to use Gentoo on that system?
I am sorry for the stupid questions, but i am an electrican, not an "real" computer guy, but maybe someone can help me and we can share all the informations.
Posted: Mon Nov 27, 2023 10:39 pm
by pingtoo
Gladdle,
I think Orange Pi5 is very different from Raspberry Pi4B so most of those Raspberry Pi installation guide is wrong for your board.
Orange Pi5 use Rockchip SoC, so its boot sequence is different from Raspberry Pi. I think Rockchip SoC default use its idbloader, but can switch to use u-boot, anyway the /boot content will be very different from Raspberry Pi.
You should use Orange Pi supplied kernel for your board first to get a working system. eventually you can build you own kernel once you are comfortable with boot sequence.
You can use arm64 stage 3 from Gentoo as basis to begin. It is targeted for general ARM64 so it will work for OPI5.
You can try this for CFLAGS
Code: Select all
COMMON_FLAGS="-O2 -pipe -march=armv8.2-a+crypto+fp16+rcpc+dotprod -mtune=cortex-a76.cortex-a55"
disclaimer, I don't have Orange Pi5, I have NanoPi R6C which also is rk3588s based SoC. I only use gentoo container on the R6C, so I don't know above CFLAGS will work for you or not, I only use the container to help me compile other stuff. The Compiler suite in the container is compiled use above CFLAGS.
One thing important when working with SoC development board, best to have UART serial connect to help debug booting issue. I use
USB to TTL Adaptor SH-u09c5
Posted: Tue Nov 28, 2023 12:07 pm
by NeddySeagoon
Gladdle,
The
Raspberry PI Install Guide should work for any install where the Gentoo stage3 can be put on top of the vendor kernel.
It gives Pi specific set up for boot though. I don't know what an Orange Pi5 uses.
Provided that no target code needs to be compiled, the same approach should work.
e.g. building u-boot would need some outside help.
Not all aarch64 CPUs also support the aarch32 instruction set. Its optional.
As your CPU is 64 bit, you may as well do a 64 bit install with the 64bit stage3.
You derive the COMMON_FLAGS / CFLAGS as the guide explains.
The tools that do the derivation will be built with the generic COMMON_FLAGS after your Orange Pi5 boots but you will probably only use them once, so it won't matter.
-- edit --
The only stupid question is the one you never ask.
Posted: Tue Nov 28, 2023 6:45 pm
by Gladdle
NeddySeagoon wrote:Gladdle,
The
Raspberry PI Install Guide should work for any install where the Gentoo stage3 can be put on top of the vendor kernel.
Thanks for the hint but you was a little late. I have used the Orange Pi 5 image and deleted the second partition and make a new one using gentoo stage 3 - the gentoo system boot and works very good!
pingtoo wrote:You can try this for CFLAGS
Code: Select all
COMMON_FLAGS="-O2 -pipe -march=armv8.2-a+crypto+fp16+rcpc+dotprod -mtune=cortex-a76.cortex-a55"
disclaimer, I don't have Orange Pi5, I have NanoPi R6C which also is rk3588s based SoC. I only use gentoo container on the R6C, so I don't know above CFLAGS will work for you or not, I only use the container to help me compile other stuff. The Compiler suite in the container is compiled use above CFLAGS.
There is a tool called cpuid2cpuflags - it has the following output:
Code: Select all
CPU_FLAGS_ARM: edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v4 v5 v6 v7 v8 thumb2
So may i ask what is the best CFLAGS, because i didn't get it, i am sorry.
Posted: Tue Nov 28, 2023 6:56 pm
by pingtoo
Gladdle wrote:There is a tool called cpuid2cpuflags - it has the following output:
Code: Select all
CPU_FLAGS_ARM: edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v4 v5 v6 v7 v8 thumb2
So may i ask what is the best CFLAGS, because i didn't get it, i am sorry.
I don't understand you too
What is that you are looking for? The CPU_FLAGS_ARM is a hint for ebuild to turn on/off package's configuration (assume the package developer done some kind of optimisation base on type of CPU)
Posted: Tue Nov 28, 2023 8:28 pm
by NeddySeagoon
Gladdle,
Set
Code: Select all
CPU_FLAGS_ARM="edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 v4 v5 v6 v7 v8 thumb2"
in make.conf.
There is another tool for CFLAGS.
arm64 needs version 3.0.0 or newer.
That's testing at the moment.
You don't set -march on arm. Its -mcpu and -mtune. Set both. I've updated the wiki page.
Posted: Wed Nov 29, 2023 8:42 pm
by Ferociouspineapple
Gladdle wrote:
Thanks for the hint but you was a little late. I have used the Orange Pi 5 image and deleted the second partition and make a new one using gentoo stage 3 - the gentoo system boot and works very good!
I'm due to be compiling a gentoo for an Orange Pi 5 some time soon and I'm wondering if you needed to put any proprietary blobs in the /boot/ partition of your gentoo in order for gentoo to boot? Also did you compile a kernel for gentoo or use the pre-compiled one from Orange Pi?
I hope to stay away from pre-compiled binaries as much as possible although I don't know to what extent this is possible on the OPi5. I've found the configs for
uboot and the
kernel which it uses.
edit: rk3588 chips require two closed-source binaries for boot ("bl31" and "tpl/ddr")...not freedom respecting. rk3399 seems to be reputed for its blobless boot.
Posted: Thu Jan 23, 2025 3:55 pm
by akrmn24
NeddySeagoon wrote:Gladdle,
You don't set -march on arm. Its -mcpu and -mtune. Set both. I've updated the wiki page.
Do you have a source for why not to set -march=native for ARM?
Posted: Thu Jan 23, 2025 8:01 pm
by NeddySeagoon
akrmn24,
When you set -march=native, gcc generally gets it right but a few build systems think they know better and add in flags for instructions that are not available.
e.g. Chromium and one or two others.
That's how a found out that in takes 3d 10h to build Chromium on an 8G Pi4 :)
-march failed and my -mcpu, mtune worked, so I could not reproduce the failure.