Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Quick question by a lazy noob
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
Yvanoff
n00b
n00b


Joined: 11 Jan 2016
Posts: 8

PostPosted: Wed Jul 21, 2021 11:06 am    Post subject: Quick question by a lazy noob Reply with quote

Hello people,

sorry to take up some of your time with a beginner's question but:
long story short I have a RasPi 4 sitting uselessly in my house. Got Ubuntu to work on it but Ubuntu is a bloat I don't want. Other distros I tried didn't work nearly as well (required me to debug stuff). If I'm going to spend time installing a Linux on my RasPi, might as well have it a solid distro, Gentoo, which I've been using for a year with fantastic results.

But as I suppose most people I'm a bit stuck at the kernel compilation part. Being lazy I don't want to bother with setting up a cross compiling toolchain on my Gentoo laptop, so I've identified two solutions:
- install Ubuntu or a headless Raspbian on the Pi. Build the kernel there. Since I'd be building the kernel on the Pi I won't have to bother with compilation flags right ? Or is that the laziness in me hoping I have no work to do ?
- grab kernel builds from the Raspbian foundation, skipping the compilation problem altogether

What are the advantages/disadvantages or either solution ? I have seen none of them being mentioned here or there, so I figured I'd ask

As a side note, I also have a RPi2 sitting useless in my house (yeah, I should stop hoarding electronics I don't need). Figured I'd put Alpine on it because it's supposed to be light, but I see some courageous people put Gentoo on it. How viable is it ? (By viable I mean: am I going to spend hours on every single emerge --update ? can I compile the kernel in at most a couple hours ?)
Back to top
View user's profile Send private message
Goverp
Veteran
Veteran


Joined: 07 Mar 2007
Posts: 1199

PostPosted: Wed Jul 21, 2021 12:50 pm    Post subject: Reply with quote

At risk of diverting you from the true path, you might consider Arch linux - www.archlinuxarm.org has versions for 32- and 64-bit Pi's.
_________________
Greybeard
Back to top
View user's profile Send private message
Yvanoff
n00b
n00b


Joined: 11 Jan 2016
Posts: 8

PostPosted: Wed Jul 21, 2021 12:56 pm    Post subject: Reply with quote

Goverp wrote:
At risk of diverting you from the true path, you might consider Arch linux - www.archlinuxarm.org has versions for 32- and 64-bit Pi's.

ArchLinux is among the distros i tried. Basic config didn't result in a working RPi - it booted but at some point during the boot sequence the screen turned to white and the RPi turns non responsive, only thing I can do is shut it dwn

Surely fixable if I bother investigating - but again if I'm going to waste time on this I'd rather have it with Gentoo. If Arch isn't plug and play, it's not worth it imo
Back to top
View user's profile Send private message
VargFren
n00b
n00b


Joined: 20 Jul 2021
Posts: 9

PostPosted: Wed Jul 21, 2021 1:05 pm    Post subject: Re: Quick question by a lazy noob Reply with quote

Hi, new gentoo user here too, just let me say that the fact you don't want to bother with flags and that kind of stuff is understandable, but if you want to really squish that extra performance from your cpu then you need to spend some time searching, reading and compiling the things you need in order to get something usable

Yvanoff wrote:
What are the advantages/disadvantages or either solution ? I have seen none of them being mentioned here or there, so I figured I'd ask


Not completely sure but, at the end of the day you probably are gonna be better compiling you own thing that letting other distro do it for you
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 48619
Location: 56N 3W

PostPosted: Wed Jul 21, 2021 4:10 pm    Post subject: Reply with quote

Yvanoff,

Have the best of both worlds.

As a get-you-going quickly, install the Foundation Kernel under your Gentoo.
When you have more time, add a DIY kernel.

For the Pi, the kernel is in three pieces.
The kernel binary and *.dtb go into /boot
The kernel modules go into /lib/modules/

You can do all that on your main PC with a card reader.

-- edit --

The Pi4 will run 32 it or 64 bit code but not a mix.
There is no DRM support on arm64 but if you install 32 bit, you are keeping a Ferrari just to drive to the corner shop.
You will want some CPU cooling or the SoC will reach 80C and clock throttle until it cools.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Yvanoff
n00b
n00b


Joined: 11 Jan 2016
Posts: 8

PostPosted: Wed Jul 21, 2021 7:46 pm    Post subject: Reply with quote

@NeddySeagoon,

thank you for the reply.

I have a case and a passive cooling solution for the Pi.

I've tried applying the RPi 64bits instruciton, but skipping the "compiling kernel" part by directly using the files from https://github.com/raspberrypi/firmware

The Pi sort of boots. the kernel ends panicking because it can't find a proper init system

I'm guessing the raspberrypi foundation files are made for systemd systems and I should use a systemd stage3 tarball ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 48619
Location: 56N 3W

PostPosted: Wed Jul 21, 2021 8:33 pm    Post subject: Reply with quote

Yvanoff,

The Pi Foundation kernel should work with either.
I don't use it but I use the default Raspberry Pi 4 64 bit kernel configuration file, so what I build should be the same thing.

I'll guess it can't find a proper init system because the content of the Pis /boot/cmdline.txt is not correct.

Once it gets as far as mounting root, the hard bit is done.

Tell us the partition tables on the Pi and show the the /boot/cmdline.txt.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Yvanoff
n00b
n00b


Joined: 11 Jan 2016
Posts: 8

PostPosted: Thu Jul 22, 2021 6:29 am    Post subject: Reply with quote

Indeed @NeddySeagoon, it works with either

I managed to reach the login prompt with OpenRC as init system.

The error was a -8 error, with /sbin/init existing but not being executable. Google told me it was a format issue (the executable wasn't in the correct format for the kernel). Since I used the arm64 tarball, I'm guessing I was loading a 32-bit kernel for some reason despite having set arm_64bits=1 in /boot/config.txt

Originally my config files were the same as here, with the addition of the 64_bits line in the /boot/config.txt
I got rid of that, and I also got rid of the two "console=...." and of "elevator=deadline fsck.repair=yes" in /boot/cmdline.txt

Because of the -8 error, I figured that maybe I should ensure the correct kernel was loaded. I hear kernel8.img in /boot corresponds to the 64 bits kernel, so I moved kernel.img, kernel7.img and kernel7l.img out of the way

I also took the time to update my fstab (which I hadn't taken previously)


So I'm not sure which of these steps did it, but now that I can reach the login prompt, everything should be alright I think


Thank you for your help everyone ! Seems that using a default raspberrypi kernel is the best solution to get the Pi running quickly. Am I correct in thinking that I can now treat any kernel update on the Pi as I do on my AMD64 laptop ? (with the addition of having to update the various .dtb files in /boot if need be)
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 2089

PostPosted: Thu Jul 22, 2021 10:07 pm    Post subject: Reply with quote

Quote:
There is no DRM support on arm64 but if you install 32 bit, you are keeping a Ferrari just to drive to the corner shop.

Is 64 bit actually faster than 32 bit? With what sort of workloads? Will it be noticeable on boards with up to 4GB RAM?


Anyway... Can anyone point me to a tested (and working), minimal image for RPi 4B? Yeah, I'm gonna join the arm gang.
I just want to plug the card, login via SSH (headless), and play with network a bit, so nothing fancy for now. I'll do it the right way (read: my way) later; I have some plans for it, but it will take a while to complete and I'm a bit in a hurry.
Image from http://sd-card-images.johang.se/ didn't properly boot for me (no idea why, I'm running blind), and ubuntu image is just insanely big, so I'm reluctant to even download it before checking out other options. Also, it may not be the best fit for running without peripherals.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 48619
Location: 56N 3W

PostPosted: Fri Jul 23, 2021 7:26 am    Post subject: Reply with quote

szatox,

roylongbottom did a series of benchmarks on both the Pi3 and Pi4 to answer that qestion.
I'm not sure if that link will work for you or if its Mods only.

There are more/wider registers in 64 bit mode. That does not help GPU intensive workloads, as the GPU is 32 bit.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 2089

PostPosted: Fri Jul 23, 2021 7:47 am    Post subject: Reply with quote

Search is not "mods only", it's "those who already know only" :lol: Thanks, I'll have a look at it, might be an interesting read.

I imagine that IO-heavy workload won't be affected either (pretty much all servers).
Compilation? Dunno. Depending on how it's implemented, I'd expect the speed gain between 0 and 2. The better implemented, the lower gain (It's just a guess)
Heavy number crunching? Yeah, sure, but it's rare, and would probably be done by GPU anyway. Or it would be done using specialized instruction set, (*cough* AES *cough*)


So... Any hints on ready to go minimal rpi 4b image?
Back to top
View user's profile Send private message
flysideways
Apprentice
Apprentice


Joined: 29 Jan 2005
Posts: 235

PostPosted: Fri Jul 23, 2021 1:30 pm    Post subject: Reply with quote

It does not take that long to build up a minimal system from a Raspberry Pi OS, 32 or 64 bit, as appropriate.

The more stale the stage 3 is, the longer it will take. Right now the date on the arm64 stage 3 is 2021-06-13 and the arm stage 3 is 2021-07-13. Maybe the arm64 date is a typo.

arm/arm64 have the distinction, along with riscv and experimental, of not having bootable installation media. But there is more to arm than the Pi's, not that I have anything arm with Gentoo but Pi's.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 48619
Location: 56N 3W

PostPosted: Fri Jul 23, 2021 5:46 pm    Post subject: Reply with quote

szatox,

Being lazy, I don't feel much like uploading a 128G SD card image that has less than 4G used.

I can tell you how to make your own, with no arm64 hardware or QEMU static-user required.

Roughly, partition your SDCard with a dos partition table. Mark partition 1 bootable. 128Mb will be plenty.
Its a really bad idea to swap to SD card, but make a swap partition an a warning indicator.
Dedicate the rest to root,

Format partition 1 VFAT and root as ext4.
Untar an arm64 stage3
Get raspberry Pi firmare and put it onto /boot, except the kernel modules that go to /lib/modures/<kernel-ver> on the SD card.

Make symlinks in /etc/runlevels/... so that the services you want will start.
Networking and sshd would be good. :)
Put a root password hash into /etc/shadow
Edit /etc/ssh/sshd_config ta allow root logins.
Create a /boot/config.txt to start in 64 bit mode.
Create a /boot/cmdline.txt to tell the kernel all about root.

Optionally, set a static IP address for eth0 in /etc/conf.d/net, so you know where to look.

The image I have on the SD card demos root in LVM2, so it has an initrd.

I could tar up the filesystems but its not image the SD and go. Its a lot less than 128G for me though.
I'm not sure I ever set up sshd either but that's only a few minutes.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 2089

PostPosted: Sat Jul 24, 2021 8:21 am    Post subject: Reply with quote

I guess I should have mentioned I already have installed gentoo on banana pi, so I roughly know the procedure... It's the details I don't want trip over. Building kernel that will support peripherals, setting up uboot, and yes, coming up with the correct config.txt and cmdline.txt
Good you didn't upload this 128GB image though, it's way too much :lol:

Anyway, someone pointed me to the most obvious place that somehow doesn't show up in search results: http://downloads.raspberrypi.org/
I'm not quite sure which of the things I did enabled ssh (I found an instruction to touch /boot/ssh), as it's not enabled by default, and 1GB download is quite a lot for a "minimal", but it fits on 4GB SD.
Of course being ready to use and designed for beginers it comes with downsides like systemd and total lack of control over the filesystem (it autoexpanded to 25GB out of 32), but it's not that big of a deal right now. I'll probably start building something I like better in a few weeks, and it's going to like an ogre: it will have layers.

So far I tested passive cooling with a hefty aluminum case which is basically a massive heatsink (with ridiculously thick blades). It reported CPU getting up to 60°C running yes > /dev/null on all 4 cores, with ambient temperature somewhere around 25°C. Dropped to like 55 after I positioned it vertically. Not too bad. The case gets pretty warm, so I guess the thermal pads do work, and the passive cooling can be boosted by wrapping the whole thing in a sleeve should it get too hot during both, CPU and memory heavy workload (Uhmm... Compilation)
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
Page 1 of 1

 
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