Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Prepare a bootable MicroSD Card

5,437 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"
|-
!|
====='''GENERAL CASE'''=====
!|
====='''NXP PROCESSORS'''=====
|-
||'''1- '''Select the corresponding device
||[[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>'''
==='''<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>
==='''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.
===='''<span {| class="mw-headlinecontenttable sortable">Create the MSDOS Partition Table </span>'''===style="width: 890px;"|-<span class! style="mw-headlinewidth: 431.367px;">The next step it's create the msdos table partition for it you should click in the |GENERAL CASE! style="Devicewidth: 436.633px;" menu and then in the "Create Partition Table" option. </span>|NXP PROCESSORS|- <span class| style="mw-headlinewidth: 431.367px;"| sudo sfdisk /dev/ <<EOF<br>[[Filelabel:2.png|731x344px]]dos</spanbr>   ===='''63,144522,0x0C,*<span class="mwbr>160650,,,-headline">Erasing all data</spanbr>'''====EOF<span class| style="mw-headlinewidth: 436.633px;">Check the default option it's create a msdos partition table.| sudo sfdisk /dev/ <<EOF</spanbr>'''label: dos<span class="mw-headline"br>16065,128520,0x0C,*<br />144585,,,-</spanbr>'''EOF|-After that you can '''Apply'''| style="width: 431.367px;"| sudo mkfs.vfat -F32 /dev/ -n boot <span class| style="mw-headline">[[Filewidth:SD4436.png633px;"|724x499px]]< sudo mkfs.vfat -F32 /dev/span>-n boot|-  ===='''<span class| style="mw-headlinewidth: 431.367px;">Creating the boot partition<| sudo mkfs.ext4 /dev/span>'''====-L rootfs<span class| style="mw-headlinewidth: 436.633px;">This Step it's only for iMX6 processor based IGEP boards| sudo mkfs.<ext4 /dev/span>-L rootfs|-The Next step it's create the partitions for it you should go to the partition menu and select the | style="Newwidth: 431.367px;" option. We will configure the partition as|'''For example* Primary Partition* Format: FAT32* Free Space Preceding: 8 MiB* Size: 100 MegaBytes* Label: Boot* Align to: cylinder It is recommended to apply changes now or you might get an error later.  '''<span class| style="mw-headline">[[Filewidth:SD_IMX_1436.png633px;"|728x338px]]</span>'''   ====For example:'''<span class|-| style="mw-headlinewidth: 431.367px;"| sudo sfdisk /dev/<strong>Creating the new partitionsdc</spanstrong>'''====<span class<EOF<br data-attributes="mw-headline">The Next step it's create the root file system partition.<br %20/>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>  [[Filelabel:SD_IMX_2.png|708x333px]]   ===='''dos<span classbr data-attributes="mw-headline%20/">63,144522,0x0C,*<span id="result_box" class="short_text" tabindex="br data-1" langattributes="en%20/">160650,,,-<span classbr data-attributes="%20/">CharacterizingEOF</spanbr><br>sudo mkfs.vfat -F32 /dev/span<strong> the Rootfssdc1</spanstrong>'''====-n boot<span classbr data-attributes="mw-headline%20/">We will configure the rootfs partition as:<br data-attributes="%20/">sudo mkfs.ext4 /dev/<strong>sdc2</spanstrong> -L rootfs<br* 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 | style="Add" button.  [[Filewidth:SD_IMX_3436.png633px;"|706x333px]]   ====''' sudo sfdisk /dev/<span class="mw-headline"strong>Applying changessdc</spanstrong>'''====<span class<EOF<br data-attributes="mw-headline%20/">Click on apply button in the main menu after that gparted show a window like this for confirm all operations label: dos<br data-attributes="%20/span">  [[File:SD_IMX_4.png|712x333px]]   16065,128520,0x0C,* <span classbr data-attributes="mw%20/">144585,,,-headline<br data-attributes="%20/">We should click on apply button to confirmEOF<br><br>sudo mkfs.vfat -F32 /dev/span<strongsdc1<span class="mw/strong> -headline"n boot<br>[[File:SD_IMX_5.png|718x338px]]</spanbr>   ===='''Loading'''====When the process finish we can see all changes applied   [[File:SD_IMX_7sudo mkfs.png|728x342px]]   ===='''ext4 /dev/<span class="mw-headline"strong>Selecting boot flagsdc2</spanstrong>'''====-L rootfs<span class="mw-headline"br>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</spanbr>|}
 [[File:SD_IMX_8.png|727x340px]]   ==='''SFDISK'''======='''IMX6'''==== sudo sfdisk /dev/ <<EOF<br>label: dos<br>16065,128520,0x0C,*<br>144585,,,-<br>EOF<br><br><strong>Example</strong>How to copy everything into the MicroSD Card<br><br>sudo sfdisk /dev/sdc <<EOF<br>label: dos<br>16065,128520,0x0C,*<br>144585,,,-<br>EOF[[File:SFDISK_NORMAL1.png]] '''Explanation'''  sudo mkfs.vfat -F32 /dev/ -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/ -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 Once the result''' [[File:SFDISK_NORMAL4.png]]     ===='''NORMAL'''===='''Explanation'''  sudo sfdisk /dev/ <<EOF<br>label: dos<br>63MicroSD is completely prepared,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/ -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/ -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=./it is time to copy the u-boot.imx of=/dev/sdc bs=512 seek=2; sync ?????</span><br />'''     ='''How to boot each part'''=Now we will see where to put each part , 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  
==Root file System==
In this tutorial we will use 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 also.
'''How to configure Uenv<br />'''
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.
{| width="auto" cellspacing="1" cellpadding="1" border="0" align="center"|-||| style="text-align: center;"| |-| scope="row"| ||Here there are many articles about how We present two examples of help to get '''many other [index.php/Category:Software_distributions software distributions]'''.|}<br /> Here you've start 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 system from the ISEE MicroSD Card or from an nfs server.
Notes* 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: You must build your programs with the hard floating if your rootfs is build with it//downloads.isee.biz/pub/relaunch/uenv_nfs.txt uenv.txt]
Notes: IGEPv5 must use Hard floating RootfsThese 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 [[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>===
Go to /media directory and create one sub-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 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</pre>
<br /> Now you should see inside your rootfs partition a similar structure like this.
 
<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 system.
 
<pre>$ media > cd /home/jdoe/linux-omap-2.6
 
$ /home/jdoe/linux-omap-2.6> sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary
</pre>
Alternatively if you 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 partition.
 
<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].
==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