• Home
  • Tags
  • RSS
  • About
  • putting debian on the notion ink adam

    Timestamp:
    Tags: debian

    Introduction

    I recently put Debian Sid on my Notion Ink Adam and since I wouldnt have managed to do that alone I want to thank the guys in ##adamroot on freenode

    Quick Solution

    Just download my pre-assembled boot.img

    You will flash it to the adam from your linux host with a proprietary tool called nvflash that you can grab here for your specific version of adam:

    unzip it and find out the partition number you want to flash the image to. For each invocation of nvflash you have to put your adam into apx mode recovery by holding down the volume down button and the power button until the orange charge LED and the red CPU LED light up.

    ./nvflash --bl bootloader.bin --getpartitiontable parts.cfg
    

    In parts.cfg the SOS partition is the recovery partition (most likely partition 8) and LNX is the boot partition (most likely partition 9). Flashing boot.img to the recovery partition will give dual boot capabilities but destroy the recovery image. Flashing it to the boot partition has the advantage that it boots per default. I flashed it to the boot partition which was partition 9 for me.

    ./nvflash --bl bootloader.bin --download 9 boot.img
    

    Once that finished the adam can be switched off an on again. The adam will now boot some /sbin/init from the first partition on an SD card.

    I prepared a debian rootfs you can just extract to your SD. It comes with e17 and you best select illume in the welcome screen: debian-sid-multistrap.tar.xz

    The rootfs also includes the proprietary broadcom module and firmware for the bcm4329: modules.tar.gz

    The rootfs was created using this script: rootstock.sh

    Modifying boot.img

    If you want to make changes to the boot.img (specifically recompile the kernel) it works the following:

    To extract and create the boot.img use the android BootTools (local copy)

    git clone https://github.com/AndroidRoot/BootTools.git
    cd BootTools
    make
    

    With this tool you can already unpack the boot.img and look what’s inside. The boot.img will unpack into a ramdisk and the kernel and a textfile that specifies additional parameters like the kernel cmdline arguments. The ramdisk can be examined and changed as usual with cpio.

    ./BootTools/bootunpack boot.img
    gunzip boot.img-ramdisk.cpio.gz
    mkdir ramdisk
    cd ramdisk
    cpio -id < ../boot.img-ramdisk.cpio
    

    Ramdisk

    The ramdisk is good for two things: work around the setfont bug and introduce a delay before the root partition from the SD is mounted. I tried to boot without a ramdisk, using the rootdelay kernel commandline option but it didnt work. I have no idea what is going wrong due to the setfont bug. This bug means that the framebuffer console will only output anything else than the initial blank, black screen when a KDFONTOP ioctl is done to one of the ttys.

    The ramdisk contains an /init that mounts the root partition from the SD card after a delay of three seconds or falls back to a shell if there is no /sbin/init on it and statically compiled busybox and setfont. Setfont is a program that will do the ioctl and load the font Lat15-Fixed16 to the tty specified by its first command line argument. The sourcecode is included in the ramdisk itself as setfont.c.gz and can also be downloaded here: setfont.c.

    Cross compiling a kernel for ARM

    To compile the kernel you need a cross build toolchain that is easiest installed via the emdebian repository.

    apt-get install emdebian-archive-keyring
    echo deb http://www.emdebian.org/debian/ squeeze main >> /etc/apt/sources.list
    apt-get update
    apt-get install gcc-4.4-arm-linux-gnueabi
    

    clone the notionink kernel sources:

    git clone https://github.com/notionink/adam-kernel.git
    

    put my config into it

    curl http://mister-muffin.de/adam/config > adam-kernel/.config
    

    the following patch will change the multitouch driver into a singletouch one that is supported by the current Xorg evdev driver and will also add the accept4 system call that is needed for udev >= 168.

    cd adam-kernel
    curl http://mister-muffin.de/adam/kernel.diff | git apply
    

    build the thing

    make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j5
    

    create the boot.img from the new kernel and the ramdisk

    ./BootTools/mkbootimg --kernel adam-kernel/arch/arm/boot/zImage \
    --ramdisk linux_boot.img-ramdisk.cpio.gz \
    --cmdline 'mem=256M@0M nvmem=256M@256M mem=512M@512M vmalloc=384M video=tegra'\
    'fb console=tty0,115200n8 usbcore.old_scheme_first=1 cpuid=200102 devicetype='\
    '1002 tegraboot=nand mtdparts=tegra_nand:16384K@9984K(misc),16384K@26880K(rec'\
    'overy),16384K@43776K(boot),204800K@60672K(system),781952K@266112K(cache) roo'\
    't=/dev/mmcblk0p1 init=/sbin/init debug' --output boot_new.img
    

    and upload it to the device as shown above

    Device Specific Things

    Input Devices

    the pixelqi display mode can be set with

    /sys/devices/platform/pixel_qi_screen_ctrl/state
    

    accelerometer is enabled with

    /sys/devices/platform/accelerometer/enable
    

    WWAN

    the wwan card is a Ericsson F3307 and provides a cdc ethernet interface

    chat -V ABORT "ERROR\r\n" "" \
    "AT+CFUN=1" "OK\r\n" \
    "AT+CGDCONT=1,"IP","$APN" "OK\r\n" \
    "AT*ENAP=1,1" "OK\r\n" > /dev/ttyACM0 < /dev/ttyACM0
    dhclient -v usb1
    

    (notice that, depending on your provider you might not need to specify the APN

    WLAN

    wlan works as usual via wpa_supplicant

    GPS

    gps is /dev/ttyHS3 and outputs NMEA

    Battery

    /sys/devices/platform/smba10xx_battery/power_supply/battery/capacity
    

    Not working