Installing Debian Lenny (armel) on TS-7390

  1. Get the latest Kernel image from TS:
      $ wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7390-linux/binaries/ts-images/kernel-image-aug252008.dd
    
  2. Get the Kernel modules for the above kernel from TS:
      $ wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7390-linux/binaries/ts-modules/linuxmodules-2.6.21-ts-aug042008.tar.gz
    
  3. Get the latest Initrd image from TS:
      $ wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7390-linux/binaries/ts-images/initrd-busybox-rootfs-aug252008.dd
    
  4. Get the SD MBR image from TS:
      $ wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7390-linux/binaries/ts-images/sd-mbr.dd
    
  5. Extract the files from the initrd image into a tarball (will need to be root):
      # mkdir ts-initrd
      # mount -o loop initrd-busybox-rootfs-aug252008.dd ts-initrd
      # tar -C ts-initrd -cjf ts-initrd.tar.bz2 .
      # umount ts-initrd
    
  6. Unpack the initrd tarball back into the ts-initrd dir. Do this so that the orginal initrd image from TS stays untouched.
      # tar -C ts-initrd -xjf ts-initrd.tar.bz2
    
  7. Install my tweaked linuxrc script [ linuxrc-sdroot-lenny-install ]:
      # cp linuxrc-sdroot-lenny-install ts-initrd/
      # cd ts-initrd
      # chown root:root linuxrc-sdroot-lenny-install
      # chmod 0700 linuxrc-sdroot-lenny-install
      # ln -sf linuxrc-sdroot-lenny-install linuxrc
      # cd ..
      # tar -C ts-initrd -cjf ts-initrd-lenny.tar.bz2 .
    
  8. Partition a new SD card. I make my 2GB cards look like this:
    [NOTE: I needed to change the Heads/Sectors/Cylinders. Set heads to 4, and sectors to 16. Cylinders depends on the size of your SD card. To calculate the number of cylinders use C = TOTAL_BYTES / (HEADS * SECTORS * 512).]
      # fdisk /dev/mmcblk0
      
      The number of cylinders for this disk is set to 62032.
      There is nothing wrong with that, but this is larger than 1024,
      and could in certain setups cause problems with:
      1) software that runs at boot time (e.g., old versions of LILO)
      2) booting and partitioning software from other OSs
         (e.g., DOS FDISK, OS/2 FDISK)
      
      Command (m for help): p
      
      Disk /dev/mmcblk0: 2032 MB, 2032664576 bytes
      4 heads, 16 sectors/track, 62032 cylinders
      Units = cylinders of 64 * 512 = 32768 bytes
      Disk identifier: 0x00000000
      
              Device Boot      Start         End      Blocks   Id  System
      /dev/mmcblk0p1               5         132        4096   83  Linux
      /dev/mmcblk0p2             133         260        4096   da  Non-FS data
      /dev/mmcblk0p3             261         388        4096   da  Non-FS data
      /dev/mmcblk0p4             389       62032     1972608   83  Linux
      
      Command (m for help): q
    
  9. Install the SD MBR onto the SD card (MBR info):
    NOTE: The sd-mdr.dd file supplied on the TS web site is 512 bytes long. This will over-write the partition table that you just configured if you blast all 512 bytes onto the SD card.
      # dd if=sd-mbr.dd of=/dev/mmcblk0 bs=440 count=1
    
  10. Install the kernel onto the SD card:
      # dd if=kernel-image-aug252008.dd of=/dev/mmcblk0p2
    
  11. Install the initrd files onto the SD card. Here, opt not to simple use dd to install the image from TS. I do it this way to get access to the entire 4 MB of the partition, thus giving me space to tweak and add things in the initrd.
      # mkfs.ext2 -L DebInitrd -m 0 /dev/mmcblk0p3
      # mount -L DebInitrd /media/DebInitrd
      # tar -C /media/DebInitrd -xjf ts-initrd-lenny.tar.bz2
      # umount /media/DebInitrd
    
  12. Use debootstrap to fetch setup the initial root (this is done on the local file system):
      # debootstrap --verbose --arch armel --foreign lenny ./root-armel-lenny http://ftp.us.debian.org/debian
    
  13. Add an initrd directory to the new root:
      # mkdir ./root-armel-lenny/initrd
    
  14. Add the TS kernel modules to the new root:
      # mkdir ./root-armel-lenny/lib/modules
      # tar -C ./root-armel-lenny/lib/modules -xzf linuxmodules-2.6.21-ts-aug042008.tar.gz
    
  15. Prepare the root partition on the SD card, mount it and populate it:
      # mkfs.jfs -L DebRoot /dev/mmcblk0p4
      # mount -L DebRoot /media/DebRoot
      # tar -C ./root-armel-lenny -cf - . | tar -C /media/DebRoot -xf -
      # umount /media/DebRoot
    
  16. Move the SD card from your dev system into the TS-7390 and power it up. If all goes well, you should get to a prompt (on the serial console). If things go wrong, this is where I like to compile my own kernel that spews kernel messages onto the serial console.
      -- lots of kernel noise skipped --
      ...
      >> Booting Debian Lenny debootstrap...                                           
      sh-3.2# ls                                                                       
      bin   debootstrap  etc   initrd  mnt   root  selinux  tmp  var                   
      boot  dev          home  lib     proc  sbin  sys      usr                        
      sh-3.2# 
    
  17. Run the second stage of debootstrap (this will take a while):
      sh-3.2# ./debootstrap/debootstrap --second-stage
    
  18. At this point, I powered down the TS-7390 and moved the SD card back to my laptop so that I can take a snapshot of the state of the SD card. Then I mounted the root partition and changed to that directory.
      # mount -L DebRoot /media/DebRoot
      # cd /media/DebRoot
    
  19. Set hostname:
      # echo 'ts-7390' > ./etc/hostname
    
  20. Set the timezone:
      # echo "America/Los_Angeles" > ./etc/timezone
      # cp ./usr/share/zoneinfo/US/Pacific ./etc/localtime
    
  21. Tweak the /etc/inittab file. I commented out all the lines running getty on tty2 through tty6 and add this line at the end:
      T0:23:respawn:/sbin/getty -L ttyAM0 115200 vt100
    
  22. Done with root for now, unmount it and mount initrd:
      # cd ~
      # umount /media/DebRoot
      # mount -L DebInitrd /media/DebInitrd
      # cd /media/DebInitrd
    
  23. Tweak linuxrc to start lenny. [ linuxrc-sdroot-lenny-run ]:
      # ln -sf linuxrc-sdroot-lenny-run linuxrc
    
  24. Add a line to /etc/apt/sources.lists:
      # echo 'deb http://ftp.us.debian.org/debian lenny main' > etc/apt/sources.list
    
  25. Configure Networking: Add the following to /etc/network/interfaces:
      auto lo
      iface lo inet loopback
    
      auto eth0 
      iface eth0 inet dhcp
    
      auto eth1
      iface eth1 inet dhcp
    
  26. Add ttyAM0 to /etc/securetty to allow root logins via the console.
      echo ttyAM0 >> /etc/securetty
    
  27. Boot the system to lenny and start installing software with apt-get:
    You will want the jfsutils package so you can run fsck on root!
      # apt-get install ssh jfsutils