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 (probably luke-jr) on freenode #maemo and #gentoo-embedded (webchat).
Bootable with X, WiFi, SMS, and GPRS
Contents |
[edit] 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
[edit] Installation
[edit] 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
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.
[edit] 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 (but possibly these do not have ext4 ACLs/xattrs enabled).
I recommend making swap on an external MicroSD so when you destroy it, it can be replaced (unlike the internal one).
[edit] 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
[edit] Installing Gentoo
Be sure your system clock is correct before proceeding. Weird things happen when it's not.
Download the latest *vanilla* armv7a_hardfp musl stage3 from Gentoo. Note that standard glibc stage3 will no longer work as it includes glibc 2.20, which is incompatible with the older kernels needed for N900. You could try uclibc instead, but nobody has tried that thus far, so you're on your own.
Just in case, download the .DIGESTS file too, and verify your download with:
grep -A1 SHA512 stage3-*DIGESTS | sha512sum -c
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 musl hardfp ABI!):
CHOST="armv7a-hardfloat-linux-musleabi" # WARNING: -mthumb -mthumb-interwork require a Thumb-safe kernel! Remove them otherwise. CFLAGS="-O2 -pipe -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard -mthumb -mthumb-interwork" CXXFLAGS="${CFLAGS}" ASFLAGS="-mcpu=cortex-a8 -mfpu=neon -mfloat-abi=hard -mthumb -mthumb-interwork" # 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}"
[edit] 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"
[edit] Install and configure the Portage tree, with N900 overlay
emerge --sync --quiet USE='-* git curl ssl curl_ssl_openssl python_targets_python2_7' emerge layman # be sure to follow layman post-install instructions to edit make.conf layman -fa n900 eselect profile set n900:n900/armv7a-hardfloat-linux-musleabi layman -a musl
[edit] Configure timezone
USE=-nls emerge -1 timezone-data ls /usr/share/zoneinfo echo "UTC" > /etc/timezone emerge --config timezone-data
[edit] Booting
[edit] 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) and emerge the appropriate kernel sources: fremantle-sources, fremantle-power-sources, and meego-sources are available.
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 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.
[edit] Configuring your system etc
All of these are optional if you just want a chroot.
The following steps from Gentoo's official handbook are just fine here:
- Filesystem information
- Networking information
- System information
- System logger
- Optional: Cron daemon
- Optional: File indexing
- Optional: Remote access
- Filesystem tools
- Networking tools
[edit] 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
[edit] 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
[edit] 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.
[edit] Cellular setup
[edit] Install Ofono
emerge net-misc/ofono
[edit] 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
[edit] Send SMS
ofono-send-sms n9000 15555551212 'Hey there!'
[edit] 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.
[edit] 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
[edit] Bluetooth setup
It's on my todo list, but not very high priority since I don't really use anything Bluetooth...
[edit] 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.
[edit] Known problems
[edit] 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.
[edit] Modern kernel
Current status: http://elinux.org/N900
- This page was last modified on 4 January 2017, at 20:38.
- This page has been accessed 18,833 times.