Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Prepare a bootable MicroSD Card

4,150 bytes removed, 09:52, 1 July 2019
no edit summary
=='''<span class="mw-headline">Prepare a SD In order to boot</span>'''==<div style="text-align: left;">{{Message/Information Message|title=TITLE|message= <span style="color: #000000;">We are using this version of Ubuntu .........</span>}}</div><div style="text-align: left;">We start developing with an IGEP PROCESSOR BOARD we can use two differents methods in order a microSD Card to flash our system and boot from it. One is the '''GPARTED''' and Most of the other cases is the '''sfdisk'''. Gparted is more visual than sfdisk but sfdisk is faster easiest way to do soboot a board.<br /></divspan>
<span class="mw-headline">The following steps details how to prepare a booteable MicroSD Card</span>
===<span id="Preparing_the_microSD_card" class="mw-headline">Preparing the microSD cardPrepare 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>Open <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 window :</div><div style="text-align: left; padding-left: 30px;">'''1-''' Clean the ''dmesg'' information:</div> sudo dmesg -c'''2-''' Insert the microSD Card and clear your show the ''dmesg using'' information:
<pre>sudo dmesg -c</pre>Now insert a new microsd card in your PC and then check your dmesgThe result have to be similar to this:
<pre>dmesg</pre>
You should see something like this:
<pre>mmc0[[File: new high speed SDHC card at address 0001mmcblk0: mmc0:0001 00000 3dev.79 GiBmmcblk0: unknown partition table</pre>Ensure all in your microsd card it's erased:png]]
<prediv 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/mmcblk0 sdX bs=1024 count=1024[sudo] password Where '''X''' is the character returned previously by your system, for jdoeexample, in the previous situation:</pre>
sudo dd if=/dev/zero of=/dev/sdc bs=1024 count=1024
Before use anyway of partition one good practise is unmount the dev where is inserted the SD. -> <code>umount /dev/sdx</code>
===<span id="Install_GParted" class="mw-headline">Downloading GParted</span>===<span style="color: #ff0000;">In order Now we are ready to prepare a micro SD with your already generated u-boot you need to flash the u-boot.imx using create the command ddcorresponding partitions in our MicroSD Card. (?)<br /></span>
It is important ==How to prepare your micro SD card first creating a partition that leave some free space for the uMicroSD card==<div style="text-bootalign: left;">There are several ways to partition a MicroSD Card.imx. It In this post we are using the GParted tool that can be used GPARTED installed as it is shown in the image:</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>
[[File:GPARTED.png|center|713x201px]]  In this image we can see the devices plugged in our computer. And it can be installed with this command. <pre>sudo apt-get install gparted</pre>==='''<span styleclass="color: #000000;mw-headline">When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.Using Gparted:</span>'''=== <span style{| class="color: #000000;contenttable sortable"> </span>|-!|<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"></div>=='''GENERAL CASE'''=====!|==<span id="GParted_and_Creation_of_Partitions" class="mw-headline">='''Make the partition of the SDNXP PROCESSORS'''<br /></span>=====Now we are going to see some steps with the two methods.|- First creating ||'''1- '''Select the partition and then how procedure with each processor.corresponding device {| class="sortable contenttable" style="width: 890px;"|'''1- '''Select the corresponding device
|-
! style||<span class="widthmw-headline">[[File: 869px;" colspan1.png|429x186px]]</span>||<span class="2mw-headline">[[File:1.png|==='''Defining Partitions'''===413x179px]]</span>
|-
| style="width: 209.783px;"|=====GPARTED=====| style="width: 659.217px;"|The next step it's create the '''msdos table partition2- ''' 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" style="text-align: left;"><div class="thumbcaption"><div class="magnify"></div></div><span style="color: #ff0000;">2 FOTOS</span></div></div></div>Check the default option it's create a msdos partition table. After that you can ||'''Apply2- '''.Create a partition table
|-
| style|<span class="widthmw-headline">[[File: 2092.783px;"png|=====SFDISK=====| style430x202px]]</span><span class="widthmw-headline">[[File: 659SD4.217px;"png| sudo sfdisk 433x298px]]</dev/ <<EOF<br>label: dos<brspan>16065,128520,0x0C,*<br>144585,,,-<br>EOF|}  |<div data-hasbodyspan class="true" datamw-macro-name="codeheadline">After that we will create this boot partition first for the IGEP General processors {[[File:2.png| 418x197px]]</span><span class="contenttable sortablemw-headline" style="width>[[File: 890px;"SD4.png|431x297px]]</span>
|-
! style||'''<span class="width: 869px;mw-headline" colspan>3- </span>'''<span class="2mw-headline">Create a FAT32 '''boot '''partition</span>||===<span id="Create_the_BOOT_Partition_-_IGEP_Texas_Instruments_Processor_based" class="mw-headline">'''3- '''Create the BOOT Partition -a FAT32 '''boot ''' partition '''General IGEP Processor basedleaving 8MB before'''</span>===
|-
| style="width: 164.233px;"|=====<span style="color: #000000;"><span class="mw-headline">GPARTED</span>[[File:2.png|432x203px]]</span>=====| style="width[[File: 704fat32_c121.767px;"png|<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:429x293px]]
<div class="center"><div class="thumb tnone"><div class="thumbinner"><div class="thumbcaption"><div class="magnify">We will configure the partition as:
</div></div></div></div>We will configure the partition as* Free Space Preceding:1MB
* Primary Partition
* File system/ Format: FAT32* Size: 100 MegaBytesMB* Label: '''Free Space Preceding: 0 MiBBoot'''* Label: Boot
* '''Align to: cylinder'''
It is recommended to '''apply changes''' now or you might get an error later||<span class="mw-headline">[[File:2.png|432x203px]]</span>[[File:im_1.png|425x290px]]
</div>
|-
| style="width: 164.233px;"|
=====<span style="color: #000000;">SFDISK</span>=====
| style="width: 704.767px;"|Bla bla bla
|}</div>
 
 
Specifically for the IGEP NXP-Freescale
 
{| class="contenttable sortable" style="width: 890px;"
|-
! style="width: 870px;" colspan="2"|
==='''<span id="Create_the_BOOT_Partition_-_IGEP_NXP-Freescale_Processor_based" class="mw-headline">Create the BOOT Partition - IGEP NXP-Freescale Processor based</span>'''===
|-
| style="width: 184.933px;"|
=====<span style="color: #000000;"><span class="mw-headline">GPARTED</span></span>=====
| style="width: 685.067px;"|<u>This Step it's only for iMX6 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: '''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.
 
|-
| style|'''<span class="width: 184.933px;mw-headline"|=====>4- </span>'''<span styleclass="color: #000000;mw-headline">SFDISKCreate a ext4 '''rootfs '''partition</span>=====| style|'''<span class="width: 685.067px;mw-headline"|<pre>$ sudo mkfs.vfat 4-F 32 /dev</ span>'''<span class="mw-n bootheadline">Create a ext4 '''rootfs '''partition</prespan> $ sudo mkfs|-||[[File:fat32_c2.ext3 /dev/ png|407x279px]]'''7-L rootfs''' Check the results are similar to the followings:|}|[[File:fat32_c2.png|407x279px]]|- After these steps we will make the root filesystem partition ||'''<span class="mw-headline">5- </span>'''<span class="mw-headline">Apply changes<br /></span> {| |'''<span class="mw-headline">5- </span>'''<span class="contenttable sortablemw-headline" style>Apply changes</span>|-||'''<span class="widthmw-headline">[[File: 890px;"fat32_c3.png|411x279px]]</span>'''||[[File:im_2.png|403x275px]]
|-
! style||'''<span class="width: 871px;mw-headline" colspan>6- </span>'''<span class="2mw-headline">Set boot flag to boot partition</span>||==='''<span id="Create_the_ROOTFS_Partition" class="mw-headline">Create the ROOTFS Partition6- </span>'''<span class==="mw-headline">Set boot flag to boot partition</span>
|-
| style="width: 205px;"|=====<span style="color[[File: #000000;"><span class="mw-headline">GPARTED</span></span>=====fat32_c4.png| style="width: 666px;"|The Next step it's create the root file system partition.  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:411x278px]]
<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[[File:fat32_c5.png|432x291px]]
* Primary Partition||* Format[[File: EXT4* Size: All the Rest* Label: Rootfs'''<br />'''IM_25.png|414x281px]]
At end we will click on "Add" button[[File:fat32_c5<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 class="thumbinner"><div class="thumbcaption"><div class="magnify"></div></div></div></div></div>After all apply all changespng|431x291px]]
|-
| style="width: 205px;"|=====SFDISK=====| style="width: 666px;"|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.7-'''</u>Check the results are similar to the followings: <div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl"></div><div class="codeHeader panelHeader pdl">||'''u7-boot.imx copy'''</div>Check the results are similar to the followings:<div id="highlighter_550267"> $ sudo dd if=//u|-boot.imx of=/dev/ bs=512 seek=2<br>$ sync</div></div>For example <div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl">'''u-boot||[[File:fat32_c6.imx copy'''</div>png|434x294px]]<div id="highlighter_209438"> $ sudo dd if=/home/user/Project/u-boot/u-boot||[[File:im_3.imx of=/dev/sdd bs=512 seek=2<br>$ sync</div></div>png|438x301px]]
|}
'''<span class="mw-headline">By doing that we will have ready the microSD Card in order to copy our files.</span>'''
Finally we will make this.
===='''Using SFDISK & MKFS<span id="Select_.22Boot_flag.22_for_the_boot_partition" class="mw-headline">Select "Boot flag" for the boot partition<br /span>'''====<span class="mw-headline"> </span>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<span br>label: dos<br>63,144522,0x0C,*<br>160650,,,-<br>EOF| style="colorwidth: #000000436.633px;"| sudo sfdisk /dev/ <<EOF<br>label: dos<span classbr>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="mwwidth: 436.633px;"|'''For example:'''|-headline| style="width: 431.367px;"| sudo sfdisk /dev/<strong>GPARTEDsdc</spanstrong><<EOF<br data-attributes="%20/span">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;"|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 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="Manage Flags%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"><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     ='''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 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 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-boot[your_u-imxboot_directory]/u-boot.imx of=/dev/sde [your_sd] bs=512 seek=2</pre><You can follow this post [[The bootloader U-Boot|U-boot Bootloader]] you want build the u>Where /dev/sde is your microsd card</u>-boot.imx
You can follow this [['''How to prepare a bootable MicroSD Card|link]] you want build the u-boot.imxconfigure 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.
We present two examples of help to start the system from the MicroSD Card or from an nfs server.
==Root file System==In this tutorial * If we will use want boot from the bootable microSD Card. [http://downloads.isee.biz/pub/filesrelaunch/linarouenv.txt uenv.txt]* If we want boot from nfs server. [http:/releases/linaro-m-headless-tar-20101108-2downloads.isee.biz/pub/relaunch/uenv_nfs.tartxt uenv.gz linaro headlesstxt] (soft floating) image as rootfs but you can use your favorite rootfs also.
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'''
{| cellspacing="1" cellpadding="1" border="0" width="auto" align="center"|-||| style="text-align: center;"| |-| scope="row"| ||Here there are many articles about how to get '''many other [index.php/Category:Software_distributions software distributions]Kernel Modules'''.|}<br /> Here you've have to be copied using the command indicated in the kernel compilation [http://downloads[Linux Kernel 4.isee9.biz/pub/files/linaro/releases/linaro-11.09-nano-n-tar-20110929-0.tar.gz linaro nano 11.09y|post]] (soft floating) available for download from into the ISEE server'''rootfs partition'''. 
Notes: You must build your programs with the hard floating if your rootfs is build with it.
 
Notes: IGEPv5 must use Hard floating Rootfs
 
 
 
===<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