Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Raspberry Pi, almost identical to handbook install [SOLVED]
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
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 773

PostPosted: Tue Sep 27, 2022 1:46 pm    Post subject: Raspberry Pi, almost identical to handbook install [SOLVED] Reply with quote

I booted a 64 bit raspberry pi micro-sdcard image, to use it like a livecd.

Then plugged in an external micro-sdcard-reader, into which I inserted a 32GB micro-sdcard.

I then followed almost the identical procedure for amd64 from the handbook:

I partitioned the micro-sdcard into three partitions:

Disklabel type: dos
Device Boot Start End Sectors Size Id Type
/dev/sdc1 * 2048 264191 262144 128M c W95 FAT32 (LBA)
/dev/sdc2 264192 4458495 4194304 2G 82 Linux swap / Solaris
/dev/sdc3 4458496 61069311 56610816 27G 83 Linux


After extracting the stage3 and entering the chroot, I did this:

emerge-webrsync
emerge -vDa raspberrypi-firmware
emerge -vDa raspberrypi-image
emerge -vDa raspberrypi-sources
cd /usr/src/linux
make bcmrpi3_defconfig
make && make modules_install && mount /boot && make install
emerge @module-rebuild

This wound up succeeding,
I shutdown, then disconnected the micro-sdcard reader, took the newly-minted micro-sdcard and put it in place of the raspberry-pi's original micro-sdcard.

The system does boot, and brings up the Gentoo userspace,
EXCEPT the kernel booting when I restart is NOT the kernel I compiled.

In the /boot folder, there are a few files of interest:

config.txt
https://pastebin.com/bqgTGagK

cmdline.txt:
console=serial0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 fsck.repair=yes rootwait


kernel.img: Linux kernel ARM boot executable zImage (little-endian)
kernel7.img: Linux kernel ARM boot executable zImage (little-endian)
kernel7l.img: Linux kernel ARM boot executable zImage (little-endian)
kernel8.img: gzip compressed data, was "Image", last modified: Wed Oct 6 15:42:56 2021, from Unix, original size modulo 2^32 21391872
vmlinuz-5.10.63-v8: Linux kernel ARM64 boot executable Image, little-endian, 4K pages

The last file is the one that was produced by the steps outlined above.

My question is - How do I get the kernel I compiled to boot? Do I rename it kernel.img?
What is the correct way of doing this?


Last edited by Progman3K on Tue Sep 27, 2022 3:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


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

PostPosted: Tue Sep 27, 2022 2:02 pm    Post subject: Reply with quote

in your config.txt you can put in
Code:
kernel=vmlinuz-5.10.63-v8
####initramfs initramfs-1.0.2.cpio.gz
 
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
 
[all]
#dtoverlay=vc4-fkms-v3d
arm_64bit=1


the kernel= is used to tell eeprom boot loader which kernel file to use.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Sep 27, 2022 2:28 pm    Post subject: Reply with quote

Progman3K,

You are very very close ... first a little understanding.

kernel.img: Linux kernel ARM boot executable zImage (little-endian) is for the arm6 based Pis
kernel7.img: Linux kernel ARM boot executable zImage (little-endian) is for the arm7a based Pis
kernel7l.img: Linux kernel ARM boot executable zImage (little-endian) is for the later arm7 based Pis ... all in 32 bit mode.
kernel8.img: gzip compressed data, was "Image". This is the kernel for the arm8a based Pis. The Pi3 and P4.
They can both operate in 64 bit or 32 bit mode.

vmlinuz-5.10.63-v8: Linux kernel ARM64 boot executable Image, little-endian, 4K pages
Is your kernel, as installed by
Code:
make install
.

bootcode.bin, which runs on the GPU to get everything ready for the CPU, looks to see which Pi its running on, then loads the default kernel.
I'm not sure if the Pi3 default is 32 bit or 64 bit these days.

If you want you use your own kernel, you need a /boot/config.txt file to say so.

Code:
# have a properly sized image
disable_overscan=1

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# Set 64 bit mode
arm_64bit=1

# Load my kernel
kernel=vmlinuz-5.10.63-v8


There are a few more warts to be aware of.

1. arm64 does not support auto kernel decompression. If bootcode.bin does it now, you will be good, if not, you need to use the arch/arm64/boot/Image file.
2. The *dtb is built with the kernel. Unless there is a common 32 bit and 64 bit device tree binary, only one core starts when you mix a 32bit dtb with a 64 bit kernel
3. 5.10.63-v8 is old. The foundation kernel is onto 5.15.x as it's the newest LTS branch. That may mean the ::gentoo repo needs some revbumps,
_________________
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
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 773

PostPosted: Tue Sep 27, 2022 3:25 pm    Post subject: Reply with quote

pingtoo, Neddy!

dmesg
[ 0.000000] Booting Linux on physical CPU 0x0000000000
[ 0.000000] Linux version 5.10.63-v8 (root@localhost) (gcc (Gentoo 11.3.0 p4) 11.3.0, GNU ld (Gentoo 2.38 p4) 2.38) #2 SMP PREEMPT Mon Sep 26 10:27:27 EDT 2022

uname -a
Linux localhost 5.10.63-v8 #2 SMP PREEMPT Mon Sep 26 10:27:27 EDT 2022 aarch64 GNU/Linux

WOOT!

Adding the
kernel=vmlinuz-5.10.63-v8
line to the /boot/config.txt really was all that was missing

Thank you, fellows!

In the end, it's really almost a completely standard handbook installation, if you boot with a standard rpi 64 image, connect a micro-sdcard reader, and install to the additional storage.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Sep 27, 2022 3:52 pm    Post subject: Reply with quote

Progman3K,

Does it start all four cores?
_________________
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
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 773

PostPosted: Tue Sep 27, 2022 4:10 pm    Post subject: Reply with quote

Hi Neddy!

It does!
https://pastebin.com/wTfHqRyP

excerpt:
[ 0.008775] smp: Bringing up secondary CPUs ...
[ 0.010217] Detected VIPT I-cache on CPU1
[ 0.010299] CPU1: Booted secondary processor 0x0000000001
[ 0.011939] Detected VIPT I-cache on CPU2
[ 0.011997] CPU2: Booted secondary processor 0x0000000002
[ 0.013565] Detected VIPT I-cache on CPU3
[ 0.013620] CPU3: Booted secondary processor 0x0000000003
[ 0.013836] smp: Brought up 1 node, 4 CPUs
[ 0.013981] SMP: Total of 4 processors activated.

Although there are
Under-voltage detected! (0x00050005)
warnings in there, because the power-supply I'm using doesn't seem to supply enough amperage
I'll be picking up one that does soon
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Sep 27, 2022 5:12 pm    Post subject: Reply with quote

Progman3K,

That's a good sign, the device tree binary and overlays are supposed to match the kernel.
Look in /usr/src/linux/arch/arm64/boot/dts/broadcom/ for the device tree binaries and /usr/src/linux/arch/arm64/boot/dts/overlays/.
You only install the files ending with .dtb and .dtbo.

The PSU for a PI is a bit odd. Mobile phone chargers usually supply 4.7v, even though they are labelled 5v.
The Pi really wants 5.2v on the Pi but operates down to 4.65v
There is a quirk in the USB spec for PSUs too. The output voltage is measured at the output of the unit.
Here's the quirk. "the output of the unit" varies depending on if the cable is detachable or not. Volt drop down the power cable matters.
_________________
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
NeddySeagoon
Administrator
Administrator


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

PostPosted: Tue Sep 27, 2022 5:24 pm    Post subject: Reply with quote

Moved from Installing Gentoo to Gentoo on ARM.

Its a 64 bit ARM install.
_________________
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
JumboAg
Apprentice
Apprentice


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

PostPosted: Tue Oct 25, 2022 10:34 pm    Post subject: Reply with quote

I'm curious, have you or anyone else gotten your method to work using the 5.15 builds? I've been playing with gentoo on my pi with limited success for a few weeks and anytime I umask and try to compile the more recent 5.15 build of raspberrypi-sources, raspberrypi-image and raspberrypi-firmware I get a kernel panic because it cannot find my root partition (MicroSD card).

I tried using both its /dev/mmcblk0pX name and the PARTUUID, no sucess after setting up my kernel line. Sucker works if I just rsync the equivalent "stuff" from a known good pi image though. Was trying to do it all through gentoo as a variant of a handbook install though.
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 773

PostPosted: Tue Oct 25, 2022 10:57 pm    Post subject: Reply with quote

Hi JumboAg!

I'm running this on my pi3:
Linux rpi3 5.15.32-v8 #1 SMP PREEMPT Tue Sep 27 13:26:30 EDT 2022 aarch64 GNU/Linux

And this on my pi4:
Linux pi4 5.15.32-v8 #1 SMP PREEMPT Tue Sep 27 13:26:30 EDT 2022 aarch64 GNU/Linux

As you can see they're both the same kernel version.

I can pastebin my .config file (or any other file) for either if you like, they're close, but not identical

EDIT: In fact, I can give you the partition backups in .fsa format (fsarchive format) for both the boot (63MB) and root (1.2GB) partitions, then you should be able to boot up right away, and if that fails, it's something else
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Tue Oct 25, 2022 11:09 pm    Post subject: Reply with quote

I can run 5.15 fine if I copy it over from a raspian image. Trying to find out if anyone has had success compiling the 5.15 raspberrypi-sources kernel form portage. That's what I can't get working. Won't find boot device.
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 773

PostPosted: Tue Oct 25, 2022 11:18 pm    Post subject: Reply with quote

Sorry, I wasn't clear, the gentoo portage packages ARE what I'm running.

At first, I did like you and used the raspbian image, but then I eventually replaced the boot files and everything else with a standard gentoo install.
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Tue Oct 25, 2022 11:23 pm    Post subject: Reply with quote

I'd love to look at your config file and compare it to mine to see what I'm missing. All I did was the rpi3_defconfig make. Guessing I need to Turn something else on.
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 773

PostPosted: Tue Oct 25, 2022 11:51 pm    Post subject: Reply with quote

Heh, you made me doubt for a second, but here are the first two lines of dmesg:

[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]
[ 0.000000] Linux version 5.15.32-v8 (root@localhost) (gcc (Gentoo 11.3.0 p4) 11.3.0, GNU ld (Gentoo 2.38 p4) 2.38) #1 SMP PREEMPT Tue Sep 27 13:26:30 EDT 2022

OK, I'll paste the .config files, here they are:

Raspberry pi3:
https://pastebin.com/ERyYhT6T

Raspberry pi4:
https://pastebin.com/4RnfdkcY
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Wed Oct 26, 2022 2:30 am    Post subject: Reply with quote

Interesting. I did a compare between our config files and yours has about 1000 more lines than mine does. Do you remember which package you emerged originally?

This is what I was working with (latest of each from the test branch):
sys-boot/raspberrypi-firmware-1.20220830
sys-kernel/raspberrypi-image-5.15.32_p20220331
sys-kernel/raspberrypi-sources-5.15.32_p20220331-r1

Could it be because my firmware is slightly newer? Do I instead need to use the 3/28 firmware package?
Back to top
View user's profile Send private message
Progman3K
l33t
l33t


Joined: 03 Jan 2004
Posts: 773

PostPosted: Wed Oct 26, 2022 1:20 pm    Post subject: Reply with quote

Looks like we are using the exact same package versions, for both my rpi3 and rpi4:

raspberrypi-firmware-1.20220830
raspberrypi-image-5.15.32_p20220331
raspberrypi-sources-5.15.32_p20220331-r1

The configs are probably different because I originally ran the make for the default config corresponding to the output of cat /proc/cpuinfo

RPi3:
Quote:
Hardware : BCM2835
Revision : a02082
Model : Raspberry Pi 3 Model B Rev 1.2

RPi4:
Quote:
Hardware : BCM2835
Revision : d03115
Model : Raspberry Pi 4 Model B Rev 1.5

So in both cases, I first ran
make bcmrpi3_defconfig
to generate the .config
Back to top
View user's profile Send private message
JumboAg
Apprentice
Apprentice


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

PostPosted: Wed Oct 26, 2022 1:25 pm    Post subject: Reply with quote

I ran the same make command. After that the only thing I did was do a quick make menuconfig to change the CPU powersave mode to ondemand. Saved that, then did a make on the whole thing.

My hardware is slightly older than yours but I wouldnt think that would change the config file that much. Weird.

Hardware : BCM2835
Revision : b03111
Model : Raspberry Pi 4 Model B Rev 1.1
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Wed Oct 26, 2022 6:12 pm    Post subject: Reply with quote

Team,

Code:
make bcmrpi3_defconfig
is for the Pi 3
The Pi 4 needs
Code:
bcm2711_defconfig

I've never looked at the differences.

The raspberrypi-firmware package provides all the code that runs on the GPU before ARM CPU is released from reset.
If the kernel even starts to boot, its done its thing.

Is the kernel command line one long line?
It must be or only the first line is used.

Not finding root sounds like a missing rootwait on the kernel command line.
It could be something more fundamental like missing SD card drivers too.
_________________
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
JumboAg
Apprentice
Apprentice


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

PostPosted: Wed Oct 26, 2022 6:43 pm    Post subject: Reply with quote

I did change the rootwait to a rootdelay just so I could see the kernel panic info. Looks like I was using the wrong config (Pi3 instead of Pi4). Recompiling now with the correct one.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Wed Oct 26, 2022 7:37 pm    Post subject: Reply with quote

JumboAg,

rootdelay=10 should be excessive.
_________________
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
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