Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on ARM
  • Search

Raspberry Pi, almost identical to handbook install [SOLVED]

Gentoo on all things ARM. Both 32 bit and 64 bit.
Tell about your hardware and CHOST.
Problems with crossdev targeting ARM hardware go here too.
Post Reply
  • Print view
Advanced search
20 posts • Page 1 of 1
Author
Message
Progman3K
l33t
l33t
User avatar
Posts: 805
Joined: Sat Jan 03, 2004 11:59 pm
Contact:
Contact Progman3K
Website

Raspberry Pi, almost identical to handbook install [SOLVED]

  • Quote

Post by Progman3K » Tue Sep 27, 2022 1:46 pm

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.
Top
pingtoo
Advocate
Advocate
User avatar
Posts: 2189
Joined: Fri Sep 10, 2021 8:37 pm
Location: Richmond Hill, Canada

  • Quote

Post by pingtoo » Tue Sep 27, 2022 2:02 pm

in your config.txt you can put in

Code: Select all

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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Sep 27, 2022 2:28 pm

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: Select all

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: Select all

# 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.
Top
Progman3K
l33t
l33t
User avatar
Posts: 805
Joined: Sat Jan 03, 2004 11:59 pm
Contact:
Contact Progman3K
Website

  • Quote

Post by Progman3K » Tue Sep 27, 2022 3:25 pm

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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Sep 27, 2022 3:52 pm

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.
Top
Progman3K
l33t
l33t
User avatar
Posts: 805
Joined: Sat Jan 03, 2004 11:59 pm
Contact:
Contact Progman3K
Website

  • Quote

Post by Progman3K » Tue Sep 27, 2022 4:10 pm

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
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Sep 27, 2022 5:12 pm

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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue Sep 27, 2022 5:24 pm

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.
Top
JumboAg
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Sat Mar 03, 2007 11:13 pm
Location: Dallas, TX

  • Quote

Post by JumboAg » Tue Oct 25, 2022 10:34 pm

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.
Top
Progman3K
l33t
l33t
User avatar
Posts: 805
Joined: Sat Jan 03, 2004 11:59 pm
Contact:
Contact Progman3K
Website

  • Quote

Post by Progman3K » Tue Oct 25, 2022 10:57 pm

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
Top
JumboAg
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Sat Mar 03, 2007 11:13 pm
Location: Dallas, TX

  • Quote

Post by JumboAg » Tue Oct 25, 2022 11:09 pm

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.
Top
Progman3K
l33t
l33t
User avatar
Posts: 805
Joined: Sat Jan 03, 2004 11:59 pm
Contact:
Contact Progman3K
Website

  • Quote

Post by Progman3K » Tue Oct 25, 2022 11:18 pm

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.
Top
JumboAg
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Sat Mar 03, 2007 11:13 pm
Location: Dallas, TX

  • Quote

Post by JumboAg » Tue Oct 25, 2022 11:23 pm

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.
Top
Progman3K
l33t
l33t
User avatar
Posts: 805
Joined: Sat Jan 03, 2004 11:59 pm
Contact:
Contact Progman3K
Website

  • Quote

Post by Progman3K » Tue Oct 25, 2022 11:51 pm

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
Top
JumboAg
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Sat Mar 03, 2007 11:13 pm
Location: Dallas, TX

  • Quote

Post by JumboAg » Wed Oct 26, 2022 2:30 am

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?
Top
Progman3K
l33t
l33t
User avatar
Posts: 805
Joined: Sat Jan 03, 2004 11:59 pm
Contact:
Contact Progman3K
Website

  • Quote

Post by Progman3K » Wed Oct 26, 2022 1:20 pm

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:
Hardware : BCM2835
Revision : a02082
Model : Raspberry Pi 3 Model B Rev 1.2
RPi4:
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
Top
JumboAg
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Sat Mar 03, 2007 11:13 pm
Location: Dallas, TX

  • Quote

Post by JumboAg » Wed Oct 26, 2022 1:25 pm

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
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Oct 26, 2022 6:12 pm

Team,

Code: Select all

make bcmrpi3_defconfig
is for the Pi 3
The Pi 4 needs

Code: Select all

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.
Top
JumboAg
Apprentice
Apprentice
User avatar
Posts: 224
Joined: Sat Mar 03, 2007 11:13 pm
Location: Dallas, TX

  • Quote

Post by JumboAg » Wed Oct 26, 2022 6:43 pm

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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56108
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Wed Oct 26, 2022 7:37 pm

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.
Top
Post Reply
  • Print view

20 posts • Page 1 of 1

Return to “Gentoo on ARM”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic