Changes

How to boot from MicroSD Card

958 bytes removed, 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 file system. *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 it's the X''u-loader(MLO) the program responsible to load the next programs such kernel or uboot if you use this last one approachboot.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 ... *ToolChainthese requirements''' and '''install a custom software distribution''' into it.
== ToolChain<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).
We will use the ==ToolChain==* Read: [[Ubuntu/Linaro 16.04 LTS Toolchain in this howto. ]]
You can install it ==Preparing the microSD card==Open a terminal window and clear your dmesg using synaptic package manager. :
[[Image<pre>sudo dmesg -c</pre>Now insert a new microsd card in your PC and then check your dmesg:LinaroUbuntu ToolChain.png|center|544x344px]]
= Preparing the microSD card =<pre>dmesg</pre>You should see something like this:
Insert a new microsd card in your PC, you should see in your dmesg something 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 ==
==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 ==
When the <pre>sudo apt-get install procedure ends you can call the program from your system tools menu or directly using a terminal console. gparted</pre>
=== [[Image:Gparted initial.png|thumb|center]]Create the MSDOS&nbsp;Partition Table ===
The next step it's create ==GParted and Creation of Partitions==When the msdos table partition for it install procedure ends you should click in can call the "Device" program from your system tools menu and then in the "Create Partition Table" optionor directly using a terminal console.
[[Image:Gparted create msdos table partitioninitial.png|thumb|center]]Check the default option it's create a msdos partition table.<br>
After that ===Create the MSDOS&nbsp;Partition Table===The next step it's create the msdos table partition for it you can Applyshould click in the "Device" menu and then in the "Create Partition Table" option.
=== Create [[Image:Gparted create msdos table partition.png|thumb|center]]Check the BOOT Partition ===default option it's create a msdos partition table.
The Next step itAfter that you can '''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: Apply'''.
[[Image:Gparted create first partition.png|thumb|center]]We will configure the partition as:<br>
*Primary Partition<br>
*Format: FAT32<br>
*Size: 100 MegaBytes<br>
*Label: Boot<br>
*'''Align to: cylinder'''
===Create the BOOT Partition - IGEP Texas Instruments Processor based===<u>This Step it's only for OMAP35xx, DM37xx, AM335x, OMAP5432 processor based IGEP boards.<br/u> We must "add" the partition and gparted shows a partitions structure like this:
[[ImageThe 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:Gparted configure boot partition.png|thumb|center]]
=== Create [[Image:Gparted create first partition.png|thumb|center]]We will configure the ROOTFS Partition ===partition as:
The Next step it* Primary Partition* Format: FAT32* Size: 100 MegaBytes* Free Space Preceding: 0 MiB* Label: Boot* '''Align to: cylinder'''s create the root file system partition.
First It is recommended to '''apply changes''' now or 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 partitionmight get an error later.png|thumb|center]] We will configure the rootfs partition as:<br>
*Primary ===Create the BOOT Partition<br> - IGEP NXP-Freescale Processor based===*Format: EXT4<bru> *Size: All the Rest<br> *Label: Rootfs''This Step it's only for iMX6 processor based IGEP boards.<br/u>'''
At end we will click on The Next step it's create the partitions for it you should go to the partition menu and select the "AddNew" button. option then the application show a window like this:
[[ImageFile:Gparted all configuredimx6-primary-part.png|thumb|center]]
=== Apply all Changes ===We will configure the partition as:
Click on apply button in the main menu after that gparted show a window like this for confirm all operations * Primary Partition* Format: FAT32* Free Space Preceding: 8 MiB* Size: 100 MegaBytes* Label: Boot* '''Align to: cylinder'''
[[Image:Gparted apply changes.png|thumb|center]]We should click on apply button.
[[Image:Gparted It is recommended to '''apply informationchanges''' now or you might get an error later.png|thumb|center]]When the process finish we can see all changes applied
[[Image:Gparted operations complete===Create the ROOTFS Partition===The Next step it's create the root file system partition.png|thumb|center]]
Now we can see all partitions First you should select the unallocated partition area and configurations done in then&nbsp; you should go to the main gparted partition menu and select the "New" option then the application show a windowlike this:<br /> [[Image:Gparted create first partition.png|thumb|center]] We will configure the rootfs partition as:
=== [[Image* Primary Partition* Format:Gparted partitions done.png|thumb|center]]Select "Boot flag" for EXT4* Size: All the boot partition ===Rest* Label: Rootfs'''<br />'''
Now At end we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select will click on "Manage FlagsAdd" option button.
[[Image:Gparted boot flagall configured.png|thumb|center]]Now we have the microsd prepared for copy the boot files
= Boot Partition Structure =or
We commented in the theory point the OMAP needs only the MLO (x-loader) file for boot, we will start checking this point[[File:imx6_str. png|thumb|center]]
Before you follow the next points you should mount the microsd boot partition in your host pc. After all apply all changes
===Select "Boot flag" for the boot partition===Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and mount it in your host. select "Manage Flags" option
[[Image:Microsd partitionsGparted boot flag.png|thumb|center]] Now we have the microsd prepared for copy the boot files
<br> ==MLO + u-boot IGEP Boards Texas Instruments based boards==After build or download the MLO and u-boot you should follow the next steps:
== X* Copy MLO and u-Loader (MLO)<br> ==boot.img to primary boot partition
$ cp MLO u-boot.img /media/user/bootYou can follow this other howto about the [[The IGEP XU-loaderBoot Texas Instruments Series|IGEP-X-loaderHowTo]]. <pre>We will compile if you want build the sources from our git repository:MLO and u-boot
$/home/jdoe&gt; git clone git://git.igep==u-boot.es/pub/scm/igepimx IGEP Boards based on NXP-xFreescale Processors==* Copy u-loaderboot.gitimx using dd before primary partition in raw mode as
$ sudo dd if=/home/jdoe&gt; cd igepuser/u-boot-ximx/u-loaderboot.imx of=/dev/sde bs=512 seek=2Where /dev/sde is your microsd card
$/home/jdoe/igepYou can follow this [[U-xboot Freescale-loader&gt; make igep0020NXP iMX6 Series|HowTo ]]if you want build the u-sdcard_configboot.imx
$/home/jdoe/igep-x-loader&gt; make==Kernel==You can follow this other howto about [[The Linux kernel|how compile and install the Linux Kernel]].
$==Root File System==In this tutorial we will use the [http://downloads.isee.biz/homepub/jdoefiles/igeplinaro/releases/linaro-m-headless-xtar-loader&gt; contrib/signGP</pre> Copy the x20101108-loader2.bintar.ift into the boot partitiongz linaro headless]&nbsp;(soft floating) image as rootfs but you can use your favorite rootfs also.
<br /> {{Message/Information Message|message=Here there are many articles about how to get '''many other [[Image:Copy Xloader.pngCategory:Software distributions|thumb|centersoftware distributions]] '''.}}
Rename <br /> Here you've the x[http://downloads.isee.biz/pub/files/linaro/releases/linaro-loader11.bin09-nano-n-tar-20110929-0.tar.gz linaro nano 11.09]&nbsp;(soft floating) available for download from the ISEE server.ift to MLO<br>
[[ImageNotes:Rename Xloader to MLO.png|thumb|center]]Now we're ready for test You must build your programs with the board boot from the microsd cardhard floating if your rootfs is build with it.
=== X-Loader Boot ===Notes: IGEPv5 must use Hard floating Rootfs
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 the IGEP board, connect the serial debug cable and open the serial terminal
[[Image:Putty Serial Configuration.png|thumb|center]]Power UP ===Create the board. Rootfs mount point===Go to /media directory and create one sub-folder called "binary"
[[Image:IGEP-X-Loader Boot.png|thumb|center]] <pre>$ cd /media
=== Configure the IGEP-X-Loader ===$ sudo mkdir binary</pre>
You can use a file like this: <pre>[kernel]; Kernel load address, NOT&nbsp;Modifykaddress=0x80008000; RAM disk load Address, NOT Modify;rdaddress=0x84000000; Board Serial IDserial.low=00000001serial.high=00000000; Board Revisionrevision=0003; Kernel Image NamekImageName=zImage; Kernel RAM Disk Image Name;kRdImageName=initrd.img-2.6.35-1010-linaro-omap [kparams]; Setup Mount the Kernel console paramsconsoleRootFS partition=ttyS2,115200n8; Enable early printk;earlyprintk=serial,ttyS2,115200; Setup the Board Memory Configurationmem=430M;mem=512M; Setup Mount the Boot Delayboot_delay=0; Setup the ARM Processor Speed;mpurate=800; Setup the loglevel;loglevel=7; Enable Kernel Debug Output;debug=1; Fix RTC Variable;fixrtc=1; Configure nocompcache variablenocompcache=1; Configure Frame Buffer Configuration;omapfb.mode=dvi:1280x720MR-16@60omapfb.mode=dvi:hd720-16@60; Configure Video Ram assignedvram=40M; Configure Video RAM assigned to every frame bufferomapfb.vram=0:12M,1:16M,2:12M; Configure frame buffer debug output;omapfb.debug=1; Configure DSS Video Debug option;omapdss.debug=1; Configure rootfs partition using the Board Ethernet Mac Addresssmsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde; --- Configure UBI FS boot --- ;ubi.mtd=2 ;root=ubi0:igep0020-rootfs ;rootfstype=ubifs; --- Configure NFS boot --- ;ip=192.168.2.123:192.168.2.129:192.168.2.1:255.255.255.0::eth0:;root=/dev/nfs;nfsroot=192.168.2.129:/srv/nfs/igep_rootfs; --- Configure MMC boot --- root=/dev/mmcblk0p2 rw rootwait; Assign Init program;init=/bin/bash'binary' directory
<pre>$ media &gt; sudo mount /dev/mmcblkp2 /media/binary</pre> Create a new file into the boot partition named igep.ini with these content and save the file.
== Kernel &amp; Rootfs =Untar the rootfs package===Copy "linaro-m-headless-tar-20101108-2.tar.gz" file inside the /media directory and untar the file
You can follow <pre>$ media &gt; 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 other howto about [[The Linux kernel|how compile and install the Linux Kernel]].
In our case we build ===[[Image:Linaro RootFS.png|thumb|center]]Install the kernel sources from zero:<br> modules===<pre>a) Clone the Kernel git repositoryNow you should install your kernel modules inside your root file system.
<pre>$/home/jdoe/media &gt; git clone git:cd /home/git.igep.es/pub/scmjdoe/linux-omap-2.6.git
$/home/jdoe&gt; cd /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 downloaded the binary package uncompress it inside the directory /media/binary
b) Checkout ===Install the kernel Image===Just copy the zImage inside your desired branch (we used for this howto 2.6.35boot partition, remember before that you must mount your mmc boot partition.y)
<pre>$/home/jdoe/linux-omap-2.6&gt; git checkout originsudo cp arch/arm/boot/zImage /media/boot/linux-2.6if you're using dtb kernel as 3.358.y -b linux-2-6-35.y c) Configure you must copy the kernel $/home/jdoe/linux-omap-2dtb too.6&gt; make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- igep0020_defconfig d) Build the kernel and Modules $/home/jdoe/linuxlinuz-omap-2.6&gt; make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules</pre> Notes: The kernel binary resides inside the directory: $/home/jdoe/linux-omap-2.6/sudo cp arch/arm/boot/'''zImage'''  We will use the [http://downloads.igep.es/filesdtbs/linaro-momap5-headless-tar-20101108-2.tar.gz linaro headless] image as rootfs but you can use your favorite rootfs alsoigep0050.  === Create the Rootfs mount point === Go to dtb /media directory and create one sub-folder called "binary" <pre>$ cd /media $ sudo mkdir binary</pre> === Mount the RootFS partition === Mount the rootfs partition using the 'binary' directory <pre>$ media &gt; sudo mount /dev/mmcblkp2 /media/binary</pre> === Untar the rootfs package ===boot
Copy "linaro-m-headless-tar-20101108-2.tar.gz" file inside the /media directory and untar the file <pre>$ media &gt; sudo tar xvfz linaro-m-headless-tar-20101108-2.tar.gz</pre> <br> Now After that you should see inside your can unmount the boot &amp; rootfs partition a similar structure like thispartitions.<br>
=== [[Image:Linaro RootFS.png|thumb|center]]Install the kernel modules<br> ===Now we're ready for test our new microsd card
Now you should install =Test your kernel modules inside new MicroSD=You can test your root file systemnew microSD card with a Serial client such as PuTTy.<br> <pre>$ media &gt; cd /home/jdoe/linux-omap-2[[Using serial debug port to communicate|Here]] is an explanation about how to configure it.6
$ /home/jdoe/linux-omap-2(Note that speed should be configured to 115200 bauds).6&gt; sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary
</pre> === Install If you already have configured it or you are using another Serial client and you have connected the kernel Image<br> ===Serial cable to the IGEPv2 board, then you are ready to test your microSD.
Just copy Insert the zImage inside microSD in your boot partition, remember before that you must mount your mmc boot partition.<br> <pre>$ /home/jdoe/linux-omap-2.6&gt; sudo cp arch/arm/boot/zImage /media/boot/</pre> After that you can unmount IGEPv2 board and power up the boot &amp; rootfs partitionsboard.
Now we're ready for test our new microsd card<br>[[Image:Linaro Boot1.png|thumb|center]][[Image:Linaro Boot2.png|thumb|center]]
= Test your new MicroSD<br> =
Insert the microsd in your IGEPv2 board and power up the board.
=Related articles=* [[Image:Linaro Boot1.png|thumb|centerBoot up sequence]]* [[Image:Linaro Boot2.png|thumb|centerUpdate the PRE-INSTALLED software image to a current release]]* [[The Linux kernel]]
{{Message/Forum}}
[[Category:How_to_forgeBoot loaders]][[Category:Software]][[Category:Software distributions]]