Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Prepare a bootable MicroSD Card

5,758 bytes removed, 09:52, 1 July 2019
no edit summary
<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<div style="text-align: left; padding-left: 30px;">'''2-''' Insert the microSD Card and show the ''dmesg'' information:</div> dmesg<div style="text-align: left;">The result have to be similar to this:</div>[[File:SD1_.png]]
dmesgThe result have to be similar to this:  [[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/sdsdc'''e.'''</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<div style="text-align: left;">Where '''X''' is the character returned previously by your system, for example, in the previous situation:</div>  sudo dd if=/dev/zero of=/dev/sde sdc bs=1024 count=1024Before use anyway of partition one good practise is unmount the dev where is inserted the SD. -> <div style="text-align: left;"code>umount /dev/sdx</code> Now we are ready to create the corresponding partitions in our MicroSD Card.</div>
==How to partition the MicroSD card==
<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 class="mw-headline">General case processUsing Gparted:</span>'''==={| class="contenttable sortable"|-!|====='''<span classGENERAL CASE'''=====!|====="mw-headline">Finding your device</span>'''NXP PROCESSORS'''=====|-||'''1- '''Select the corresponding device||'''1- '''Select the corresponding device|-||<span class="mw-headline">[[File:1.png|733x318px429x186px]]</span>   ===='''||<span class="mw-headline">Create the MSDOS Partition Table [[File:1.png|413x179px]]</span>|-||'''2- '''Create a partition table||'''2- ''===='Create a partition table|-||<span class="mw-headline">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[[File:2. png|430x202px]]</span>  <span class="mw-headline">[[File:2SD4.png|733x345px433x298px]]</span>   ===='''||<span class="mw-headline">Erasing all data[[File:2.png|418x197px]]</span>'''====<span class="mw-headline">Check the default option it's create a msdos partition table[[File:SD4.png|431x297px]]</span>|-||'''<span class="mw-headline"><br />3- </span>''' After that you can '''Apply'''.  <span class="mw-headline">[[File:SD4.png|717x494px]]Create a FAT32 '''boot '''partition</span>   ===='''||<span class="mw-headline">Creating the '''3- '''Create a FAT32 '''boot '''partition'''leaving 8MB before'''</span>'''====|-||<span class="mw-headline">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[[File:2.png|432x203px]]</span>[[File:fat32_c121.png|429x293px]]
We will configure the partition as:
* Free Space Preceding: 1MB
* Primary Partition
* File system/ Format: FAT32
* Size: 100 MegaBytesMB* Label: '''Boot'''
* '''Align to: cylinder'''
 [[File:SD5.png|721x324px]] * It is recommended to '''apply changes''' now or you might get an error later.  ===='''<span class="mw-headline">Creating the new partition</span>'''====<span class="mw-headline">The Next step it's create the root file system partition.<br />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:</span>  [[File:SD6.png|710x334px]]   ===='''<span class="mw-headline"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Characterizing</span></span> the Rootfs</span>'''====<span class="mw-headline">We will configure the rootfs partition as:<br /></span> * Primary Partition* Format: EXT4* Size: All the Rest* Label: Rootfs'''<br />'''* Other spaces such as the defaults ones At end we will click on "Add" button.  [[File:SD7.png|715x319px]]   ===='''<span class="mw-headline">Applying changes</span>'''====<span class="mw-headline">Click on apply button in the main menu after that gparted show a window like this for confirm all operations </span> [[File:SD8.png|715x321px]]   * <span class="mw-headline">We should click on apply button to confirm<br /></span>  [[File:SD9.png|722x323px]]   ===='''Loading'''====When the process finish we can see all changes applied   [[File:SD10.png|724x326px]]   ===='''<span class="mw-headline">Selecting boot flag</span>'''====<span class="mw-headline">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</span>'''<span class="mw-headline"><br /></span>'''  [[File:SD12.png|719x337px]]   Now we have the microsd prepared for copy the boot files     ==='''<span class="mw-headline">NXP case process:</span>'''======='''<span class="mw-headline">Finding your device</span>'''====<span class="mw-headline">[[File:1.png|721x313px]]</span>   ===='''<span class="mw-headline">Create the MSDOS Partition Table </span>'''====<span class="mw-headline">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. </span>  <span class="mw-headline">[[File:2.png|731x344px432x203px]]</span>   ===='''<span class="mw-headline">Erasing all data</span>'''====<span class="mw-headline">Check the default option it's create a msdos partition table.</span>'''<span class="mw-headline"><br /></span>''' After that you can '''Apply'''.  <span class="mw-headline">[[File:SD4im_1.png|724x499px425x290px]]</span>   ===='''<span class="mw-headline">Creating the boot partition</span>'''====<span class="mw-headline">This Step it's only for iMX6 processor based IGEP boards.</span> The Next step it's create the partitions for it you should go to the partition menu and select the "New" option.
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'''
It is recommended to apply changes now or you might get an error later|-||'''<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]]|-||'''<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]]
'''<span class="mw-headline">||[[File:SD_IMX_1IM_25.png|728x338px414x281px]]</span>'''
[[File:fat32_c5.png|431x291px]]
|-
||'''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">Creating By doing that we will have ready the new partitionmicroSD Card in order to copy our files.</span>'''====<span class="mw-headline">The Next step it's create the root file system partition.<br />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:</span>
[[File:SD_IMX_2.png|708x333px]]
 
 
 
===='''<span class="mw-headline"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Characterizing</span></span> the Rootfs</span>'''====
<span class="mw-headline">We will configure the rootfs partition as:<br /></span>
 
* Primary Partition
* File system/Format: EXT4
* Size: All the Rest
* Label: Rootfs'''<br />'''
* Other spaces such as the defaults ones
 
At end we will click on "Add" button.
 
 
[[File:SD_IMX_3.png|706x333px]]
 
 
 
===='''<span class="mw-headline">Applying changes</span>'''====
<span class="mw-headline">Click on apply button in the main menu after that gparted show a window like this for confirm all operations </span>
 
 
[[File:SD_IMX_4.png|712x333px]]
 
 
 
* <span class="mw-headline">We should click on apply button to confirm</span>
 
<span class="mw-headline">[[File:SD_IMX_5.png|718x338px]]</span>
 
 
 
===='''Loading'''====
When the process finish we can see all changes applied 
 
 
[[File:SD_IMX_7.png|728x342px]]
 
 
 
===='''<span class="mw-headline">Selecting boot flag</span>'''====
<span class="mw-headline">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</span>
 
 
[[File:SD_IMX_8.png|727x340px]]
 
 
==='''SFDISK'''===
 
===='''IMX6'''====
 
sudo sfdisk /dev/<your_device> <<EOF<br/>label: dos<br/>16065,128520,0x0C,*<br/>144585,,,-<br/>EOF<br><br><strong>Example</strong><br/><br/>sudo sfdisk /dev/sdc <<EOF<br/>label: dos<br/>16065,128520,0x0C,*<br/>144585,,,-<br/>EOF
 
 
 
'''Explanation'''
 
sudo mkfs.vfat -F32 /dev/<your_device> -n boot<br data-attributes="%20/"><br data-attributes="%20/"><strong>Example</strong><br data-attributes="%20/"><br data-attributes="%20/">sudo mkfs.vfat -F32 /dev/sdc1 -n boot
 
[[File:SFDISK_IMX2.png]]
 
 
'''Explanation'''
 
sudo mkfs.ext4 /dev/<your_device> -L rootfs<br data-attributes="%20/"><br data-attributes="%20/"><strong>Example</strong><br data-attributes="%20/"><br data-attributes="%20/">sudo mkfs.ext4 /dev/sdc2 -L rootfs
[[File:SFDISK_IMX3.png]]
 
==== ====
'''Here the result'''
 
[[File:SFDISK_NORMAL4.png]]
 
 
 
 
===='''NORMAL'''====
'''Explanation'''
 
sudo sfdisk /dev/<your_device> <<EOF<br/>label: dos<br/>63,144522,0x0C,*<br/>160650,,,-<br/>EOF<br/><br data-attributes="%20/"><strong>Example</strong><br/><br data-attributes="%20/">sudo sfdisk /dev/sdc <<EOF<br/>label: dos<br/>63,144522,0x0C,*<br/>160650,,,-<br/>EOF
 
[[File:SFDISK_NORMAL1.png]]
 
 
'''Explanation'''
 
sudo mkfs.vfat -F32 /dev/<your_device> -n boot<br data-attributes="%20/"><br data-attributes="%20/"><strong>Example</strong> <br/><br data-attributes="%20/">sudo mkfs.vfat -F32 /dev/sdc1 -n boot
[[File:SFDISK_IMX2.png]]
 
 
'''Explanation'''
 
sudo mkfs.ext4 /dev/<your_device> -L rootfs<br><br><strong>Example</strong><br><br data-attributes="%20/">sudo mkfs.ext4 /dev/sdc2 -L rootfs
'''<br />[[File:SFDISK_NORMAL3.png]]<br />'''
 
 
 
'''The result'''
 
'''[[File:SFDISK_NORMAL5.png|638x70px]]'''
 
 
'''<br /><br /><span style="color: #ff0000;">sudo dd if=./u-boot.imx of=/dev/sdc bs=512 seek=2; sync ?????</span><br />'''
==='''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==
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 post [[How to prepare a bootable MicroSD CardThe bootloader U-Boot|linkU-boot Bootloader]] if you want build the MLO and u-boot
* Copy u-boot.imx using dd before primary partition in raw mode as
<pre>sudo dd ifsudo dd if=/home/user/u[your_u-boot-imxboot_directory]/u-boot.imx of=/dev/sde [your_sd] bs=512 seek=2</pre><u>Where /dev/sde is your microsd card</u>  You can follow this post [[How to prepare a bootable MicroSD CardThe bootloader U-Boot|linkU-boot Bootloader]] you want build the u-boot.imx
'''How to configure Uenv<br />'''
==Root file System==In It is need to indicate how start the boot. For this tutorial we reason it will use be created a file called uenv.txt with the [http://downloads.isee.biz/pub/files/linaro/releases/linaro-m-headless-tar-20101108-2.tar.gz linaro headless] (soft floating) image as rootfs but you can use your favorite rootfs alsocorrect 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/uenv_nfs.txt uenv.txt]
{| width="auto" cellspacing="1" cellpadding="1" border="0" align="center"|-||| style="text-align: center;"| |-| scope="row"| ||Here there are many articles about how These two examples have an ip address assigned to get '''many other [index.php/Category:Software_distributions software distributions]'''.|}<br /> Here them that can be modified as you've the [http://downloads.isee.biz/pub/files/linaro/releases/linaro-11.09-nano-n-tar-20110929-0.tar.gz linaro nano 11.09] (soft floating) available for download from the ISEE serverwant.
Notes: You must build your programs with ==Kernel==Kernel files, '''zImage '''and''' .dtb''', can be copied into the hard floating if your rootfs is build with it.'' root folder'' of the''' boot partition'''
Notes: IGEPv5 must use Hard floating Rootfs'''Kernel Modules''' have to be copied using the command indicated in the kernel compilation [[Linux Kernel 4.9.y|post]] into the '''rootfs partition'''. 
===<span id="Create_the_Rootfs_mount_point" class="mw-headline">Create the Rootfs mount point</span>=Root file System==Go The root file system have to /media directory and create one sub-be extracted into the'' root folder called "binary" <pre>cd /media sudo mkdir binary</pre>===<span id="Mount_the_RootFS_partition" class="mw-headline">Mount the RootFS partition</span>===Mount ''  of the '''rootfs ''' '''partition using the 'binary' directory <pre>$ media > sudo mount /dev/mmcblkp2 /media/binary</pre>===<span id="Untar_the_rootfs_package" class="mw-headline">Untar the rootfs package</span>===Copy "linaro-m-headless-tar-20101108-2'.tar.gz" file inside the /media directory and untar the file <pre>$ media > sudo tar xvfz linaro-m-headless-tar-20101108-2.tar.gz<Where can be [http:/pre><br /> Now you should see inside your rootfs partition a similar structure like thislabs<div class="center"><div class="thumb tnone"><div class="thumbinner" style="width: 302px;"><div class="thumbcaption"><div class="magnify"></div></div></div></div></div>===<span id="Install_the_kernel_modules" class="mw-headline">Install the kernel modules</span>===Now you should install your kernel modules inside your root file systemisee<pre>$ media > cd biz/home/jdoe/linux-omap-2index.6 $ /homephp/jdoe/linuxIGEP_Firmware_set-omap-2.6> sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary</pre>Alternatively if you up downloaded the binary package uncompress it inside the directory /media/binary ===<span id="Install_the_kernel_Image" class="mw-headline">Install the kernel Image</span>===Just copy the zImage inside your boot partition, remember before that you must mount your mmc boot partitionhere<pre>$ /home/jdoe/linux-omap-2.6> sudo cp arch/arm/boot/zImage /media/boot/if you're using dtb kernel as 3.8.y you must copy the dtb too.$ /home/jdoe/linuz-omap-2.6> sudo cp arch/arm/boot/dtbs/omap5-igep0050.dtb /media/boot </pre>After that you can unmount the boot & rootfs partitions. Now we're ready for test our new microsd card ==Kernel & Modules==You can follow this other howto about [index.php/The_Linux_kernel how compile and install the Linux Kernel].  
=<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