Saturday, December 01, 2012

Gentoo on my RPi

This is my first posting for quite some time as I was away in Portugal for close to two weeks.
Nevertheless, I have been doing quite a lot of playing around with the little (and now outdated with only 256 MB RAM) Raspberry Pi.

Although I've been using Linux for more than 6 years, I've always been reticent about trying out Gentoo as its introduction is generally prefaced by phrases such as "definitely not for beginners" or "not for the faint-hearted".

Anyway, I finally took the plunge and tried it out on my RPi.
Installation was fairly straightforward and I basically used the Gentoo Wiki Quick Install guide for the RPi as well as looking over the more elaborate install procedure.
I used Gparted to partition my 8GB Class 4 SD card as well as to create the filesystems. Also, I didn't try compiling my own kernel but simply used the existing RPi firmware as explained in the quick install guide.

Next I installed xorg-server largely as explained in the Gentoo wiki. I added the USE flags xorg and udev to /etc/portage/make.conf and nothing else as pre-install configuration as I assumed the rpi kernel was already appropriately configured.
This took about three hours on my RPi.
To get startx to do something, I had to also emerge twm, xclock and xterm.

Next I installed lxde-meta again as detailed in the wiki.
This install took 20 hours on my machine.

To boot to the LXDE Desktop, add
exec startlxde
to ~/.xinitrc and issue the command

You should now see the LXDE desktop after you log in. However, in my case at least, no lxde wallpaper appeared apparently because the kernel was not compiled with jpeg enabled.
Nevertheless, .png wallpapers are accepted.
Incidentally, I tried a lot of things to overcome this rejection of .jpeg/.jpg images including re-compiling pcmanfm with USE=jpeg but to no avail.

However, you should now be ready to do some organize your Desktop as suits you. The screenshot shows how mine looks.
And, yes, conky works without any problems.

Once you can boot to the Desktop, it's time to add your own user account as described here.
Don't forget to include yourself in the 'wheel' group in order that you can use su and sudo.
Indeed, it's a good idea now to "emerge sudo" and when that's done, uncomment the line
so that you, as a member of the wheel group, can use sudo without having to add your password.

The first thing I always like to do is to configure the system to autologin straight to the Desktop.
In Gentoo/LXDE this requires changing this line in /etc/inittab
c1:12345:respawn:/sbin/agetty 38400 tty1 linux
to this
c1:12345:respawn:/bin/login -f "your user" tty1 >/dev/tty1 >/dev/tty1 2<&1

Now, just addd the line
to ~/.bash_profile and reboot.

And now we need a browser, right?
Well, I tried four and only one works for me in the RPi version of Gentoo.
UZBL didn't successfully compile (I had great problems with the compilation of webkitgtk until I increased my Swap partition size from 500MB to 2GB. However, even after getting it to compile with the larger Swap partition, it still stalled while compiling Uzbl)
Midori compiles and installs fine but seg-faults at the drop of a hat.
DWB similarly compiled and installed without problems but seg-faulted every time I opened Google.
Lynx, however, worked fine although it may not be to everyone's taste as it's a text-only browser.
But this is very strange that browser availability is so limited.
I'll have to look more closely at this (which generally means posting to a forum).

To take screenshots on Gentoo/LXDE, some work is required as explained here.
On the RPi, I just emerged imagemagick and set up an alias in ~/.bashrc
alias sshot="sleep 5; import -window root /home/paul/Desktop/screenshot.png"
Note that I assigned a .png suffix to the file name as my system, as it stands, doesn't accept .jpg images.
So, now to take a screenshot, I just open a terminal and type sshot.
The only problem is that will all have the same file name so that, before taking a subsequent shot, I need to rename, or assign to a different folder, the last shot I took.

I got wifi working more or less by following the Gentoo wiki guide.
In the end, however, I just set up a simple script to run at boot time with the following content:
sudo ifconfig wlan0 up
sleep 3
sudo iwconfig wlan0 essid "essid_name"
sleep 3
sudo iwconfig wlan0 s:"your_key"
sleep 3
sudo ifconfig wlan0

and that seemed to work fine in that the wifi dongle LED lit up at boot and the assigned wifi address appeared in Conky.
Strangely, though, when I unplugged the ethernet cable, I lost wifi as well.
Another thing to look into.
However, I have to point out that, even though I use the dongle in a powered usb-hub, when it's plugged in, typing on the screen becomes extremely erratic which I put down to insufficient power to the mouse/keyboard dongle also in the powered hub.

OK, next is sound.
I had a lot of problems here which are as yet unresolved.
First I emerged shell-fm and madplay, the first of which I've used in quite a few distros on my RPi without any problems.
Additionally, I loaded the modules snd-bcm2835 and snd-pcm-oss using the commands
#modprobe snd-bcm2835
#modprobe snd-pcm-oss

Next I emerged alsa-utils and alsa-tools (this latter is almost certainly unnecessary).
Now, this works:
aplay /usr/share/sounds/alsa/Front_Center.wav

but shell-fm, even though it provides the usual terminal output, produces no sound.
Similarly, madplay (as root) produces no sound from .wav, .mp3 or .flac files, each time showing a "frame 0: lost synchronization" error.

Nevertheless, I was able to convert the same .mp3 file to a .wav file using this free online service and aplay (as root) played this perfectly.
Note however, that my 7MB .mp3 file converted to a 31MB .wav file. However, the quality of the .wav sound seemed far superior as you'd expect from  the much bigger lossless .wav.
So, I finally got some music but also quite a few questions.

It seems to me that the problem results from the usual (.mp3, .flac, .ogg) music file formats being omitted from the RPi kernel as compiled for Gentoo.

I'm currently emerging VLC with USE flags mp3, flac, vorbis-tools and wavpack in an attempt to overcome this.
If this doesn't work, I'll recompile my kernel.

Incidentally, the biggest problem I've come across so far with Gentoo on the RPi, is that this little machine with a 700 MHz processor and less than 256 MB of RAM just doesn't have the resources to deal with an OS where package building is used to install apps.
What takes hours and, even days, to install on the RPi, takes minutes and, at most two hours, to compile on my Desktop which, of itself, has quite modest credentials bu todays standards (CPU 1.86 GHz C2D, 3GB RAM).

No comments:

Post a Comment