How to boot a board from a SD card

From RidgeRun Developer Connection

(Difference between revisions)
Jump to:navigation, search
(Creating a SD card image)
(8 intermediate revisions not shown)
Line 1: Line 1:
-
In this section it will be shown how to boot your file system directly from your SD card. For this tutorial the free SDK for the LeopardBoard DM365 but in most of SDKs you will find similar options.
+
= Introduction =
-
1. First you must get a SD Card and format it with a software tool like gParted with the EXT3 system type.
+
In this section it will be shown how to boot your board directly from your SD card. For this tutorial it will be used the Stable Release of the SDK for the LeopardBoard DM368 (called 2011Q2) but in most of SDKs you will find similar options.
-
2. Introduce your SD card on your SD card reader and copy all the files allocated in <DEVDIR_ROOT>/fs/fs/ to it.
 
-
3. Enter the configuration menu of your SDK (''make config''), go to ''File system configuration'' and select the ''Secure digital card''  from the ''File system image target'' menu.
+
= Disabling Ubuntu Auto-Mount =
-
4. Run the ''make'' command and then ''make install''.
+
When the SDK installer is putting a new file system on a partition, it seems on some (fast) machines a race condition occurs when the Nautilus file system manager auto-mounter is able to mount the file. To disable Nautilus from auto-mounting file systems, run
-
5. Start your board and stop it on the U-Boot prompt. Type ''printenv'' and copy the ''bootargs'' variable.
+
gconf-editor
-
6. In this variable will be a parameter ''root='' that will have no arguments. Set it as ''root=/dev/mmcblk0p1'' and modify your bootargs line as is shown below
+
and in the apps/nautilus/preferences tree, unselect media_automount.
 +
 
 +
= Instruction to boot from SD card using the SDK 2011Q2 =
 +
 
 +
In our new Stable Release of the SDK (called 2011Q2) and later versions you will be able to find a new option to boot your board from the SD card, this means you will be able to load the bootloader and kernel images directly from a SD card. For this example we will use NFS for file system.
 +
 
 +
1. Got to you SDK's path:  ''cd <mySDKPath>''. <br>
 +
2. Run ''make config''.<br>
 +
3. Go to ''Installer Configuration''.<br>
 +
4. Press ENTER in the ''"Firmware deployment mode"'' option.<br>
 +
5. Select ''"Deploy all the firmware to an SD card"''.<br>
 +
6. If you want to put your file system to the SD card too, select the ''"Secure Digital Card"'' option on<br>
 +
 
 +
-> File System Configuration
 +
    -> File system image target
 +
 
 +
7. Now you can choose how to flash your SD card with the images: creating a sdcard image or write the images directly to your SD card. Both methods are shown in the following sections.<br>
 +
 
 +
== Creating a SD card image ==
 +
 
 +
This is the default option, you will see the ''"Flash SD card image into loopback file instead of real SD"'' option selected. This method creates a SD image that then you will be able to write to a real SD card. In order to do this follow the next steps:
 +
 
 +
1. Select the size of the image you want to create by typing it the ''"Size of loopback device for SD card"'', by default it is set to 128MB and in most of the cases this value is enough.<br>
 +
2. Exit you configuration wizard and type ''make install'' into your SDK's path. A warning message will be prompted, just type ''yes'' and wait until the process finishes.<br>
 +
3. After that a file called ''sdcard.img'' will be created into the ''<mySDKPath>/images/'' directory. <br>
 +
4. Insert a SD card in your PC and wait until it is mounted. <br>
 +
5. Type ''mount'' and verify the name of the device associated to your SD card as is shown below:<br>
<pre>
<pre>
-
setenv bootargs '[...] root=/dev/mmcblk0p1 rootdelay=2 rootfstype=ext3 [...]'
+
'''/dev/sdb1''' on /media/boot type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush)
</pre>
</pre>
-
7. Execute the previous line on your U-Boot prompt and then type ''saveenv''.
+
6. Umount the media by typing the following command:
 +
 
 +
<pre>
 +
sudo umount <directory where your SD card was mounted i.e. /media/boot >
 +
</pre>
 +
 
 +
7. Go to the ''images'' directory and run the following command:
 +
 
 +
<pre>
 +
sudo dd bs=64M if=sdcard.img of=/dev/sdX
 +
</pre>
 +
 
 +
Where '''sdX''' represents the device name gotten in 5, for the example presented it would be '''sdb'''.
 +
 
 +
8. Once the process finishes insert the SD card into your board and turn ON the dip switch 2, then power on the board, it will start booting from your SD card now.<br>
 +
 
 +
== Write to the SD card directly ==
 +
 
 +
This method allows you to write a SD card directly using your SDK storing the kernel and bootloader images on it. In order to do that you must follow the next steps:
-
8. Run the ''boot'' command and wait while your board starts.
+
1. Unselect the option ''"Flash SD card image into loopback file instead of real SD"''.<br>
 +
2. Repeat steps 5 and 6 of the previous section. <br>
 +
3. In step 1 a new option called ''"SD device on Linux host"'' will appear, type the name of the device associated with your SD card on it.<br>
 +
4. Save the changes and exit to your SDK's path.<br>
 +
5. Run ''make install'' and wait until the SD card has been wrote.<br>
 +
6. Once the process finishes insert the SD card into your board and turn ON the dip switch 2, then power on the board, it will start booting from your SD card now.<br>

Revision as of 15:04, 25 December 2012

Contents

Introduction

In this section it will be shown how to boot your board directly from your SD card. For this tutorial it will be used the Stable Release of the SDK for the LeopardBoard DM368 (called 2011Q2) but in most of SDKs you will find similar options.


Disabling Ubuntu Auto-Mount

When the SDK installer is putting a new file system on a partition, it seems on some (fast) machines a race condition occurs when the Nautilus file system manager auto-mounter is able to mount the file. To disable Nautilus from auto-mounting file systems, run

gconf-editor

and in the apps/nautilus/preferences tree, unselect media_automount.

Instruction to boot from SD card using the SDK 2011Q2

In our new Stable Release of the SDK (called 2011Q2) and later versions you will be able to find a new option to boot your board from the SD card, this means you will be able to load the bootloader and kernel images directly from a SD card. For this example we will use NFS for file system.

1. Got to you SDK's path: cd <mySDKPath>.
2. Run make config.
3. Go to Installer Configuration.
4. Press ENTER in the "Firmware deployment mode" option.
5. Select "Deploy all the firmware to an SD card".
6. If you want to put your file system to the SD card too, select the "Secure Digital Card" option on

-> File System Configuration 
   -> File system image target

7. Now you can choose how to flash your SD card with the images: creating a sdcard image or write the images directly to your SD card. Both methods are shown in the following sections.

Creating a SD card image

This is the default option, you will see the "Flash SD card image into loopback file instead of real SD" option selected. This method creates a SD image that then you will be able to write to a real SD card. In order to do this follow the next steps:

1. Select the size of the image you want to create by typing it the "Size of loopback device for SD card", by default it is set to 128MB and in most of the cases this value is enough.
2. Exit you configuration wizard and type make install into your SDK's path. A warning message will be prompted, just type yes and wait until the process finishes.
3. After that a file called sdcard.img will be created into the <mySDKPath>/images/ directory.
4. Insert a SD card in your PC and wait until it is mounted.
5. Type mount and verify the name of the device associated to your SD card as is shown below:

'''/dev/sdb1''' on /media/boot type vfat (rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush)

6. Umount the media by typing the following command:

sudo umount <directory where your SD card was mounted i.e. /media/boot >

7. Go to the images directory and run the following command:

sudo dd bs=64M if=sdcard.img of=/dev/sdX

Where sdX represents the device name gotten in 5, for the example presented it would be sdb.

8. Once the process finishes insert the SD card into your board and turn ON the dip switch 2, then power on the board, it will start booting from your SD card now.

Write to the SD card directly

This method allows you to write a SD card directly using your SDK storing the kernel and bootloader images on it. In order to do that you must follow the next steps:

1. Unselect the option "Flash SD card image into loopback file instead of real SD".
2. Repeat steps 5 and 6 of the previous section.
3. In step 1 a new option called "SD device on Linux host" will appear, type the name of the device associated with your SD card on it.
4. Save the changes and exit to your SDK's path.
5. Run make install and wait until the SD card has been wrote.
6. Once the process finishes insert the SD card into your board and turn ON the dip switch 2, then power on the board, it will start booting from your SD card now.

Navigation
Toolbox