Setting up a gumstix SD Card

My notes, based on http://gumstix.org/create-a-bootable-microsd-card.html

fdisk -l /dev/sdd

Disk /dev/sdd: 32.2 GB, 32191283200 bytes
255 heads, 63 sectors/track, 3913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        3914    31432704    c  W95 FAT32 (LBA)

Calculate number of cylinders required:

root@ubuntu:~# bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
32191283200/255/63/512
3913.70059134765017117958
quit

Wipe the SD card:

root@ubuntu:~# dd if=/dev/zero of=/dev/sdd bs=1024 count=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 2.84156 s, 369 kB/s

Parition the disk:

root@ubuntu:~# sfdisk --force -D -uS -H 255 -S 63 -C 3913 /dev/sdd
Checking that no-one is using this disk right now ...
OK

Disk /dev/sdd: 3913 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an MSDOS signature
 /dev/sdd: unrecognised partition table type
Old situation:
No partitions found
Input in the following format; absent fields get a default value.
<start> <size> <type [E,S,L,X,hex]> <bootable [-,*]> <c,h,s> <c,h,s>
Usually you only need to specify <start> and <size> (and perhaps <type>).

/dev/sdd1 :128,130944,0x0C,*
/dev/sdd1   *       128    131071     130944   c  W95 FAT32 (LBA)
/dev/sdd2 :131072,,,-
/dev/sdd2        131072  62873599   62742528  83  Linux
/dev/sdd3 :
/dev/sdd3             1       127        127  83  Linux
/dev/sdd4 :
/dev/sdd4             0         -          0   0  Empty
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/sdd1   *       128    131071     130944   c  W95 FAT32 (LBA)
/dev/sdd2        131072  62873599   62742528  83  Linux
/dev/sdd3             1       127        127  83  Linux
/dev/sdd4             0         -          0   0  Empty
Warning: partition 1 does not end at a cylinder boundary
Do you want to write this to disk? [ynq] y
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)

Format the paritions:

Your ads will be inserted here by

Easy AdSense Pro.

Please go to the plugin admin page to paste your ad code.

root@ubuntu:~# mkfs.vfat -F 32 /dev/sdd1 -n boot
mkfs.vfat 3.0.7 (24 Dec 2009)
root@ubuntu:~# mke2fs -j -L rootfs /dev/sdd2
mke2fs 1.41.11 (14-Mar-2010)
Filesystem label=rootfs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1962240 inodes, 7842816 blocks
392140 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
240 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mount the partitions and copy the current root to them:

root@ubuntu:~# sudo mkdir /media/{boot,rootfs}
root@ubuntu:~# sudo mount -t vfat /dev/sdd1 /media/boot
root@ubuntu:~# sudo mount -t ext3 /dev/sdd2 /media/rootfs
root@ubuntu:~# cd /media/boot/
root@ubuntu:/media/boot# ls
root@ubuntu:/media/boot# cd ~
root@ubuntu:~# wget http://cumulus.gumstix.org/images/angstrom/developer/current/MLO
--2011-11-21 11:31:12--  http://cumulus.gumstix.org/images/angstrom/developer/current/MLO
Resolving cumulus.gumstix.org... 74.3.164.55
Connecting to cumulus.gumstix.org|74.3.164.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 24304 (24K)
Saving to: `MLO'

100% 24,304      49.8K/s   in 0.5s    

2011-11-21 11:31:13 (49.8 KB/s) - `MLO' saved [24304/24304]

root@ubuntu:~# mv MLO /media/boot
root@ubuntu:~# wget http://cumulus.gumstix.org/images/angstrom/developer/current/u-boot.bin
--2011-11-21 11:31:48--  http://cumulus.gumstix.org/images/angstrom/developer/current/u-boot.bin
Resolving cumulus.gumstix.org... 74.3.164.55
Connecting to cumulus.gumstix.org|74.3.164.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 269120 (263K) [application/octet-stream]
Saving to: `u-boot.bin'

100% 269,120      199K/s   in 1.3s    

2011-11-21 11:31:49 (199 KB/s) - `u-boot.bin' saved [269120/269120]

root@ubuntu:~# mv u-boot.bin /media/boot
root@ubuntu:~# wget http://cumulus.gumstix.org/images/angstrom/developer/current/uImage
--2011-11-21 11:32:08--  http://cumulus.gumstix.org/images/angstrom/developer/current/uImage
Resolving cumulus.gumstix.org... 74.3.164.55
Connecting to cumulus.gumstix.org|74.3.164.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3091308 (2.9M) 
Saving to: `uImage'

100% 3,091,308    205K/s   in 15s     

2011-11-21 11:32:23 (196 KB/s) - `uImage' saved [3091308/3091308]

root@ubuntu:~# mv uImage /media/boot
root@ubuntu:~# wget http://cumulus.gumstix.org/images/angstrom/developer/current/omap3-desktop-image-overo.tar.bz2
--2011-11-21 11:34:06--  http://cumulus.gumstix.org/images/angstrom/developer/current/omap3-desktop-image-overo.tar.bz2
Resolving cumulus.gumstix.org... 74.3.164.55
Connecting to cumulus.gumstix.org|74.3.164.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 234752536 (224M) [application/x-bzip2]
Saving to: `omap3-desktop-image-overo.tar.bz2'

100% 234,752,536  396K/s   in 13m 58s 

2011-11-21 11:48:04 (274 KB/s) - `omap3-desktop-image-overo.tar.bz2' saved [234752536/234752536]

root@ubuntu:~#  tar xaf omap3-desktop-image-overo.tar.bz2 -C /media/rootfs
root@ubuntu:~# ls /media/rootfs/
bin  boot  dev  etc  home  lib  linuxrc  lost+found  media  mnt  proc  sbin  sys  tmp  usr  var
root@ubuntu:~# sync
root@ubuntu:~# umount /media/boot
root@ubuntu:~# umount /media/rootfs

Network config

If your using a board with a network interface and want to use this at first boot:

edit /etc/network/interfaces

Add the following for a static config:

auto eth0
iface eth0 inet static
address 192.168.0.7
netmask 255.255.255.0
gateway 192.168.0.254

or uncomment the following for a dynamic config:

auto eth0
iface eth0 inet dhcp

Fin