Difference between revisions of "Prepare a bootable MicroSD Card"

From IGEP - ISEE Wiki

Jump to: navigation, search
 
(55 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
This page explain how to '''create a microSD card''' to boot IGEP boards with  '''software distributions ( yocto, Ubuntu, Debian ...)'''.
 
This page explain how to '''create a microSD card''' to boot IGEP boards with  '''software distributions ( yocto, Ubuntu, Debian ...)'''.
  
 +
* Now we can see an image of which are the steps to boot any module.
  
 +
With a general processor all start with MLO file and U-Boot.img. Also it is the same procedure for Freescale- NXP. If you want to see how to create these files follow this [[The bootloader U-Boot|link]].
  
[[File:How_to_SD.PNG|772x332px|center]]
+
Next step is that once the processor is initialized,call the linux kernel making the execution of  your operative system available.
  
 +
Finally your OS runs and you can initialize the board correctly 
  
  
===Boot from Flash===
+
[[File:How_to_SD.PNG|center|772x332px]]
* Exist other ways of boot and in this link we can see how to do it with the Flash Memory-> LINK
 
  
==<span id="Prerequisites" class="mw-headline">Prerequisites</span>==
+
 
 +
 
 +
===<span id="Texas_Instruments_Processors" class="mw-headline">General Processors</span>===
 +
<span class="mw-headline">Inside General processors we can find Texas Instruments</span>
 +
 
 +
* 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.''
 +
 
 +
 
 +
 
 +
{{Message/Information Message|title=TITLE|message= <span style="color: #000000;">Freescale has a different structure</span>}}
 +
 
 +
 
 +
 
 +
===<span id="Freescale-NXP_Processors" class="mw-headline">Freescale-NXP Processors</span>===
 +
* 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.
 +
 
 +
 
 +
 
 +
===<span id="Prerequisites" class="mw-headline">Prerequisites</span>===
 
* PC with Linux (We use for this how to Ubuntu 16.04 LTS)
 
* PC with Linux (We use for this how to Ubuntu 16.04 LTS)
 
* MicroSD Card (4 Gbytes - class 4) or bigger ...
 
* MicroSD Card (4 Gbytes - class 4) or bigger ...
Line 17: Line 48:
 
* Cross Toolchain included in Ubuntu 16.04 LTS gcc version 4.9.3 (Ubuntu/Linaro 4.9.3-13ubuntu2).
 
* Cross Toolchain included in Ubuntu 16.04 LTS gcc version 4.9.3 (Ubuntu/Linaro 4.9.3-13ubuntu2).
  
==<span id="ToolChain" class="mw-headline">ToolChain</span>==
 
* Read: [index.php/Ubuntu_16.04_LTS_Toolchain Ubuntu 16.04 LTS Toolchain]
 
  
==<span id="Preparing_the_microSD_card" class="mw-headline">Preparing the microSD card</span>==
 
Open a terminal window and clear your dmesg using:
 
  
<pre>sudo dmesg -c</pre>
+
===<span id="ToolChain" class="mw-headline">ToolChain</span>===
Now insert a new microsd card in your PC and then check your dmesg:
+
* Read: [[Ubuntu 16.04 LTS Toolchain]]
  
<pre>dmesg</pre>
 
You should see something like this:
 
  
<pre>mmc0: new high speed SDHC card at address 0001
 
mmcblk0: mmc0:0001 00000 3.79 GiB
 
mmcblk0: unknown partition table
 
</pre>
 
Ensure all in your microsd card it's erased:
 
  
$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024
+
<span class="mw-headline">In order to start developing with an IGEP PROCESSOR BOARD we can use a microSD Card to flash our system and boot from it. Most of the cases is the easiest way to boot a board.<br /></span>
[sudo] password for jdoe:
+
 
=='''<span class="mw-headline">Prepare a SD to boot</span>'''==
+
<span class="mw-headline">The following steps details how to prepare a booteable MicroSD Card</span>
==<span id="Install_GParted" class="mw-headline">Install GParted</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:
 
  
<pre>sudo apt-get install gparted</pre>
+
==<span class="mw-headline">Prepare a SD to boot</span>==
<span style="color: #ff0000;">Another method is using fdisk and creating directly two partitions:</span>
+
<div style="text-align: left;">{{Message/Information Message|message=The following steps has been tested using an Ubuntu 16.04}}</div>
 +
<div style="text-align: left;">First of all it is important to detect which device is our microSD Card. In order to do that we can follow this instructions in a Linux terminal:</div>
 +
<div style="text-align: left; padding-left: 30px;">'''1-''' Clean the ''dmesg'' information:</div>
 +
sudo dmesg -c
 +
'''2-''' Insert the microSD Card and show the ''dmesg'' information:
  
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code">
+
  dmesg
==<span style="color: #ff0000;">Use sfdisk partition method</span>==
+
The result have to be similar to this:
<div class="codeContent panelContent pdl"><div id="highlighter_789287" class="syntaxhighlighter sh-eclipse nogutter bash">
 
{| class=" contenttable" border="0" 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>
 
  
  
<div class="line number2 index1 alt1"><span style="color: #ff0000;"><code class="bash plain">label: dos</code></span></div>
+
[[File:dev.png]]
<div class="line number3 index2 alt2"><span style="color: #ff0000;"><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 number5 index4 alt2"><span style="color: #ff0000;"><code class="bash plain">EOF</code></span></div>
 
</div>
 
</div>
 
|}</div>
 
</div>
 
</div>
 
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl">'''Define partitions'''</div>
 
<div class="codeContent panelContent pdl"><div id="highlighter_144340" class="syntaxhighlighter sh-eclipse nogutter  bash">
 
{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"
 
|-
 
| class="code"|<div class="container" title="Hint: double-click to select code"><div class="line number1 index0 alt2"><code class="bash plain">$ </code><code class="bash functions">sudo</code> <code class="bash plain">mkfs.vfat -F 32 </code><code class="bash plain">/dev/</code><code class="bash plain"> -n boot</code>
 
  
 +
<div style="text-align: left;">We can see the name of our device in the system: '''/dev/sdX''' where X is the character assigned by our system, in this case /dev/sdc'''.'''</div>
 +
<div style="text-align: left;">Now we have to ensure that the MicroSD Card is completely clean. We can use the following command to do that:</div>
 +
sudo dd if=/dev/zero of=/dev/sdX bs=1024 count=1024
 +
Where '''X''' is the character returned previously by your system, for example, in the previous situation:
  
<div class="line number2 index1 alt1"><code class="bash plain">$ </code><code class="bash functions">sudo</code> <code class="bash plain">mkfs.ext3 </code><code class="bash plain">/dev/</code><code class="bash plain"> -L rootfs</code></div>
+
sudo dd if=/dev/zero of=/dev/sdc bs=1024 count=1024
</div>
+
Before use anyway of partition one good practise is unmount the dev where is inserted the SD. -> <code>umount /dev/sdx</code>
</div>
 
|}</div>
 
</div>
 
</div>
 
Then you only have to use dd command in order to copy the u-boot.imx to the SD card.
 
  
<u>'''Please, be sure you have write correctly the following command because in if not, it can corrupt your computer.'''</u>
+
Now we are ready to create the corresponding partitions in our MicroSD Card.
  
 +
==How to partition the MicroSD card==
 +
<div style="text-align: left;">There are several ways to partition a MicroSD Card. In this post we are using the GParted tool that can be installed as:</div>
 +
sudo apt-get install gparted
 +
<span class="mw-headline">Other tools as sfdisk and mkfs are useful too.</span>
  
 +
<span class="mw-headline">It is important to difference between a MicroSD Card for a NXP processor and the other cases. The process of partition is similar but, in the case of NXP chips, there exists some differences. </span>
  
<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>
+
==='''<span class="mw-headline">Using Gparted:</span>'''===
<div class="codeContent panelContent pdl"><div id="highlighter_550267" class="syntaxhighlighter sh-eclipse nogutter  bash">
+
{| class="contenttable sortable"
{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"
+
|-
 +
!|
 +
====='''GENERAL CASE'''=====
 +
!|
 +
====='''NXP PROCESSORS'''=====
 +
|-
 +
||'''1- '''Select the corresponding device
 +
||'''1- '''Select the corresponding device
 +
|-
 +
||<span class="mw-headline">[[File:1.png|429x186px]]</span>
 +
||<span class="mw-headline">[[File:1.png|413x179px]]</span>
 +
|-
 +
||'''2- '''Create a partition table
 +
||'''2- '''Create a partition table
 
|-
 
|-
| class="code"|<div class="container" title="Hint: double-click to select code"><div class="line number1 index0 alt2"><code class="bash plain"></code><code class="bash functions">sudo</code> <code class="bash functions">dd</code> <code class="bash keyword">if</code><code class="bash plain">=/</code><code class="bash plain">/u-boot</code><code class="bash plain">.imx of=</code><code class="bash plain">/dev/</code><code class="bash plain"> bs=512 seek=2</code>
+
||<span class="mw-headline">[[File:2.png|430x202px]]</span><span class="mw-headline">[[File:SD4.png|433x298px]]</span>
 +
||<span class="mw-headline">[[File:2.png|418x197px]]</span><span class="mw-headline">[[File:SD4.png|431x297px]]</span>
 +
|-
 +
||'''<span class="mw-headline">3- </span>'''<span class="mw-headline">Create a FAT32 '''boot '''partition</span>
 +
||<span class="mw-headline">'''3- '''Create a FAT32 '''boot '''partition '''leaving 8MB before'''</span>
 +
|-
 +
||
 +
<span class="mw-headline">[[File:2.png|432x203px]]</span>[[File:fat32_c121.png|429x293px]]
  
 +
We will configure the partition as:
  
<div class="line number2 index1 alt1"><code class="bash plain">$ </code><code class="bash functions">sync</code></div>
+
* Free Space Preceding: 1MB
</div>
+
* Primary Partition
</div>
+
* File system/ Format: FAT32
|}</div>
+
* Size: 100 MB
</div>
+
* Label: '''Boot'''
</div>
+
* '''Align to: cylinder'''
For example
 
  
<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="codeContent panelContent pdl"><div id="highlighter_209438" class="syntaxhighlighter sh-eclipse nogutter  bash">
+
<span class="mw-headline">[[File:2.png|432x203px]]</span>[[File:im_1.png|425x290px]]
{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"
+
 
 +
We will configure the partition as:
 +
 
 +
* Free Space Preceding: '''8MB'''
 +
* Primary Partition
 +
* File system/ Format: FAT32
 +
* Size: 100 MB
 +
* Label: '''Boot'''
 +
* '''Align to: cylinder'''
 +
 
 +
|-
 +
||'''<span class="mw-headline">4- </span>'''<span class="mw-headline">Create a ext4 '''rootfs '''partition</span>
 +
||'''<span class="mw-headline">4- </span>'''<span class="mw-headline">Create a ext4 '''rootfs '''partition</span>
 +
|-
 +
||[[File:fat32_c2.png|407x279px]]'''7-''' Check the results are similar to the followings:
 +
||[[File:fat32_c2.png|407x279px]]
 +
|-
 +
||'''<span class="mw-headline">5- </span>'''<span class="mw-headline">Apply changes<br /></span>
 +
||'''<span class="mw-headline">5- </span>'''<span class="mw-headline">Apply changes</span>
 +
|-
 +
||'''<span class="mw-headline">[[File:fat32_c3.png|411x279px]]</span>'''
 +
||[[File:im_2.png|403x275px]]
 
|-
 
|-
| class="code"|<div class="container" title="Hint: double-click to select code"><div class="line number1 index0 alt2"><code class="bash plain">$ </code><code class="bash functions">sudo</code> <code class="bash functions">dd</code> <code class="bash keyword">if</code><code class="bash plain">=</code><code class="bash plain">/home/user/Project/u-boot/u-boot</code><code class="bash plain">.imx of=</code><code class="bash plain">/dev/sdd</code> <code class="bash plain">bs=512 seek=2</code>
+
||'''<span class="mw-headline">6- </span>'''<span class="mw-headline">Set boot flag to boot partition</span>
 +
||'''<span class="mw-headline">6- </span>'''<span class="mw-headline">Set boot flag to boot partition</span>
 +
|-
 +
||
 +
[[File:fat32_c4.png|411x278px]]
  
 +
[[File:fat32_c5.png|432x291px]]
  
<div class="line number2 index1 alt1"><code class="bash plain">$ </code><code class="bash functions">sync</code></div>
+
||
</div>
+
[[File:IM_25.png|414x281px]]
</div>
 
|}</div>
 
</div>
 
</div>
 
  
 +
[[File:fat32_c5.png|431x291px]]
  
==<span id="GParted_and_Creation_of_Partitions" class="mw-headline">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.
+
||'''7-''' Check the results are similar to the followings:
 +
||'''7-''' Check the results are similar to the followings:
 +
|-
 +
||[[File:fat32_c6.png|434x294px]]
 +
||[[File:im_3.png|438x301px]]
 +
|}
 +
 
 +
'''<span class="mw-headline">By doing that we will have ready the microSD Card in order to copy our files.</span>'''
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
 
</div>
 
</div>
 
</div>
 
</div>
 
===<span id="Create_the_MSDOS.C2.A0Partition_Table" class="mw-headline">Create the MSDOS Partition Table</span>===
 
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.
 
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
 
</div>
 
</div>
 
</div>
 
</div>
 
Check the default option it's create a msdos partition table.
 
  
After that you can '''Apply'''.
+
==='''Using SFDISK & MKFS<br />'''===
 +
Another method is to use the following commands in order to prepare the microSD card. These commands will perform the same operations that in the previous part.
 +
 
 +
{| class="contenttable sortable" style="width: 890px;"
 +
|-
 +
! style="width: 431.367px;"|GENERAL CASE
 +
! style="width: 436.633px;"|NXP PROCESSORS
 +
|-
 +
| style="width: 431.367px;"|
 +
sudo sfdisk /dev/ <<EOF<br>label: dos<br>63,144522,0x0C,*<br>160650,,,-<br>EOF
 +
| style="width: 436.633px;"|
 +
sudo sfdisk /dev/ <<EOF<br>label: dos<br>16065,128520,0x0C,*<br>144585,,,-<br>EOF
 +
|-
 +
| style="width: 431.367px;"|
 +
sudo mkfs.vfat -F32 /dev/ -n boot
 +
| style="width: 436.633px;"|
 +
sudo mkfs.vfat -F32 /dev/ -n boot
 +
|-
 +
| style="width: 431.367px;"|
 +
sudo mkfs.ext4 /dev/ -L rootfs
 +
| style="width: 436.633px;"|
 +
sudo mkfs.ext4 /dev/ -L rootfs
 +
|-
 +
| style="width: 431.367px;"|'''For example:'''
 +
| style="width: 436.633px;"|'''For example:'''
 +
|-
 +
| style="width: 431.367px;"|
 +
sudo sfdisk /dev/<strong>sdc</strong> <<EOF<br data-attributes="%20/">label: dos<br data-attributes="%20/">63,144522,0x0C,*<br data-attributes="%20/">160650,,,-<br data-attributes="%20/">EOF<br><br>sudo mkfs.vfat -F32 /dev/<strong>sdc1</strong> -n boot<br data-attributes="%20/"><br data-attributes="%20/">sudo mkfs.ext4 /dev/<strong>sdc2</strong> -L rootfs<br><br>
 +
| style="width: 436.633px;"|
 +
sudo sfdisk /dev/<strong>sdc</strong> <<EOF<br data-attributes="%20/">label: dos<br data-attributes="%20/">16065,128520,0x0C,*<br data-attributes="%20/">144585,,,-<br data-attributes="%20/">EOF<br><br>sudo mkfs.vfat -F32 /dev/<strong>sdc1</strong> -n boot<br><br>sudo mkfs.ext4 /dev/<strong>sdc2</strong> -L rootfs<br><br>
 +
|}
  
 +
='''How to copy everything into the MicroSD Card<br />'''=
 +
Once the MicroSD is completely prepared, it is time to copy the u-boot, kernel and root dile system to the MicroSD Card.
  
 +
==U-Boot==
 +
'''General processors<br />'''
  
===<span id="Create_the_BOOT_Partition_-_IGEP_Texas_Instruments_Processor_based" class="mw-headline">Create the BOOT Partition - IGEP Texas Instruments Processor based</span>===
+
After build or download the MLO and u-boot you should follow the next steps:
<u>This Step it's only for OMAP35xx, DM37xx, AM335x, OMAP5432 processor based IGEP boards.</u>
 
  
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:
+
* Copy MLO and u-boot.img to primary into the ''root folder'' of the '''boot partition'''
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
+
<pre>cp [your_u-boot_directory]/u.boot.img /media/user/boot
</div>
 
</div>
 
</div>
 
</div>
 
We will configure the partition as:
 
  
* Primary Partition
+
cp [your_u-boot_directory]/MLO /media/user/boot
* Format: FAT32
+
</pre>
* Size: 100 MegaBytes
+
You can follow this post [[The bootloader U-Boot|U-boot Bootloader]] if you want build the MLO and u-boot
* Free Space Preceding: 0 MiB
 
* Label: Boot
 
* '''Align to: cylinder'''
 
  
It is recommended to '''apply changes''' now or you might get an error later.
 
  
===<span id="Create_the_BOOT_Partition_-_IGEP_NXP-Freescale_Processor_based" class="mw-headline">Create the BOOT Partition - IGEP NXP-Freescale Processor based</span>===
+
'''Freescale processors<br />'''
<u>This Step it's only for iMX6 processor based IGEP boards.</u>
 
  
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:
+
* Copy u-boot.imx using dd before primary partition in raw mode as
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
+
<pre>sudo dd if=/[your_u-boot_directory]/u-boot.imx of=/dev/[your_sd] bs=512 seek=2</pre>
</div>
+
You can follow this post [[The bootloader U-Boot|U-boot Bootloader]] you want build the u-boot.imx
</div>
 
</div>
 
</div>
 
We will configure the partition as:
 
  
* Primary Partition
 
* Format: FAT32
 
* Free Space Preceding: 8 MiB
 
* Size: 100 MegaBytes
 
* Label: Boot
 
* '''Align to: cylinder'''
 
  
<br />It is recommended to '''apply changes''' now or you might get an error later.
+
'''How to configure Uenv<br />'''
  
===<span id="Create_the_ROOTFS_Partition" class="mw-headline">Create the ROOTFS Partition</span>===
+
It is need to indicate how start the boot. For this reason it will be created a file called uenv.txt with the correct configuration.
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 present two examples of help to start the system from the MicroSD Card or from an nfs server.
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
+
* If we want boot from the bootable microSD Card. [http://downloads.isee.biz/pub/relaunch/uenv.txt uenv.txt]
</div>
+
* If we want boot from nfs server. [http://downloads.isee.biz/pub/relaunch/uenv_nfs.txt uenv.txt]
</div>
 
</div>
 
</div>
 
We will configure the rootfs partition as:
 
  
* Primary Partition
+
These two examples have an ip address assigned to them that can be modified as you want.
* Format: EXT4
 
* Size: All the Rest
 
* Label: Rootfs'''<br />'''
 
  
At end we will click on "Add" button.
+
==Kernel==
 +
Kernel files, '''zImage '''and''' .dtb''', can be copied into the'' root folder'' of the''' boot partition'''
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
+
'''Kernel Modules''' have to be copied using the command indicated in the kernel compilation [[Linux Kernel 4.9.y|post]] into the '''rootfs partition'''. 
</div>
 
</div>
 
</div>
 
</div>
 
or
 
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
 
</div>
 
</div>
 
</div>
 
</div>
 
After all apply all changes
 
  
===<span id="Select_.22Boot_flag.22_for_the_boot_partition" class="mw-headline">Select "Boot flag" for the boot partition</span>===
 
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
 
  
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
+
==Root file System==
</div>
+
The root file system have to be extracted into the'' root folder''  of the '''rootfs''' '''partition'''. Where can be [http://labs.isee.biz/index.php/IGEP_Firmware_set-up downloaded here.]
</div>
 
</div>
 
</div>
 
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==
+
[[Category:Boot loaders]]
How to record the Kernel & Modules
+
[[Category:Software]]
 +
[[Category:Software distributions]]

Latest revision as of 09:52, 1 July 2019

Introduction

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

  • Now we can see an image of which are the steps to boot any module.

With a general processor all start with MLO file and U-Boot.img. Also it is the same procedure for Freescale- NXP. If you want to see how to create these files follow this link.

Next step is that once the processor is initialized,call the linux kernel making the execution of  your operative system available.

Finally your OS runs and you can initialize the board correctly 


How to SD.PNG


General Processors

Inside General processors we can find Texas Instruments

  • 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.


Information.jpg Freescale has a different structure


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.


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


In order to start developing with an IGEP PROCESSOR BOARD we can use a microSD Card to flash our system and boot from it. Most of the cases is the easiest way to boot a board.

The following steps details how to prepare a booteable MicroSD Card

Prepare a SD to boot

Information.jpg The following steps has been tested using an Ubuntu 16.04
First of all it is important to detect which device is our microSD Card. In order to do that we can follow this instructions in a Linux terminal:
1- Clean the dmesg information:
sudo dmesg -c

2- Insert the microSD Card and show the dmesg information:

dmesg

The result have to be similar to this:


dev.png

We can see the name of our device in the system: /dev/sdX where X is the character assigned by our system, in this case /dev/sdc.
Now we have to ensure that the MicroSD Card is completely clean. We can use the following command to do that:
sudo dd if=/dev/zero of=/dev/sdX bs=1024 count=1024

Where X is the character returned previously by your system, for example, in the previous situation:

sudo dd if=/dev/zero of=/dev/sdc bs=1024 count=1024

Before use anyway of partition one good practise is unmount the dev where is inserted the SD. -> umount /dev/sdx

Now we are ready to create the corresponding partitions in our MicroSD Card.

How to partition the MicroSD card

There are several ways to partition a MicroSD Card. In this post we are using the GParted tool that can be installed as:
sudo apt-get install gparted

Other tools as sfdisk and mkfs are useful too.

It is important to difference between a MicroSD Card for a NXP processor and the other cases. The process of partition is similar but, in the case of NXP chips, there exists some differences. 

Using Gparted:

GENERAL CASE
NXP PROCESSORS
1- Select the corresponding device 1- Select the corresponding device
1.png 1.png
2- Create a partition table 2- Create a partition table
2.pngSD4.png 2.pngSD4.png
3- Create a FAT32 boot partition 3- Create a FAT32 boot partition leaving 8MB before

2.pngfat32 c121.png

We will configure the partition as:

  • Free Space Preceding: 1MB
  • Primary Partition
  • File system/ Format: FAT32
  • Size: 100 MB
  • Label: Boot
  • Align to: cylinder

2.pngim 1.png

We will configure the partition as:

  • Free Space Preceding: 8MB
  • Primary Partition
  • File system/ Format: FAT32
  • Size: 100 MB
  • Label: Boot
  • Align to: cylinder
4- Create a ext4 rootfs partition 4- Create a ext4 rootfs partition
fat32 c2.png7- Check the results are similar to the followings: fat32 c2.png
5- Apply changes
5- Apply changes
fat32 c3.png im 2.png
6- Set boot flag to boot partition 6- Set boot flag to boot partition

fat32 c4.png

fat32 c5.png

IM 25.png

fat32 c5.png

7- Check the results are similar to the followings: 7- Check the results are similar to the followings:
fat32 c6.png im 3.png

By doing that we will have ready the microSD Card in order to copy our files.


Using SFDISK & MKFS

Another method is to use the following commands in order to prepare the microSD card. These commands will perform the same operations that in the previous part.

GENERAL CASE NXP PROCESSORS
sudo sfdisk /dev/ <<EOF
label: dos
63,144522,0x0C,*
160650,,,-
EOF
sudo sfdisk /dev/ <<EOF
label: dos
16065,128520,0x0C,*
144585,,,-
EOF
sudo mkfs.vfat -F32 /dev/ -n boot
sudo mkfs.vfat -F32 /dev/ -n boot
sudo mkfs.ext4 /dev/ -L rootfs
sudo mkfs.ext4 /dev/ -L rootfs
For example: For example:
sudo sfdisk /dev/sdc <<EOF
label: dos
63,144522,0x0C,*
160650,,,-
EOF

sudo mkfs.vfat -F32 /dev/sdc1 -n boot

sudo mkfs.ext4 /dev/sdc2 -L rootfs

sudo sfdisk /dev/sdc <<EOF
label: dos
16065,128520,0x0C,*
144585,,,-
EOF

sudo mkfs.vfat -F32 /dev/sdc1 -n boot

sudo mkfs.ext4 /dev/sdc2 -L rootfs

How to copy everything into the MicroSD Card

Once the MicroSD is completely prepared, it is time to copy the u-boot, kernel and root dile system to the MicroSD Card.

U-Boot

General processors

After build or download the MLO and u-boot you should follow the next steps:

  • Copy MLO and u-boot.img to primary into the root folder of the boot partition
cp [your_u-boot_directory]/u.boot.img /media/user/boot

cp [your_u-boot_directory]/MLO /media/user/boot

You can follow this post U-boot Bootloader if you want build the MLO and u-boot


Freescale processors

  • Copy u-boot.imx using dd before primary partition in raw mode as
sudo dd if=/[your_u-boot_directory]/u-boot.imx of=/dev/[your_sd] bs=512 seek=2

You can follow this post U-boot Bootloader you want build the u-boot.imx


How to configure Uenv

It is need to indicate how start the boot. For this reason it will be created a file called uenv.txt with the correct configuration.

We present two examples of help to start the system from the MicroSD Card or from an nfs server.

  • If we want boot from the bootable microSD Card. uenv.txt
  • If we want boot from nfs server. uenv.txt

These two examples have an ip address assigned to them that can be modified as you want.

Kernel

Kernel files, zImage and .dtb, can be copied into the root folder of the boot partition

Kernel Modules have to be copied using the command indicated in the kernel compilation post into the rootfs partition


Root file System

The root file system have to be extracted into the root folder  of the rootfs partition. Where can be downloaded here.