Changes

Prepare a bootable MicroSD Card

1,040 bytes removed, 09:52, 1 July 2019
no edit summary
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]].
 
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 
 
===<span id="Texas_Instruments_Processors" class="mw-headline">General Processors</span>===
<span class="mw-headline">Inside General processors we can find Texas Instruments</span>
===<span id="Texas_Instruments_Processors" class="mw-headline">Texas Instruments Processors</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.
''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>===
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
===<span id="Prerequisites" class="mw-headline">Prerequisites</span>===
* 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:
===<prespan id="ToolChain" class="mw-headline">sudo dmesg -cToolChain</prespan>===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 [sudo] password for jdoe:=='''<span class="mw-headline">Prepare In order to start developing with an IGEP PROCESSOR BOARD we can use a SD microSD Card to flash our system and boot from it. Most of the cases is the easiest way to boota board.<br /span>'''=={{Message/Information Message|title=TITLE|message= <span style="color: #000000;">We are using this version of Ubuntu .........</span>}}
<span class="mw-headline">The following steps details how to prepare a booteable MicroSD Card</span>
==<span class="mw-headline">Prepare a SD to boot</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:
==<span id="Install_GParted" class="mw-headline">Downloading GParted</span>== dmesgIn order The result have to prepare a micro SD with your already generated u-boot you need be similar to flash the u-boot.imx using the command dd.this:
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:GPARTEDdev.png|center|713x201px]]
<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:
And it can be installed with this command sudo dd if=/dev/zero of=/dev/sdc bs=1024 count=1024Before use anyway of partition one good practise is unmount the dev where is inserted the SD.-> <code>umount /dev/sdx</code>
<pre>sudo apt-get install gparted</pre><span style="color: #000000;">Now we will see all are ready to create the steps for this partition with GPARTED after another brief  explanation of  other methodcorresponding partitions in our MicroSD Card.</span>
==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>
* ==='''<span styleclass="color: #000000;mw-headline">Another method is using fdisk and creating directly two partitionsUsing Gparted:</span>'''=== <div {| class="code panel pdl confcontenttable sortable"|-macro output!|====='''GENERAL CASE'''=====!|====='''NXP PROCESSORS'''=====|-block" data||'''1-hasbody="true" data'''Select the corresponding device||'''1-macro'''Select the corresponding device|-name||<span class="codemw-headline">[[File:1.png|429x186px]]</span>==||<span styleclass="color: #000000;mw-headline">Using sfdisk partition method[[File:1.png|413x179px]]</span>==|-||'''2- '''Create a partition table||'''2- '''Create a partition table|-||<div span class="codeContent panelContent pdlmw-headline">[[File:2.png|430x202px]]</span><div id="highlighter_789287" span class="syntaxhighlighter shmw-eclipse nogutter bashheadline">[[File:SD4.png|433x298px]]</span>{| |<span class=" wikitablemw-headline" style="height>[[File: 128px;" border2.png|418x197px]]</span><span class="0mw-headline" width>[[File:SD4.png|431x297px]]</span>|-||'''<span class="839mw-headline" cellspacing>3- </span>'''<span class="0mw-headline" cellpadding>Create a FAT32 '''boot '''partition</span>||<span class="0mw-headline">'''3- '''Create a FAT32 '''boot '''partition '''leaving 8MB before'''</span>
|-
| class="code" style="width: 825.813px;"|<div span class="container" title="Hint: doublemw-click to select code"><div class="line number1 index0 alt2headline"><span style="color[[File: #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>2.png|432x203px]]</span>[[File:fat32_c121.png|429x293px]]
We will configure the partition as:
<div class="line number2 index1 alt1"><span style="color* Free Space Preceding: #000000;"><code class="bash plain">label: dos</code></span></div>1MB* Primary Partition<div class="line number3 index2 alt2"><span style="color: #000000;"><code class="bash plain">16065,128520,0x0C,*<File system/code></span></div>Format: FAT32<div class="line number4 index3 alt1"><span style="color* Size: #000000;"><code class="bash plain">144585,,,-</code></span></div>100 MB<div class="line number5 index4 alt2"><span style="color* Label: #000000;"><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 partitionsBoot'''</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* '''Align to: 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>cylinder'''
||
<span class="mw-headline">[[File:2.png|432x203px]]</span>[[File:im_1.png|425x290px]]
<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></div></div>|}</div></div></div>Then you only have to use dd command in order to copy We will configure the u-boot.imx to the SD card.partition as:
<u>* Free Space Preceding: '''Please, be sure you have write correctly the following command because in if not, it can corrupt your computer.8MB'''<* Primary Partition* File system/u>Format: FAT32* Size: 100 MB* Label: '''Boot'''* '''Align to: cylinder'''
<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_550267" class="syntaxhighlighter sh-eclipse nogutter bash">
{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"
|-
| |'''<span class="codemw-headline"|>4- </span>'''<div span class="containermw-headline" title>Create a ext4 '''rootfs '''partition</span>||'''<span class="Hint: doublemw-click to select codeheadline">4- <div /span>'''<span class="line number1 index0 alt2mw-headline">Create a ext4 '''rootfs '''partition<code /span>|-||[[File:fat32_c2.png|407x279px]]'''7-''' Check the results are similar to the followings:||[[File:fat32_c2.png|407x279px]]|-||'''<span class="bash plainmw-headline">5- </codespan>'''<code span class="bash functionsmw-headline">sudoApply changes<br /code> <code /span>||'''<span class="bash functionsmw-headline">dd5- </codespan> '''<code span class="bash keywordmw-headline">ifApply changes</codespan>|-||'''<code span class="bash plainmw-headline">=/[[File:fat32_c3.png|411x279px]]</codespan>'''||[[File:im_2.png|403x275px]]|-||'''<code span class="bash plainmw-headline">/u6-boot</codespan>'''<code span class="bash plainmw-headline">.imx of=Set boot flag to boot partition</codespan>||'''<code span class="bash plainmw-headline">/dev/6- </codespan>'''<code span class="bash plainmw-headline"> bs=512 seek=2Set boot flag to boot partition</codespan>|-||[[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></div>||[[File:IM_25.png|}</div></div></div>For example414x281px]]
<div class="code panel pdl conf[[File:fat32_c5.png|431x291px]] |-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl">||'''u7-boot.imx copy'''</div>Check the results are similar to the followings:<div class="codeContent panelContent pdl"><div id="highlighter_209438" class="syntaxhighlighter sh||'''7-eclipse nogutter bash">{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"''' Check the results are similar to the followings:
|-
| class="code"|<div class="container" title="Hint[[File: 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">fat32_c6.imx of=</code><code class="bash plain">/dev/sdd</code> <code class="bash plain">bs=512 seek=2</code>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="line number2 index1 alt1"><code class="bash plain">$ </code><code class="bash functions">sync</code></div>
</div>
</div>
|}</div>
</div>
</div>
==<span id="GParted_and_Creation_of_Partitions" class="mw-headline">'''Using GParted and Creation of PartitionsSFDISK & MKFS<br /span>'''===When Another method is to use the following commands in order to prepare the microSD card. These commands will perform the install procedure ends you can call same operations that in the program from your system tools menu or directly using a terminal consoleprevious part.
<div {| class="centercontenttable 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,*<div classbr>160650,,,-<br>EOF| style="thumb tnonewidth: 436.633px;"| sudo sfdisk /dev/ <<EOF<br>label: dos<br>16065,128520,0x0C,*<div classbr>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="thumbinnerwidth: 431.367px;"| sudo sfdisk /dev/<strong>sdc</strong><div class<EOF<br data-attributes="thumbcaption%20/">label: dos<div classbr data-attributes="magnify%20/">63,144522,0x0C,*<br data-attributes="%20/div">160650,,,-<br data-attributes="%20/div">EOF<br><br>sudo mkfs.vfat -F32 /dev/div<strong>sdc1</divstrong>-n boot<br data-attributes="%20/div">==<br data-attributes="%20/">sudo mkfs.ext4 /dev/<strong>sdc2</strong> -L rootfs<br><span idbr>| style="Create_the_MSDOSwidth: 436.C2.A0Partition_Table633px;" class| sudo sfdisk /dev/<strong>sdc</strong> <<EOF<br data-attributes="mw-headline%20/">Create the MSDOS Partition Tablelabel: dos<br data-attributes="%20/span">16065,128520,0x0C,*<br data-attributes===The next step it's create the msdos table partition for it you should click in the "Device%20/" menu and then in the >144585,,,-<br data-attributes="Create Partition Table%20/" option>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>|}
<div class="center">'''How to copy everything into the MicroSD Card<div class="thumb tnone"br /><div class="thumbinner"><div class="thumbcaption"><div class'''="magnify"></div></div></div></div></div>Check Once the default option MicroSD is completely prepared, it's create a msdos partition tableis time to copy the u-boot, kernel and root dile system to the MicroSD Card.
After that you can ==U-Boot=='''ApplyGeneral processors<br />'''.
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'''
===<span id="Create_the_BOOT_Partition_-_IGEP_Texas_Instruments_Processor_based" class="mw-headline"pre>Create the BOOT Partition cp [your_u- IGEP Texas Instruments Processor based<boot_directory]/span>===<u>This Step it's only for OMAP35xx, DM37xx, AM335x, OMAP5432 processor based IGEP boards.<boot.img /media/user/u>boot
cp [your_u-boot_directory]/MLO /media/user/boot</pre>You can follow this post [[The Next step it's create the partitions for it bootloader U-Boot|U-boot Bootloader]] if you should go to want build the partition menu MLO and select the "New" option then the application show a window like this:u-boot
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
</div>
</div>
</div>
</div>
We will configure the partition as:
* Primary Partition* Format: FAT32* Size: 100 MegaBytes* Free Space Preceding: 0 MiB* Label: Boot* '''Align to: cylinderFreescale processors<br />'''
It is recommended to '''apply changes''' now or you might get an error later* Copy u-boot.imx using dd before primary partition in raw mode as
===<span idpre>sudo dd if="Create_the_BOOT_Partition_/[your_u-_IGEP_NXPboot_directory]/u-Freescale_Processor_based" classboot.imx of="mw-headline">Create the BOOT Partition - IGEP NXP-Freescale Processor based/dev/[your_sd] bs=512 seek=2</spanpre>===<You can follow this post [[The bootloader U-Boot|U-boot Bootloader]] you want build the u>This Step it's only for iMX6 processor based IGEP boards-boot.</u>imx
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:
'''How to configure Uenv<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div></div></div></div><br /div>We will configure the partition as:'''
* Primary Partition* Format: FAT32* Free Space Preceding: 8 MiB* Size: 100 MegaBytes* Label: Boot* '''Align It is need to: cylinder'''indicate how start the boot. For this reason it will be created a file called uenv.txt with the correct configuration.
<br />It is recommended to '''apply changes''' now We present two examples of help to start the system from the MicroSD Card or you might get from an error laternfs server.
===<span id="Create_the_ROOTFS_Partition" class="mw-headline">Create * If we want boot from the ROOTFS Partition<bootable microSD Card. [http://downloads.isee.biz/pub/span>===relaunch/uenv.txt uenv.txt]The Next step it's create the root file system partition* If we want boot from nfs server. [http://downloads.isee.biz/pub/relaunch/uenv_nfs.txt uenv.txt]
First These two examples have an ip address assigned to them that can be modified as 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:want.
<div class="center"><div class="thumb tnone"><div classKernel="thumbinner"><div class="thumbcaption"><div class="magnify"></div></div></div></div></div>We will configure Kernel files, '''zImage '''and''' .dtb''', can be copied into the'' root folder'' of the rootfs ''' boot partition as:'''
* Primary Partition* Format: EXT4* Size: All '''Kernel Modules''' have to be copied using the command indicated in the kernel compilation [[Linux Kernel 4.9.y|post]] into the Rest* Label: Rootfs'''<br />rootfs partition'''
At end we will click on "Add" button.
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>
</div>
</div>
</div>
</div>
or
<div class="center"><div class="thumb tnone"><div classRoot file System="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 root file system have to be extracted into the boot partition</span>===Now we must select '' root folder''  of the boot flag for the first '''rootfs''' '''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><'''. Where can be [http:/div></div><labs.isee.biz/div><index.php/div>Now we have the microsd prepared for copy the boot filesIGEP_Firmware_set-up downloaded here.]
=='''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]]
560
edits