Gentoo/N900
This is the official page for the unofficial port of Gentoo to N900 internet tablets.
If you have any questions/troubles, you can find me on freenode #maemo and #gentoo-embedded (webchat).
Bootable with X, WiFi, SMS, and GPRS
Contents |
Overview / Todo list
-
Main display - Battery charger daemon (or kernel integration)
-
Keyboard (X11) -
GPRS/UMTS data connections-
Integrated with Gentoo network subsystems
-
-
SMS - Audio output (NOT SAFE: see highpass filter)
- Voice calls
- Cellular
- Ring/vibrate
- SIP
- XMPP
-
Front camera- Camera button
- Autofocus
- Usable GUI
- Razor-qt?
- KDE Plasma Active?
- Video calls (webcam)
- Skype support?
- Flashlight (SAFETY RESTRICTIONS NEEDED)
- GPS (gpsd driver)
- Road navigation
- Dead reckoning w/ accelerometers?
- Cellular
- TV out
- FM transmitter
- Keyboard (console)
- Bluetooth
- Headset
- GPS
- ??
- Infrared transmitter
- 3D acceleration
- FM receiver
Installation
Partitioning
If you use the internal memory card, be sure to leave your Maemo partitions in the same partition order as before (unless you don't want to run Maemo anymore, of course)
Unless you're super-careful doing this, you will probably lose all the data on the partitions you change. Backup!
First, dump your current partition layout:
sfdisk -d /dev/mmcblk0 > ptable
Now, edit the ptable file with your favourite editor and load the modified one:
sfdisk --no-reread /dev/mmcblk0 < ptable
Here is how I partitioned my internal SSD:
unit: sectors /dev/mmcblk0p1 : start= 64, size= 4194304, Id= c /dev/mmcblk0p2 : start= 56631360, size= 4194304, Id=83 /dev/mmcblk0p3 : start= 60825664, size= 1572864, Id=82 /dev/mmcblk0p4 : start= 4194368, size= 52436992, Id= 5 /dev/mmcblk0p5 : start= 4194384, size= 20971568, Id=83 /dev/mmcblk0p6 : start= 25165968, size= 31465392, Id=83</blockquote>
If you're more conforable with standard Linux fdisk, supposedly the deb from Debian Lenny works. See the official Gentoo handbook if you need help using fdisk to edit your partition table.
Creating Filesystems
Since you are installing on a SSD that may very well queue its writes out of order, ext3 and other journaling filesystems designed for magnetic/write-in-order drives are generally a bad idea and may be very dangerous to use. If you're using an old kernel, such as the original Fremantle kernel, you'll have to stick to ext2. If you are using a recent "power" kernel (or modern kernel), you can use ext4 without journal support.
I recommend making swap on an external MicroSD so when you destroy it, it can be replaced (unlike the internal one).
Mounting
Due to Maemo using the FHS /media for other partitions, I chose to use it for the Gentoo mount too. You can use Gentoo's standard /mnt here if you want, I think.
mount -t ext2 /dev/mmcblk0p5 /mnt/gentoo
Installing Gentoo
Be sure your system clock is correct before proceeding. Weird things happen when it's not.
Download the latest armv7a_hardfp stage3 from Gentoo, or, if you want to run the softfp ABI (still hardware-accelerated) for some reason (like better binary compatibility with Maemo), you can use the armv7a stage3. Note that I only run hardfp, so can't support problems specific to the softfp ABI and don't provide prebuilt binary packages for it.
Just in case, download the .DIGESTS file too, and verify your download with:
sha1sum -c *.DIGEST
Now, proceed to unpack the stage3:
cd /media/gentoo tar xvjpf stage3-*.tar.bz2
Configure your compile options (/media/gentoo/etc/portage/make.conf) next.
Recommended (only safe to use unmodified for hardfp ABI!):
CHOST="armv7a-hardfloat-linux-gnueabi" CFLAGS="-O2 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard" CXXFLAGS="${CFLAGS}" ASFLAGS="-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard" # Distcc is a good idea, if you setup a cross-compiler on another Gentoo system FEATURES="${FEATURES} distcc" # MAKEOPTS -jN should probably be the number of systems in your distcc array; but never more than 2 when building KDE software (meinproc uses a lot of memory and won't be distributed)! MAKEOPTS="-j2" # Since the N900 doesn't have a lot of RAM, you'll probably need to sacrifice some CPU time to minimize memory usage LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory -Wl,--reduce-memory-overheads" # The following thing increased building times of some packages (paludis and cryptography, for instance) insanely and the man page suggests it is of questionable utility CFLAGS="${CFLAGS} --param ggc-min-expand=0 --param ggc-min-heapsize=32768" PORTAGE_NICENESS="10" PORTAGE_IONICE_COMMAND="ionice -c 3 -p \${PID}" PORTAGE_BINHOST="http://luke.dashjr.org/programs/gentoo-n900/packages/hardfp/gcc45/" EMERGE_DEFAULT_OPTS="--getbinpkg y"
Chroot
cp -L /etc/resolv.conf etc/ mount -t proc proc proc mount -o bind /dev dev mount -t devpts devpts dev/pts env -i chroot . /bin/bash env-update source /etc/profile export PS1="(chroot) $PS1"
Install and configure the Portage tree, with N900 overlay
emerge --sync --quiet emerge layman layman -a n900 rm /etc/make.profile ln -s /var/lib/layman/n900/profiles/default/linux/arm/10.0/n900/ /etc/make.profile
Configure timezone
ls /usr/share/zoneinfo cp /usr/share/zoneinfo/UTC /etc/localtime echo "UTC" > /etc/timezone
Booting
Configuring your kernel
If you just want to use your Maemo kernel, simply copy /lib/modules/* from your Maemo partition into Gentoo (you'll need to exit the chroot first).
However, if you want to build one yourself (required for any custom kernel modules, or non-X11 console), follow these steps:
emerge fremantle-power-sources # regular fremantle-sources is also available cd /usr/src/linux make menuconfig # (configure the kernel as you like here) make && make modules_install # (copy arch/arm/boot/zImage to your host system to flash as the N900's kernel)
Note that this kernel will not boot Maemo without setting up the modules on the Maemo partition. I believe this is as simple as copying the directory and running depmod on that side, but I'll have to review it before I'm sure.
You can skip the compiling (but you still need to install the sources!) if you want, by using one of my prebuilt kernels.
Configuring your system etc
The following steps from Gentoo's official handbook are just fine here:
Installing N900-required stuff
The n900-env metapackage should pull in all the essentials for your N900. If you don't want some N900 functionality, you can change your USE flags in make.conf prior to installing it.
USE flag | Description |
---|---|
bluetooth | BlueZ and Bluetooth firmware |
cellular or gps | Ofono |
nokia-osso-linux | Maemo "bootmenu" compatibility |
v4l | Camera firmware |
wifi | Wifi firmware and tools |
X | X11 drivers |
emerge n900-env
X11 setup
Create /etc/X11/xorg.conf with the following:
Section "Device" Identifier "Configured Video Device" Driver "omapfb" Option "fb" "/dev/fb0" EndSection Section "InputClass" Identifier "calibration" MatchProduct "TSC2005 touchscreen" Option "Calibration" "194 3901 3739 241" EndSection Section "InputClass" Identifier "keyboard" MatchProduct "omap_twl4030keypad" Option "XkbOptions" "grp:ctrl_shift_toggle" Option "XkbLayout" "nokia_vndr/rx-51(common)+nokia_vndr/rx-51(us)" Option "XkbModel" "nokia" EndSection Section "InputClass" Identifier "touchscreen" MatchProduct "TSC2005 touchscreen" Driver "tslib" Option "EmulateRightButton" "1" EndSection
Sound setup
This basically "just works", but be careful when unmuting - it's possible to play audio that destroys the internal speakers! If you're experienced in writing highpass filters, please contact me to help resolve this.
Cellular setup
Install Ofono
emerge net-misc/ofono
Configure GPRS networking
ln -s net.lo /etc/init.d/net.gprs0
Edit /etc/conf.d/net:
rc_need_gprs0='ofono' modem_gprs0='n9000' # The extra zero is the n900 instance number 0 :) context_apn_gprs0='epc-scpcf000.t-mobile.com' # Other providers need other APNs! context_protocol_gprs0='ipv6'
Start the GPRS interface:
/etc/init.d/net.gprs0 start
Send SMS
ofono-send-sms n9000 15555551212 'Hey there!'
Voice call
ofono-dial-number n9000 15555551212
Note the other end will probably get silence, and you won't hear them either. I'm working on an ALSA plugin to fix this.
WiFi setup
ln -s net.lo /etc/init.d/net.wlan0
Edit /etc/conf.d/net:
mac_wlan0='00:1f:df:xx:xx:xx' # You MUST set this, or N900's wlan MAC won't be initialized! preferred_aps='my_wep_network my_public_network linksys etc' key_my_wep_network='abcd-ef00-1234-5678-9abc-def0-12' modules="!wpa_supplicant"
Start the wlan interface:
/etc/init.d/net.wlan0 start
Bluetooth setup
It's on my todo list, but not very high priority since I don't really use anything Bluetooth...
GPS setup
I've reverse engineered the cellmo GPS protocols, and written a NMEA proxy that mostly works with gpsd. When I get to properly integrating GPS support, I plan to write an actual gpsd driver so a proxy isn't needed.
Known problems
Webkit linking memory usage
WebKit requires an absurd amount of memory to link. I build binary packages inside qemu when it needs to be bumped. I suggest you use them.
Modern kernel
Current status: http://elinux.org/N900