ts-7000
[Top] [All Lists]

[ts-7000] Compiling 2.6 Kernel & running Lenny via SD fastboot on TS-726

To:
Subject: [ts-7000] Compiling 2.6 Kernel & running Lenny via SD fastboot on TS-7260 [Solved]
From: "ronmuzzi" <>
Date: Wed, 19 Dec 2012 21:15:41 -0000


After wrestling with this problem before finding a solution, I thought I'd share the solution with everyone.  Even though there are various posts on the subject, it is easy to run into problems and unanswered questions.  This post attempts to answer those questions!

This post explains how to take a stock ts-7260 board with an SD card slot and update it to run the 2.6 kernel and Debian Lenny distribution including compiling the kernel from source.  The reason for doing something like this would be to customize the kernel in order to use drivers and/or kernel options that were not provided in the stock versions or provided in linux 2.4.

One side note: I started this project in order to interface a UVC webcam via USB.  That is, until I discovered that in spite of what the spec sheet says, the USB on the ts-7260 is not really version 2.0!  My webcam requires "high speed USB 2.0".  The ts-7260 only provides 12 Mbit/s, which according to wiki is really "full bandwidth USB 1.1"!  So I'm moving onto another board.  But back to the ts-7260...

We are going to do this in two steps: first, modify the board to run fastboot and boot the 2.6 kernel and Debian Lenny from the SD card; second, update the kernel by compiling it from source.


1. Modify ts-7260 to fastboot 2.6 kernel and Lenny from the SD card

References:
    http://www.embeddedarm.com/software/arm-linux-fastboot-ts7300.php
    http://tech.groups.yahoo.com/group/ts-7000/message/15933 
    http://tech.groups.yahoo.com/group/ts-7000/message/15934

On a host linux system running under a user account, make sure you have jfs file system support:

    sudo apt-get install jfsutils

Then make a new empty directory to hold all our work in:

    mkdir lenny
    cd lenny

Download this SD card image, which contains the Lenny distribution.  Though this image is for a 512MB SD card, we're going to extract the data from it in a way that it can be put into an SD card that is the same size or larger.  I used a 2 GB card.

    wget "ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7400-linux/binaries/ts-images/512mbsd-7400-linux2629-lenny-eabi.dd.bz2"

Insert SD card into host system and set up SD card partitions:

    sudo fdisk /dev/sdX    (where X = your sd card letter, cf. dmesg | tail)

            use 'd' command until all partitions are deleted
            use 'n' command with 'p' to create new primary partitions as follows:
                1 - first cylinder: 1, last cylinder: 1
                2 - first cylinder:  default, last cylinder: +4M
                3 - first cylinder:  default, last cylinder: +4M
                4 - first cylinder:  default, last cylinder: default
            use 't' command to change type of partitions 2 & 3 to "da"
            use 'w' command to write partition table

Create a jfs file system on partition 4:

    sudo mkfs.jfs /dev/sdX4    (where X = your sd card letter)

Extract the boot sector and partitions 2 & 3 images from the file.  Note that partition 1 is not used, partition 2 is the kernel image (zImage), partition 3 is the initrd disk, and partition 4 is the root system disk.

    bzip2 -d -k 512mbsd-7400-linux2629-lenny-eabi.dd.bz2

    dd if=512mbsd-7400-linux2629-lenny-eabi.dd of=boot.dd  bs=446 count=1
    dd if=512mbsd-7400-linux2629-lenny-eabi.dd of=part2.dd bs=512 skip=8704  count=5120
    dd if=512mbsd-7400-linux2629-lenny-eabi.dd of=part3.dd bs=512 skip=16896 count=2688

Mount and extract the data from partition 4 so that we can copy the data into a larger partition:
 

    mkdir part4
    sudo mount 512mbsd-7400-linux2629-lenny-eabi.dd part4 -oloop,offset=0xc40000
    cd part4
    sudo tar -jcS -b8 --one -v -f ../part4.tar.bz2 .
    cd ..
    sudo umount part4

Copy the partitions to the SD card:

    sudo dd if=boot.dd  of=/dev/sdX           (where X = your sd card letter)
    sudo dd if=part2.dd of=/dev/sdX2 bs=2048  (where X = your sd card letter)
    sudo dd if=part3.dd of=/dev/sdX3 bs=1M    (where X = your sd card letter)
    sync

    mkdir sd4
    sudo mount /dev/sdX4 sd4
    (where X = your sd card letter)
    cd sd4
    sudo tar -xjS -b8 -p -v -f ../part4.tar.bz2

Change symbolic link on partition 3 in order to boot to the SD card:

    mkdir sd3
    sudo mount /dev/sdX3 sd3   
(where X = your sd card letter)
    cd sd3
    sudo rm -i linuxrc
    sudo ln -s linuxrc-sdroot linuxrc
    cd ..

We will need a peekpoke command on the new system, so we copy it from partition 3.  It is part of the busybox suite.  So we copy busybox and then set up a symbolic link to it:

    sudo cp sd3/bin/busybox sd4/usr/local/bin/
    pushd sd4/usr/local/bin/
    sudo ln -s busybox peekpoke
    popd

Unmount everything and confirm that everything was unmounted:

    sudo umount sd3
    sudo umount sd4
    df

Remove SD card from the host and place it in the ts-7260.

Connect both a cross-over serial cable and cross-over ethernet cable between the host system and the ts-7260.

     Access the serial console port with something like this:

    sudo apt-get install picocom
    picocom -b 115200 /dev/ttyS0


    You may also need to set up your host ethernet port:

    sudo ifconfig eth0 192.168.0.1

If you don't already have the ts-7260 running and supporting SSH, do the following:

    Using picocom to access the serial console port, set the ts-7260 clock:

    date -s MMDDhhmmCCYY
    hwclock --systohc

    Then generate the ts-7260 SSH host key:

    dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key

    You should now be able to SSH to the ts-7260 from your host system via the default IP address.

    ssh

    Press <Enter> to enter no password.  On some systems you may need to set a password for SSH to work.

Now on the host system, download the tsbootrom-update program:

    wget "ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/binaries/ts-utils/tsbootrom-update"
    ls -l tsbootrom-update

And copy it to the ts-7260 board:

    cat tsbootrom-update | ssh "cat > tsbootrom-update"
    ls -l tsbootrom-update

Verify that the tsbootrom-update file size on the host system and the ts-7260 agree.

(Side note: Looking at what I did above, I don't remember why I didn't just use scp to copy the file.  Perhaps scp doesn't work yet on this system?  I can't go back now to find out.  If scp works for you, that would be a better way to transfer the file!)

From the serial console, get the ts-7260 MAC address and verify that it looks ok:

    mac=$( ifconfig eth0 | grep HWaddr | cut -d' ' -f11 )
    echo "[$mac]"

From the above command, my MAC address reads, "[00:d0:69:42:10:01]".  If you run into problems and need a MAC address, feel free to use mine!  We're never going to be running in the same LAN anyway!

When you're certain the mac address is OK and you're ready to go, run the tsbootrom-update.  Beware: this is the point of no return!

    chmod +x tsbootrom-update
    ./tsbootrom-update -s -m $mac
    reboot

If everything goes well, this will boot you into a ramdisk shell.  To change to boot to the SD card, do the following:

    cd /
    rm -i linuxrc
    ln -s linuxrc-sdroot linuxrc
    save
    reboot

Again if everything goes well, this will boot you into the 2.6 kernel running Lenny!

You'll probably notice that the system runs slower under the 2.6 kernel and Lenny, but that's the price to pay for a Debian distribution on a slower machine!

On the ts-7260, the USB will no longer be powered on by default.  cf. http://tech.groups.yahoo.com/group/ts-7000/message/16816

You can use this command to power it on:

    peekpoke 8 0x12000000 $[ $( peekpoke 8 0x12000000 ) | 2 ]

You can add this to your rc.local script if you change the command to include the full path for peekpoke (i.e., /usr/local/bin/peekpoke).   Note that I use '| 2' instead of '+ 2'.  This is important because when you reboot the board without powering down it retains its value and you don't want to just keep incrementing it!

Since Lenny is now in the Debian archive, you should change the /etc/apt/sources.list file to this:

    deb http://archive.kernel.org/debian-archive/debian lenny main

Now if you connect your board to the internet, you can get the last Lenny updates with:

    apt-get update
    apt-get upgrade

And you can install whatever Lenny software you need with:

    apt-get install <package name>

That's the fun of having a full-featured Debian Lenny system!


2. Compiling 2.6 kernel from source

Now that you have a working 2.6 kernel Lenny system, let's discuss how to compile the kernel from source.  The key here is to use the correct source (having the exact same version) and the correct tool chain.  I've found that most of the time when I get compiler errors it's because I'm using the wrong source, the wrong tool chain, or the wrong configuration.

So we're going to start by downloading the working 2.6 configuration from the ts-7260 board:

On the host system in our working directory, get the configuration from the ts-7260 board:

    ssh "zcat /proc/config.gz" > config.org

Download the 2.6.29-ts source and gnueabi tool chain:

    wget "ftp://ftp.embeddedarm.com/application-kits/ts-wifibox/sources/tskernel-2.6.29-ts-src.tar.gz"
    tar xzvf tskernel-2.6.29-ts-src.tar.gz

    wget "ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7800-linux/cross-toolchains/ts7800-crosstool-linux-gnueabi-2005q3-2.tar.gz"
    tar xzvf ts7800-crosstool-linux-gnueabi-2005q3-2.tar.gz

Edit the Makefile to use our toolchain:

    cd linux-2.6.29-ts
    edit Makefile
       
change CROSS_COMPILE to:
            CROSS_COMPILE = $(TOPDIR)/../arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-

Make the base configuration the same as our working system:

    make clean
    make distclean
    cp config.org .config

Add some modules that are not present (which also lets menuconfig do some needed processing for us):

    make menuconfig

        Device Drivers -
            Character devices -
                Serial drivers -
                    <M> TSUART support
                    <M> TSUART driver for TS-7400

Now build the kernel and modules:

    make zImage
    make modules
    make modules_install INSTALL_MOD_PATH=output

Do some file cleanup (these are my preferences--it's puts all the output in the same directory):

    mv vmlinux* output/
    cp arch/arm/boot/zImage output/zImage-2.6.29-ts

After powering down the ts-7260, remove the SD card and insert it into the host system.  This must be a working SD card, as we're only going to update the kernel and kernel modules.

Copy the zImage file to the SD card:

    sudo dd if=output/zImage-2.6.29-ts of=/dev/sdX2 bs=2048     (where X = your SD card)
    sync

Copy the modules to the SD card:

    sudo mount /dev/sdX4 ../sd4    (where X = your SD card)
    sudo cp -a -f -v output/lib/* ../sd4/lib/
    sync
    pushd ../sd4
    sudo chown -R root.root lib
    sync
    popd
    sudo umount ../sd4

Remove SD card from host system and insert it into the ts-7260 board.  Power up the board and confirm that everything is working.

On the ts-7260, update the modules.

    depmod -a
    reboot

I'd suggest getting this base kernel working first, then make whatever changes are needed via make menuconfig.  Doing this one step at a time makes debugging problems a lot easier!

If this was a help to you, please let me know!

Enjoy,
Ron



__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU