Installation of Debian (Squeeze) on the TAM3517 "Twister" Board
Author
This document was written by Wolfgang Denk (wd {at} denx {dot} de).
Introduction
This application note describes how to install the
Debian "squeeze" Linux distribution on a SDCard for
using it as operating system for the TAM3517 "Twister" board.
For development (building the Linux kernel image) and bootstrapping
(initial installation of Debian on that platform) we will use the
DENX Embedded Linux Development Kit (
ELDK) Release 4.2 for
armVFP
systems.
This document describes the whole procedure how to perform the
installation from scratch. If you are just interested in getting
Debian running on your "Twister" board, you probably want to skip to
section
"Installation from a Snapshot" and start
from existing tarballs from our
FTP server.
Prepare a SDCard
In this example we use a Micro-SDCard of 2 GB size (3862528 512-byte
logical blocks) which we organize as 3 partitions:
- Mount point
"/boot", formatted as =VFAT file system:
used to store the Linux kernel image.
- Mount point
"/", formatted as =ext4 file system:
used to store the root file system.
- Swap space, formatted as
swap
Note: you can of course use bigger SDCards as well. Please adjust the
partition sizes accordingly. Usually you will add the additional
space to the root file system.
- Attach the SDCard to your host using any suitable Micro-SD-Card reader.
- To find out as which device it was registered, run for example:
$ dmesg | tail -40
...
... kernel: [576512.948487] sd 18:0:0:2: [sdg] 3862528 512-byte logical blocks: (1.97 GB/1.84 GiB)
... kernel: [576512.953356] sd 18:0:0:2: [sdg] Write Protect is off
... kernel: [576512.953363] sd 18:0:0:2: [sdg] Assuming drive cache: write through
... kernel: [576512.955979] sd 18:0:0:2: [sdg] Assuming drive cache: write through
... kernel: [576512.955986] sdg: sdg1
... kernel: [576512.961490] sd 18:0:0:2: [sdg] Assuming drive cache: write through
... kernel: [576512.961495] sd 18:0:0:2: [sdg] Attached SCSI removable disk
In this case the SD-Card has been registered as "sdg".
WARNING: Be careful and double-check the data!
Using the wrong device may corrupt your host computer's hard disk
or destroy other important data!
WARNING 2: Keep in mind that all occurrences of
"/dev/sdg" and "/dev/sdgX" in the following example will need
to be replaced with the appropriate values on your system!
- Use
"fdisk" to show and delete any existing partitions
$ sudo fdisk /dev/sdg
Command (m for help): p
Disk /dev/sdg: 1977 MB, 1977614336 bytes
18 heads, 52 sectors/track, 4126 cylinders, total 3862528 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x51dd12ca
Device Boot Start End Blocks Id System
/dev/sdg1 2048 3862527 1930240 b W95 FAT32
Command (m for help): d
Selected partition 1
Create new partitions:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 1): 1
First sector (2048-3862527, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3862527, default 3862527): +8M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 2): 2
First sector (18432-3862527, default 18432):
Using default value 18432
Last sector, +sectors or +size{K,M,G} (18432-3862527, default 3862527): +1536M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4, default 3): 3
First sector (3164160-3862527, default 3164160):
Using default value 3164160
Last sector, +sectors or +size{K,M,G} (3164160-3862527, default 3862527):
Using default value 3862527
Set file system types and boot flag:
Command (m for help): a
Partition number (1-4): 1
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 82
Changed system type of partition 3 to 82 (Linux swap / Solaris)
Verify settings and write partition table to SDCard
Command (m for help): p
Disk /dev/sdg: 1977 MB, 1977614336 bytes
18 heads, 52 sectors/track, 4126 cylinders, total 3862528 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x51dd12ca
Device Boot Start End Blocks Id System
/dev/sdg1 * 2048 18431 8192 b W95 FAT32
/dev/sdg2 18432 3164159 1572864 83 Linux
/dev/sdg3 3164160 3862527 349184 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered!
- Create file systems and format swap space:
$ sudo mkfs.vfat /dev/sdg1
$ sudo mkfs.ext4 -L root /dev/sdg2
$ sudo mkswap -L swap /dev/sdg3
Download source files
- Download the
"xuk-src.tar.bz2" tarball
which includes the Linux Kernel source tree from the
Technexion
download page:
$ wget -O xuk-src.tar.bz2 http://www.technexion.com/index.php/support-center/downloads/arm-cpu-modules/tam-3517/389-xuk-src-tar/download
At the time this document was written, this was the version marked as
"Uploaded: 24.03.11":
$ sha256sum -b xuk-src.tar.bz2
23bb9f608ab0a1cee416621db612e683e5393acb50a2ab71f882e99c07be4fc8 *xuk-src.tar.bz2
Configure and Build a Linux Kernel Image
- Unpack the Linux kernel tree:
$ tar -jxf xuk-src.tar.bz2 tam3517/kernel
- Prepare ELDK 5.0 build environment
$ export PATH=/opt/eldk-4.2-arm/bin:/opt/eldk-4.2-arm/usr/bin:$PATH
$ export ARCH=arm
$ export CROSS_COMPILE=armVFP-linux-
- Configure and build the Linux kernel image, using
this
kernel configuration file:
$ cd tam3517/kernel/
$ cp /tmp/twister.config .config
$ make oldconfig
$ make -j4 uImage
Boot "Twister" Board with Roof File System over NFS
- Make sure the "Twister" board is powered off.
- Insert the SDCard into the board.
- Power on the board, and interrupt the initial countdown by pressing
any key.
- Prepare environment settings for boot with root file system mounted over NFS:
TAM3517 # setenv ipaddr 192.168.20.29
TAM3517 # setenv serverip 192.168.1.1
TAM3517 # setenv gatewayip 192.168.1.254
TAM3517 # setenv netmask 255.255.0.0
TAM3517 # setenv hostname twister
TAM3517 # setenv netdev eth1
TAM3517 # setenv addtty 'setenv bootargs ${bootargs} console=ttyS0,115200n8'
TAM3517 # setenv addip 'setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off'
TAM3517 # setenv addmisc 'setenv bootargs ${bootargs} mem=${memsize} mpurate=${mpurate} console=${console} omapfb.vram=0:${vram_size} eth0addr=${eth0addr} eth1addr=${eth1addr} eth2addr=${eth2addr} eth3addr=${eth3addr} ${android_args} ${sys_mode} ${board_info} ${auto_run} omapdss.def_disp=${def_disp} ${disp_mode} mtdparts=${nandparts}'
TAM3517 # setenv fixup 'setenv bootargs ${bootargs} panic=1 ads7846.swap_left_right=1 ads7846.swap_top_down=1'
TAM3517 # setenv nfsargs 'setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath}'
TAM3517 # setenv rootpath /opt/eldk-4.2-arm/armVFP
TAM3517 # setenv mmc_nfs 'mmc init;fatload mmc 0 ${kernel_load} uImage;run def_disp_mode nfsargs addip addtty addmisc fixup;bootm ${kernel_load}'
TAM3517 # saveenv
- Boot board using the Linux kernel from the SDCard
and the root file sytem from the NFS server:
TAM3517 # run mmc_nfs
mmc1 is available
reading uImage
2992268 bytes read
## Booting kernel from Legacy Image at 81000000 ...
Image Name: Linux-2.6.32
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2992204 Bytes = 2.9 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
...
Mounting NFS filesystems: [ OK ]
Mounting other filesystems: [ OK ]
Starting xinetd: [ OK ]
DENX ELDK version 4.2 build 2008-11-24
Linux 2.6.32 on a armv7l
twister login:
Login as user "root".
Bootstrap Debian
- Attach SDCard as storage for the new (to be created) Debian root file system
-bash-3.2# mkdir /mnt/tmp
-bash-3.2# mount -t ext4 /dev/mmcblk0p2 /mnt/tmp
-bash-3.2# mkdir /mnt/tmp/tmp
-bash-3.2# chmod 01777 /mnt/tmp/tmp
-bash-3.2# swapon /dev/mmcblk0p3
- Get and install
"wget"
-bash-3.2# cd /mnt/tmp/tmp
-bash-3.2# ftp ftp.gnu.org
Connected to ftp.gnu.org (140.186.70.20).
220 GNU FTP server ready.
Name (ftp.gnu.org:root): ftp
...
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /gnu/wget/
250 Directory successfully changed.
ftp> bin
200 Switching to Binary mode.
ftp> get wget-latest.tar.bz2
...
ftp> by
221 Goodbye.
-bash-3.2# tar xf wget-latest.tar.bz2
-bash-3.2# cd wget-1.12/
-bash-3.2# ./configure
-bash-3.2# make
-bash-3.2# make install
- Get and install
"debootstrap"
-bash-3.2# cd /mnt/tmp/tmp
-bash-3.2# wget http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.29_all.deb
-bash-3.2# ar xv debootstrap_1.0.29_all.deb data.tar.gz
-bash-3.2# ( cd / ; tar -zxvf - ) <data.tar.gz
- Populate Debian root file system
-bash-3.2# cd /mnt/tmp
-bash-3.2# debootstrap --arch=armel squeeze /mnt/tmp http://ftp.de.debian.org/debian
-
"chroot" into Debian file system and prepare for bootstrap
-bash-3.2# chroot /mnt/tmp /bin/bash
root@twister:/# mount -t proc proc /proc
Create console and other serial devices:
root@twister:/# apt-get clean
root@twister:/# mknod /dev/ttyS0 c 4 64
root@twister:/# mknod /dev/ttyS1 c 4 65
root@twister:/# mknod /dev/ttyS2 c 4 66
root@twister:/# mknod /dev/ttyS3 c 4 67
Set up file system table:
root@twister:/# vi /etc/fstab
root@twister:/# cat /etc/fstab
/dev/mmcblk0p1 /boot vfat defaults 1 2
/dev/mmcblk0p2 / ext4 defaults 1 1
/dev/mmcblk0p3 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
Configure network interfaces:
root@twister:/# vi /etc/network/interfaces
root@twister:/# cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
# The loopback interface
auto lo
iface lo inet loopback
# Wired interfaces
auto eth1
iface eth0 inet dhcp
iface eth1 inet dhcp
Set up DNS:
root@twister:/# vi /etc/resolv.conf
root@twister:/# cat /etc/resolv.conf
search denx.de
nameserver 192.168.1.254
Adapt "/etc/hosts":
root@twister:/# vi /etc/hosts
root@twister:/# cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.20.29 twister.denx.de twister
Fix settings for serial console port:
root@twister:/# cp -vp /etc/inittab{,.ORIG}
`/etc/inittab' -> `/etc/inittab.ORIG'
root@twister:/# vi /etc/inittab
root@twister:/# diff /etc/inittab{.ORIG,}
63c63
< #T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
---
> T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100
Enable initial login for root without password:
root@twister:/# vi /etc/shadow
< root:*:15090:0:99999:7:::
---
> root::15090:0:99999:7:::
Done. Unmount and reboot:
root@twister:/# umount /proc
root@twister:/# sync
root@twister:/# exit
exit
root@twister:/mnt/tmp#
root@twister:/mnt/tmp# reboot
Finalize Debian Setup
- Create or adjust the following environment settings in U-Boot:
TAM3517 # setenv deb_root setenv bootargs root=/dev/mmcblk0p2 ro
TAM3517 # setenv debian 'mmc init;fatload mmc 0 ${kernel_load} uImage;run def_disp_mode deb_root addtty addmisc fixup load_kernel;bootm ${kernel_load}'
TAM3517 # saveenv
Boot Debian for a test:
TAM3517 # run debian
mmc1 is available
reading uImage
2992268 bytes read
Using DaVinci EMAC device
TFTP from server 192.168.1.1; our IP address is 192.168.20.29
Filename 'twister/uImage'.
Load address: 0x81000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
done
Bytes transferred = 2992268 (2da88c hex)
## Booting kernel from Legacy Image at 81000000 ...
Image Name: Linux-2.6.32
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2992204 Bytes = 2.9 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux........................................................................................................................................................................................... done, booting the kernel.
Linux version 2.6.32 (wd@pollux.denx.de) (gcc version 4.2.2) #1 Wed Apr 27 15:05:23 CEST 2011
CPU: ARMv7 Processor [411fc087] revision 7 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: TAM3517 EVM
...
Debian GNU/Linux 6.0 twister ttyS0
twister login:
Log in as root; no password is needed here:
twister login: root
Linux twister 2.6.32 #2 Wed Apr 6 12:41:42 CEST 2011 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@twister:~#
Set system time and time zone:
root@twister:~# apt-get clean
root@twister:~# apt-get install ntpdate
root@twister:~# ntpdate -b pool.ntp.org
root@twister:~# hwclock --systohc --utc
root@twister:~# cp /usr/share/zoneinfo/CET /etc/localtime
root@twister:~# date
Tue Apr 26 22:23:00 CEST 2011
Set up package database and make sure we are up to date:
root@twister:~# apt-cache gencaches
root@twister:~# apt-get update
root@twister:~# apt-get upgrade
Enable remote login through ssh:
root@twister:~# apt-get install ssh
Set root password and halt system.
root@twister:~# passwd root
root@twister:~# poweroff
Make Debian default OS
Enter the following commands in U-Boot to make Debian boot as default OS
whenever you power on the "Twister" board:
TAM3517 # setenv old_bootcmd $bootcmd
TAM3517 # setenv bootcmd run debian
TAM3517 # saveenv
Reset the board to test this.
Customizing Debian Environment
Take a Snapshot
At this point it makes sense to take a snapshot of the installed
system, so you don't have to go through all these steps again:
root@twister:~# cd /
root@twister:/# tar --one-file-system -cf - . | ssh wd@pollux 'gzip >/work/wd/Twister/twister-snapshot-1.tar.gz'
A copy of the resulting tarball can be found
here.
Install a GUI
Debian comes with a plethora of software you can pick from. For
example, to install a graphical desktop environment, proceed as
follows:
- Install Xorg and basic XFCE environment
root@twister:~# apt-get install xorg xfce4 xfce4-goodies xfce4-notifyd
- Install Display Manager
root@twister:~# apt-get install gdm3
- Install Web Browser
root@twister:~# apt-get install iceweasel
or
root@twister:~# apt-get install midori
- Take another snapshot:
twister-snapshot-2.tar.gz
Installation from a Snapshot
If you are just interested in getting Debian running on your "Twister"
board, the fastest way to get there is installation from the snapshot
tarballs on our
FTP server.
Please proceed as follows:
- Perform all the steps described in sections
"Prepare a SDCard",
"Download source files",
"Configure and Build a Linux Kernel Image", and
"Install Linux kernel image".
- Download a snapshot tarball:
$ cd /tmp
$ wget ftp://ftp.denx.de/pub/os-images/debian-6.0/arm/twister-snapshot-1.tar.gz
- Mount root file system partition of SDCard and install tarball:
$ sudo mount /dev/sdg2 /mnt/tmp/
$ cd /mnt/tmp/
$ sudo tar zxpf /tmp/twister-snapshot-1.tar.gz
$ cd
$ sudo umount /dev/sdg2
- Insert the SDCard into the board.
- Power on the board, and interrupt the initial countdown by pressing
any key.
- Prepare environment settings as described
here,
here and
here .
- Reset (or power-cycle) the board and watch it booting into
Debian.
Note: the
root password used in the snapshot images is
"root";
in the XFCE environment
you can login as normal user
"denx" with password
"denx".
Please make sure to change these psswords before putting the system into
actual use. You should also make sure to generate new, unique
SSH host keys for
"/etc/ssh/ssh_host_*".