Notes

Kernel wird von einem Usb-Stick geladen. Das Root-Verzeichnis von einer NFS Freigabe.

Wichtige Debian Packete:

gpios anpassen

** /usr/src/linux-source-2.6.36-rc6/arch/arm/mach-kirkwood/sheevaplug-setup.h **

static struct gpio_led sheevaplug_led_pins[] = {
        {
                .name                   = "plug:green:health",
                .default_trigger        = "default-on",
                .gpio                   = 46,   /*green led*/
                .active_low             = 1,
        },
        {
                .name                   = "dockstar:orange:misc",
                .default_trigger        = "none",
                .gpio                   = 47, /* orange */
                .active_low             = 1,
        }
};

static unsigned int sheevaplug_mpp_config[] __initdata = {
        MPP29_GPIO,     /* USB Power Enable */
        MPP46_GPIO,     /* LED green*/
        MPP47_GPIO,     /* LED orange*/

        0
};

** vim /usr/src/linux-source-2.6.36-rc6/arch/arm/mach-kirkwood/mpp.c **

...
#define MPP19_GPO               MPP( 19, 0x0, 0, 1, 1,   1,   1,   1,   1 )
#define MPP19_NF_IO1            MPP( 19, 0x1, 1, 1, 1,   1,   1,   1,   1 )
...
#define MPP46_GPIO              MPP( 46, 0x0, 1, 1, 0,   0,   0,   1,   1 )
#define MPP46_TSMP10            MPP( 46, 0x1, 1, 1, 0,   0,   0,   1,   1 )
#define MPP46_TDM_FS            MPP( 46, 0x2, 1, 1, 0,   0,   0,   1,   1 )
#define MPP46_LCD_HSYNC         MPP( 46, 0xb, 0, 0, 0,   0,   0,   0,   1 )
...

Kernel und Initrd

Cross Compile Kernel unter Debian

aptitude install emdebian-archive-keyring
...
deb http://www.emdebian.org/debian wheezy main
aptitude update
aptitude install gcc-4.4-arm-linux-gnueabi uboot-mkimage
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.tar.bz2
tar -xvjf linux-3.6.tar.bz2
cd linux-3.6.tar.bz2
(eventuell eine funktionierende .config einfügen)
ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make menuconfig
ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- make uImage modules
ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/mnt/stick/lib/modules make modules_install
chroot /mnt/stick
mkinitramfs -o /boot/initrd-3.6.0-arm 3.6.0
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x01100000 -e 0 -d /boot/initrd.img-3.6.0-arm /boot/uInitrd

Kernel Image und Initrd nativ auf einem Dockstar kompilieren

root@arm-kiste:~# dpkg -i linux-source-2.6.irgentwas.deb
root@arm-kiste:~# cd /usr/src/linux-source-2.6.irgentwas
root@arm-kiste:~# make menuconfig #am besten man hat eine alte funktionierende .config
root@arm-kiste:~# make uImage modules modules_install #benötigt swap
root@arm-kiste:~# update-initramfs -u
(root@arm-kiste:~# update-initramfs -c -k 2.6.38)
root@arm-kiste:~# cd /boot
root@arm-kiste:~# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x01100000 -e 0 -n "initrd.img-2.6.32-5-kirkwood" -d initrd.img-2.6.32-5-kirkwood uInitrdnfs

uboot

via rs232:

setenv ipaddr 10.2.2.30; 
setenv netmask 255.255.255.0; 
setenv gatewayip 10.2.2.1;
setenv serverip 10.2.2.10

setenv bootargs root=/dev/nfs nfsroot=10.2.2.10:/tank/plugs/test_root ip=10.2.2.30:10.2.2.10:10.2.2.1:255.255.255.0::eth0: console=ttyS0,115200

usb start
ext2load usb 0:1 0x01100000 /uInitrd
ext2load usb 0:1 0x00800000 /uImage
bootm 0x00800000 0x01100000

auto boot

Startet vom ersten gefundenen usb Gerät.

Marvell>> setenv bootcmd_usb "usb start; ext2load usb 0:1 0x01100000 /uInitrd; ext2load usb 0:1 0x00800000 /uImage"
Marvell>> setenv bootcmd "run bootcmd_usb; bootm 0x00800000 0x01100000"
Marvell>> saveenv
Marvell>> boot

uboot aus Linux konfigurieren

aptitude install uboot-envtools

/etc/fw_env.config

# MTD device name   Device offset   Env. size   Flash sector size   Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000

fw_printenv

fw_setenv

USB Stick als Root

Erste Partition ca. 100MB für Kernel und initrd, zweite für das root, swap nicht vergessen! Die Dockstar hat nur 128MB Ram.

ext4

nilfs

notes

root@thinkpad:/home/marc# fdisk -l /dev/sdb

Disk /dev/sdb: 16.1 GB, 16055795712 bytes
64 heads, 32 sectors/track, 15312 cylinders, total 31358976 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: 0x000c99c8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              32      249855      124912   83  Linux
/dev/sdb2          249856    31358975    15554560   83  Linux
root@thinkpad:/home/marc# nilfs-resize -v /dev/sdb2 30109119s
Partition size = 15927869440 bytes.
Shrink the filesystem size from 15927869440 bytes to 15415868928 bytes.
1529 free segments (12826181632 bytes) will be left after shrinkage.
61 segments will be truncated from segnum 1837.
Do you wish to proceed (y/N)? y
Truncating segments.
Done.
root@thinkpad:/home/marc#

** 21.04.13 ** Resize rootfs 6GB, swap 1GB, data rest(ca. 10GB)

  1. 6GB -> 6 * 1000 * 1000 * 1000 / 512 = 11718750s (6000000000Byte)

  2. nilfs-cleaner ausführen um genügend Speicher frei zu räumen.

  3. nilfs-resize -v /dev/sdc2 11718750s root@thinkpad:/home/marc# nilfs-resize -v /dev/sdc2 11718750s Partition size = 15927869440 bytes. Shrink the filesystem size from 15927869440 bytes to 6000000000 bytes. 442 free segments (3707764736 bytes) will be left after shrinkage. 1183 segments will be truncated from segnum 715. Do you wish to proceed (y/N)? y Truncating segments. Done. root@thinkpad:/home/marc#

  4. Paritition verkleinern und neue erstellen `root@thinkpad:/home/marc# fdisk /dev/sdc -l

    Disk /dev/sdc: 16.1 GB, 16055795712 bytes 64 heads, 32 sectors/track, 15312 cylinders, total 31358976 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: 0x000c99c8

            Device Boot Start End Blocks Id System

    /dev/sdc1 32 249855 124912 83 Linux /dev/sdc2 249856 11968606 5859375+ 83 Linux /dev/sdc3 11968607 14065758 1048576 83 Linux /dev/sdc4 14065759 31358975 8646608+ 83 Linux `

  5. Dateisysteme:

    1. mkswap -L swap /dev/sdc3
    2. mkfs.ext4 -L data /dev/sdc4

beachten: http://en.wikipedia.org/wiki/Binary_prefix

Root Verzeichnis erstellen

debootstrap

aptitude install qemu-user-static

root@thinkpad:~# debootstrap --foreign --arch armel wheezy /mnt/stick
root@thinkpad:~# cp /usr/bin/qemu-arm-static /mnt/stick/usr/bin/
root@thinkpad:~# chroot /mnt/stick

I have no name!@thinkpad:/# /debootstrap/debootstrap --second-stage
I have no name!@thinkpad:/# echo "bla" > /etc/hostname
I have no name!@thinkpad:/# exit

root@thinkpad:~# chroot /mnt/stick

root@bla:~# echo "deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free" > /etc/apt/sources.list
root@bla:~# aptitude update
root@bla:~# aptitude install locales vim ntp openssh-server
root@bla:~# dpkg-reconfigure locales
root@bla:~# dpkg-reconfigure tzdata
root@bla:~# passwd

Anpassungen

/etc/inittab

In der inittab müssen folgende Zeilen geändert werden damit man mit dem seriellen Terminal auf die erste Konsole zugreifen kann.

1:2345:respawn:/sbin/getty 115200 ttyS0
#2:23:respawn:/sbin/getty 38400 tty2

#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

/etc/fstab

/dev/sda2 / nilfs2 noatime 0 0

/etc/network/interfaces

auto eth0
iface eth0 inet static
    address 10.2.2.30
    netmask 255.255.255.0
    gateway 10.2.2.1
    dns-domain localnet.cc
    dns-nameservers 10.2.2.1

Restore aus backup

Partitionstabelle

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              32      194559       97264   83  Linux
/dev/sdb2          194560    27537407    13671424   83  Linux
/dev/sdb3        27537408    31442943     1952768   83  Linux

Dateisysteme

# mkfs.ext2 /dev/sdb1
# mkfs.ext4 /dev/sdb2
# mkswap /dev/sdb3

In root müssen die Verzeichnisse /proc und /sys erstellt werden.

Pinout

GPIOs

Die Pinbelegungen der GPIOs gibts im Dockstar Artikel auf Mikrocontroller.net:

http://www.mikrocontroller.net/articles/Dockstar

PIN Funktion Widerstand
MPP1 NF_D3 4,7k to GND
MPP2 NF_D4 4,7k to 3,3V
MPP3 NF_D5 4,7k to GND
MPP8 TW_SDA 4,7k to 3,3V
MPP9 TW_SCK 4,7k to 3,3V
MPP15 SD_D1 4,7k to 3,3V
MPP16 SD_D2 4,7k to 3,3V
MPP18 NF_IO0 4,7k to GND
MPP19 NF_IO1 4,7k to GND

10pol Stiftleiste (JTAG/UART)

Pin1 >>           3.3V | GND
   JTAG RESET ? SRST ? | UART TxD
              JTAG TDI | UART RxD
          JTAG TMS CPU | JTAG NRST ? TRST ? SRST?
              JTAG CLK | JTAG TDO
Dockstar Pinout JTAG,UART

JTAG lesen/schreiben

** NIE GETESTET **

http://nil-techno.blogspot.de/2009/10/openocd-and-sheevaplug-on-linux-x8664.html

Interessante Links

http://www.plugapps.com/index.php5?title=Hardware:_Seagate_DockStar_JTAG