Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Prepare a bootable MicroSD Card

14 bytes removed, 09:52, 1 July 2019
no edit summary
 
===<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>}}
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="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>Now insert a new microsd card in your PC and then check your dmesg: <pre>dmesg</pre>You should see something like this: <pre>mmc0: new high speed SDHC card at address 0001mmcblk0: mmc0:0001 00000 3.79 GiBmmcblk0: unknown partition table</pre>Ensure all in your microsd card it's erased: <pre>$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024[sudo] password for jdoe:</pre>='''<span class="mw-headline">Prepare a SD to boot</span>'''={{Message/Information Message|title=TITLE|message= <span style="color: #000000;">We are using this version of Ubuntu .........</span>}}   ==<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. This method is much more graphic than sfdisk method.   [[File:GPARTED.png|center|713x201px]]  And it can be installed with this command. <pre>sudo apt-get install gparted</pre><span style="color: #000000;">Now we will see all the steps for this partition with GPARTED after another brief  explanation of  sfdisk method.</span>  
* <span style="color: #000000;">Using fdisk we create directly two partitions</span>
<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code">
==<span style="color: #000000;">Using sfdisk partition method</span>==
<div id="highlighter_789287">
<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>
<pre>sudo sfdisk /dev/ 16065,128520,0x0C,*<br>144585,,,span class="mw-<brheadline">EOFThe following steps details how to prepare a booteable MicroSD Card</prespan>
</div></div><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div span class="codeHeader panelHeader pdlmw-headline">'''Define partitions'''Prepare a SD to boot</divspan>==<div classstyle="codeContent panelContent pdltext-align: left;"><div class{{Message/Information Message|message="syntaxhighlighter sh-eclipse nogutter bash">The following steps has been tested using an Ubuntu 16.04}}</div><div classstyle="syntaxhighlighter shtext-eclipse nogutter bashalign: left;"><pre>$ sudo mkfsFirst of all it is important to detect which device is our microSD Card.vfat -F 32 /dev/ -n boot</pre><pre>$ sudo mkfs.ext3 /dev/ -L rootfs</pre>In order to do that we can follow this instructions in a Linux terminal:</div><div classstyle="syntaxhighlighter shtext-align: left; padding-eclipse nogutter bashleft: 30px;">'''1-''' Clean the ''dmesg'' information:</div></div> sudo dmesg -c</div>Then you only have to use dd command in order to copy '''2-''' Insert the u-boot.imx to microSD Card and show the SD card.''dmesg'' information:
<u>'''Please, dmesgThe result have to be sure you have write correctly the following command because in if not, it can corrupt your computer.'''</u>similar to this:
<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 id="highlighter_550267">
<pre>$ sudo dd if=//u-boot.imx of=/dev/ bs=512 seek=2 <br>$ sync</pre>
</div></div>For example[[File:dev.png]]
<div classstyle="code panel pdl conftext-macro output-blockalign: left;" data-hasbody="true" data-macro->We can see the name="code"><div class="codeHeader panelHeader pdl">of our device in the system: '''/dev/sdX''' where X is the character assigned by our system, in this case /dev/sdc'''u-boot.imx copy'''</div><div idstyle="highlighter_209438text-align: left;">Now we have to ensure that the MicroSD Card is completely clean. We can use the following command to do that:<pre/div>$ sudo dd if sudo dd if=/home/user/Project/u-bootdev/u-boot.imx zero of=/dev/sdd bssdX bs=512 seek1024 count=2<br>$ sync</pre>1024Where '''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=1024Before use anyway of partition one good practise is unmount the dev where is inserted the SD. -> <code>umount /div>dev/sdx</divcode>
Now we are ready to create the corresponding partitions in our MicroSD Card.
==How to partition the MicroSD card==<span iddiv style="GParted_and_Creation_of_Partitionstext-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">Using GParted Other tools as sfdisk and Creation of Partitionsmkfs are useful too.</span>==When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.
<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 It is important to difference between a MicroSD Card for a NXP processor and the MSDOS Partition Table</span>===other cases. The next step it's create the msdos table process of partition for it you should click is similar but, in the "Device" menu and then in the "Create Partition Table" optioncase of NXP chips, there exists some differences. </span>
==='''<div span class="centermw-headline">Using Gparted:<div /span>'''==={| class="thumb tnonecontenttable sortable"|-!|====='''GENERAL CASE'''=====!|====='''NXP PROCESSORS'''=====|-||'''1- '''Select the corresponding device||'''1- '''Select the corresponding device|-||<span class="mw-headline">[[File:1.png|429x186px]]</span>||<div span class="thumbinnermw-headline">[[File:1.png|413x179px]]<div /span>|-||'''2- '''Create a partition table||'''2- '''Create a partition table|-||<span class="thumbcaptionmw-headline">[[File:2.png|430x202px]]</span><div span class="magnifymw-headline">[[File:SD4.png|433x298px]]</divspan>||<span class="mw-headline">[[File:2.png|418x197px]]</divspan><span class="mw-headline">[[File:SD4.png|431x297px]]</divspan>|-||'''<span class="mw-headline">3- </divspan>'''<span class="mw-headline">Create a FAT32 '''boot '''partition</divspan>Check the default option it||<span class="mw-headline">'''3- '''s create Create a msdos FAT32 '''boot '''partition table'''leaving 8MB before'''</span>|-||<span class="mw-headline">[[File:2.png|432x203px]]</span>[[File:fat32_c121.png|429x293px]]
After that you can '''Apply'''.
 
 
 
===<span id="Create_the_BOOT_Partition_-_IGEP_Texas_Instruments_Processor_based" class="mw-headline">Create the BOOT Partition - '''IGEP Texas Instruments Processor based'''</span>===
<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:
 
<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:
* Free Space Preceding: 1MB
* Primary Partition
* File system/ Format: FAT32* Size: 100 MegaBytes* Free Space Preceding: 0 MiBMB* 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'''[[File:2.png|432x203px]]</span>===<u>This Step it's only for iMX6 processor based IGEP boards[[File:im_1.</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:png|425x290px]]
<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:
* 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<br /span>It is recommended to |-||[[File:fat32_c2.png|407x279px]]'''apply changes7-''' now or you might get an error laterCheck 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 idclass="Create_the_ROOTFS_Partitionmw-headline" >Apply changes</span>|-||'''<span class="mw-headline">Create the ROOTFS Partition[[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>||'''<span class=The Next step it"mw-headline">6- </span>'''s create the root file system <span class="mw-headline">Set boot flag to boot partition</span>|-||[[File:fat32_c4.png|411x278px]]
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[[File:fat32_c5.png|432x291px]]
<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 rootfs partition as: * Primary Partition* Format: EXT4* Size: All the Rest* Label[[File: Rootfs'''<br />'''IM_25.png|414x281px]]
At end we will click on "Add" button[[File:fat32_c5.png|431x291px]]
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div>|-</div>||'''7-''' Check the results are similar to the followings:</div>||'''7-''' Check the results are similar to the followings:</div>|-</div>||[[File:fat32_c6.png|434x294px]]or||[[File:im_3.png|438x301px]]|}
'''<div span class="centermw-headline"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify"></div></div></div></div>By doing that we will have ready the microSD Card in order to copy our files.</divspan>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>
</div>
</div>
</div>
</div>
Now we have the microsd prepared for copy the boot files
==='''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 [your_u-boot_directory]/u.boot.img /media/user/boot
<pre>$ cp [your_u-boot_directory]/MLO u-boot.img /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/sde >''' It is your microsd cardneed 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.
You can follow this * If we want boot from the bootable microSD Card. [indexhttp://downloads.isee.phpbiz/pub/relaunch/U-boot_Freescale-NXP_iMX6_Series HowTo ifuenv.txt uenv.txt] you * If we want build the u-bootfrom nfs server.imx[http://downloads.isee.biz/pub/relaunch/uenv_nfs.txt 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'''
==Root file System==Bla bla bal'''Kernel Modules''' have to be copied using the command indicated in the kernel compilation [[Linux Kernel 4.9.y|post]] into the '''rootfs partition'''. 
==Kernel & Modules==
You can follow this other howto about [index.php/The_Linux_kernel how compile and install the Linux Kernel].
==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.]
=<span id="Test_your_new_MicroSD" class="mw-headline">Test your new MicroSD</span>=
You can test your new microSD card with a Serial client such as PuTTy. [index.php/Using_serial_debug_port_to_communicate Here] is an explanation about how to configure it.
(Note that speed should be configured to 115200 bauds).
If you already have configured it or you are using another Serial client and you have connected the Serial cable to the IGEPv2 board, then you are ready to test your microSD.
Insert the microSD in your IGEPv2 board and power up the board.
560
edits