Create a bootable microSD. Part 1: Partition & Format

This tutorial illustrates how to create a bootable microSD card to load Linux on the FOX Board G20.

Introduction

The very fist piece of code executed by the FOX Board G20 at the startup is RomBOOT. This firmware is burned inside the Atmel CPU and for first it tries to find executable code on the Dataflash memory.

Until August 2010 all the FOX Board G20 Dataflash was been programmed with two bootloaders:

  1. AT91Bootstrap an Atmel firmware used to initializate the hardware and execute u-Boot.
  2. u-Boot (http://www.denx.de/wiki/U-Boot/WebHome) a general purpose boot loader that loads the Linux image from the microSD card.

Starting from September 2010 the all the FOX Board G20 Dataflash will be programmed with a unique bootloader:

  1. AcmeBoot a specialized version of AT91Bootstrap that loads and launches the Linux uimage directly (learn more...).

In either case the microSD has to be parted in two:

  1. A FAT16 partition with the kernke uimage
  2. A linux partition formatted in ext2,3,4 or reiserFS with the rootfs files
microSD
|
+- FAT16 partition labeled "kernel"
|  |
|  +-- uimage.bin (used by uboot) or uimage (used by acmeboot)
|  +-- foxg20-script.bin (used only by u-boot)
|
+- Linux partition labeled "rootfs"
   |
   +-- /etc
   +-- /bin
   +-- /var
   +... ...

micro SD partition & format

The blank microSD usually are formatted with just one big FAT partition that is not usable to store the rootfs.

To delete this partition and create the partition structure required bt the FOX it's need a Linux PC.

Insert the microSD memory card in an USB card reader then start a terminal session and type:

$ dmesg
...
[13731.581204] usb 1-3.4: new high speed USB device using ehci_hcd and address 13
[13731.678951] usb 1-3.4: configuration #1 chosen from 1 choice
[13731.679962] scsi15 : SCSI emulation for USB Mass Storage devices
[13731.685523] usb-storage: device found at 13
[13731.685528] usb-storage: waiting for device to settle before scanning
[13736.685830] usb-storage: device scan complete
[13736.687821] scsi 15:0:0:0: Direct-Access     Generic  USB  SD Reader   1.00 PQ: 0 ANSI: 0 CCS
[13736.689123] sd 15:0:0:0: Attached scsi generic sg2 type 0
[13736.699438] sd 15:0:0:0: [sdb] 3911680 512-byte logical blocks: (2.00 GB/1.86 GiB)
[13736.700061] sd 15:0:0:0: [sdb] Write Protect is off
[13736.700067] sd 15:0:0:0: [sdb] Mode Sense: 4b 00 00 08
[13736.700072] sd 15:0:0:0: [sdb] Assuming drive cache: write through
[13736.702662] sd 15:0:0:0: [sdb] Assuming drive cache: write through
[13736.702671]  sdb: sdb1
[13736.709301] sd 15:0:0:0: [sdb] Assuming drive cache: write through
[13736.709309] sd 15:0:0:0: [sdb] Attached SCSI removable disk
$

This indicates that the unique FAT16 partition of microSD is allocated as /dev/sdb1 disk.

Be sure to well understand which is the device allocated to the microSD (in this case /dev/sdb ) to avoid to erase your hard disk !!

The following operations will destroy all the data contained on microSD so please be sure that you don't have any useful file on your microSD card.

Unmount the microSD and delete the factory default FAT16 partition:

$ sudo umount /dev/sdb1
$ sudo parted /dev/sdb -s rm 1

Now create the two partition required:

$ sudo parted /dev/sdb -s mkpart primary 0 31.99MB 
$ sudo parted /dev/sdb -s mkpart primary 32MB 2GB

And format it:

$ sudo mkdosfs /dev/sdb1 -n kernel
mkdosfs 3.0.3 (18 May 2009)
$ sudo mke2fs -t ext4 -O ^has_journal /dev/sdb2 -L rootfs
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=rootfs
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
120000 inodes, 479941 blocks
23997 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=494927872
15 block groups
32768 blocks per group, 32768 fragments per group
8000 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912
 
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done
 
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
...

Remove the microSD, wait 10 sec and insert again, the new partition will be mounted automatically on:

  • /media/kernel
  • /media/rootfs

Now proceed to fill these partitions with the contents required by the FOX Board G20.

(Continue...).

 
dev/bootable-microsd.txt · Last modified: 2010/08/27 12:51 by tanzox
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki