Nokia N900

From postmarketOS
(Redirected from Nokia-rx51 (Nokia N900))
Jump to: navigation, search
Nokia N900
Nokia N900 running cmus
Nokia N900 running cmus
Manufacturer Nokia
Name N900
Codename rx-51
Released 2009
Original software Maemo on Linux 2.6
postmarketOS kernel Mainline Linux
Hardware
Chipset TI OMAP 3430
CPU 600 MHz Cortex-A8
GPU PowerVR SGX530
Display 800x480 TFT resistive
Storage 32 GB
Memory 256 MB
Running i3wm
Splash screen

Contributors

What works

  • Framebuffer & DRM graphics
  • GPRS / SMS (see section below)
  • Unlocking the root partition using the physical keyboard
  • Display Backlight control
  • Wayland on framebuffer
  • Wifi (see Additional Info below)
  • Notification led
  • Audio playback (ALSA)
  • Keyboard backlight (see Additional Info below)
  • Battery capacity reporting (see Additional Info below)
  • Keyboard in virtual terminal
  • USB Mass Storage (see USB Gadget below)

What does not work

  • Front cameras
  • Back camera is close to supported in 4.14-rc1.
  • Voice calls (needs https://gitlab.com/libcmtspeechdata/libcmtspeechdata and has poor quality)
  • 3D Acceleration (requires binary blob)
  • There's bluetooth support at bluetooth-next, but that works on N950, not on N900. Bluetooth . There's a driver ported to 4.13 at bt-v4.13 tree, git.kernel.org, linux-n900 .

Installation

We currently only support installing and running pmos from the microsd card on the n900.
Getting it to work with emmc and 0xffff is harder to implement and has no real benefit since
the built in emmc is quite slow and fragile.

  1. Init pmbootstrap
    $ ./pmbootstrap.py init
    
    Choose 'nokia-n900' as target device.
  2. Start the build process and install the completed image to a sdcard
    # Replace /dev/sdX with the device for your sdcard
    $ ./pmbootstrap.py install --sdcard /dev/sdX
    
  3. Install u-boot from pali on the n900 in Maemo, if you haven't installed it already. See Additional Info below for instructions on configuring pmos to boot by default.
  4. Place the sdcard into the n900 and boot it with the keyboard slide open
  5. Choose the u-boot shell
  6. enter run sdboot into the shell

Features

Configuring U-boot (optional)

In order to configure pmos to boot by default on the N900, using U-boot, you will need to boot into Maemo and create a /etc/bootmenu.d/10-pmos.item file as the root user with these contents:

/etc/bootmenu.d/10-pmos.item
ITEM_NAME="postmarketOS"
ITEM_SCRIPT="boot.scr"
ITEM_DEVICE="${EXT_CARD}p1"
ITEM_FSTYPE="ext2"

It can be set to the default boot option by creating a symlink:

root@Nokia-N900:~# ln -s /etc/bootmenu.d/10-pmos.item /etc/default/bootmenu.item

Finally, run u-boot-update-bootmenu:

root@Nokia-N900:~# u-boot-update-bootmenu 
Default bootmenu entry is '/etc/bootmenu.d/10-pmos.item'
Adding bootmenu entry for: 'Maemo 5 with attached kernel (Internal Nand)'

Configuration file: /etc/bootmenu.d/10-pmos.item
Adding bootmenu entry for: 'postmarketOS'
Configuring this bootmenu entry as default

Generating u-boot bootmenu script...

Note: This will set pmos as the default boot option. Maemo will still be accessible when booting the N900 with the keyboard slide out and selecting the relevant boot option in the u-boot boot menu.

Wifi

The linux-firmware-ti-connectivity package is required to provide the wl1251 firmware necessary for initializing the wifi device. (#1414)

Once the device has been successfully initialized, enable it:

$ sudo ip link set wlan0 up
$ sudo iw wlan0 set type managed

Configure wpa_supplicant (only necessary on encrypted networks):

$ sudo su -
# wpa_passphrase $YOUR_SSID > /etc/wpa_supplicant/wpa_supplicant.conf
<enter passphrase here and press Enter>
# exit

Connect to network using wpa_supplicant:

$ sudo rc-service wpa_supplicant restart 

Sound

Modules need not to be compiled, sound support is built into kernel. Install alsa-utils.

sudo aplay /usr/share/sounds/alsa/Front_Left.wav

NikkSaan provided an advanced audio configuration in #702 (comment).

Keyboard Backlight

There are 6 keyboard backlight LEDs that can be adjusted, they are found under /sys/class/leds/lp5523:kb{1-6}. To adjust brightness, write a value, $VAL between 0 and 255, to the brightness parameter as the root user:

for i in $(seq 1 6);
    do echo $VAL > /sys/class/leds/lp5523\:kb$i/brightness
done

Keyboard layout

Console

The keyboard layout for the virtual console is asked during pmbootstrap init after you select the nokia-n900 device.

Available keymaps:

  • us/rx51_us

N900 keymap us.jpg

  • ch/rx51_ch-de

N900 keymap ch-de.jpg


To obtain your desired language keymap file for the RX-51, such as this one:

  • On the N900, install kbd-bkeymaps, either by using pmbootstrap install --add kbd-bkeysmaps on the host system or by running apk add kbd-bkeysmaps on the device itself.
  • The keymap must be in binary format, bmap. This can be accomplished using the loadkeys tool:
$ apk add kbd kbd-bkeymaps
$ loadkeys -b rx51_us.map > rx51_us.bmap
$ gzip rx51_us.bmap
  • Compress it and copy it to /usr/share/bkeymaps/us/ on the N900.
  • Log into the N900, and run sudo setup-keymap, then select us and finally rx51_us.

(TODO: Need to pull 'official' vconsole keymaps from Maemo5 if they exist..)

X11

In X11 you can use setxkbmap to configure the desired layout.

Right now it's configured to use the nokiarx51/us layout by default (see 40-xkb.conf).

Info: Tab is ctrl+i
Console switching

You can use the Nokia-n900-blue-arrow.PNG blue arrow key in combination with the Volume Up/Down to switch to a different virtual terminal.

If you installed postmarketOS with a UI, you first have to enable again the other VT by editing the /etc/inittab file and uncomment the following lines:

...
# Set up a couple of getty's
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
tty3::respawn:/sbin/getty 38400 tty3
tty4::respawn:/sbin/getty 38400 tty4
tty5::respawn:/sbin/getty 38400 tty5
tty6::respawn:/sbin/getty 38400 tty6
...

Display

With DRM enabled (#197), the display can be managed at this location: /sys/devices/platform/omapdrm.0/graphics/fb0/

For example, the display can be turned off by:

# echo 1 > /sys/devices/platform/omapdrm.0/graphics/fb0/blank

To adjust brightness:

# # Replace $VAL with a value from 0 to 255:
# echo $VAL > /sys/class/backlight/acx565akm/brightness

GUI

XFCE4

XFCE4 works well.

i3wm

I3wm also works very well with the N900 due to the hardware keyboard, and MartijnBraam created some nice configs which have are included in the standard postmarketos-ui-i3wm installation.

Hildon

As of 15th May 2018, Hildon is unusably slow. This is due to the fact that Hildon requires acceleration which is not supported at the date of writing.

Others

There are also Mate, Matchbox, etc.

Misc: Power button

If you want to make use of the power button, bind XF86PowerOff to this script:

FILE=~/.screenoff
if [ -f $FILE ]; then
    xinput set-prop 8 "Device Enabled" 1
    xinput set-prop 6 "Device Enabled" 1
    xinput set-prop 9 "Device Enabled" 1
    xset dpms force on
    rm ~/.screenoff
else
    xinput set-prop 8 "Device Enabled" 0
    xinput set-prop 6 "Device Enabled" 0
    xinput set-prop 9 "Device Enabled" 0
    xset dpms force off
    touch ~/.screenoff
fi
You cannot use this to turn the screen back on if i3lock or similar is running, as they would grab the keys
Misc: Middle click

Obviously, you can't middle click with a touchscreen, but this can be annoying when it's one of the few ways to paste in the terminal. This script simulates a middle click:

xdotool mousedown --clearmodifiers 2
xdotool mouseup 2
xdotool keyup alt
xdotool keyup ctrl
xdotool keyup shift

You can bind it to any key you wish. XF86WebCam is a good choice since it's fairly easy to reach and isn't used for anything.

Battery

Charging

Battery charging is fully supported by the kernel and does not need any special configuration.

Capacity Reporting

The current battery capacity can be found under /sys/class/power_supply/bq27200-0/capacity, and is represented as a percentage. For example, a value of 11 equates to 11%. If capacity does not exist or contains erroneous information, then your battery needs to be calibrated. To calibrate the battery:

1) Charge it up fully, using a wall power adapter.

2) Unplug the device and allow the battery to run all the way down until it powers off. This may take quite a while to happen (>24hrs, but can be made shorter by running a CPU intensive workload). Do not let it charge at all during this time. This means you may not use USB for example, as this automatically causes the device to start charging, albeit slowly.

3) When device eventually powers off, the battery charge gauge chip should then be calibrated. You may charge it up again to use the device.

Datasheet for the bq27200 charge gauge chip

Hint: To disable the LED charging indication, disable the charging chip's status pin.

echo 0 > /sys/class/power_supply/bq24150a-0/stat_pin_enable.

Datasheet for the bq24150 charging chip

Clock

Setting the hardware clock

Since 49fd9e0e4efcf030ca47344858bdc74370a78603 the hardware clock works. If your hardware clock doesn't have the time set you can set it with:

# Get the system date in the right ballpark so ntpd works
$ date -s "2017-08-14 16:34:50"

# Write the current system time to the hardware clock
$ hwclock -w
Setting the hardware alarm clock

Realtime clock at /dev/rtc0 is on the twl4030 (PMU), and allows setting an alarm to wake the device from sleep, poweroff states.

Control trough rtcwake (Manual Page).

# Suspends the device to memory for 10 seconds
rtcwake --verbose --seconds 10 --mode mem

# Power off the device and power it on after $TIME, where $TIME is the number of seconds since epoch (1970-01-01)
rtcwake --verbose --time_t $TIME --mode no
/sbin/poweroff

Manual control from sysfs:

# To set the wakealarm directly, set $TIME to number of seconds since epoch (1970-01-01). Then poweroff or suspend:
echo $TIME > /sys/class/rtc/rtc0/wakealarm
 	
# To set new wakealarm time, first reset time to 0!
echo 0 > /sys/class/rtc/rtc0/wakealarm
When setting number of seconds since epoch, make sure you account for your timezone and see how your realtime clock keeps the time (utc or local)!

SMS

In order to use the ofono test scripts, you must install py-dbus, that is currently available only for python2.

The N900 needs internet access to perform these steps. See the section above on setting up Wifi.
Your date/time need to be correct in order for HTTPS to work. You can use ntpd to do this.
# apk add git py-dbus
# git clone --depth 1 https://git.kernel.org/pub/scm/network/ofono/ofono.git

Here's an example using the test scripts to enable the modem and send a SMS:

# cd ofono/test
# python2 enable-modem
# python2 online-modem
# python2 send-sms 5033784582 "I like pizza." 0 

USB Gadget

Mass Storage

The Mass Storage class exposes a block device as a flash drive on your host machine.

For example, to use the "MyDocs" partition as Mass Storage Device, make sure you unmount the partition first (if mounted), then execute:

echo /dev/mmcblk1p1 > /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/gadget/lun0/file

If you only need read permissions on the partition, you can set the read-only flag before exporting it:

echo 1 > /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/gadget/lun0/ro

GPRS

GPRS can be managed by connman. Either install connman using apk or add it when installing pmOS by passing --add connman to pmbootstrap.

Once you perform the following steps, the GPRS connection will be established by connman automatically on every boot.

It's VERY important that you add the following to /etc/connman/main.conf BEFORE starting connman, else it will take over all network connection handling and disconnect you if you are connected over SSH:

/etc/connman/main.conf
NetworkInterfaceBlacklist = usb,wlan

Configure connman to start at boot:

$ sudo rc-update add connman

Stop ofono in order to set APN:

$ sudo rc-service ofono stop

Edit APN, where <IMSI> should be replaced in the following commands with the IMSI from your SIM card. Replace <APN> with the relevant APN for your cellular carrier (e.g. fast.t-mobile.com). This file should be created when ofono starts, so you should only need to add the APN.

/var/lib/ofono/<IMSI>/gprs
[Settings]                                                                                                                                                                                                                                                                                                                                                              
Powered=true                                                                                                                                                                                                                                                                                                                                                            
RoamingAllowed=false                                                                                                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                                                                                        
[context1]                                                                                                                                                                                                                                                                                                                                                              
Name=Internet                                                                                                                                                                                                                                                                                                                                                           
AccessPointName=<APN>                                                                                                                                                                                                                                                                                                                                      
Username=                                                                                                                                                                                                                                                                                                                                                               
Password=                                                                                                                                                                                                                                                                                                                                                               
AuthenticationMethod=chap                                                                                                                                                                                                                                                                                                                                               
Type=internet                                                                                                                                                                                                                                                                                                                                                           
Protocol=ip  

Start ofono and power on modem.

$ sudo rc-service ofono start
$ sudo connmanctl enable cellular

In some cases, it seems necessary to run a scan before the necessary service will show in connman, even though the scan is 'unsupported':

$ sudo connmanctl scan cellular                                                                 
Error /net/connman/technology/cellular: Not supported                                     
$ sudo connmanctl services
cellular_340369959729712_context1

Connect to the cellular service:

                                
$ sudo connmanctl connect cellular_340369959729712_context1                                     
Connected cellular_340369959729712_context1
$ ip addr show gprs0
10: gprs0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1400 qdisc pfifo_fast state UNKNOWN qlen 10
    link/[821] 
    inet 33.238.141.172/32 brd 33.238.141.172 scope global gprs0
       valid_lft forever preferred_lft forever

GPS

First, get network and date to work. Next, clone tui repository. it contains includes many goodies, including script for hardware testing, gps support, and graphical ofono control software.

mkdir /my
cd /my
git clone https://gitlab.com/tui/tui.git

Next, install packages necessary for compiling software and prepare gps2. enable-modem, online-modem and you should be able to run gps2. AGPS is not available, so expect long startup.

apk add gcc vala musl-dev make linux-headers gpsd
cd /my/tui/ofone
make gps2
./gps2

gps2 will not talk to gpsd, so it is only useful to verify that hardware is working.

Resources


Helpful Links for Porting