560
edits
Changes
From IGEP - ISEE Wiki
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>
* 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>}}
Therefore, we are going to '''setup a microSD card with these requirements''' and '''install a custom software distribution''' into it.
===<span id="ToolChain" class="mw-headline">ToolChain</span>===
* Read: [index.php/Ubuntu_16.04_LTS_Toolchain [Ubuntu 16.04 LTS Toolchain]]
<prespan class="mw-headline">sudo dmesg -cThe following steps details how to prepare a booteable MicroSD Card</prespan>Now insert a new microsd card in your PC and then check your dmesg:
==<prespan 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:</prediv>You should see something like this sudo dmesg -c'''2-''' Insert the microSD Card and show the ''dmesg'' information:
[[File:dev.png]]
<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:
sudo dd if=/dev/zero of=<span id/dev/sdc bs="Install_GParted" class1024 count="mw1024Before use anyway of partition one good practise is unmount the dev where is inserted the SD. -headline">Downloading GParted<code>umount /dev/sdx</spancode>==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.
==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>
|-
| class="code" style="width: 825.813px;"|<div class="container" title="Hint: double'''2-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: #000000;"><code class="bash plain">label: dos</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: #000000;"><code class="bash plain">144585,,,-</code></span></div><div class="line number5 index4 alt2"><span style="color: #000000;"><code class="bash plain">EOF</code></span></div></div></div>'''Create a partition table|}</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 partitions2- '''</div><div class="codeContent panelContent pdl"><div id="highlighter_144340" class="syntaxhighlighter sh-eclipse nogutter bash">{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"Create a partition table
|-
| class="code"|<div span class="container" title="Hint: doublemw-click to select codeheadline"><div class="line number1 index0 alt2"><code class="bash plain">$ [[File:2.png|430x202px]]</codespan><code span class="bash functionsmw-headline">sudo</code> <code class="bash plain">mkfs[[File:SD4.vfat -F 32 png|433x298px]]</code><code class="bash plain">/dev/</codespan>||<code span class="bash plain"> mw-n boot</code> <div class="line number2 index1 alt1headline"><code class="bash plain">$ </code><code class="bash functions">sudo</code> <code class="bash plain">mkfs[[File:2.ext3 </code><code class="bash plain">/dev/</code><code class="bash plain"> -L rootfs</code></div></div></div>png|}418x197px]]</divspan></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> <div span class="code panel pdl conf-macro output-block" data-hasbody="true" datamw-macro-name="codeheadline"><div class="codeHeader panelHeader pdl">'''u-boot[[File:SD4.imx copy'''png|431x297px]]</div><div class="codeContent panelContent pdl"span><div id="highlighter_550267" class="syntaxhighlighter sh-eclipse nogutter bash">{| class=" contenttable" border="0" cellspacing="0" cellpadding="0"
|-
| class="code"|'''<div span class="container" title="Hint: doublemw-click to select codeheadline"><div class="line number1 index0 alt2"><code class="bash plain">$ 3- </codespan>'''<code span class="bash functionsmw-headline">sudo</code> <code class="bash functions">dd</code> <code class="bash keyword">if</code><code class="bash plain">=/</code><code class="bash plain">/u-Create a FAT32 '''boot'''partition</code><code class="bash plain">.imx of=</code><code class="bash plain">/dev/</code><code class="bash plain"> bs=512 seek=2</code> <div class="line number2 index1 alt1"><code class="bash plain">$ </code><code class="bash functions">sync</code></div></div></divspan>|}</div>|</div></div>For example <div span class="code panel pdl confmw-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdlheadline">'''u3-'''Create a FAT32 '''boot.imx copy'''partition '''leaving 8MB before'''</div><div class="codeContent panelContent pdl"><div id="highlighter_209438" class="syntaxhighlighter sh-eclipse nogutter bash"span>{| 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 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> <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 Partitions</span>==When the install procedure ends you can call the program from your system tools menu or directly using a terminal console[[File:2. <div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div></div></div>png|432x203px]]</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[[File:fat32_c121.png|429x293px]]
We will configure the partition as:
* Free Space Preceding: 1MB
* Primary Partition
* File system/ Format: FAT32* Size: 100 MegaBytes* Free Space Preceding: 0 MiBMB* Label: '''Boot'''
* '''Align to: cylinder'''
We will configure the partition as:
* Free Space Preceding: '''8MB'''
* Primary Partition
* File system/ Format: FAT32* Free Space Preceding: 8 MiB* Size: 100 MegaBytesMB* 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 />It is recommended to </span>||'''<span class="mw-headline">5- </span>'''apply <span class="mw-headline">Apply changes</span>|-||'''<span class="mw-headline">[[File:fat32_c3.png|411x279px]]</span>'''||[[File:im_2.png|403x275px]]|-||'''<span class="mw-headline">6- </span>'''<span class="mw-headline">Set boot flag to boot partition</span>||' now or you might get an error later''<span class="mw-headline">6- </span>'''<span class="mw-headline">Set boot flag to boot partition</span>|-||[[File:fat32_c4.png|411x278px]]
==='''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 boot each partcopy everything into the MicroSD Card<br />'''=Now we will see where Once the MicroSD is completely prepared, it is time to put each part copy the u-boot, kernel and how root dile system tothe MicroSD Card.
==U-Boot==
'''TexasGeneral 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'''
<pre>$ cp MLO [your_u-boot_directory]/u-.boot.img /media/user/boot cp [your_u-boot_directory]/MLO /media/user/boot
</pre>
You can follow this this post [index.php/[The bootloader U-Boot|U-Boot_Texas_Instruments_Series HowToboot Bootloader]] if if you want build the MLO and u-boot
'''iMX6Freescale processors<br />'''
* Copy u-boot.imx using dd before primary partition in raw mode as
<pre>sudo dd ifsudo dd if=/home/user/u-boot[your_u-imxboot_directory]/u-boot.imx of=/dev/sde [your_sd] bs=512 seek=2</pre>Where You can follow this post [[The bootloader U-Boot|U-boot Bootloader]] you want build the u-boot.imx '''How to configure Uenv<br /dev>''' 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. [http://downloads.isee.biz/pub/relaunch/uenv.txt uenv.txt]* If we want boot from nfs server. [http://downloads.isee.biz/pub/relaunch/sde is your microsd carduenv_nfs.txt uenv.txt]
==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 [[Linux Kernel 4.9.y|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 [http://labs.isee.biz/index.php/IGEP_Firmware_set-up downloaded here.]