Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Prepare a bootable MicroSD Card

542 bytes added, 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: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<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/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
==='''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.
|-
| style="width: 431.367px;"|
sudo sfdisk /dev/<strong><your_microsd></strong> <<EOF<br>label: dos<br>63,144522,0x0C,*<br>160650,,,-<br>EOF
| style="width: 436.633px;"|
sudo sfdisk /dev/<strong><your_microsd></strong> <<EOF<br>label: dos<br>16065,128520,0x0C,*<br>144585,,,-<br>EOF
|-
| style="width: 431.367px;"|
sudo mkfs.vfat -F32 /dev/<strong><your_microsd></strong> -n boot
| style="width: 436.633px;"|
sudo mkfs.vfat -F32 /dev/<strong><your_microsd></strong> -n boot
|-
| style="width: 431.367px;"|
sudo mkfs.ext4 /dev/<strong><your_microsd></strong> -L rootfs
| style="width: 436.633px;"|
sudo mkfs.ext4 /dev/<strong><your_microsd></strong> -L rootfs
|-
| style="width: 431.367px;"|'''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>sdcsdc1</strong> -n boot<br data-attributes="%20/"><br data-attributes="%20/">sudo mkfs.ext4 /dev/<strong>sdcsdc2</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>sdcsdc1</strong> -n boot<br><br>sudo mkfs.ext4 /dev/<strong>sdcsdc2</strong> -L rootfs<br><br>
|}
 
='''How to copy everything into the MicroSD Card<br />'''=
* Copy MLO and u-boot.img to primary into the ''root folder'' of the '''boot partition'''
cp <your_MLOpre> cp [your_u-boot_directory]/u.boot.img /media/<your_user>user/boot cp <[your_u-boot.img> boot_directory]/MLO /media/user/boot<your_user/pre>/bootYou 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= /[your_u-boot_directory]/u-boot.imx of=/dev/ [your_sd] bs=512 seek=2</pre>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 />''' 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.
==Root file System==The root file system have We present two examples of help to be extracted into start the'' root folder''  of system from the '''rootfs''' partitionMicroSD 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]
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'''
'''Kernel Modules '''can 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.]   
560
edits