Difference between revisions of "Prepare a bootable MicroSD Card"

From IGEP - ISEE Wiki

Jump to: navigation, search
Line 56: Line 56:
 
  [sudo] password for jdoe:
 
  [sudo] password for jdoe:
 
=='''<span class="mw-headline">Prepare a SD to boot</span>'''==
 
=='''<span class="mw-headline">Prepare a SD to boot</span>'''==
==<span id="Install_GParted" class="mw-headline">Install GParted</span>==
+
{{Message/Information Message|title=TITLE|message= <span style="color: #000000;">We are using this version of Ubuntu .........</span>}}
We will use the gparted program for create the partitions, if you don't have this program installed then you must install it with this command:
+
 
 +
 
 +
==<span id="Install_GParted" class="mw-headline">Downloading GParted</span>==
 +
In order to prepare a micro SD with your already generated u-boot you need to flash the u-boot.imx using the command dd.
 +
 
 +
It is important to prepare your micro SD card first creating a partition that leave some free space for the u-boot.imx. It can be used GPARTED as it is shown in the image:
 +
 
 +
[[File:GPARTED.png|center|713x201px]]
 +
 
 +
 
 +
And it can be installed with this command.
  
 
<pre>sudo apt-get install gparted</pre>
 
<pre>sudo apt-get install gparted</pre>
<span style="color: #ff0000;">Another method is using fdisk and creating directly two partitions:</span>
+
<span style="color: #000000;">Now we will see all the steps for this partition with GPARTED after another brief  explanation of  other method.</span>
 +
 
 +
 
 +
 
 +
* <span style="color: #000000;">Another method is using fdisk and creating directly two partitions</span>
  
 
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code">
 
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code">
==<span style="color: #ff0000;">Use sfdisk partition method</span>==
+
==<span style="color: #000000;">Using sfdisk partition method</span>==
 
<div class="codeContent panelContent pdl"><div id="highlighter_789287" class="syntaxhighlighter sh-eclipse nogutter  bash">
 
<div class="codeContent panelContent pdl"><div id="highlighter_789287" class="syntaxhighlighter sh-eclipse nogutter  bash">
{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"
+
{| class=" wikitable" style="height: 128px;" border="0" width="839" cellspacing="0" cellpadding="0"
 
|-
 
|-
| class="code"|<div class="container" title="Hint: double-click to select code"><div class="line number1 index0 alt2"><span style="color: #ff0000;"><code class="bash functions">sudo</code> <code class="bash plain">sfdisk </code><code class="bash plain">/dev/</code><code class="bash plain"> <<EOF</code></span>
+
| class="code" style="width: 825.813px;"|<div class="container" title="Hint: double-click to select code"><div class="line number1 index0 alt2"><span style="color: #000000;"><code class="bash functions">sudo</code> <code class="bash plain">sfdisk </code><code class="bash plain">/dev/</code><code class="bash plain"> <<EOF</code></span>
  
  
<div class="line number2 index1 alt1"><span style="color: #ff0000;"><code class="bash plain">label: dos</code></span></div>
+
<div class="line number2 index1 alt1"><span style="color: #000000;"><code class="bash plain">label: dos</code></span></div>
<div class="line number3 index2 alt2"><span style="color: #ff0000;"><code class="bash plain">16065,128520,0x0C,*</code></span></div>
+
<div class="line number3 index2 alt2"><span style="color: #000000;"><code class="bash plain">16065,128520,0x0C,*</code></span></div>
<div class="line number4 index3 alt1"><span style="color: #ff0000;"><code class="bash plain">144585,,,-</code></span></div>
+
<div class="line number4 index3 alt1"><span style="color: #000000;"><code class="bash plain">144585,,,-</code></span></div>
<div class="line number5 index4 alt2"><span style="color: #ff0000;"><code class="bash plain">EOF</code></span></div>
+
<div class="line number5 index4 alt2"><span style="color: #000000;"><code class="bash plain">EOF</code></span></div>
 
</div>
 
</div>
 
</div>
 
</div>
Line 95: Line 109:
  
 
<u>'''Please, be sure you have write correctly the following command because in if not, it can corrupt your computer.'''</u>
 
<u>'''Please, be sure you have write correctly the following command because in if not, it can corrupt your computer.'''</u>
 
 
  
 
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl">'''u-boot.imx copy'''</div>
 
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl">'''u-boot.imx copy'''</div>
Line 128: Line 140:
  
  
==<span id="GParted_and_Creation_of_Partitions" class="mw-headline">GParted and Creation of Partitions</span>==
+
==<span id="GParted_and_Creation_of_Partitions" class="mw-headline">Using GParted and Creation of Partitions</span>==
 
When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.
 
When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.
  

Revision as of 12:52, 9 May 2018

Introduction

This page explain how to create a microSD card to boot IGEP boards with  software distributions ( yocto, Ubuntu, Debian ...).


How to SD.PNG


Inside General processors we can find Texas Instruments

Texas Instruments Processors

  • The microsd card must be content at latest 2 partitions.
  • The first one must be primary partition with the boot flag mark and formated using FAT(16 or 32) file system.
  • All names used in this partition must be msdos names (applies to OLD OMAP35xx processor).
  • The processor must load a first program called MLO, this program must reside in the first partition, this program it's also called x-loader or uboot-spl.

The processor when boot ONLY load and execute the MLO program and ignore all the rest it's the X-loader(MLO) the program responsible to load the next programs such kernel or uboot if you use this last one approach.

Freescale-NXP Processors

  • The microsd card must be content at latest 1 partitions.
  • The primary partition can be formatted with any filesystem that u-boot can mount.
  • The Processor will load the u-boot.imx it include the SPL and u-boot.

After load this u-boot.imx, u-boot will be ready for boot the kernel.

Therefore, we are going to setup a microSD card with these requirements and install a custom software distribution into it.

Boot from Flash

  • Exist other ways of boot and in this link we can see how to do it with the Flash Memory-> LINK

Prerequisites

  • PC with Linux (We use for this how to Ubuntu 16.04 LTS)
  • MicroSD Card (4 Gbytes - class 4) or bigger ...
  • Tools such, fdisk, mkfs.ext3, mkfs.vfat, gparted ...
  • Cross Toolchain included in Ubuntu 16.04 LTS gcc version 4.9.3 (Ubuntu/Linaro 4.9.3-13ubuntu2).

ToolChain

  • Read: [index.php/Ubuntu_16.04_LTS_Toolchain Ubuntu 16.04 LTS Toolchain]

Preparing the microSD card

Open a terminal window and clear your dmesg using:

sudo dmesg -c

Now insert a new microsd card in your PC and then check your dmesg:

dmesg

You should see something like this:

mmc0: new high speed SDHC card at address 0001
mmcblk0: mmc0:0001 00000 3.79 GiB
mmcblk0: unknown partition table

Ensure all in your microsd card it's erased:

$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024
[sudo] password for jdoe:

Prepare a SD to boot

Information.jpg We are using this version of Ubuntu .........


Downloading GParted

In order to prepare a micro SD with your already generated u-boot you need to flash the u-boot.imx using the command dd.

It is important to prepare your micro SD card first creating a partition that leave some free space for the u-boot.imx. It can be used GPARTED as it is shown in the image:

GPARTED.png


And it can be installed with this command.

sudo apt-get install gparted

Now we will see all the steps for this partition with GPARTED after another brief  explanation of  other method.


  • Another method is using fdisk and creating directly two partitions

Using sfdisk partition method

sudo sfdisk /dev/ <<EOF


label: dos
16065,128520,0x0C,*
144585,,,-
EOF
Define partitions
sudo mkfs.vfat -F 32 /dev/ -n boot


sudo mkfs.ext3 /dev/ -L rootfs

Then you only have to use dd command in order to copy the u-boot.imx to the SD card.

Please, be sure you have write correctly the following command because in if not, it can corrupt your computer.

u-boot.imx copy
sudo dd if=//u-boot.imx of=/dev/ bs=512 seek=2


sync

For example

u-boot.imx copy
sudo dd if=/home/user/Project/u-boot/u-boot.imx of=/dev/sdd bs=512 seek=2


sync


Using GParted and Creation of Partitions

When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.

Create the MSDOS Partition Table

The next step it's create the msdos table partition for it you should click in the "Device" menu and then in the "Create Partition Table" option.

Check the default option it's create a msdos partition table.

After that you can Apply.


Create the BOOT Partition - IGEP Texas Instruments Processor based

This Step it's only for OMAP35xx, DM37xx, AM335x, OMAP5432 processor based IGEP boards.

The Next step it's create the partitions for it you should go to the partition menu and select the "New" option then the application show a window like this:

We will configure the partition as:

  • Primary Partition
  • Format: FAT32
  • Size: 100 MegaBytes
  • Free Space Preceding: 0 MiB
  • Label: Boot
  • Align to: cylinder

It is recommended to apply changes now or you might get an error later.

Create the BOOT Partition - IGEP NXP-Freescale Processor based

This Step it's only for iMX6 processor based IGEP boards.

The Next step it's create the partitions for it you should go to the partition menu and select the "New" option then the application show a window like this:

We will configure the partition as:

  • Primary Partition
  • Format: FAT32
  • Free Space Preceding: 8 MiB
  • Size: 100 MegaBytes
  • Label: Boot
  • Align to: cylinder


It is recommended to apply changes now or you might get an error later.

Create the ROOTFS Partition

The Next step it's create the root file system partition.

First you should select the unallocated partition area and then  you should go to the partition menu and select the "New" option then the application show a window like this:

We will configure the rootfs partition as:

  • Primary Partition
  • Format: EXT4
  • Size: All the Rest
  • Label: Rootfs

At end we will click on "Add" button.

or

After all apply all changes

Select "Boot flag" for the boot partition

Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select "Manage Flags" option

Now we have the microsd prepared for copy the boot files


How to boot each part

Now we will see where to put each part and how to.

U-Boot

How to record the U-Boot

Root file System

How to record the Root file System

Kernel & Modules

How to record the Kernel & Modules