Nokia N900 (nokia-n900)

From postmarketOS
Revision as of 12:28, 24 August 2017 by MartijnBraam (talk | contribs) (Added wikitext headers)
Jump to navigation Jump to search

Contributors

What works

  • Booting the system
  • Kernel log to the display
  • Framebuffer graphics
  • Unlocking the root partition using the keyboard
  • Display Backlight control
  • Wayland on framebuffer
  • Module loading
  • Wifi (see Additional Info below)
  • Notification led
  • Audio playback
  • Keyboard backlight (see Additional Info below)
  • Battery capacity reporting (see Additional Info below)
  • Keyboard in virtual terminal

What does not work

  • Both cameras
  • Cell modem (untested)
  • 3D Acceleration (requires binary blob)

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

```bash $ ./pmbootstrap.py init ```

2. Start the build process and install the completed image to a sdcard

```bash

  1. Replace /dev/sdX with the device for your sdcard

$ ./pmbootstrap.py install --sdcard /dev/sdX ```

3. [Install u-boot from pali](http://maemo.org/downloads/product/Maemo5/u-boot-flasher/) on the n900 if you haven't installed it already. See Additional Info below for instructions on configuring pmos to boot by default. 1. Place the sdcard into the n900 and boot it with the keyboard slide open 1. Choose the u-boot shell 1. enter `run sdboot` into the shell


Links

Additional info

  • Martijn's N900 has uboot installed a long time ago, I'm using sdcard boot from the bootmenu shell using `run sdboot`
  • The [Neo900](https://neo900.org/) (still in development) will upgrade the hardware inside of the N900, and has some nice features such as hardware sandboxing the modem.

Wifi

The `linux-firmware` package is required to provide the wl1251 firmware necessary for initializing the wifi device. ([#158](https://github.com/postmarketOS/pmbootstrap/pull/158))

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/wlan0.conf
   <enter passphrase here and press Enter>
   # exit

Connect to network using wpa_supplicant:

   $ sudo wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant/wlan0.conf 

If your network uses DHCP, start the DHCP client:

   $ sudo udhcpc -i wlan0

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 ```

Display

With DRM enabled ([#197](https://github.com/postmarketOS/pmbootstrap/pull/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:

```

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

```

Keyboard layout in console

In order to set the keyboard layout for the virtual console (e.g. to take advantage of number keys on the N900 keyboard), obtain your desired language keymap file for the RX-51, [such as this one.](https://raw.githubusercontent.com/archlinuxarm-n900/n900-keymaps/master/rx51_us.map). (TODO: Need to pull 'official' vconsole keymaps from Maemo5 if they exist..).

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:

```bash $ 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`.

Battery 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 first. To calibrate the battery:

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

2) Once it is charged up, power on the device

3) 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)

4) When device powers off, plug it back into wall adapter and allow to charge up fully again. The battery and charging chip should now be calibrated.

[Datasheet for the bq27200 charging chip](http://www.ti.com/lit/ds/symlink/bq27200.pdf)

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:

```bash

  1. Get the system date in the right ballpark so ntpd works

$ date -s "2017-08-14 16:34:50"

  1. Write the current system time to the hardware clock

$ hwclock -w ```

Configuring U-boot

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:

``` ITEM_NAME="Postmarket OS" 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: 'Postmarket OS' 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.

Helpful Links for Porting

- [Device schematic](https://neo900.org/stuff/block-diagrams/n900/n900.html)

- [Very detailed schematic](http://plan9.stanleylieber.com/hardware/n900/n900.schematics.pdf)

- [Arch Linux ARM - N900 hardware components list](https://github.com/archlinuxarm-n900/alarm-n900/wiki/Hardware-support)

- [N900 sensor access in Maemo](http://mlab.taik.fi/paja/?p=1263)

- [Hardware component specs / list](http://natisbad.org/N900/n900-commented-hardware-specs.html)