English (United Kingdom)

How to install Debian on nand wm8505 ver 2

Written by gyppe.

User Rating: / 23
PoorBest 

Many thanks to John Wiggins for having offered to fix and improve the guide:

 

Table of Contents:

  1. Brief Introduction
  2. Installation
  3. Fix What is Missing
  4. Networking
  5. Install New Programs
  6. Install the Desktop
  7. Linuxgnuru section
  8. Thanks and Sources

 

This is an edited copy of another article entitled How to install Debian on nand wm8505 ver 2.
When editing a file, I used vim whereas the original author used nano. If you are unsure how to use either of these then please use google to find out.
When you see NOTE: it indicates my own experience or thoughts and are not part of the original text.
I've also moved some things around to where they make a little more sense and I've added some section titles.

NOTE: First, some conventions I use:

shell command to be entered
sample text
sample from text file
sample text

Brief Introduction

This guide is finally ready (with only a few finishing touches to be made to the desktop section) and for now, everything works.
This guide should be considered a beta version as you may have to experiment a little. In a short time we, and with the help of the community, will try to make it faster to learn and easier to follow for the non-tech folks.

The procedure is still laborious and the web only offers a few simple examples and tests that we must be content with for the time being.
Ideally we would like to build a script and/or a filesystem ready for an easy and automatic installation.
Remember that this guide was written to allow an installation on a smartbook Chinese smartmedia wm8505 with the following specifications:

Item code: 89103C
System RAM: 128MB RAM
Processor: ARM926EJ-S rev 5 (V51)
Internal Memory: 2 GB NAND


The NAND organized into 12 blocks, which we defined because the ver2.
The organization of the memory is different as well as some of the hardware features such as the SDD reader that works in rw mode.

For the first version of this smartbook, simply use the files released by abrasive.
If in doubt which version you have, check how many partitions the NAND has or maybe try script pads.
For the first version, you can follow the guide, however, leaving out the parts concerning mtd10-11-12.
In some cases you may still need these procedures, installing the root up and the rest on mtd7 mtd9, depends on some models.

Installation

First you'll have to install a working copy of Android which was explained in the first portion of this document found here.
I used the steel slatedroid V2 but I changed the boot logo (logo.bmp) by replacing it with what is in the Debian script directory so I now have a penguin instead of the Android logo.
We use Android's bootloader not just because it makes things easier but for the time being, is also our only option. It sounds strange but it's true; and it works well.
We're still waiting for a release of a special script for the different format of the NAND memory for this model.
So, now we must call the scriptcmd.install for Debian so that it doesn't change the bootloader, which is also useful to have a live-on-ram and control the system without compromising or modifying anything.

To change the script, edit the text file cmd.install so that you only have the following:


lcdinit
cleanlcd
mmcinit

textout 30 150 "Booting linux, will build root fs" ffffff
textout 100 180 "(on /dev/mtdblock9)" eeeeee
fatload mmc 0 1000000 script/installrd.gz
setenv bootargs mem=112M root=/dev/ram rw initrd=0x01000000,32M init=/linuxrc
bootm 0

Save the file and execute make_scriptcmds (this script executes Linux x86-32bit ELF binaries so you'll need to do this on a Linux machine).
This will generate new files: scriptcmd and scriptcmd.install. Normally we would delete the scriptcmd file and rename scriptcmd.install to scriptcmd.
Here is the script folder ready including the penguin logo in order to save the breaking of the compilation:
script no write NAND

Remember that the SD card must be partitioned/formatted as fat32 and the root of the SD is where the scripts folder is located along with the compressed file extpar.tgz.

In practice we should have the scripts folder and this file. This file can be found here:
http://www.projectgus.com/files/abrasive_mirror/wm8505_linux/1.0/extpart.tgz

Ok now insert the SD card into the sdd reader and once started, the system will eventually give us access to a shell.
With the shell we have enough tools to erase the first block of memory that contains the system files:

flash_eraseall /dev/mtd9



Now we mount this block:

mount /dev/mtdblock9 /mnt/mtd



And mount the SD card:

mount /dev/mmcblock0p1 /mnt/sd



Check with df -h to make sure that the partitions are in place; mtd9 should be about 300 MB or 200 MB.
Now we extract and copy the files to the Debian block mtd9:

tar -zvxf /mnt/sd/extpart.tgz -C /mnt/mtd



This will take several minutes to extract so go and get yourself some coffee.

Now remove the SD card and reboot the system:

reboot



Ok, after the system reboots we get the Debian login!! Yeah! You can now log in as root without a password.
If you'd like root to have a password then execute the passwd program with no arguments:

passwd

Fix What is Missing

NOTE: Since we are manually installing Debian, several things that are normally done via shell scripts will also have to be done manually.

First of all is permissions.

Let's add write permission to the root (/):

chmod 775 /

 

Now, since they do not exist yet, we have to create the mtd block devices for 10, 11 and 12:

mknod /dev/mtdblock10 b 31 10
mknod /dev/mtdblock11 b 31 11
mknod /dev/mtdblock12 b 31 12



We also have to create device files for sda, sda1, sda2, and sda3 so USB drives will work:

mknod /dev/sda b 8 0
mknod /dev/sda1 b 8 1
mknod /dev/sda2 b 8 2
mknod /dev/sda3 b 8 3



You may want to modify the swampiness; the tendency of the Linux kernel to use swap.
This can range from 100 (maximum utilization) to 0 (never use) so edit the file /etc/sysctl.conf and at the end of the file add:

vm.swappiness = 1


By doing this, the swap will be used as little as possible to the benefit of the overall speed of the system.

mtdblock is 2GB but is portioned into 10, 11, and 12 with 10 having 620MB, 11 having 102MB, and 12 having 1.1GB of space.

Now that you have access to mtdblock12 and 1.1GB of space, you will want to migrate /usr and /var to a location where you can add more programs.
The easiest approach is to create a new mount for this drive. For our scenario we used /userspace but you can use whatever you wish to:

mkdir /userspace



Now we must edit /etc/fstab and add our new mount point:


/dev/mtdblock12 /userspace auto defaults 0 0


Let's create the swap:

mkswap -c /dev/mtdblock11



Then edit fstab and add the swap:


/dev/mtdblock11 none swap sw 0 0


While we're in fstab, why not create a directory for /home as well:


/dev/mtdblock10 /home auto defaults 0 0


NOTE:Here's my (linuxgnuru's) /etc/fstab:


/dev/root / auto defaults 0 0
/dev/mtdblock12 /userspace auto defaults 0 0
/dev/mtdblock11 none swap sw 0 0
/dev/mtdblock10 /home auto defaults 0 0


I later discovered that Android also managed the hard drive space in this manner so the idea was not that bad after all.

Now reboot and you should have /userspace mounted with around 1.1GB where we will be moving /usr and /var:

mv /usr/userspace /usr
mv /var/userspace /var



Now create symbolic links to the folders you just moved into userspace:

ln -s /userspace/var /var
ln -s /userspace/usr /usr



Reboot once again so the system doesn't complain about anything missing.
Once you've rebooted you then they will be downloaded directly into the new partition and we a lot of space available.

Now restart and you should have swap, home and userspace mounted and operational. Check with df and free to make sure.
If everything is ok then we have some cleaning to do because the initial install of the system failed to do set certain permissions that we now have to preform:

chmod ug+rwx /tmp
chmod o+rwt /tmp
chmod ug+rwx /userspace/usr
chmod o+rwt /userspace/usr
chmod ug+rwx /userspace/var
chmod o+rwt /userspace/var
chown -R man:man /var/cache/man

Networking

Now activate the wifi, edit the file /etc/network/interfaces, and paste this:


auto lo
iface lo inet loopback

#comment out the next line if you don't want networking setup during boot up
auto ra0

# ip from dhcp for ra0
iface ra0 inet dhcp
wpa-ssid (qui scrivete l'ssid della vostra rete)
wpa-psk (qui scrivete la password wpa della vostra rete)
pre-up modprobe rt3070sta
post-down killall -q wpa_supplicant
post-down rmmod rt3070sta

NOTE: For my setup, my wifi network is open so my interfaces looks like this:


auto lo
iface lo inet loopback
iface ra0 inet dhcp
pre-up modprobe rt3070sta
pre-up wpa_supplicant -B -Dwext -ira0 -c /etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant
post-down rmmod rt3070sta

and my /etc/wpa_supplicant.conf contains:


network={
key_mgmt=NONE
scan_ssid=0
mode=0
ssid="MY WIFI"
}

If you do not comment out the line "auto ra0", keep in mind that the connection will start automatically at startup, which (obviously) slows down for a few tens of seconds to boot. If you are not in range of your router this time will increase dramatically.
Ideally you should comment out the auto ra0 and just start the connection when necessary with ifup ra0, and stop with ifdown ra0.
The start time automatically increases by about thirty-seconds, and the launch of ifup is about 10, so it is still quite affordable.

The next thing is to create the /etc/hosts file as it's missing. Touch /etc/hosts file and copy:


127.0.0.1 localhost
127.0.0.1 hostname


The hostname can be found in the file /etc/hostname.

When you restart you should have the wifi working. If you have commented out the autostart in the interfaces (#auto ra0) file, then just turn on wifi when you want with ifup ra0 with ifdown ra0 off.

In order to access the internet as a user, first create the group aid_inet:

groupadd -g 3003 aid_inet



Now just add the user to this group:

usermod -G aid_inet [username]



Now we to configure apt to work, first edit /etc/apt/sources.list and replace the original file server with a generic;
the original server gave a casino of problems and we lost weeks trying to figure out what the hell was going on:

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

Also you will need to create the missing log directory of apt before you can run apt-get:

mkdir /var/log/apt



Now we can finally install/update the rest of the system. First run update followed by the upgrade.
Update refreshes the list of package updates whereas upgrade actually downloads the packages to be updated.

apt-get update
apt-get upgrade

Install New Programs

This package is needed for the proper functioning of the wifi kill with ifdown:

apt-get install psmisc

 

Then install the necessary dependencies for X:

apt-get install xserver-xorg-video-fbdev xfonts-utils xinit xauth xutils

 

The console-tools and console-setup packages are also useful for configuring the keyboard:

apt-get install console-tools console-setup

 

Audio:

apt-get install alsa-base aumix

 

Linuxgnuru's Section

NOTE: The following is completely new and not from the original guide.
What follows is just a few things I've installed / done.

 

Time / Date

If you wish to set the system clock, do the following:
For example, the following sets the current date and time to June, 8, 2011 8:00am:

date -s "8 Jun 2011 8:00:00"



This, however, is gone after a system reboot so in order to keep the time saved:

wmt-rtc --sys2hw

 

 

 

Ethernet: Built-in and USB ethernet

NOTE: Please understand what follows could use some cleaning up later on.
It works but I'd like to be able to start/stop the ethernet devices via ifup and/or a gui front-end later on.
So please be kind with the comments; I know it's messy.

Within the Android script directory can be found some rather useful files.
These files are kernel modules which allowed me to use both the built-in ethernet controller and an external USB ethernet adapter.

We will need these three files:

  • via-velocity.ko
  • usbnet.ko
  • asix.ko

 

I found these files in the script/driver directory from the Android install.
All I did was copy the file from my computer to a SD card, put the card into the wm8505's card reader, then I mounted the card:

mount /dev/mmcblk0p1 /mnt/sd


After that, I simply copied the files to /lib/modules:

cp /mnt/sd/*.ko /lib/modules


Then I edited the modules.dep file. This file may or may not be in the exact location as your install, but for me the location of the modules.dep is /lib/modules/2.6.29-00236-g4f8dbbb-dirty
At the end of the file, add:


/lib/modules/asix.ko:
/lib/modules/usbnet.ko:
/lib/modules/via-velocity.ko:


If you wish to use the internal ethernet adapter, type:

modprobe via-velocity


and you should now be able to use it by either adding it to the /etc/network/interfaces or by starting it manually:

ifconfig eth0 192.168.50.100 netmask 255.255.255.0


and then setting up the default route:

route add default gw 192.168.50.1 eth0


The interface might not always be eth0 so check dmesg to find out:

dmesg | grep eth | grep VIA



If you plan on using an USB ethernet adapter then you'll need to run:

modprobe usbnet
modprobe asix


You can check to make sure the modules were loaded with:

lsmod

 

 

In addition, I've installed the following packages and can vow they work fine (at least for me anyway).

package commands included function / what I use it for
file file so I can see if something is for ARM or x86
less less I like less better than more because it allows for string searching while you are viewing the output
openssh-client ssh Lets me connect to other machines.
openssh-server sshd Allows me to connect to this machine remotely.
pciutils lspci Shows information on hardware.
usbutils lsusb Shows information on connected USB devices and internal USB hardware.
quagga ospfd, zebra, ripd, bgpd, isisd Routing daemon

The following have been installed as well but I haven't had time to test their functionality:

  • abiword
  • gnumeric

 

Install the Desktop

In order for a user to login you will need to re-create /dev/null:

rm /dev/null
mknod -m 0666 /dev/null c 1 3

After millions of tests icewm was chosen for its lighter CPU usage and less RAM usage as well. Likewise we picked the xdm for graphical login:

apt-get install icewm xdm



On reboot everything should work correctly, including the GUI login to the desktop. To add a user for login (other than root):

adduser [username]



As for browsers, try to go as light as possible. I feel comfortable using arora:

apt-get install arora



But if you prefer galeon:

apt-get install galeon

There are many other more or less similar and more complete, but obviously heavy:

  • Iceweasel (tested, 100% complete, of course, but it seems too heavy, takes a long to load, but then I must admit that it seems easier to navigate)
  • Links2 (tested, but only a sliver text with some random picture, that's great for a geek to do a text search on the fly, but does not support graphics at all. I have installed it, however, and use it as an example if I need to do a search on wikipedia)
  • Midori (I have yet to try it, it is not on the repo)
  • Arora (I like this one, probably the lightest one I always use. some things do not work like the Facebook Chat so it is not 100% compatible pop: D)
  • Galeon (I think this is roughly the same as arora, a little more complete, has some icons like the comfortable home that are not on arora, for now it seems the best but too much clutter on screen.)

 

Other useful things recommended by swedenfox:

FTP: Filezilla, bash script (perhaps expanding this to at least 2 parameters http://www.unix.com/302071531-post2.html)

Drawing: GNU Paint (apt-get install gpaint), Inkscape (inkspace).

For midori:
http://archive.xfce.org/src/apps/midori ... .9. Tar.bz2

Make Sure You Have Python 2.4 or higher installed.

tar -xjf midori-0.2.9.tar.bz2
./waf install



To screenshots, you can use scrot light, or ultralight swedenfox recommend a script like:for the script --->
http://ubuntuforums.org/showpost.php?p=...ostcount=5

We still lack a desktop manager, you could use xfce, which should be enough to launch it to create a bash script named in the startup configuration directory icewm.
There is also rox, the official repo but when I tried it everything went wrong and I messed things up. I tried to use rox-filer as well but without success. sin should be as light as ever. I also forgot to install a handler for interactive wifi connections. So far I have not found solutions to mount the flash. I have tested but gnash does not work for anything on the browser. You can find the Work Forum at this address:
http://gyplace.altervista.org/index.php

This guide is licensed under creative commons 2.0, here the summary and the full text:
http://creativecommons.org/licenses/by-nc-sa/2.0/it/
This means that you can use it as you like provided you cite the author (gyppe) and address of this web page. I hope to do what you like.

Sources and thanks:

Big thanks to swedenfox of forum for the great help.
Thanks to the forum http://www.debianizzati.org and in particular to Aki for being interested in this system.
Abbrasive, of course, for releasing the file system works.
Thanks to the forum http://devio.us/nextvolume~/via_arm/viewforum.php?Id=4 where there are many tips.


Thanks also to:

 

And of course a big thanks to all the open source community and as always we can do great things by sharing all the information possible, without asking anything in return. I hope you did not forget anyone :)


Add comment


Security code
Refresh