Creating a bootable microSD card

From RidgeRun Developer Connection

Jump to:navigation, search

The Overo board will boot directly from a properly prepared microSD card. This section will outline how to partition and format a bootable microSD card. In order to create a bootable microSD compatible with the OMAP3 boot ROM, the SDK automatically format the SD and save the necessary images in the correct partitions.

This example will show the steps for setting up a 2GB microSD card.

Contents

Verify your SD CARD is working

First insert your card into your development machine's flash card slot. You may need to use a microSD to SD card adaptor to fit your slot. You can use 'mount' or 'df' to see where the card mounts on your machine.

$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1            234521212  35058568 187549648  16% /
none                   1009920       372   1009548   1% /dev
none                   1014140      1940   1012200   1% /dev/shm
none                   1014140       124   1014016   1% /var/run
none                   1014140         0   1014140   0% /var/lock
none                   1014140         0   1014140   0% /lib/init/rw
                    
/dev/sdd1                39497      4916     34582  13% /media/boot
/dev/sdd2              1857948     93928   1669640   6% /media/rootfs

Set the correct options installer

Installer-configuration.png

The option (/dev/sdd) SD device could vary , and its depends on each PC and SD card. The option (/dev/ttyUSB0) Serial port for target communication allow the pc to have a console running on the target. The options Create and format the SD partitions (FAT and Ext3) , allow the SDK format the SD card and create two partitions A FAT partition: I'll have the bootloader , xloader and kernel images

A linux partition (Ext3) to 
  [*]   Create and format the SD partitions (FAT and Ext3)                           
                    Bootloader destination (Flash)  --->                                         
                    Kernel destination (SD)  --->                                                
                    File System destination (SD)  --->     

There are three files required on the first (FAT) partition to boot your Overo:

MLO:

The boot-loader loader - this small program is loaded into the OMAP3 processor's static RAM. It does some minimal configuration of system memory and io pins and then loads the second file.

u-boot.bin

The boot loader image At a minimum an embedded bootloader provides the following features:

uImage:

The linux kernel

You can build these yourself and download pre-built images. or use the SDK installer. It is important that these three files have precisely these names. , but the SDK installer automatically set those names.

Prefilling SD card with 0xFF

You may want to fill the SD card with 0xFF first so that an image made by copying the entire SD card compresses better.

SD_DEV=/dev/sdd
tr "\000" "\377" < /dev/zero | sudo dd bs=16M of=${SD_DEV}

Running the SDK installer

The SD card must be on on the SD Card Reader Be sure u-boot is running on port /dev/ttyUSB0 and none process (like minicom) is using it

on the terminal run the following command

make install

The SDK installer will automatically set all the environment on the u-boot and save the images to the SD Card this is the log derived from the installation

$ make install
------------------------------------------------------------------------------------------------------
  Ridgerun Linux SDK
  Board configuration: Gumstix Overo Board
 
  Installation system of uboot images over TFTP for host 1500
  Please be sure u-boot is running on port /dev/ttyUSB0 and none process (like minicom) is using it
  u-boot port /dev/ttyUSB0

  Performing handshake with u-boot...done.

  Trying to identify NAND block size... detected 0x20000

  Creating SD partitions on the device /dev/sdd... 
    a) Boot partition for Bootloader and kernel
    b) Root File System partition

    Unmounting the existent partitons...
    sudo umount /dev/sdd'1'
    sudo umount /dev/sdd'2'

    Creating the partitions...
    sudo fdisk /dev/sdd < .sd

    Formating partitions...
    sudo mkfs.vfat -F 32 /dev/sdd'1' -n boot
    sudo mkfs.ext3 /dev/sdd'2' -L rootfs
    sudo fsck.ext3 /dev/sdd'2'
e2fsck 1.41.11 (14-Mar-2010)
fsck.ext3: Superblock invalid, trying backup blocks...
fsck.ext3: Bad magic number in super-block while trying to open /dev/sdd

The superblock could not be read or does not describe a correct ext2
filesystem.  If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>

    The partition table is:

Disk /dev/sdd: 1977 MB, 1977614336 bytes
255 heads, 63 sectors/track, 240 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: 0x6308582a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1           5       40131    c  W95 FAT32 (LBA)
/dev/sdd2               6         240     1887637+  83  Linux

  Verifying if kernel needs to be installed...
  Flashing Kernel image to SD...

  Mounting boot partition...
    sudo mount /dev/sdd'1' images/boot

  Copying the kernel into the SD...
    cp $(DEVDIR)/images/kernel.uImage $(DEVDIR)/images/boot/

  Unmounting the boot partition...
    sudo umount $(DEVDIR)images/boot

  Saving new kernel load address...
    Uboot <= setenv kernelloadaddr 0x82000000

  Verifying if file system needs to be installed...
  Flashing File System to SD...

  Unmounting rootfs partition...
    sudo umount /dev/sdd'2'

  Formating rootfs partition...
    sudo mkfs.ext3 /dev/sdd'2' -L rootfs
  Mounting rootfs partition...
    sudo mount -t ext3 /dev/sdd'2' images/rootfs

  Copying the File System into the SD...
    cd fs/fs && find . | sudo cpio -pdum images/rootfs/

201312 blocks
  Unmounting the rootfs partition...
    sudo umount /dev/sdd'2'

    sudo fsck.ext3 /dev/sdd'2'
e2fsck 1.41.11 (14-Mar-2010)
e2fsck: need terminal for interactive repairs

  Verifying if kernel command line needs to be installed...
  Kernel command line doesn't need to be installed

  Verifying if the boot command needs to be installed...
    Uboot <= setenv bootcmd 'mmc init ; fatload mmc 0 \${kernelloadaddr} kernel.uImage ; bootm \${kernelloadaddr}'
    Uboot <= setenv autostart yes
    Uboot <= saveenv

Reboot the board with the SD

After all the process , reboot the target with the SD an the check the installation works properly

Navigation
Toolbox