Manual Debian

From Openmoko

(Difference between revisions)
Jump to: navigation, search
(4 prepare sd card)
 
(107 intermediate revisions by 33 users not shown)
Line 1: Line 1:
 +
{{Languages|Debian}}
 
[[Image:Debian.png|thumb|480px|''Debian on neo1973'']]
 
[[Image:Debian.png|thumb|480px|''Debian on neo1973'']]
This page is to explain how to run debian armel port on neo1973. These instructions are likely to work on freerunner, too.
 
  
All the steps below take approximately 2h depending on your internet connection. Most of the time your system will work on its own (apt-getting xfce4 takes a loong time..).
+
'''For the latest information regarding running [[Debian]] on Neo FreeRunner please refer to [http://wiki.debian.org/DebianOnFreeRunner wiki.debian.org]'''
 +
 
 +
''The following describes an earlier manual approach to installing Debian, which is left here for reasons of historical interest:''
 +
 
 +
----
 +
 
 +
This page is to explain how to run Debian armel port on Openmoko devices.  You can do this from scratch, or download a prebuilt file system.
 +
The former will take some time, perhaps 2 hours, depending on your internet connection
 +
 
 +
= Prebuilt Filesystem =
 +
 
 +
Download and extract to an ext2 formatted filesystem on your SD card:
  
If you do not have the time feel free to download a ready to use tar archive of the results of everything described below. Just extract the contents to your sd card!
 
 
  wget http://rabenfrost.net/debian/debian-armel-xfce.tar.bz2
 
  wget http://rabenfrost.net/debian/debian-armel-xfce.tar.bz2
* root-pw: openmoko
 
* 1st user: openmoko (pw: openmoko)
 
Extract it directly to your sd card - have fun!
 
  
= 1. (optional) install known good kernel =
+
Note that the above is just a bit too big to fit on a 512MB SD card. A smaller image will soon be provided.
this kernel was build by Marcel_M and has some important patches in it such as removed sd debug symbols and build-in ext3 support.
+
 
 +
Access via SSH is much the same as under other images using [[USB Networking]], with the user accounts below:
 +
 
 +
* root password: openmoko
 +
* First user and password: openmoko
 +
 
 +
Note: If you upgrade your your debian and your touchscreen doesn't work any more, you most likely have to adjust /etc/udev/rules.d/50-udev.rules by applying the settings described later in this document for /etc/udev/udev.rules
 +
 
 +
== (Optional) Install Known Good Kernel ==
 +
 
 +
This kernel was build by Marcel_M and has some important patches in it such as removed sd debug symbols.
 +
 
 
  wget http://rabenfrost.net/celtune/uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin
 
  wget http://rabenfrost.net/celtune/uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin
 
  ./dfu-util -d 0x1457:0x5119 -a kernel -R -D ./uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin
 
  ./dfu-util -d 0x1457:0x5119 -a kernel -R -D ./uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin
As there is no way to boot from sdhc with uboot directly I always copy my kernel to flash and let it boot my rootfs from sd but feel free to do it your way.
 
  
= 2. configure booting from sd/sdhc =
+
This kernel doesn't work for gta02, but the kernel from Om 2008.9 works good.
 +
http://downloads.openmoko.org/distro/releases/Om2008.9/Om2008.9-gta02-20081106.uImage.bin
 +
 
 +
== (Optional) Recompiling Kernel to Add Drivers ==
 +
(Based on http://lists.openmoko.org/pipermail/support/2008-August/001240.html)
 +
 
 +
Steps to build the kernel standalone with the "moredrivers" config (to get additional drivers, such as the usb tether drivers that were moved out as kernel modules, compiled directly into the kernel).
 +
 
 +
  ~ - git clone git://git.openmoko.org/git/kernel.git linux-2.6
 +
  ~ - cd linux-2.6
 +
  ~ - git checkout origin/stable
 +
  ~ - edit ./build to point to your compiler path
 +
  ~ - cp defconfig-2.6.24 .config
 +
  ~ - ./build
 +
 
 +
That gets you a uImage.bin you can DFU or copy into your SD Card filesystem.
 +
 
 +
== Configure booting from SD/SDHC ==
  
 
Do as proposed here: [[Booting_from_SD]]
 
Do as proposed here: [[Booting_from_SD]]
  
= 3.1. (option #1) debootstrap your own armel rootfs =
+
Note that these instructions are in need a rewrite.
debootstrap your rootfs on debian or ubuntu
+
debootstrap --verbose --arch armel --foreign sid ./armel-chroot http://ftp.de.debian.org/debian/
+
= 3.2. (option #2) download ready to use armel rootfs =
+
if you dont have debootstrap on your system you can download the results here:
+
wget http://rabenfrost.net/debian/armel-chroot-first-stage.tar.gz
+
  
= 4 prepare sd card =
+
= Build your own armel filesystem =
ssh to your neo and format your sd card appropriately. I'm using an 8GB sdhc card here.
+
umount /media/card
+
mkfs.ext3 /dev/mmcblk0p1
+
mount /dev/mmcblk0p1 /media/card
+
copy the armel chroot to your device by tar'ing it to circumvent symbolic link cycles (https://bugzilla.mindrot.org/show_bug.cgi?id=1059 <= WONTFIX)
+
tar -C ./armel-chroot/ -c . | ssh root@192.168.0.202 tar -C /media/card -xv
+
or if you downloaded the archive
+
cat armel-chroot-first-stage.tar.gz | ssh root@192.168.0.202 tar -C /media/card -xzvf
+
  
= 5. complete debootstrap process =
+
== Prepare SD card ==
ssh to your device and execute the following commands (just copypaste everything below)
+
 
  echo "nameserver 192.168.0.200" > /media/card/etc/resolv.conf
+
ssh to your neo and format your sd card appropriately. I'm using an 8GB SDHC card here.
  echo "fic-gta01" > /media/card/etc/hostname
+
 
  echo "127.0.0.1 localhost.localdomain localhost fic-gta01" > /media/card/etc/hosts
+
:''NOTE: On the Freerunner one also will need a vfat or ext2 (only vfat worked for me with the stock u-boot for the freerunner) partition on which to place the kernel to boot off. See the [[Booting_from_SD]] If you have not done so already.''
  echo -e "auto lo\n\
+
 
  iface lo inet loopback\n\
+
  fdisk /dev/mmcblk0
  auto usb0\n\
+
We will now create a 8 mb partition for our kernel and another one for the rootfs which will take up all the 
  iface usb0 inet static\n\
+
remaining space.
     address 192.168.0.202\n\
+
  Command (m for help): d
     netmask 255.255.255.0\n\
+
  Selected partition 1
     network 192.168.0.0\n\
+
  Command (m for help): n
     gateway 192.168.0.200\n\
+
  Command action
     up echo nameserver 192.168.0.200 >/etc/resolv.conf" > /media/card/etc/network/interfaces
+
    e  extended
  echo -e "rootfs  /                ext3   defaults,errors=remount-ro,noatime 0 1\n\
+
    p  primary partition (1-4)
  proc    /proc            proc    defaults                          0 0\n\
+
  p
  tmpfs  /etc/network/run tmpfs  defaults,noatime                  0 0\n\
+
  Partition number (1-4): 1
  tmpfs  /tmp            tmpfs  defaults,noatime                  0 0\n\
+
  First cylinder (1-983, default 1):
  tmpfs  /var/lock        tmpfs  defaults,noatime                  0 0\n\
+
  Using default value 1
tmpfs  /var/log        tmpfs  defaults,noatime                  0 0\n\
+
  Last cylinder or +size or +sizeM or +sizeK (1-983, default 983): +8M
  tmpfs  /var/run        tmpfs  defaults,noatime                  0 0\n\
+
  Command (m for help): n
  tmpfs  /var/tmp        tmpfs  defaults,noatime                  0 0" > /media/card/etc/fstab
+
  Command action
now chroot into your armel rootfs and finish the install
+
    e  extended
chroot /media/card
+
    p  primary partition (1-4)
/debootstrap/debootstrap --second-stage
+
  p
make sure your internal clock is set to the correct date because apt-get will complain if otherwise (does not work on the gta02 at the moment: "Cannot access the Hardware Clock via any known method.")
+
  Partition number (1-4): 2
  hwclock --set --date="MM/DD/YY hh:mm:ss"
+
  First cylinder (18-983, default 18):
install openssh so you can login remotely
+
  Using default value 18
echo "deb http://ftp.de.debian.org/debian sid main" > /etc/apt/sources.list
+
  Last cylinder or +size or +sizeM or +sizeK (18-983, default 983):
  apt-get update
+
  Using default value 983
  apt-get upgrade
+
  Command (m for help): w
  apt-get install openssh-server
+
  The partition table has been altered!
install and configure locales
+
  Calling ioctl() to re-read partition table.
apt-get install locales
+
  Syncing disks.
dpkg-reconfigure locales
+
 
install udev to dynamically create /dev
+
Consider a swap partition [http://lists.openmoko.org/pipermail/community/2008-September/031106.html]
  apt-get install udev
+
[http://lists.openmoko.org/pipermail/community/2008-October/032964.html]
set a root password
+
mkfs.vfat /dev/mmcblk0p1
passwd
+
create a normal user
+
mkfs.ext2 /dev/mmcblk0p2
adduser <yournamehere>
+
mount /dev/mmcblk0p2 /media/card
 +
 
 +
== debootstrap on the neo ==
 +
 
 +
you can download and debootstrap natively on the neo by downloading cdebootstrap-static.
 +
 
 +
wget http://ftp.de.debian.org/debian/pool/main/c/cdebootstrap/cdebootstrap-static_0.5.4_armel.deb
 +
ar -x cdebootstrap-static_0.5.4_armel.deb data.tar.gz
 +
tar -xz -C / -f data.tar.gz
 +
rm data.tar.gz cdebootstrap-static_0.5.4_armel.deb
 +
wget http://ftp.de.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2009.01.31_all.deb
 +
ar -x debian-archive-keyring_2009.01.31_all.deb data.tar.gz
 +
tar -xz -C / -f data.tar.gz
 +
rm data.tar.gz debian-archive-keyring_2009.01.31_all.deb
 +
cdebootstrap-static --flavour=minimal --include=ifupdown,udev,procps,netbase,vim-tiny,module-init-tools,wget,openssh-server,screen,apmd stable /media/card/ http://ftp.de.debian.org/debian/
 +
 
 +
'''There is a bug, and at this point it does not work. See [http://www.mail-archive.com/smartphones-userland@linuxtogo.org/msg01615.html] and fllowups.'''
 +
 
 +
justifying the included packages
 +
* ifupdown - contains ifup, ifdown
 +
* udev - necessary to fill /dev
 +
* procps - contains watch, ps, kill, free, top, uptime... (otherwise this is a openssh-server dependency)
 +
* netbase - /etc/init.d/networking
 +
* vim-tiny - we want to edit files
 +
* module-init-tools - modprobe, lsmod, rmmod, depmod (otherwise this is a apmd dependency)
 +
* curl - we want to download stuff
 +
* openssh-server - we want to connect to our device and we have enough power to not need to use dropbear
 +
* screen - we want to operate within screen sessions so that we can disconnect or detach without problems
 +
* apmd - suspending via apm -s
 +
 
 +
additionally interesting packages:
 +
* locale (use dpkg-reconfigure afterwards)
 +
* less (better than more)
 +
* man-db
 +
* rsyslog
 +
* psmisc (killall, fuser)
 +
* rsync
 +
* console-tools (chvt)
 +
* iputils-ping - ping
 +
* mtd-utils (flash_eraseall, nandwrite, mkfs.jffs2)
 +
 
 +
== Complete debootstrap Process ==
 +
 
 +
execute the following commands (just copypaste everything below)
 +
  echo "neo1973-debian" > /media/card/etc/hostname
 +
  cat > /media/card/etc/network/interfaces <<__END__
 +
  auto lo
 +
  iface lo inet loopback
 +
  auto usb0
 +
  iface usb0 inet static
 +
     address 192.168.0.202
 +
     netmask 255.255.255.0
 +
     network 192.168.0.0
 +
     gateway 192.168.0.200
 +
     up echo nameserver 192.168.0.200 >/etc/resolv.conf
 +
__END__
 +
cat > /media/card/etc/fstab << __END__
 +
  rootfs  /                ext2   defaults,errors=remount-ro,noatime 0 1
 +
  proc    /proc            proc    defaults                          0 0
 +
  tmpfs  /etc/network/run tmpfs  defaults,noatime                  0 0
 +
  tmpfs  /tmp            tmpfs  defaults,noatime                  0 0
 +
  tmpfs  /var/lock        tmpfs  defaults,noatime                  0 0
 +
  tmpfs  /var/run        tmpfs  defaults,noatime                  0 0
 +
  tmpfs  /var/tmp        tmpfs  defaults,noatime                  0 0
 +
__END__
 +
cat > /media/card/etc/apt/apt.conf.d/99no-install-recommends << __END__
 +
APT::Install-Recommends "0";
 +
  __END__
 +
sed -i 's/\(PermitEmptyPasswords\) no/\1 yes/' /media/card/etc/ssh/sshd_config
 +
  chroot /media/card /bin/sh -e <<__END_CHROOT__
 +
  echo root: | chpasswd
 +
  apt-get --yes --purge remove cdebootstrap-helper-rc.d
 +
  __END_CHROOT__
 +
 
 +
== Get X Running ==
 +
Now reboot and start Debian. Login with ssh and start configuring xorg:
  
= 6. get x running =
 
now reboot and start your debian. you can login with ssh and start configuring xorg:
 
 
  apt-get install xorg
 
  apt-get install xorg
 +
 
configure /etc/X11/xorg.conf so that it looks like this:
 
configure /etc/X11/xorg.conf so that it looks like this:
  Section "InputDevice"
+
 
        Identifier      "Configured Mouse"
+
  cat > /etc/X11/xorg.conf << __END__
        Driver          "mouse"
+
        Option          "Device" "/dev/input/mice"
+
EndSection
+
 
  Section "Device"
 
  Section "Device"
 
         Identifier      "Configured Video Device"
 
         Identifier      "Configured Video Device"
 
         Driver          "fbdev"
 
         Driver          "fbdev"
 
  EndSection
 
  EndSection
  Section "Monitor"
+
  __END__
        Identifier      "Configured Monitor"
+
Start X in the first vt:
EndSection
+
Section "Screen"
+
        Identifier      "Default Screen"
+
        Monitor        "Configured Monitor"
+
EndSection
+
Section "ServerLayout"
+
        Identifier      "Default Layout"
+
        Screen          "Default Screen"
+
        InputDevice    "Configured Mouse"
+
EndSection
+
start x in the first vt:
+
 
  startx -- vt1
 
  startx -- vt1
  
= 7. get touchscreen working =
+
== Get touchscreen working ==
install the tslib driver:
+
Install the tslib driver from debian experimental:
  apt-get install xserver-xorg-input-tslib
+
 
edit /etc/udev/udev.rules as the tslib device is hardcoded for now. search for the input devices section and make the first line look like this:
+
echo "deb http://ftp.de.debian.org/debian experimental main" >> /etc/apt/sources.list
# input devices
+
apt-get update
KERNEL=="event1",              NAME="event0"
+
  apt-get install xserver-xorg-input-tslib/experimental
 +
 
 
and edit the InputDevice section in your xorg.conf
 
and edit the InputDevice section in your xorg.conf
 +
 +
cat >> /etc/X11/xorg.conf << __END__
 
  Section "InputDevice"
 
  Section "InputDevice"
        Identifier "Configured Mouse"
+
        Identifier     "Configured Touchscreen"
        Driver "tslib"
+
        Driver         "tslib"
        Option "CorePointer"
+
        Option         "CorePointer"          "true"
        Option "Device" "/dev/input/event1"
+
        Option          "SendCoreEvents"        "true"
        Option "Protocol" "Auto"
+
        Option         "Device"               "/dev/input/event1"
 +
        Option         "Protocol"             "Auto"
 
  EndSection
 
  EndSection
 +
__END__
 
calibrate your touchscreen
 
calibrate your touchscreen
 +
 +
for gta01:
 
  echo -67 36365 -2733100 -48253 -310 45219816 65536 > /etc/pointercal
 
  echo -67 36365 -2733100 -48253 -310 45219816 65536 > /etc/pointercal
start x and enjoy!!
+
 
 +
for gta02:
 +
echo  -67 38667 -4954632 -51172 121 46965312 65536 > /etc/pointercal
 +
 
 +
or calibrate it yourself until you are happy with the result:
 +
apt-get install libts-bin
 +
TSLIB_CALIBFILE=/etc/pointercal TSLIB_TSDEVICE=/dev/input/event1 TSLIB_CONSOLEDEVICE=none ts_calibrate
 +
 
 +
Start X and enjoy!
 
  startx -- vt1
 
  startx -- vt1
= 8. install gdm and xfce4 =
+
 
simple...
+
== Install GDM and xfce4 ==
 +
 
 
  apt-get install gdm xfce4 xvkbd
 
  apt-get install gdm xfce4 xvkbd
configure gdm so xkvbd will allow you to put in your username and password. simply add this to the end of /etc/gdm/Init/Default before exit 0 so that the three last lines look like this:
+
 
 +
Configure gdm so xkvbd will allow you to put in your username and password. simply add this to the end of /etc/gdm/Init/Default before exit 0 so that the three last lines look like this:
 +
 
 
  fi
 
  fi
 
  sleep 20 && /usr/bin/xvkbd -xdm -compact -geometry 480x210+0+0 &
 
  sleep 20 && /usr/bin/xvkbd -xdm -compact -geometry 480x210+0+0 &
 
  exit 0
 
  exit 0
simply click on the focus button of xvkbd and then on the input box of gdm to input your username and password there.
 
  
on each boot gdm should start automatically now.
+
Simply click on the focus button of xvkbd and then on the input box of GDM to input your user name and password there.  On each boot gdm should start automatically now.
 +
 
 +
If you like you can also download a correctly sized Debian wallpaper I generated from the SVG source for 480x640:
  
if you like you can also download a correctly sized debian wallpaper I generated from the svg source for 480x640:
 
 
  wget <nowiki>http://rabenfrost.net/debian/debian-blueish-wallpaper-480x640.png</nowiki> -O /usr/share/images/desktop-base/desktop-background
 
  wget <nowiki>http://rabenfrost.net/debian/debian-blueish-wallpaper-480x640.png</nowiki> -O /usr/share/images/desktop-base/desktop-background
  
= 9. clean up =
+
== Clean Up ==
 
  apt-get clean
 
  apt-get clean
  
= 10. load additional kernel modules =
+
== Load Additional Kernel Modules ==
  
These are for sound (!!), bluetooth and usb foo. Use the modules archive that fits to your kernel.
+
These are for sound, bluetooth and USB. Use the modules archive that fits to your kernel.
  
 
  wget http://rabenfrost.net/celtune/modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz
 
  wget http://rabenfrost.net/celtune/modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz
 
  tar -xf modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz -C /
 
  tar -xf modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz -C /
 
  depmod -a
 
  depmod -a
  echo -e "hci_usb\n\
+
  cat > /etc/modules << __END__
  hidp\n\
+
hci_usb
  ohci-hcd\n\
+
  hidp
  rfcomm\n\
+
  ohci-hcd
  snd-mixer-oss\n\
+
  rfcomm
  snd-pcm-oss\n\
+
  snd-mixer-oss
  snd-soc-neo1973-wm8753" > /etc/modules
+
  snd-pcm-oss
 +
  snd-soc-neo1973-wm8753
 +
__END__
  
 +
Note: On the FreeRunner, the sound module (on the last line) is called snd-soc-neo1973-gta02-wm8753
 
[[Image:Sonata.png|thumb|480px|''Sonata on neo1973'']]
 
[[Image:Sonata.png|thumb|480px|''Sonata on neo1973'']]
= 11. enable sound =
+
 
 +
== Enable Sound ==
  
 
Now we turn our Debian into a jukebox!
 
Now we turn our Debian into a jukebox!
  
  apt-get install alsa-base
+
  apt-get install alsa-base alsa-utils gstreamer0.10-alsa
 +
cat > /etc/asound.conf << __END__
 +
pcm.!default {
 +
    type plug
 +
    slave.pcm "dmixer"
 +
}
 +
pcm.dmixer  {
 +
    type dmix
 +
    ipc_key 1024
 +
    slave {
 +
        pcm "hw:0,0"
 +
        period_time 0
 +
        period_size 1024
 +
        buffer_size 4096
 +
        rate 44100
 +
    }
 +
    bindings {
 +
        0 0
 +
        1 1
 +
    }
 +
}
 +
ctl.dmixer {
 +
    type hw
 +
    card 0
 +
}
 +
__END__
 
  wget http://rabenfrost.net/celtune/alsa_state_files-working.tar.gz
 
  wget http://rabenfrost.net/celtune/alsa_state_files-working.tar.gz
 
  tar -xf alsa_state_files-working.tar.gz -C /etc
 
  tar -xf alsa_state_files-working.tar.gz -C /etc
Line 168: Line 296:
 
  addgroup openmoko audio
 
  addgroup openmoko audio
  
I currently use mpd+sonata - let me know if you know another nice lightweight gtk player. Unfortunately rhythmbox is way to much for the neo to handle - the mp3 playing stops after 20secs.
+
I currently use mpd+sonata - let me know if you know another nice lightweight gtk player. Unfortunately RhythmBox is way too much for the Neo to handle - the MP3 playing stops after 20secs.
 +
 
 +
== Enable Modem ==
 +
 
 +
Here comes the phone functionality - just add this line into the "serial devices" section in your /etc/udev/rules.d/50-udev.rules
 +
 
 +
# serial devices
 +
KERNEL=="s3c2410_serial[0-9]",  NAME="ttySAC%n"
 +
 
 +
= Miscellaneous =
 +
 
 +
== Disable Framebuffer Blanking ==
 +
 
 +
the obfuscated way:
 +
echo -e '\033[9;0]' > /dev/tty0
 +
 
 +
the sys-path way:
 +
echo -n 0 > /sys/devices/platform/s3c2410-lcd/graphics\:fb0/blank
 +
 
 +
the debian way:
 +
apt-get install console-tools
 +
sed -i 's/\(BLANK_TIME\)=30/\1=0/' /etc/console-tools/config
 +
 
 +
== Chroot installation ==
 +
 
 +
If you just want to run random debian programs without completely booting to debian you can use the following minimal steps:
 +
 
 +
On desktop:
 +
 
 +
sudo debootstrap --arch armel --foreign sid sid
 +
sudo tar czf sid.tar.gz sid
 +
nc -w 10 -l -p 1234 < sid.tar.gz
 +
 
 +
On neo:
 +
 
 +
cd /media/card
 +
nc 192.168.0.200 1234 | tar xzf -
 +
mount -t none -o bind /dev /media/card/sid/dev
 +
mount -t none -o bind /proc /media/card/sid/proc
 +
mount -t none -o bind /sys /media/card/sid/sys
 +
mount -t none -o bind /tmp /media/card/sid/tmp
 +
chroot /media/card/sid /deboostrap/debootstrap --second-stage
 +
cp /etc/resolv.conf /media/card/sid/etc
 +
 
 +
On neo edit the file <tt>/media/card/sid/etc/apt/sources.list</tt> and add the following line:
 +
 
 +
deb http://ftp.de.debian.org/debian/ sid main non-free contrib
 +
 
 +
On neo:
 +
 
 +
chroot /media/card/sid apt-get update
 +
chroot /media/card/sid apt-get install mplayer
 +
chroot /media/card/sid mplayer http://relay.slayradio.org:8000/
 +
 
 +
To enter the debian chroot environment you could use the following script:
 +
 
 +
<pre>
 +
#!/bin/sh
 +
mount -t none -o bind /dev /media/card/sid/dev
 +
mount -t none -o bind /proc /media/card/sid/proc
 +
mount -t none -o bind /sys /media/card/sid/sys
 +
mount -t none -o bind /tmp /media/card/sid/tmp
 +
chroot /media/card/sid /bin/sh
 +
</pre>
 +
 
 +
== Using Xglamo on the FreeRunner ==
 +
 
 +
Copy /usr/bin/Xglamo (and /usr/bin/Xfbdev) to  /usr/bin in Debian from FSO/ASU/2007.2/2008.8.
 +
 
 +
Add this to your .bashrc (to tell tslib to use the correct input device):
 +
export TSLIB_TSDEVICE=/dev/input/event1
 +
 
 +
The X server binaries are linked against version 1 of tslib, for some reason Debian calls its version 0, even though it actually is version 1. Symlink the library to the alternative name by running (as root):
 +
ln -s /usr/lib/libts-0.0.so.0 /usr/lib/libts-1.0.so.0
 +
 
 +
We also need to change the symlink for the X server to either Xfbdev or Xglamo (this should better be handled by update-alternatives!):
 +
cd /usr/bin && mv X X.orig && ln -s Xfbdev X
 +
(replace Xfbdev by Xglamo if you want to use that, Xglamo is faster, but rotation still does not work correctly as of 2008-08-12).
 +
 
 +
== Rotating screen to landscape ==
 +
 
 +
add the following to the /etc/X11/xorg.conf in both the Device and InputDevice sections to get landscape mode
 +
 
 +
Option          "Rotate"                "CCW"
 +
 
 +
== Hiding the cursor ==
 +
 
 +
To make the cursor invisible create a file called empty.cursor with this content:
 +
 
 +
#define empty.cursor_width 16
 +
#define empty.cursor_height 16
 +
static unsigned char empty.cursor_bits[] = {
 +
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 +
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 +
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 +
 
 +
add
 +
xsetroot -cursor empty.cursor empty.cursor
 +
 
 +
to your ~/.xinitrc
 +
 
 +
=Official Debian Port=
 +
 
 +
An official Debian port based on the FSO image is being created. First information can be found at http://wiki.debian.org/DebianOnFreeRunner. Early adopters are welcome.
  
[[category:Software]]
+
[[Category:Debian]]
[[category:Technical]]
+
[[Category:Manuals]]

Latest revision as of 00:28, 1 September 2010

Debian on neo1973

For the latest information regarding running Debian on Neo FreeRunner please refer to wiki.debian.org

The following describes an earlier manual approach to installing Debian, which is left here for reasons of historical interest:


This page is to explain how to run Debian armel port on Openmoko devices. You can do this from scratch, or download a prebuilt file system. The former will take some time, perhaps 2 hours, depending on your internet connection

Contents

[edit] Prebuilt Filesystem

Download and extract to an ext2 formatted filesystem on your SD card:

wget http://rabenfrost.net/debian/debian-armel-xfce.tar.bz2

Note that the above is just a bit too big to fit on a 512MB SD card. A smaller image will soon be provided.

Access via SSH is much the same as under other images using USB Networking, with the user accounts below:

  • root password: openmoko
  • First user and password: openmoko

Note: If you upgrade your your debian and your touchscreen doesn't work any more, you most likely have to adjust /etc/udev/rules.d/50-udev.rules by applying the settings described later in this document for /etc/udev/udev.rules

[edit] (Optional) Install Known Good Kernel

This kernel was build by Marcel_M and has some important patches in it such as removed sd debug symbols.

wget http://rabenfrost.net/celtune/uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin
./dfu-util -d 0x1457:0x5119 -a kernel -R -D ./uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin

This kernel doesn't work for gta02, but the kernel from Om 2008.9 works good. http://downloads.openmoko.org/distro/releases/Om2008.9/Om2008.9-gta02-20081106.uImage.bin

[edit] (Optional) Recompiling Kernel to Add Drivers

(Based on http://lists.openmoko.org/pipermail/support/2008-August/001240.html)

Steps to build the kernel standalone with the "moredrivers" config (to get additional drivers, such as the usb tether drivers that were moved out as kernel modules, compiled directly into the kernel).

 ~ - git clone git://git.openmoko.org/git/kernel.git linux-2.6
 ~ - cd linux-2.6
 ~ - git checkout origin/stable
 ~ - edit ./build to point to your compiler path
 ~ - cp defconfig-2.6.24 .config
 ~ - ./build

That gets you a uImage.bin you can DFU or copy into your SD Card filesystem.

[edit] Configure booting from SD/SDHC

Do as proposed here: Booting_from_SD

Note that these instructions are in need a rewrite.

[edit] Build your own armel filesystem

[edit] Prepare SD card

ssh to your neo and format your sd card appropriately. I'm using an 8GB SDHC card here.

NOTE: On the Freerunner one also will need a vfat or ext2 (only vfat worked for me with the stock u-boot for the freerunner) partition on which to place the kernel to boot off. See the Booting_from_SD If you have not done so already.
fdisk /dev/mmcblk0
We will now create a 8 mb partition for our kernel and another one for the rootfs which will take up all the   
remaining space.
 Command (m for help): d
 Selected partition 1
 Command (m for help): n
 Command action
    e   extended
    p   primary partition (1-4)
 p
 Partition number (1-4): 1
 First cylinder (1-983, default 1):
 Using default value 1
 Last cylinder or +size or +sizeM or +sizeK (1-983, default 983): +8M
 Command (m for help): n
 Command action
    e   extended
    p   primary partition (1-4)
 p
 Partition number (1-4): 2
 First cylinder (18-983, default 18):
 Using default value 18
 Last cylinder or +size or +sizeM or +sizeK (18-983, default 983):
 Using default value 983
 Command (m for help): w
 The partition table has been altered!
 Calling ioctl() to re-read partition table.
 Syncing disks.

Consider a swap partition [1] [2]

mkfs.vfat /dev/mmcblk0p1

mkfs.ext2 /dev/mmcblk0p2
mount /dev/mmcblk0p2 /media/card

[edit] debootstrap on the neo

you can download and debootstrap natively on the neo by downloading cdebootstrap-static.

wget http://ftp.de.debian.org/debian/pool/main/c/cdebootstrap/cdebootstrap-static_0.5.4_armel.deb
ar -x cdebootstrap-static_0.5.4_armel.deb data.tar.gz
tar -xz -C / -f data.tar.gz
rm data.tar.gz cdebootstrap-static_0.5.4_armel.deb
wget http://ftp.de.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2009.01.31_all.deb
ar -x debian-archive-keyring_2009.01.31_all.deb data.tar.gz
tar -xz -C / -f data.tar.gz
rm data.tar.gz debian-archive-keyring_2009.01.31_all.deb
cdebootstrap-static --flavour=minimal --include=ifupdown,udev,procps,netbase,vim-tiny,module-init-tools,wget,openssh-server,screen,apmd stable /media/card/ http://ftp.de.debian.org/debian/

There is a bug, and at this point it does not work. See [3] and fllowups.

justifying the included packages

  • ifupdown - contains ifup, ifdown
  • udev - necessary to fill /dev
  • procps - contains watch, ps, kill, free, top, uptime... (otherwise this is a openssh-server dependency)
  • netbase - /etc/init.d/networking
  • vim-tiny - we want to edit files
  • module-init-tools - modprobe, lsmod, rmmod, depmod (otherwise this is a apmd dependency)
  • curl - we want to download stuff
  • openssh-server - we want to connect to our device and we have enough power to not need to use dropbear
  • screen - we want to operate within screen sessions so that we can disconnect or detach without problems
  • apmd - suspending via apm -s

additionally interesting packages:

  • locale (use dpkg-reconfigure afterwards)
  • less (better than more)
  • man-db
  • rsyslog
  • psmisc (killall, fuser)
  • rsync
  • console-tools (chvt)
  • iputils-ping - ping
  • mtd-utils (flash_eraseall, nandwrite, mkfs.jffs2)

[edit] Complete debootstrap Process

execute the following commands (just copypaste everything below)

echo "neo1973-debian" > /media/card/etc/hostname
cat > /media/card/etc/network/interfaces <<__END__
auto lo
iface lo inet loopback
auto usb0
iface usb0 inet static
    address 192.168.0.202
    netmask 255.255.255.0
    network 192.168.0.0
    gateway 192.168.0.200
    up echo nameserver 192.168.0.200 >/etc/resolv.conf
__END__
cat > /media/card/etc/fstab << __END__
rootfs  /                ext2    defaults,errors=remount-ro,noatime 0 1
proc    /proc            proc    defaults                           0 0
tmpfs   /etc/network/run tmpfs   defaults,noatime                   0 0
tmpfs   /tmp             tmpfs   defaults,noatime                   0 0
tmpfs   /var/lock        tmpfs   defaults,noatime                   0 0
tmpfs   /var/run         tmpfs   defaults,noatime                   0 0
tmpfs   /var/tmp         tmpfs   defaults,noatime                   0 0
__END__
cat > /media/card/etc/apt/apt.conf.d/99no-install-recommends << __END__
APT::Install-Recommends "0";
__END__
sed -i 's/\(PermitEmptyPasswords\) no/\1 yes/' /media/card/etc/ssh/sshd_config
chroot /media/card /bin/sh -e <<__END_CHROOT__
echo root: | chpasswd
apt-get --yes --purge remove cdebootstrap-helper-rc.d
__END_CHROOT__

[edit] Get X Running

Now reboot and start Debian. Login with ssh and start configuring xorg:

apt-get install xorg

configure /etc/X11/xorg.conf so that it looks like this:

cat > /etc/X11/xorg.conf << __END__
Section "Device"
       Identifier      "Configured Video Device"
       Driver          "fbdev"
EndSection
__END__

Start X in the first vt:

startx -- vt1

[edit] Get touchscreen working

Install the tslib driver from debian experimental:

echo "deb http://ftp.de.debian.org/debian experimental main" >> /etc/apt/sources.list
apt-get update
apt-get install xserver-xorg-input-tslib/experimental

and edit the InputDevice section in your xorg.conf

cat >> /etc/X11/xorg.conf << __END__
Section "InputDevice"
        Identifier      "Configured Touchscreen"
        Driver          "tslib"
        Option          "CorePointer"           "true"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/input/event1"
        Option          "Protocol"              "Auto"
EndSection
__END__

calibrate your touchscreen

for gta01:

echo -67 36365 -2733100 -48253 -310 45219816 65536 > /etc/pointercal

for gta02:

echo  -67 38667 -4954632 -51172 121 46965312 65536 > /etc/pointercal

or calibrate it yourself until you are happy with the result:

apt-get install libts-bin
TSLIB_CALIBFILE=/etc/pointercal TSLIB_TSDEVICE=/dev/input/event1 TSLIB_CONSOLEDEVICE=none ts_calibrate

Start X and enjoy!

startx -- vt1

[edit] Install GDM and xfce4

apt-get install gdm xfce4 xvkbd

Configure gdm so xkvbd will allow you to put in your username and password. simply add this to the end of /etc/gdm/Init/Default before exit 0 so that the three last lines look like this:

fi
sleep 20 && /usr/bin/xvkbd -xdm -compact -geometry 480x210+0+0 &
exit 0

Simply click on the focus button of xvkbd and then on the input box of GDM to input your user name and password there. On each boot gdm should start automatically now.

If you like you can also download a correctly sized Debian wallpaper I generated from the SVG source for 480x640:

wget http://rabenfrost.net/debian/debian-blueish-wallpaper-480x640.png -O /usr/share/images/desktop-base/desktop-background

[edit] Clean Up

apt-get clean

[edit] Load Additional Kernel Modules

These are for sound, bluetooth and USB. Use the modules archive that fits to your kernel.

wget http://rabenfrost.net/celtune/modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz
tar -xf modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz -C /
depmod -a
cat > /etc/modules << __END__
hci_usb
hidp
ohci-hcd
rfcomm
snd-mixer-oss
snd-pcm-oss
snd-soc-neo1973-wm8753
__END__

Note: On the FreeRunner, the sound module (on the last line) is called snd-soc-neo1973-gta02-wm8753

Sonata on neo1973

[edit] Enable Sound

Now we turn our Debian into a jukebox!

apt-get install alsa-base alsa-utils gstreamer0.10-alsa
cat > /etc/asound.conf << __END__
pcm.!default {
    type plug
    slave.pcm "dmixer"
}
pcm.dmixer  {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 4096
        rate 44100
    }
    bindings {
        0 0
        1 1
    }
}
ctl.dmixer {
    type hw
    card 0
}
__END__
wget http://rabenfrost.net/celtune/alsa_state_files-working.tar.gz
tar -xf alsa_state_files-working.tar.gz -C /etc
alsactl -f /etc/alsa_state_files-working/stereoout.state restore
addgroup openmoko audio

I currently use mpd+sonata - let me know if you know another nice lightweight gtk player. Unfortunately RhythmBox is way too much for the Neo to handle - the MP3 playing stops after 20secs.

[edit] Enable Modem

Here comes the phone functionality - just add this line into the "serial devices" section in your /etc/udev/rules.d/50-udev.rules

# serial devices
KERNEL=="s3c2410_serial[0-9]",  NAME="ttySAC%n"

[edit] Miscellaneous

[edit] Disable Framebuffer Blanking

the obfuscated way:

echo -e '\033[9;0]' > /dev/tty0

the sys-path way:

echo -n 0 > /sys/devices/platform/s3c2410-lcd/graphics\:fb0/blank

the debian way:

apt-get install console-tools
sed -i 's/\(BLANK_TIME\)=30/\1=0/' /etc/console-tools/config

[edit] Chroot installation

If you just want to run random debian programs without completely booting to debian you can use the following minimal steps:

On desktop:

sudo debootstrap --arch armel --foreign sid sid
sudo tar czf sid.tar.gz sid
nc -w 10 -l -p 1234 < sid.tar.gz

On neo:

cd /media/card
nc 192.168.0.200 1234 | tar xzf -
mount -t none -o bind /dev /media/card/sid/dev
mount -t none -o bind /proc /media/card/sid/proc
mount -t none -o bind /sys /media/card/sid/sys
mount -t none -o bind /tmp /media/card/sid/tmp
chroot /media/card/sid /deboostrap/debootstrap --second-stage
cp /etc/resolv.conf /media/card/sid/etc

On neo edit the file /media/card/sid/etc/apt/sources.list and add the following line:

deb http://ftp.de.debian.org/debian/ sid main non-free contrib

On neo:

chroot /media/card/sid apt-get update
chroot /media/card/sid apt-get install mplayer
chroot /media/card/sid mplayer http://relay.slayradio.org:8000/

To enter the debian chroot environment you could use the following script:

#!/bin/sh
mount -t none -o bind /dev /media/card/sid/dev
mount -t none -o bind /proc /media/card/sid/proc
mount -t none -o bind /sys /media/card/sid/sys
mount -t none -o bind /tmp /media/card/sid/tmp
chroot /media/card/sid /bin/sh

[edit] Using Xglamo on the FreeRunner

Copy /usr/bin/Xglamo (and /usr/bin/Xfbdev) to /usr/bin in Debian from FSO/ASU/2007.2/2008.8.

Add this to your .bashrc (to tell tslib to use the correct input device):

export TSLIB_TSDEVICE=/dev/input/event1

The X server binaries are linked against version 1 of tslib, for some reason Debian calls its version 0, even though it actually is version 1. Symlink the library to the alternative name by running (as root):

ln -s /usr/lib/libts-0.0.so.0 /usr/lib/libts-1.0.so.0

We also need to change the symlink for the X server to either Xfbdev or Xglamo (this should better be handled by update-alternatives!):

cd /usr/bin && mv X X.orig && ln -s Xfbdev X

(replace Xfbdev by Xglamo if you want to use that, Xglamo is faster, but rotation still does not work correctly as of 2008-08-12).

[edit] Rotating screen to landscape

add the following to the /etc/X11/xorg.conf in both the Device and InputDevice sections to get landscape mode

Option          "Rotate"                "CCW"

[edit] Hiding the cursor

To make the cursor invisible create a file called empty.cursor with this content:

#define empty.cursor_width 16
#define empty.cursor_height 16
static unsigned char empty.cursor_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

add

xsetroot -cursor empty.cursor empty.cursor

to your ~/.xinitrc

[edit] Official Debian Port

An official Debian port based on the FSO image is being created. First information can be found at http://wiki.debian.org/DebianOnFreeRunner. Early adopters are welcome.

Personal tools
Debian on neo1973

This page is to explain how to run debian armel port on neo1973. These instructions are likely to work on freerunner, too.

All the steps below take approximately 2h depending on your internet connection. Most of the time your system will work on its own (apt-getting xfce4 takes a loong time..).

If you do not have the time feel free to download a ready to use tar archive of the results of everything described below. Just extract the contents to your sd card!

wget http://rabenfrost.net/debian/debian-armel-xfce.tar.bz2
  • root-pw: openmoko
  • 1st user: openmoko (pw: openmoko)

Extract it directly to your sd card - have fun!

1. (optional) install known good kernel

this kernel was build by Marcel_M and has some important patches in it such as removed sd debug symbols and build-in ext3 support.

wget http://rabenfrost.net/celtune/uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin
./dfu-util -d 0x1457:0x5119 -a kernel -R -D ./uImage-2.6.24+svnr4194-r4165-r3-neo1973.bin

As there is no way to boot from sdhc with uboot directly I always copy my kernel to flash and let it boot my rootfs from sd but feel free to do it your way.

2. configure booting from sd/sdhc

Do as proposed here: Booting_from_SD

3.1. (option #1) debootstrap your own armel rootfs

debootstrap your rootfs on debian or ubuntu

debootstrap --verbose --arch armel --foreign sid ./armel-chroot http://ftp.de.debian.org/debian/

3.2. (option #2) download ready to use armel rootfs

if you dont have debootstrap on your system you can download the results here:

wget http://rabenfrost.net/debian/armel-chroot-first-stage.tar.gz

4 prepare sd card

ssh to your neo and format your sd card appropriately. I'm using an 8GB sdhc card here.

umount /media/card
mkfs.ext3 /dev/mmcblk0p1
mount /dev/mmcblk0p1 /media/card

copy the armel chroot to your device by tar'ing it to circumvent symbolic link cycles (https://bugzilla.mindrot.org/show_bug.cgi?id=1059 <= WONTFIX)

tar -C ./armel-chroot/ -c . | ssh root@192.168.0.202 tar -C /media/card -xv

or if you downloaded the archive

cat armel-chroot-first-stage.tar.gz | ssh root@192.168.0.202 tar -C /media/card -xzvf

5. complete debootstrap process

ssh to your device and execute the following commands (just copypaste everything below)

echo "nameserver 192.168.0.200" > /media/card/etc/resolv.conf
echo "fic-gta01" > /media/card/etc/hostname
echo "127.0.0.1 localhost.localdomain localhost fic-gta01" > /media/card/etc/hosts
echo -e "auto lo\n\
iface lo inet loopback\n\
auto usb0\n\
iface usb0 inet static\n\
    address 192.168.0.202\n\
    netmask 255.255.255.0\n\
    network 192.168.0.0\n\
    gateway 192.168.0.200\n\
    up echo nameserver 192.168.0.200 >/etc/resolv.conf" > /media/card/etc/network/interfaces
echo -e "rootfs  /                ext3    defaults,errors=remount-ro,noatime 0 1\n\
proc    /proc            proc    defaults                           0 0\n\
tmpfs   /etc/network/run tmpfs   defaults,noatime                   0 0\n\
tmpfs   /tmp             tmpfs   defaults,noatime                   0 0\n\
tmpfs   /var/lock        tmpfs   defaults,noatime                   0 0\n\
tmpfs   /var/log         tmpfs   defaults,noatime                   0 0\n\
tmpfs   /var/run         tmpfs   defaults,noatime                   0 0\n\
tmpfs   /var/tmp         tmpfs   defaults,noatime                   0 0" > /media/card/etc/fstab

now chroot into your armel rootfs and finish the install

chroot /media/card
/debootstrap/debootstrap --second-stage

make sure your internal clock is set to the correct date because apt-get will complain if otherwise (does not work on the gta02 at the moment: "Cannot access the Hardware Clock via any known method.")

hwclock --set --date="MM/DD/YY hh:mm:ss"

install openssh so you can login remotely

echo "deb http://ftp.de.debian.org/debian sid main" > /etc/apt/sources.list
apt-get update
apt-get upgrade
apt-get install openssh-server

install and configure locales

apt-get install locales
dpkg-reconfigure locales

install udev to dynamically create /dev

apt-get install udev

set a root password

passwd

create a normal user

adduser <yournamehere>

6. get x running

now reboot and start your debian. you can login with ssh and start configuring xorg:

apt-get install xorg

configure /etc/X11/xorg.conf so that it looks like this:

Section "InputDevice"
       Identifier      "Configured Mouse"
       Driver          "mouse"
       Option          "Device" "/dev/input/mice"
EndSection
Section "Device"
       Identifier      "Configured Video Device"
       Driver          "fbdev"
EndSection
Section "Monitor"
       Identifier      "Configured Monitor"
EndSection
Section "Screen"
       Identifier      "Default Screen"
       Monitor         "Configured Monitor"
EndSection
Section "ServerLayout"
       Identifier      "Default Layout"
       Screen          "Default Screen"
       InputDevice     "Configured Mouse"
EndSection

start x in the first vt:

startx -- vt1

7. get touchscreen working

install the tslib driver:

apt-get install xserver-xorg-input-tslib

edit /etc/udev/udev.rules as the tslib device is hardcoded for now. search for the input devices section and make the first line look like this:

# input devices
KERNEL=="event1",               NAME="event0"

and edit the InputDevice section in your xorg.conf

Section "InputDevice"
       Identifier "Configured Mouse"
       Driver "tslib"
       Option "CorePointer"
       Option "Device" "/dev/input/event1"
       Option "Protocol" "Auto"
EndSection

calibrate your touchscreen

echo -67 36365 -2733100 -48253 -310 45219816 65536 > /etc/pointercal

start x and enjoy!!

startx -- vt1

8. install gdm and xfce4

simple...

apt-get install gdm xfce4 xvkbd

configure gdm so xkvbd will allow you to put in your username and password. simply add this to the end of /etc/gdm/Init/Default before exit 0 so that the three last lines look like this:

fi
sleep 20 && /usr/bin/xvkbd -xdm -compact -geometry 480x210+0+0 &
exit 0

simply click on the focus button of xvkbd and then on the input box of gdm to input your username and password there.

on each boot gdm should start automatically now.

if you like you can also download a correctly sized debian wallpaper I generated from the svg source for 480x640:

wget http://rabenfrost.net/debian/debian-blueish-wallpaper-480x640.png -O /usr/share/images/desktop-base/desktop-background

9. clean up

apt-get clean

10. load additional kernel modules

These are for sound (!!), bluetooth and usb foo. Use the modules archive that fits to your kernel.

wget http://rabenfrost.net/celtune/modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz
tar -xf modules-2.6.24+svnr4194-r4165-r3-neo1973.tgz -C /
depmod -a
echo -e "hci_usb\n\
hidp\n\
ohci-hcd\n\
rfcomm\n\
snd-mixer-oss\n\
snd-pcm-oss\n\
snd-soc-neo1973-wm8753" > /etc/modules
Sonata on neo1973

11. enable sound

Now we turn our Debian into a jukebox!

apt-get install alsa-base
wget http://rabenfrost.net/celtune/alsa_state_files-working.tar.gz
tar -xf alsa_state_files-working.tar.gz -C /etc
alsactl -f /etc/alsa_state_files-working/stereoout.state restore
addgroup openmoko audio

I currently use mpd+sonata - let me know if you know another nice lightweight gtk player. Unfortunately rhythmbox is way to much for the neo to handle - the mp3 playing stops after 20secs.