Friday, July 07, 2017

Gentoo on RaspberryPi

There are several guides on how to setup Gentoo on a Raspberry PI.  For whatever reason they all seem to have mistakes or things in them that frustrate me.

[Edit:  This is a story of failure.  I've struck out the useless & frustrating bits.  The only interesting or possibly useful bit is at the bottom.]

So here is my guide, for me, which you will probably find mistakes in and find frustrating. Sorry.

So if you really want the best speed from you Pi SD card the partitions need to be done in just the right way - or so I'm told:
However it's worth noting that the SDCard reader on the Pi does have a theoretical limit on how fast it can move data.  I think its somewhere close to 25Mbps (MBps?).  So maybe don't expect that your extreme/pro/super card will run at top speed no matter what we do to it:

fdisk -c=dos /dev/mmcblk0
x (expert mode)
h (set to 255)
s (set to 63)
p (check out the total bytes on the card)
c (set cylinders = integer part of { [total bytes] / 255 / 63 / 512 })
   (Probably the same as the default because we started with "-c=dos")

r (go back to regular mode)

(I make my partitions like this:
Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors
Geometry: 255 heads, 63 sectors/track, 1883 cylinders
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9649c08a

Device         Boot    Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *          63   262207   262145  128M  c W95 FAT32 (LBA)
/dev/mmcblk0p2        262208 28155902 27893695 13.3G 83 Linux
/dev/mmcblk0p3      28155903 30253055  2097153    1G 82 Linux swap / Solaris

I put the swap at the end, cause I figure it will get trashed and die from heavy use.  Maybe I wil be able to shrink partition 2 and just move the swap in as write fatigue destroys it. YMMV)

mkfs.vfat -F 32 -n BOOT /dev/mmcblk0p1
mkfs.f2fs -L ROOT/dev/mmcblk0p2
mkswap -L SWAP /dev/mmcblk0p

(Might need to choose something other than f2fs to start with, I think the modern raspberry pi kernels support ext4)

Then mount them up at /mnt/gentoo and /mnt/gentoo/boot

And start copying files, I followed these instructions:
And that didn't work: kernel panic couldn't mount the partitions...  I think the problem was with the /boot/cmdline.txt file.  But seeing as I already took issue with that guy's sdcard formating and choice of filesystem, I decided to look elsewhere.

I tried to follow these instructions:

mount /dev/mmcblk0p1 /boot
emerge --oneshot sys-boot/raspberrypi-firmware

* Please configure your ram setup by editing /boot/config.txt

vim /boot/cmdline.txt
"root=/dev/mmcblk0p2 rootdelay=2"

mount /dev/mmcblk0p2 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/mmcblk0p1 /mnt/gentoo/boot
tar xpjf /home/anon/Downloads/Gentoo\ RPi\ Images/stage3-armv6j_hardfp-20161205.tar.bz2 -C /mnt/gentoo


This isn't working....  All the guides I've been able to find are terrible. Many broken links, small incomplete sections, nothing covered thoroughly, while trying to cover a huge variety of software and scenarios:
*Using portage to get firmware.
*At least four different sections concerning installing the kernel
*Modifying ebuild files
*Stage 3 downloads
*Stage 4 downloads
*Cross compiling with cossdev
**Creating an overlay
*Compiling using chroot
**Using QEMU virtualization
* Binhost servers (

Really! >:-(

That's too much stuff to just touch on and assume that the reader will figure it out.  I wasted days trying to work though all that, and I've at least experienced many of those concepts/software before.  If you were trying to scare someone off of using Gentoo on a raspberry pi; congratulations: you did a great job!  (Jerk.)
Then near the bottom I find this:

Is a working link to a Raspberry Pi 3 image that can be installed by Noobs, and has clear instructions.
I ordered a couple of raspberry pi 3's and I'll wait for them to arrive.

(What a waste...)

In the mean time I started working on my own Gentoo on Raspberry Pi wiki how-to.  I don't know if I'm going to be successful; but if I can figure out how to get Gentoo onto a Pi - then I can definitely write a better wiki page about it.

No comments:

Post a Comment