Architectures/ARM/SheevaplugSDCard

From FedoraProject

Jump to: navigation, search

HOWTO: SheevaPlug Fedora SD Card


This howto will cover installing Fedora (12) on a SheevaPlug running on a SD Ram card.


Prep the SD Card


Add the SD Card to your linux box you are building this on and run:

[root@wigeon ~]# dmesg | tail
scsi 8:0:0:0: Direct-Access     HP       v100w            4096 PQ: 0 ANSI: 0 CCS
sd 8:0:0:0: Attached scsi generic sg2 type 0
sd 8:0:0:0: [sdb] 7831552 512-byte hardware sectors: (4.00 GB/3.73 GiB)
sd 8:0:0:0: [sdb] Write Protect is off
sd 8:0:0:0: [sdb] Mode Sense: 43 00 00 00
sd 8:0:0:0: [sdb] Assuming drive cache: write through
sd 8:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 8:0:0:0: [sdb] Attached SCSI removable disk
[root@wigeon ~]#

Next run fdisk to create the partition table. I created one large partition skipping swap, no need to swap on to an SD card.


[root@wigeon ~]# fdisk /dev/sdb
The number of cylinders for this disk is set to 1125.
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): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 1
First cylinder (1-1125, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1125, default 1125):
Using default value 1125
Command (m for help): a
Partition number (1-4): 1
Command (m for help): t 
Selected partition 1
        be  Solaris boot    ff  BBT
Hex code (type L to list codes): 83
Command (m for help): p
Disk /dev/sdb: 4009 MB, 4009754624 bytes
145 heads, 48 sectors/track, 1125 cylinders
Units = cylinders of 6960 * 512 = 3563520 bytes
Disk identifier: 0xc3072e18
 Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1125     3914976   83  Linux
Command (m for help):  w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Create the filesystem:

[root@wigeon ~]# mkfs.ext2 /dev/sdb1
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
244800 inodes, 978744 blocks
48937 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1002438656
30 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
       32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Install Fedora on the SD Card


Download the distro and kernel

[root@wigeon tmp]# cd /tmp
[root@wigeon tmp]# wget http://ftp.linux.org.uk/pub/linux/arm/fedora/platforms/sheevaplug/uImage-2.6.30-sheevaplug
[root@wigeon tmp]# wget http://ftp.linux.org.uk/pub/linux/arm/fedora/rootfs/rootfs-f12.tar.bz2

Create a mount point for the SD card and mount.

[root@wigeon tmp]# mkdir /media/flash
[root@wigeon tmp]# mount /dev/sdb1 /media/flash/

Copy the distro over.

[root@wigeon tmp]# tar -jxf rootfs-f12.tar.bz2
[root@wigeon tmp]# cp -r rootfs-f12/* /media/flash/
[root@wigeon tmp]# cp uImage-2.6.30-sheevaplug /media/flash/boot/

Customize the OS.

Edit the fstab, change / partition to /dev/mmcblk0p1:

[root@wigeon tmp]# vi /media/flash/etc/fstab
....
/dev/mmcblk0p1          /                       ext2     relatime        1 0
....

Roots PW is fedoraarm, I didn't know this and editted /etc/shadow, you don't need to...

Edit the ethernet configuration:

[root@wigeon tmp]# vi /media/flash/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=YourHostnameHere
[root@wigeon tmp]# vi /media/flash/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.0.0.2
GATEWAY=10.0.0.1
DNS1=10.0.0.1
TYPE=Ethernet
USERCTL=no
PEERDNS=no
IPV6INIT=no
NM_CONTROLLED=no

Now you can umount the sd card and put it in the sheevaplug.

Prep your linux box to update the kernel


The SheevaPlug ships with a firmware that can't boot off of SD cards. So you need to update it over TFTP Install a tftp server

[root@wigeon tmp]# yum install tftp-server

Get the u-boot image and make it available to the sheevaplug.

[root@wigeon tmp]# cd /var/lib/tftpboot/
[root@wigeon tmp]# wget http://www.cyrius.com/tmp/u-boot.bin-3.4.19
[root@wigeon tmp]# mv u-boot.bin-3.4.19 uboot.bin
[root@wigeon tmp]#vi /etc/xinetd.d/tftp

Change

"disable  = yes " to "disable = no " 

Set up the linux box for serial over usb support - FTDI

[root@wigeon tftpboot]# vi /etc/udev/rules.d/85-sheevaplug.rules
# if no driver has claimed the interface yet, load ftdi_sio
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", \
       ATTRS{idVendor}=="9e88", ATTRS{idProduct}=="9e8f", \
       DRIVER=="", \
       RUN+="/sbin/modprobe -b ftdi_sio"
# add the sheevaplug VID and PID to the list of devices supported by ftdi_sio
ACTION=="add", SUBSYSTEM=="drivers", \
       ENV{DEVPATH}=="/bus/usb-serial/drivers/ftdi_sio", \
       ATTR{new_id}="9e88 9e8f"
# optionally create a convenience symlink for the console device
ACTION=="add", KERNEL=="ttyUSB*", \
       ATTRS{interface}=="SheevaPlug JTAGKey FT2232D B", \
       ATTRS{bInterfaceNumber}=="01", \
       SYMLINK+="sheevaplug"

Plug in the serial cable from the Sheevaplug, if a /dev/ttyUSBx is not created, reboot your linux system.

Connect to the sheevaplug

[root@wigeon tftpboot]# screen /dev/ttyUSBX 115200

Marvell>> setenv serverip 192.168.1.2 # IP of your TFTP server
Marvell>> setenv ipaddr 192.168.1.200 #IP of sheevaplug
Marvell>> bubt uboot.bin

**Warning**
If U-Boot Endiannes is going to change (LE->BE or BE->LE),
Then Env parameters should be overridden..
Override Env parameters? (y/n) n

Configure the boot parameters.

Marvell>>  setenv mainlineLinux yes
Marvell>>  setenv arcNumber 2097
Marvell>> setenv bootargs_console console=ttyS0,115200
Marvell>> setenv bootargs_root 'rw root=/dev/mmcblk0p1 rootdelay=10 rootfstype=ext2'
Marvell>> setenv bootcmd_mmc 'mmcinit; ext2load mmc 0 0x800000 /boot/uImage-2.6.30-sheevaplug'
Marvell>> setenv bootcmd 'setenv bootargs $(bootargs_console) $(bootargs_root); run bootcmd_mmc; bootm 0x0800000'
Marvell>>  saveenv
Marvell>> reset


The SheevaPlug should be configured now.