Changes

How to boot from MicroSD Card

3,937 bytes added, 11:46, 9 March 2018
u-boot.imx IGEP Boards based on NXP-Freescale Processors
= Introduction Overview=This how to explains how to '''create a microSD card''' to boot IGEP boards with  '''software distributions ( yocto, Ubuntu, Debian ...)'''.
This how to explains how to boot IGEPv2 or IGEP Module using a microSD card. __TOC__
== Theory ==OMAP35xx, DM37xx, AM335x, OMAP5, iMX6 processors can boot from a microSD. All IGEP boards use the microSD card as highest boot priority, it means that the processor try to boot from the microsd card before try to boot from other devices such the OneNand, Nand, SSD or eMMC.
OMAP35xx or DM37xx processors can Exist some rules to boot from a microSD. IGEPv2 or IGEP Module uses the microSD card as highest boot priority, it means that the processor try to boot from the microsd card before try to boot from other devices such the OneNand.
Exist some rules for ===Texas Instruments Processors===* The microsd card must be content at latest 2 partitions.* The first one must be primary partition with the boot from flag mark and formated using FAT(16 or 32) file system.* All names used in this partition must be msdos names (applies to OLD OMAP35xx processor).* The processor must load a microSD cardfirst program called '''MLO''', this program must reside in the first partition, this program it's also called '''x-loader or uboot-spl. '''
*''The microsd card must be content at latest 2 partitions. *The first one must be primary partition with the processor when boot flag mark ONLY load and formated using FAT filesystem. *All names used in this partition must be msdos names, it means you cannot use a extended names. *The processor must load a first program called '''execute the MLO''', this  program must reside in and ignore all the first partition, this program rest it's also called '''xthe X-loader(MLO) the program responsible to load the next programs such kernel or uboot if you use this last one approach.'''
''===Freescale-NXP Processors===* The microsd card must be content at latest 1 partitions.* The primary partition can be formatted with any filesystem that u-boot can mount.* The processor ONLY Processor will load and execute the MLO program and ignore all the rest'''u-boot.imx''' it include the SPL and u-boot.
== Prerequisites ==''After load this u-boot.imx, u-boot will be ready for boot the kernel.''
*PC Therefore, we are going to '''setup a microSD card with Linux (We use for this how to Ubuntu 11.04) *MicroSD Card (4 Gbytes - class 4) *Tools such, fdisk, mkfs.ext3, mkfs.vfat, gparted ..these requirements''' and '''install a custom software distribution''' into it.
<br> ==Prerequisites==* PC with Linux (We use for this how to Ubuntu 16.04 LTS)* MicroSD Card (4 Gbytes - class 4) or bigger ...* Tools such, fdisk, mkfs.ext3, mkfs.vfat, gparted ...* Cross Toolchain included in Ubuntu 16.04 LTS gcc version 4.9.3 (Ubuntu/Linaro 4.9.3-13ubuntu2).
==ToolChain==* Read: [[Ubuntu 16.04 LTS Toolchain]] == Preparing the microSD card ==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:
Insert a new microsd card in your PC, you should see in your dmesg somthing like this after insert a new microsd card:
<pre>mmc0: new high speed SDHC card at address 0001
mmcblk0: mmc0:0001 00000 3.79 GiB
mmcblk0: unknown partition table
</pre> Ensure all in your microsd card it's erased:<br>  
<pre>$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024
[sudo] password for jdoe:
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.43556 s, 2.4 MB/s</pre>  == Install GParted ==We will use the gparted program for create the partitions, if you don't have this program installed then you must install it with this command: <pre>sudo apt-get install gparted</pre>  ==GParted and Creation of Partitions==When the install procedure ends you can call the program from your system tools menu or directly using a terminal console. [[Image:Gparted initial.png|thumb|center]] ===Create the MSDOS&nbsp;Partition Table===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. [[Image:Gparted create msdos table partition.png|thumb|center]]Check the default option it's create a msdos partition table. After that you can '''Apply'''.   ===Create the BOOT Partition - IGEP Texas Instruments Processor based===<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: [[Image:Gparted create first partition.png|thumb|center]]We will configure the partition as: * Primary Partition* Format: FAT32* Size: 100 MegaBytes* Free Space Preceding: 0 MiB* Label: Boot* '''Align to: cylinder''' It is recommended to '''apply changes''' now or you might get an error later. ===Create the BOOT Partition - IGEP NXP-Freescale Processor based===<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: [[File:imx6-primary-part.png|thumb|center]] We will configure the partition as: * 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. ===Create the ROOTFS Partition===The Next step it's create the root file system partition. First you should select the unallocated partition area and then&nbsp; you should go to the partition menu and select the "New" option then the application show a window like this:<br /> [[Image:Gparted create first partition.png|thumb|center]] We will configure the rootfs partition as: * Primary Partition* Format: EXT4* Size: All the Rest* Label: Rootfs'''<br />''' At end we will click on "Add" button. [[Image:Gparted all configured.png|thumb|center]]
We will use the gparted program for create the partitions, if you don't have this program installed then you must install it with this command: <pre>sudo apt-get install gparted</pre> == GParted ==or
When the install procedure ends you can call the program from your system tools menu or directly using a terminal console[[File:imx6_str. png|thumb|center]]
=== [[Image:Gparted initial.png|thumb|center]]Create the MSDOS&nbsp;Partition Table ===After all apply all changes
The next step it's create ===Select "Boot flag" for the boot partition===Now we must select the boot flag for the msdos table first partition for it you should click in we use the "Device" menu right mouse button over the boot partition and then in the select "Create Partition TableManage Flags" option.
[[Image:Gparted create msdos table partitionboot flag.png|thumb|center]]Check Now we have the default option it's create a msdos partition table after that you can apply. microsd prepared for copy the boot files
==MLO + u-boot IGEP Boards Texas Instruments based boards= Create =After build or download the BOOT Partition ===MLO and u-boot you should follow the next steps:
The Next step it's create the partitions for it you should go * Copy MLO and u-boot.img to the primary boot partition menu and select the "New" option then the application show a window like this:
$ cp MLO u-boot.img /media/user/bootYou can follow this [[Image:Gparted create first partition.png|thumbU-Boot Texas Instruments Series|centerHowTo]]We will configure if you want build the partition as:<br> MLO and u-boot
*Primary Partition<br> *Format: FAT32<br> *Size: 100 MegaBytes<br> ==u-boot.imx IGEP Boards based on NXP-Freescale Processors==*Label: Boot<br>Copy u-boot.imx using dd before primary partition in raw mode as
<br> sudo dd if=/home/user/u-boot-imx/u-boot.imx of=/dev/sde bs=512 seek=2Where /dev/sde is your microsd card
You can follow this [[Image:Gparted configure U-boot partition.pngFreescale-NXP iMX6 Series|thumb|centerHowTo ]]We must "add" if you want build the partition and gparted shows a partitions structure like thisu-boot. imx
==Kernel= Create =You can follow this other howto about [[The Linux kernel|how compile and install the ROOTFS Partition ===Linux Kernel]].
The Next step it's create ==Root File System==In this tutorial we will use the root filesystem partition[http://downloads.isee.biz/pub/files/linaro/releases/linaro-m-headless-tar-20101108-2.tar.gz linaro headless]&nbsp;(soft floating) image as rootfs but you can use your favorite rootfs also.
First you should select the unallocated partition area and then&nbsp; you should go to the partition menu and select the "New" option then the application show a window like this:<br/> {{Message/Information Message|message=Here there are many articles about how to get '''many other [[Image:Gparted create first partition.png|thumbCategory:Software distributions|centersoftware distributions]] We will configure the rootfs partition as:<br> '''.}}
*Primary Partition<br/> *Format: EXT4<br> *SizeHere you've the [http: All //downloads.isee.biz/pub/files/linaro/releases/linaro-11.09-nano-n-tar-20110929-0.tar.gz linaro nano 11.09]&nbsp;(soft floating) available for download from the Rest<br> *Label: Rootfs<br>ISEE server.
At end we will click on "Add" buttonNotes: You must build your programs with the hard floating if your rootfs is build with it.
[[ImageNotes:Gparted all configured.png|thumb|center]] IGEPv5 must use Hard floating Rootfs
=== Apply all Changes ===
Clink on Apply changes button in the main menu after that gparted show a window like this for confirm all operations
[[Image:Gparted apply changes.png|thumb|center]]We should click on apply button. ===Create the Rootfs mount point===Go to /media directory and create one sub-folder called "binary"
[[Image:Gparted apply information.png|thumb|center]]When the process finish we can see all changes applied <pre>$ cd /media
[[Image:Gparted operations complete.png|thumb|center]] $ sudo mkdir binary</pre>
Now we can see all partitions and configurations done in ===Mount the main gparted window RootFS partition===Mount the rootfs partition using the 'binary' directory
=== [[Image:Gparted partitions done.png|thumb|center]]Select "Boot flag" for the boot partition ===<pre>$ media &gt; sudo mount /dev/mmcblkp2 /media/binary</pre>
Now we must select ===Untar the boot flag for rootfs package===Copy "linaro-m-headless-tar-20101108-2.tar.gz" file inside the first partition for it we use /media directory and untar the right mouse button over the boot partition and select "Manage Flags" option file
[[Image:Gparted boot flag<pre>$ media &gt; sudo tar xvfz linaro-m-headless-tar-20101108-2.png|thumb|center]]tar.gz</pre><br /> Now we have the microsd prepared for copy the boot files you should see inside your rootfs partition a similar structure like this.
= Boot Partition Structure ==[[Image:Linaro RootFS.png|thumb|center]]Install the kernel modules===Now you should install your kernel modules inside your root file system.
We commented in the theory point the OMAP needs only the MLO (x<pre>$ media &gt; cd /home/jdoe/linux-loader) file for boot, we will start checking this pointomap-2. 6
Before $ /home/jdoe/linux-omap-2.6&gt; sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary</pre>Alternatively if you follow downloaded the next points you should mount binary package uncompress it inside the microsd boot partition in your host pc. directory /media/binary
Select ===Install the kernel Image===Just copy the zImage inside your boot partition and , remember before that you must mount it in your hostmmc boot partition.
[[Image:Microsd partitions<pre>$ /home/jdoe/linux-omap-2.png|thumb|center]] 6&gt; 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&gt; sudo cp arch/arm/boot/dtbs/omap5-igep0050.dtb /media/boot
<br/pre> After that you can unmount the boot &amp; rootfs partitions.
== X-Loader (MLO)<br> ==Now we're ready for test our new microsd card
=Test your new MicroSD=You can follow this other howto about the test your new microSD card with a Serial client such as PuTTy. [[The_IGEP_X-loaderUsing serial debug port to communicate|IGEP-X-loaderHere]]is an explanation about how to configure it.
Copy the x-loader.bin.ift into the boot partition(Note that speed should be configured to 115200 bauds).
[[Image:Copy XloaderIf 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.png|thumb|center]]
Rename Insert the x-loader.binmicroSD in your IGEPv2 board and power up the board.ift to MLO<br>
[[Image:Rename Xloader to MLOLinaro Boot1.png|thumb|center]]Now we're ready for test the board boot from the microsd card[[Image:Linaro Boot2. png|thumb|center]]
=== X-Loader Boot ===
We will eject the boot and rootfs partitions from our Host PC, this step it's a lot important due the Linux must sync all changes before eject the microsd card.
We will insert our microSD card into =Related articles=* [[Boot up sequence]]* [[Update the IGEP board, connect the serial debug cable and open the serial terminal PRE-INSTALLED software image to a current release]]* [[The Linux kernel]]
[[Image:Putty Serial Configuration.png|thumb|center]]Power UP the board. {{Message/Forum}}
[[ImageCategory:IGEP-X-Loader_Boot.png|thumb|centerBoot loaders]][[Category:Software]][[Category:Software distributions]]