Changes

How to boot from MicroSD Card

6,445 bytes removed, 11:46, 9 March 2018
u-boot.imx IGEP Boards based on NXP-Freescale Processors
=Overview=
This how to explains how to '''create a microSD card''' to boot Texas Instruments Processors (OMAP35xx, DM37xx, AM335x, OMAP5432)  with other IGEP boards with  '''software distributions (Including yocto, Ubuntu, Debian ...)'''.
__TOC__
 
==Theory==
OMAP35xx, DM37xx, AM335x or , 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.
Exist some rules to boot from a microSD card.
===Texas Instruments Processors===
* The microsd card must be content at latest 2 partitions.
* The first one must be primary partition with the boot flag mark and formated using FAT(16 or 32) file system.
* All names used in this partition must be msdos names (if you use old OMAP3 applies to OLD OMAP35xx processor).
* The processor must load a first program called '''MLO''', this program must reside in the first partition, this program it's also called '''x-loader or uboot-spl.'''
''The processor when boot ONLY load and execute the MLO program and ignore all the rest it's the 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 will load the '''u-boot.imx''' it include the SPL and u-boot.
 
''After load this u-boot.imx, u-boot will be ready for boot the kernel.''
Therefore, we are going to '''setup a microSD card with these requirements''' and '''install a custom software distribution''' into it.
* 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:
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.43556 s, 2.4 MB/s</pre>
 
==Install GParted==
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.
===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:
* 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.<br /u> We must  The Next step it's create the partitions for it you should go to the partition menu and select the "addNew" option then the partition and gparted shows application show a partitions structure window like this: [[File:imx6-primary-part.png|thumb|center]]
[[Image:Gparted We will configure boot the partition.png|thumb|center]]as:
It is recommended to * Primary Partition* Format: FAT32* Free Space Preceding: 8 MiB* Size: 100 MegaBytes* Label: Boot* '''apply changesAlign to: cylinder''' now or you might get an error later.
It is recommended to '''apply changes''' now or you might get an error later.
===Create the ROOTFS Partition===
[[Image:Gparted all configured.png|thumb|center]]
or
[[File:imx6_str.png|thumb|center]]
===Apply After all Changes===Click on apply button in the main menu after that gparted show a window like this for confirm all operationschanges
[[Image:Gparted apply changes.png|thumb|center]]We should click on apply button. [[Image:Gparted apply information.png|thumb|center]]When the process finish we can see all changes applied [[Image:Gparted operations complete.png|thumb|center]] Now we can see all partitions and configurations done in the main gparted window ===[[Image:Gparted partitions done.png|thumb|center]]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 select "Manage Flags" option
[[Image:Gparted boot flag.png|thumb|center]]Now we have the microsd prepared for copy the boot files
==MLO + u-boot IGEP Boards Texas Instruments based boards==
After build or download the MLO and u-boot you should follow the next steps:
* Copy MLO and u-boot.img to primary boot partition
==Boot Partition Structure==We commented in the theory point the OMAP needs only the $ cp MLO (xu-loader) file for boot, we will start checking this pointBefore you follow the next points you should mount the microsd boot partition in your host pc. Select the img /media/user/boot partition and mount it in your host. [[Image:Microsd partitions.png|thumb|center]]    ==X-Loader (MLO) - IGEPv2 - IGEP COM Module - IGEP COM Proton==You can follow this other howto about the [[The IGEP XU-loaderBoot Texas Instruments Series|IGEP-X-loaderHowTo]]. <pre>We will compile the sources and get it from our git repository: $/home/jdoe&gt; git clone git://git.isee.biz/pub/scm/igep-x-loader.git $/home/jdoe&gt; cd igep-x-loader $/home/jdoe/igep-x-loader&gt; make igep00x0_config CROSS_COMPILE=&lt;put here your cross compiler&gt; $/home/jdoe/igep-x-loader&gt; make CROSS_COMPILE=&lt;put here your cross compiler&gt; Starting from version 2.5 it's not necesary sign the MLO due the build system generate directly the MLO fileif you're using a old version then you must sign it as: $/home/jdoe/igep-x-loader&gt; contrib/signGP</pre>Alternatively you can download the binary package from [http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.5.0-2.tar.bz2 here] If you're using 2.5.0.x x-loader copy directly the MLO to your boot partion or if you use older version then follow the next instructions:  Copy the x-loader.bin.ift into the boot partition. [[Image:Copy Xloader.png|thumb|center]] Rename want build the x-loader.bin.ift to MLO [[Image:Rename Xloader to MLO.png|thumb|center]]Now we're ready for test the board boot from the microsd card.  ===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 the IGEP board, connect the serial debug cable and open the serial terminal [[Image:Putty Serial Configuration.png|thumb|center]]Power UP the board. [[Image:IGEP-X-Loader Boot.png|thumb|center]]  ===Configure the IGEP-X-Loader with igep.ini===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-omapMachineID=xxxx Where Machine ID =&nbsp;2344 for IGEPv2, ID = 2717 for IGEP COM Module, ID = 3203 for IGEP COM&nbsp;PROTON; Mode can be: kernel (boot linux kernel) or binary (boot u-boot, QNX kernel or other binary ARM&nbsp;executable)Mode=kernel [kparams]; buddy parameter selects your expansion board; buddy = igep0022 (IGEPv2 Expansion board); buddy =&nbsp;base0010 (IGEP PARIS or IGEP&nbsp;BERLIN&nbsp;Expansion Board); buddy.revision = A or B (Selects Expansion board Revision IGEP Paris or IGEP Berlin only, if you dubt select B);buddy=igep0022;buddy=base0010;buddy.revision=B; Setup the Kernel console params; console= Configure the kernel console (ttyS2 kernel &lt;= 2.6.35 ttyO2 if kernel &gt;= 2.6.37);console=ttyS2,115200n8console=ttyO2,115200n8; Enable early printk;earlyprintk=serial,ttyS2,115200; Setup the Board Memory Configurationmem=430M;mem=512M; Setup 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 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 </pre>Create a new file into the boot partition named igep.ini with these content and save the file. igep.ini is included in the package software inside scripts directory or you can access to it directly in the git with this [http://git.isee.biz/?p=pub/scm/igep-x-loader.git;a=blob;f=scripts/igep.ini;h=ce093fe80c81d8888bf79464f847059b312bba83;hb=HEAD link]
==MLO + uboot u- boot.imx IGEP COM AQUILA, IGEPv5Boards based on NXP-Freescale Processors==You can find more detailed information about the build procedure on this other [[U* Copy u-Boot 2014.01boot.y|howto]]imx using dd before primary partition in raw mode as
<pre>git clone git: sudo dd if=/home/git.isee.biz/pub/scmuser/u-boot-arm.gitcd imx/u-boot-arm.imx of=/dev/sde bs=512 seek=2<Where /pre><span style="line-height: 1.5em;">If you're using IGEPv5 board you should checkout this one:<dev/span>sde is your microsd card
<pre>git checkout origin/u-boot-2014.01.y-omap5 -b uYou can follow this [[U-bootFreescale-2014.01.y-omap5make omap5_igep0050_config CROSS_COMPILE=arm-linux-gnueabihf-</pre>Or NXP iMX6 Series|HowTo ]]if you're using IGEP COM Aquila: <pre>git checkout origin/u-boot-2013.07.y -b u-boot-2013.07.y.localmake igep0033_config CROSS_COMPILE=arm-linux-gnueabi-</pre>After configuration you can want build it with: <pre>make CROSS_COMPILE=&lt;set here your cross compiler&gt;</pre>After build it generate two files: MLO and the u-boot.img, you must copy both file into your boot partition. U-boot use self script (enviroment) configuration can be added to boot partition too.imx
==Kernel==
You can follow this other howto about [[The Linux kernel|how compile and install the Linux Kernel]].
 
We will get from our git repository the kernel sources and build it:
 
<pre>a) Clone the Kernel git repository
 
$/home/jdoe/&gt; git clone git://git.isee.biz/pub/scm/linux-omap-2.6.git
 
$/home/jdoe&gt; cd linux-omap-2.6
 
b) Checkout your desired branch (we used for this howto 2.6.37.y IGEPv2, IGEP COM Module and IGEP COM PROTON)
if you're using IGEP COM Aquila or IGEPv5 you must select your right branch:
IGEPv5: linux-3.8.y-omap5
IGEP COM Aquila: linux-3.8.y-am335x
 
$/home/jdoe/linux-omap-2.6&gt; git checkout origin/linux-2.6.37.y -b linux-2-6-37.y
 
c) Configure the kernel (IGEPv2, IGEP COM Module, IGEP COM Proton)
 
$/home/jdoe/linux-omap-2.6&gt; make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- igep00x0_defconfig
 
If you use IGEPv5 or IGEP COM Aquila you should use:
 
$/home/jdoe/linux-omap-2.6&gt; make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfig
 
d) Build the kernel and Modules (IGEPv2, IGEP COM Module, IGEP COM&nbsp;PROTON)
 
$/home/jdoe/linux-omap-2.6&gt; make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules
 
e) Build the kernel, modules and dtbs (IGEPv5, IGEP COM Aquila)
 
$/home/jdoe/linux-omap-2.6&gt; make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
 
</pre>
Notes: The kernel binary resides inside the directory: $/home/jdoe/linux-omap-2.6/arch/arm/boot/'''zImage''' <br />
Notes: Alternatively you can download the kernel binary from this [http://downloads.isee.biz/pub/releases/linux_kernel/v2.6.37-7/zImage-2.6.37-7.bin link] and modules from [http://downloads.isee.biz/pub/releases/linux_kernel/v2.6.37-7/modules-2.6.37-7.tar.gz this].<br />
Notes: You can download directly all releases using this [http://downloads.isee.biz/pub/releases/linux_kernel link]<br />
Notes: Kernel 3.8.y use dtb file for describe the board configuration, these files resides inside the directory: $/home/jdoe/linux-omap-2.6/arch/arm/boot/dtbs/ and you must copy the right dtb for your board.
==Root File System==
Notes: IGEPv5 must use Hard floating Rootfs