Difference between revisions of "The IGEP X-loader"

From IGEP - ISEE Wiki

Jump to: navigation, search
(Download from git repository)
 
(133 intermediate revisions by 8 users not shown)
Line 1: Line 1:
= Summary<br><br>  =
+
=Summary=
 +
X-Loader, an initial program loader for Embedded boards based on OMAP processors.
  
X-Loader, an initial program loader for Embedded boards based on OMAP processors. <br>
+
Access to the latest version&nbsp;[http://git.isee.biz/?p=pub/scm/igep-x-loader.git;a=summary here] and read the [http://git.isee.biz/?p=pub/scm/igep-x-loader.git;a=blob_plain;f=ISEE_README.txt;h=909c072bc2512026342d802b3ef1b7e8f703458b;hb=4bb2ebd99d5b86522d786ac5b074066e9841799c ISEE_Readme.txt] for get the latest release information.
  
= Features and Limitations<br>  =
+
=Why IGEP-Xloader=
 +
Some important reasons exist for using this bootloader on IGEP boards.
  
== Improvements &amp; Modifications<br>  ==
+
==Security==
 +
This is one of the most important reasons why we develop this new IGEP X-loader. you will Probably know that flash devices get new bad memory blocks with normal usage that can make unusable or can damange the software residing inside the flash (ex: upgrading the software, copying a new kernel ... ), in these cases your board won't be usable anymore if you don't use a right nand filesystem that insures data integrity. Using the old schema we've 4 important partitions on flash without any protection, x-loader, u-boot, u-boot enviroment and kernel.
  
*Malloc/free functionality.
+
IGEP X-loader resolves this situation as the configuration and kernel files reside inside a jffs2 partition.
*Mtd framework and onenand support, removed the old onenand drivers.
 
*Jffs2 support using mtd &amp; onenand support (Read Only).
 
*Crc32 and zlib.
 
*Jffs2 zlib compression support (Read Only).
 
*Dual boot mmc &amp; onenand with mmc highest priority.
 
*Linux kernel boot directly (Support for 2.6.22 and highest version kernels)
 
*Linux kernel supported images: vmlinuz, bzImage and zImage.
 
*Support for loading Linux Ram disk (EXPERIMENTAL)
 
*"ini" files parser.
 
*The configuration resides in a plain txt (ini format file).
 
*Support Windows &amp; Linux formating ini files.
 
*Boot from mmc, onenand, or mix with mmc highest priority.
 
*Codeblocks project and compilation rules.
 
*Support for gcc 4.5.1.<br>
 
  
== Limitations<br>  ==
+
==Maintenance==
 +
With the old schema 3 different software existed (x-loader, u-boot, kernel) that did exactly the same job, so you had to reconfigure the board, increasing the complexity of maintenance for the board system and provide a major bug source because we had to assure that all software was aligned with all changes. Also, from a second point of view, we did the job three times so the boot process was more complex and slow.
  
*The ini configuration file it's limited to max size: 16 KiB
+
==Easy to use==
*Kernel Command line parameters it's limited to: 4 KiB
+
With this new approach use the software it's more easy to use, if you've the boot information stored inside a jffs2 partition you can use the linux kernel to access it directly without the use of any flash tool to modify the software (ex: using nandwrite it's to risky due to its inability to guarantee data integrity over the Nand Flash memory).
*Malloc it's limited to 32 MiB.  
 
*Cannot write comments in lines with tag=value<br>
 
  
== TODO<br>  ==
+
==Upgrade faster and easy==
 +
Upgradint to a new kernel it's easier and faster, you only need to copy the new kernel inside the boot partition, copy your new igep.ini inside and reboot the board with all security.
  
*Support for IGEP0030 - Family boards.  
+
=Features and Limitations=
*Support for other OMAP/DM/AM processor boards.  
+
==Improvements &amp; Modifications==
*Remove compilation warnings.  
+
* Added malloc/free functionality.
*Comments in tag lines<br>
+
* Added mtd framework and onenand support, removed the old onenand drivers.
 +
* Added fs jffs2 support using mtd &amp; onenand support (Read Only).
 +
* Added crc32 and zlib.
 +
* Jffs2 zlib compression support (Read Only).
 +
* Dual boot mmc &amp; onenand with mmc highest priority.
 +
* Added Linux kernel boot directly (Support for 2.6.22 and highest version kernels)
 +
* Linux kernel supported images: vmlinuz, bzImage and zImage.
 +
* Support for loading Linux Ram disk (EXPERIMENTAL)
 +
* Added "ini" files parser.
 +
* The configuration resides in a plain txt (ini format file).
 +
* Support Windows &amp; Linux formating ini files.
 +
* boot from mmc, onenand, or mix with mmc highest priority.
 +
* Added codeblocks project and compilation rules.
 +
* Added support for vfat32 extra names.
 +
* Configure TPS65950 voltage to 1.35V if it's used a DM3730 processor.
 +
* Added new parameter MachineID in kernel tag file, with it you can
 +
* &nbsp;&nbsp;&nbsp; - configure the kernel board ID setup
 +
* Added new parameter buddy for kernels 2.6.35.y and 2.6.37.y
 +
* Optimize some LPDDR Memory configuration values
 +
* Removed some OneNand Debug information
 +
* Removed some FAT incorrect warnings
 +
* Added Support Initial Ram disk
 +
* Reconfigure Makefile options
 +
* Support Kernels 2.6.35, 2.6.37, 3.6.4
 +
* Added support for boot ARM binary files (such u-boot or QNX kernel)
 +
* Support for Numonyx, Micron and hynix POP Memories.
 +
* Memory autodetection.
 +
* Added GPTimer functionality.
 +
* Support Numonyx, Micron and hynix memories.
 +
* DMA Copy support
 +
* Omtimized memcpy and memset functions.
 +
* DSS Video driver.
 +
* Support ISEE toolchain yocto 1.2 based.
  
== STATUS<br>  ==
+
==Limitations==
 +
* The ini configuration file it's limited to max size: 16 KiB
 +
* Kernel Command line parameters it's limited to: 4 KiB
 +
* Malloc it's hardcode limited to 32 MiB.
 +
* Video is limited to 1024 x 768 x 16 bits.
 +
* Video Memory is limited to 1280 x 720 x 32 bits.
  
*Support IGEP0020 Revision B &amp; C family boards.  
+
==TODO==
*Tested with IGEPv2 (DM3730@1Ghz and 512/512 MB Ram/Onenand)
+
* Remove compilation warnings.
*Tested with IGEPv2 (AM3703@1Ghz and 512/512 MB Ram/Onenand)
+
* System Rescue.
*Tested with IGEPv2 (OMAP3530@720Mhz and 512/512 MB Ram/Onenand)<br>
+
* Improve boot selection and priority.
 +
* Remove unused code.
  
= Build Procedure<br>  =
+
==STATUS==
 +
* Support:
 +
** IGEPv2 DM3730
 +
** IGEPv2 OMAP3530
 +
** IGEP COM MODULE DM3730
 +
** IGEP COM PROTON DM3730
 +
** IGEP COM MODULE AM3703
  
== Build with Ubuntu Cross Compiler gcc 4.5.1  ==
+
==VERSION CHANGES==
 +
[2.1.0-1] This version only can be build with gcc linaro 4.5.2 other compilers be not supported.
  
<span style="font-style: italic;"><span style="font-weight: bold;">Enviroment</span></span>'''''Ubuntu 10.10'''''
+
[2.1.0-1] Removed some uncontrolled "printf" with incorrect information.
  
=== Install the cross compiler if you not do it before.<br>  ===
+
[2.1.0-1] Modified some code under __DEBUG__ option.
<pre>apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi</pre>
 
=== Setup the board settings<br>  ===
 
<pre>make igep0020-sdcard_config</pre>
 
=== Build<br>  ===
 
<pre>make</pre>
 
=== Sign the binary x-loader<br>  ===
 
  
''You should execute contrib/signGP for sign the xloader.''
+
[2.1.0-1] Added Support for TPS65950-A3 initialization at 1.35V
<pre>contrib/signGP x-load.bin
 
The signed x-loader it's named: x-load.bin.ift
 
</pre>
 
== Build with IGEP SDK  ==
 
  
=== Setup the Enviroment<br>  ===
+
[2.1.0-1] Added support for IGEP Module 0030
<pre>source /usr/local/poky/eabi-glibc/environment-setup-arm-none-linux-gnueabi
 
</pre>
 
=== Setup the board settings<br>  ===
 
<pre>make igep0020-sdcard_config</pre>
 
=== Build<br>  ===
 
<pre>make CROSS_COMPILE=arm-none-linux-gnueabi-</pre>
 
=== Sign the binary x-loader  ===
 
  
''You should execute contrib/signGP for sign the xloader.''
+
[2.1.0-1] Added support dynamic Machine ID selection (same xloader boot IGEPv2 &amp; IGEP Module)
<pre>contrib/signGP x-load.bin
 
The signed x-loader it's named: x-load.bin.ift
 
</pre>
 
== Build Native  ==
 
  
=== Configure the board settings<br>  ===
+
----
<pre>make igep0020-sdcard_config
 
</pre><pre>Edit the variable CFLAGS and add the option: -fno-stack-protector
 
CFLAGS&nbsp;:= $(CPPFLAGS) -Wall -Wstrict-prototypes -fno-stack-protector</pre>
 
=== Build<br>  ===
 
<pre>make CROSS_COMPILE=arm-none-linux-gnueabi-</pre>
 
=== Sign the binary x-loader  ===
 
  
''You should execute contrib/signGP for sign the xloader.''
+
[2.1.0-2] ARM Compilation bug resolved
<pre>contrib/signGP x-load.bin
 
The signed x-loader it's named: x-load.bin.ift
 
</pre>
 
= BOOT<br>  =
 
  
The IGEP X-Loader must reside in the microSD card or in the OneNand.<br>
+
----
  
== Low Level Initialization  ==
+
[2.1.0-3] Update SDRAM structure initialization
  
The OMAP Processor loads the XLoader directly from the mmc or the OneNand and copy the binary into the internal processor RAM (0x40200000) and jump to this place, this internal memory it's limited to 64K divided as: Interrupts, code, data and stack. Initialization code can be found using this link: [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=cpu/omap3/start.S;h=4cbf4379b8502ebfe0409b35e4aafba712234c34;hb=HEAD start.S]&nbsp;
+
[2.1.0-3] Added support for Initial RAM disk
<pre>&nbsp; 96 reset:
 
 
  97        /*
 
  
  98          * set the cpu to SVC32 mode
+
[2.1.0-3] Updated Initial RAM disk destination address
  
  99          */
+
----
  
100        mrs    r0,cpsr
+
[2.2.0-1] Update Makefile structure
  
101        bic    r0,r0,#0x1f
+
[2.2.0-1] Downgrade the boot processor speed
  
102        orr    r0,r0,#0xd3
+
----
  
103        msr    cpsr,r0
+
[2.3.0-1] Add NAND flash devices and Micron MT29CXGXXMAXX memories support
  
104
+
[2.3.0-2] Add Hynix NAND memorie and IGEP0032 support
  
105        /* Copy vectors to mask ROM indirect addr */
+
[2.3.0-2] Added lzo compression schema.
  
106        adr    r0, _start              /* r0 &lt;- current position of code  */
+
----
  
107        add    r0, r0, #4                              /* skip reset vector                    */
+
[2.3.0-3] Add Support for execute ARM binaries [2.3.0-3] Bug Fixes related to I and D Cache
  
108        mov    r2, #64                /* r2 &lt;- size to copy  */
+
----
  
109        add    r2, r0, r2              /* r2 &lt;- source end address        */
+
[2.4.0-1] Added Memory test feature
  
110        mov    r1, #SRAM_OFFSET0        /* build vect addr */
+
[2.4.0-1] Added some boot information
  
111        mov    r3, #SRAM_OFFSET1
+
[2.4.0-1] New read_nand_cache function optimized for load from NAND
  
112        add    r1, r1, r3
+
[2.4.0-1] BUG resolved: Refresh Setup in Micron &amp; Hynix Memories
  
113        mov    r3, #SRAM_OFFSET2
+
[2.4.0-1] BUG resolved: Reset Memory controller after initialize Malloc function
  
114        add    r1, r1, r3
+
[2.4.0-1] BUG resolved: Resolve problems updating the flash content under jffs2
  
115 next:
+
----
  
116        ldmia  r0!, {r3-r10}          /* copy from source address [r0]   */
+
[2.4.0-2] Resolved Memory Autodetection
  
117        stmia  r1!, {r3-r10}          /* copy to  target address [r1]   */
+
[2.4.0-2] Better hang board led control
  
118        cmp    r0, r2                  /* until source end address [r2]   */
+
[2.4.0-2] New read_nand_cache function optimized for load from OneNand
  
119        bne    next                    /* loop until equal */
+
[2.4.0-2] Added Hw GPtimer functionality
  
120
+
----
  
121        bl      cpy_clk_code            /* put dpll adjust code behind vectors */
+
[2.5.0-1] Added System DMA driver.
  
122 
+
[2.5.0-1] Added optimized memcpy &amp; memset functions.
  
123        /* the mask ROM code should have PLL and others stable */
+
[2.5.0-1] Improved boot speed.
  
124        bl cpu_init_crit
+
[2.5.0-1] Improve NAND driver support.
  
&nbsp;125
+
[2.5.0-1] Auto x-loader.bin.ift and MLO generation.
  
126 relocate:                              /* relocate U-Boot to RAM          */
+
[2.5.0-1] Added DSS video support.
  
127        adr    r0, _start              /* r0 &lt;- current position of code  */
+
----
  
128        ldr    r1, _TEXT_BASE          /* test if we run from flash or RAM */
+
[2.5.0-2] Fixed System DMA misconfiguration.
  
129        cmp r0, r1                      /* no need to relocate if XIP      */
+
[2.5.0-2] Improve GPMC timming setup.
  
130        beq stack_setup                /* skip txt cpy if XIP(SRAM, SDRAM) */
+
[2.5.0-2] Added DSS igep.ini variables.
  
131
+
[2.5.0-2] Added Support for new memory capacities.
  
132        ldr    r2, _armboot_start
+
[2.5.0-2] Auto x-loader.bin.ift and MLO generation.
  
133        ldr    r3, _bss_start
+
[2.5.0-2] Minor bug fixes.
  
134        sub    r2, r3, r2              /* r2 &lt;- size of armboot            */
+
----
  
135        add    r2, r0, r2              /* r2 &lt;- source end address        */
+
[2.5.0-3] platform.S: downgrade MPU boot clock from 1GHz to 800 MHz
  
136
+
----
  
137 copy_loop:
+
[2.6.0-1] Remove OMAP35xx support
  
138        ldmia  r0!, {r3-r10}          /* copy from source address [r0]   */
+
[2.6.0-1] New DMA driver, now can handle different DMA channels and transfers
  
139        stmia  r1!, {r3-r10}          /* copy to  target address [r1]   */
+
[2.6.0-1] GPMC: Add support for use prefetch engine
  
140        cmp    r0, r2                  /* until source end addreee [r2]   */
+
[2.6.0-1] NAND: Added a new Nand driver
  
141        ble    copy_loop
+
[2.6.0-1] NAND: Modify memory setup timmings
  
142
+
----
  
143        /* Set up the stack                                                */
+
[2.6.0-2] DMA: disable dma_memcpy function due random kernel memory corruption
  
144 stack_setup:
+
=Pre-Compiled Binaries=
 +
{| border="1" width="905" cellspacing="1" cellpadding="1"
 +
|-
 +
! scope="col"|Release
 +
! scope="col"|Download link
 +
! scope="col"|Support
 +
|-
 +
||2.6.0-2
 +
||[http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.6.0-2.tar.bz2 igep-x-loader-2.6.0-2.tar.bz2]
 +
||[[The_IGEP_X-loader#STATUS | DM3730 Boards]]
 +
|-
 +
||2.5.0-2
 +
||[http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.5.0-2.tar.bz2 igep-x-loader-2.5.0-2.tar.bz2]
 +
||[[The_IGEP_X-loader#STATUS | All OMAP3 Boards]]
 +
|-
 +
||2.4.0-2
 +
||[http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.4.0-2.tar.bz2 igep-x-loader-2.4.0-2.tar.bz2]
 +
||[[The_IGEP_X-loader#STATUS | All OMAP3 Boards]] except IGEP COM MODULE AM3703
 +
|-
 +
||2.1.0-2
 +
||[http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.1.0-2.tar.bz2 igep-x-loader-2.1.0-2.tar.bz2]
 +
||[[The_IGEP_X-loader#STATUS | All OMAP3 Boards]] except IGEP COM MODULE AM3703
 +
|-
 +
||2.1.0-3
 +
||[http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.1.0-3.tar.bz2 igep-x-loader-2.1.0-3.tar.bz2]
 +
||[[The_IGEP_X-loader#STATUS | All OMAP3 Boards]] except IGEP COM MODULE AM3703
 +
|-
 +
||2.2.0-1
 +
||[http://downloads.isee.biz/pub/releases/IGEP_xloader/igep-x-loader-2.2.0-1.tar.bz2 igep-x-loader-2.2.0-1.tar.bz2]
 +
||[[The_IGEP_X-loader#STATUS | All OMAP3 Boards]] except IGEP COM MODULE AM3703
 +
|}
  
145        ldr    r0, _TEXT_BASE          /* upper 128 KiB: relocated uboot  */
+
=Build Procedure=
 +
==Build with ISEE SDK Yocto Toolchain 1.2==
 +
===Download and Install the cross compiler if you not do it before.===
 +
Download the toolchain from this [https://www.isee.biz/support/downloads/item/igep-sdk-yocto-toolchain-1-2-2-3 link] and uncompress it as root in your / directory.
  
146        sub    sp, r0, #128            /* leave 32 words for abort-stack  */
+
<pre>Hint: Remember setup the enviroment before build the source:
  
147        and    sp, sp, #~7            /* 8 byte alinged for (ldr/str)d    */
+
source /opt/poky/1.2/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi</pre>
  
148
+
===Download the sources from our git repository===
 +
<pre>git clone git://git.isee.biz/pub/scm/igep-x-loader.git
 +
</pre>
 +
===Get your desired tag / release===
 +
git checkout &lt;your_desired_release&gt; -b &lt;your_name_release&gt;
  
149        /* Clear BSS (if any). Is below tx (watch load addr - need space)  */
+
<pre>git checkout release-2.5.0-2 -b release-2.5.0-2-local
 +
</pre>
  
150 clear_bss:
+
===Setup the board build setup===
 +
<pre>make igep00x0_config</pre>
 +
===Build the software===
 +
<pre>make</pre>
 +
===Sign the binary x-loader (Only versions prior to 2.5.0-x)===
 +
''You should execute contrib/signGP for sign the xloader.''
  
151        ldr    r0, _bss_start          /* find start of bss segment        */
+
<pre>contrib/signGP x-load.bin
 +
The signed x-loader it's named: x-load.bin.ift
 +
</pre>
  
  152        ldr    r1, _bss_end            /* stop here                        */
+
==Build Native==
 +
===Download from git repository===
 +
  git clone https://git.isee.biz/arm-boot/igep-x-loader.git 
 +
git checkout &lt;your_desired_release&gt; -b &lt;your_name_release&gt;
  
153        mov    r2, #0x00000000        /* clear value                      */
+
<pre style="font-weight: normal;"> git checkout release-2.5.0-2 -b release-2.5.0-2-local
 +
</pre>
  
154 clbss_l:
+
===Configure the board settings===
 +
<pre>make igep00x0_config</pre>
 +
<pre>Edit the variable CFLAGS and add the option: -fno-stack-protector
 +
CFLAGS&nbsp;:= $(CPPFLAGS) -Wall -Wstrict-prototypes -fno-stack-protector</pre>
 +
===Build===
 +
<pre>make CROSS_COMPILE=arm-none-linux-gnueabi-</pre>
 +
===Sign the binary x-loader===
 +
''You should execute contrib/signGP for sign the xloader.''
  
155        str    r2, [r0]                /* clear BSS location              */
+
<pre>contrib/signGP x-load.bin
 +
The signed x-loader it's named: x-load.bin.ift
 +
</pre>
 +
=BOOT=
 +
The IGEP X-Loader must reside in the microSD card or in the Nand Memory.
  
156        cmp    r0, r1                  /* are we at the end yet            */
+
==MMC Boot==
 +
===Prepare the microsd card===
 +
You can follow this howto about how [http://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormat prepare the microsd card] or [[How to boot from MicroSD Card]]
  
157        add    r0, r0, #4              /* increment clear index pointer    */
+
Get a new microsd card and create two partitions, the first one must be fat16/32 and the second one can be formated in any format type supported by linux kernel.
  
158        bne    clbss_l                /* keep clearing till at end        */
+
===Copy the files in the first (FAT) partition===
 +
In the first partition you must copy in this order:
  
159
+
# x-loader.bin.ift (you must rename this file to MLO before copy it) / This is a signed image using contrib/signGP tool
 +
# x-loader configuration file [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=scripts/igep.ini;h=ce093fe80c81d8888bf79464f847059b312bba83;hb=HEAD igep.ini]&nbsp;also you can change the configuration file name editing the file:&nbsp;[http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=include/configs/igep00x0.h igep00x0.h]&nbsp;(#define IGEP_BOOT_CFG_INI_FILE "igep.ini")
 +
# Your desired kernel image.
  
160        ldr    pc, _start_armboot      /* jump to C code                  */
+
Load Order:
  
  161
+
<pre> 48 /* Linux Images */
 +
  49 const char* LinuxImageNames [] = {
 +
  50        "kparam"  /* Use kparam first */
 +
  51        "zImage",  /* jffs2 it's case sensitive */
 +
  52        "zimage",  /* fat name it's not case sentitive */
 +
  53        "vmlinuz",
 +
  54        "bzImage",
 +
  55        "bzimage",
 +
  56        0,
 +
  57 };
  
162 _start_armboot: .word start_armboot
+
or you can set the name for your kernel in the configuration file using the tag: kImageName
 +
</pre>
 +
Don't use a uImage kernel format (from uboot), only standard kernel formats be supported.
  
</pre>
+
'''kernel build command example''':
It's important take a lool to the call assembly function cpu_init_crit (you can see the code below) this is resposable to call the board initialization defined in [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=board/igep0020/platform.S platform.S] file. Check the call to lowlevel_init:<br>
 
<pre> 175 cpu_init_crit:
 
176        /*
 
  
177          * Invalidate L1 I/D
+
<pre>make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- zImage modules
 +
</pre>
  
178          */
+
===Second Partition===
 +
Copy all your rootfs in this second partition.
  
179        mov    r0, #0                /* set up for MCR */
+
Also you can use the [http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz linaro 10.11 minimal image]&nbsp;download the image and untar (as root) in your microsd card second partition.
  
180        mcr    p15, 0, r0, c8, c7, 0  /* invalidate TLBs */
+
Remember install the kernel modules in this partition.
  
181        mcr    p15, 0, r0, c7, c5, 1  /* invalidate icache */
+
Example:
  
182
+
<pre>sudo make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules_install INSTALL_MOD_PATH=[path to your target rootfs]
 +
</pre>
  
183        /* Invalide L2 cache (gp device call point)
+
==Nand Boot==
 +
===Nand Partitions===
 +
We've defined 3 partitions on the Nand Memory.
  
184          * - warning, this may have issues on EMU/HS devices
+
<pre>MTD partitions on "omap2-onenand":
 +
(a) 0x000000000000-0x000000080000&nbsp;: "X-Loader"
 +
(b) 0x000000080000-0x000000c80000&nbsp;: "Boot"
 +
(c) 0x000000c80000-0x000020000000&nbsp;: "File System"
 +
</pre>
 +
====X-Loader Partition====
 +
* Not fs formated (onenand raw)
 +
* Size: 0x80000 (512 KiB)
 +
* The xloader must be signed before copy it into the flash memory.
  
185          * this call can corrupt r0-r5
+
You should copy the x-loader in the firsts 4 blocks (first 512 KiB), this is not a&nbsp;formated partition due the ROM not permits boot from a formated partition in flash, you should use flash_eraseall and [http://git.isee.biz/?p=pub/scm/writeloader.git;a=summary writeloader] for copy x-loader in the first blocks.
  
186          */
+
<pre>Suggested procedure:
  
187        mov r12, #0x1          @ set up to invalide L2
+
Sign the x-loader before write it on the flash or microsd card.
 
+
Sign x-loader:
188 smi:   .word 0xE1600070        @ Call SMI monitor
+
You should execute contrib/signGP for sign the xloader that resides inside the flash memory.
 
+
contrib/signGP x-load.bin
189
+
The signed x-loader it's named: x-load.bin.ift
 
 
190        /*
 
 
 
191          * disable MMU stuff and caches
 
 
 
192          */
 
 
 
193        mrc    p15, 0, r0, c1, c0, 0
 
 
 
194        bic    r0, r0, #0x00002000    @ clear bits 13 (--V-)
 
 
 
195        bic    r0, r0, #0x00000007    @ clear bits 2:0 (-CAM)
 
 
 
196        orr    r0, r0, #0x00000002    @ set bit 1 (--A-) Align
 
 
 
197 #ifndef CONFIG_ICACHE_OFF
 
 
 
198        orr    r0, r0, #0x00001800    @ set bit 11,12 (---I Z---) BTB,I-Cache
 
 
 
199 #endif
 
 
 
200        mcr    p15, 0, r0, c1, c0, 0
 
 
 
201
 
  
202        /*
+
Erase and copy the x-loader into the first flash partition (mtd0):
 +
flash_eraseall /dev/mtd0
 +
writeloader -i &lt;x-loader.bin.ift&gt; -o /dev/mtd0
 +
</pre>
 +
====<span id="1299156619608S" style="display: none;">&nbsp;</span>Boot Partition====
 +
* filesystem used jffs2 zlib/lzo compressed filesystem.
 +
* Suggested size: 0xC00000 (12 MiB).
  
203          * Jump to board specific initialization... The Mask ROM will have already initialized
+
X-Loader only support jffs2 partitions for boot partition.
  
204          * basic memory.  Go here to bump up clock rate and handle wake up conditions.
+
<u>Create the boot partition:</u>
  
205          */
 
  
206        adr    r0, _start              /* r0 &lt;- current position of code  */
 
  
207        ldr    r1, _TEXT_BASE          /* test if we run from flash or RAM */
+
<pre>Suggested procedure:
  
208        cmp    r0, r1                  /* pass on info about skipping some init portions */
+
Erase all mtd1 content:
 +
flash_eraseall /dev/mtd1
  
209        moveq  r0,#0x1                /* flag to skip prcm and sdrc setup */
+
Create your partition:
 +
mount -t jffs2 /dev/mtdblock1 /mnt
 +
</pre>
 +
<u>Next uses:</u>
  
210        movne  r0,#0x0
+
<u></u>You can mount the partition over your boot directory in the rootfs
  
211
+
<pre>mount -t jffs2 /dev/mtdblock1 /boot</pre>
 +
You can use the cp command for copy your kernel and igep.ini configuration file.
  
212        mov    ip, lr          /* persevere link reg across call */
+
<pre>cp igep.ini /boot
 +
cp zImage /boot</pre>
 +
====Rootfs Partition====
 +
* fs (your prefered fs supported by linux, maybe a good choice it should be ubifs)
 +
* Size, all or you can create more partitions if you wish ...&nbsp;:)
  
213        bl      lowlevel_init  /* go setup pll,mux,memory */
+
==Boot Priority==
 
+
XLoader first try load from mmc and if it fails then try from OneNand.
214        mov    lr, ip          /* restore link */
 
 
 
215        mov    pc, lr          /* back to my caller */
 
 
 
</pre>
 
Lowlevel_init it's responsable to set the stack settings and call the lowlevel board initialization called s_init "C" code defined in [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=board/igep0020/igep0020.c here]<br>
 
<pre> 171 .globl lowlevel_init
 
172 lowlevel_init:
 
 
 
173        ldr    sp,    SRAM_STACK
 
 
 
174        str    ip,    [sp]    /* stash old link register */
 
 
 
175        mov    ip,    lr      /* save link reg across call */
 
 
 
176        bl      s_init          /* go setup pll,mux,memory */
 
 
 
177        ldr    ip,    [sp]    /* restore save ip */
 
 
 
178        mov    lr,    ip      /* restore link reg */
 
 
 
179
 
 
 
180        /* back to arch calling code */
 
 
 
181        mov    pc,    lr
 
 
 
 
 
 
 
</pre>
 
At the end and after the s_init call the code jump to initial C function called [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=lib/board.c start_armboot] defined in the file lib/board.c.<br>
 
<pre>  65 init_fnc_t *init_sequence[] = {
 
  66        cpu_init,              /* basic cpu dependent setup */
 
  67        board_init,            /* basic board dependent setup */
 
  68 #ifdef CFG_NS16550_SERIAL
 
  69        serial_init,            /* serial communications setup */
 
  70 #endif
 
  71        print_info,
 
  72        nand_init,              /* board specific nand init */
 
  73 #ifdef CONFIG_MMC
 
  74        init_func_i2c,
 
  75 #endif
 
  76        NULL,
 
  77 };
 
  78
 
  79 void start_armboot (void)
 
  80 {
 
  81        init_fnc_t **init_fnc_ptr;
 
  82        int i, size;
 
  83        uchar *buf;
 
  84        int *first_instruction;
 
  85        block_dev_desc_t *dev_desc = NULL;
 
  86 #ifdef CONFIG_ONENAND
 
  87        unsigned int onenand_features;
 
  88 #endif
 
  89        /* Execute init_sequence */
 
  90        for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 
  91                if ((*init_fnc_ptr)() != 0) {
 
  92                        hang ();
 
  93                }
 
  94        }
 
  95
 
  96        /* Execute board specific misc init */
 
  97        misc_init_r();
 
  98
 
  99    /* Initialize OneNand */
 
100        onenand_init();
 
101
 
102    /* Initialize MMC */
 
103    mmc_init(1);
 
104
 
105    /* Load the Linux kernel */
 
106    /* boot_linux() should never return */
 
107    boot_linux();
 
108
 
109    hang();
 
110 }
 
</pre>
 
== C Execution Flow<br>  ==
 
 
 
=== s_init<br>  ===
 
 
 
Function: [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=board/igep0020/igep0020.c s_init]<br>
 
 
 
This function it's responsable to do the basic board (processor) initialization. It's called before the "C" generic initialization code.<br>
 
<pre> 874 /**********************************************************
 
875  * Routine: s_init
 
 
 
876  * Description: Does early system init of muxing and clocks.
 
 
 
877  * - Called at time when only stack is available.
 
 
 
878  **********************************************************/
 
 
 
879 void s_init(void)
 
 
 
880 {
 
 
 
881        watchdog_init();
 
 
 
882        try_unlock_memory();
 
 
 
883        set_muxconf_regs();
 
 
 
884        delay(100);
 
 
 
885        prcm_init();
 
 
 
886        per_clocks_enable();
 
 
 
887        gpmc_init ();
 
 
 
888        config_multichip_package();
 
 
 
889 }
 
 
 
 
 
 
 
</pre>
 
This function set the PLL clocks, MUX settings, GPMC configuration and memory configuration.
 
 
 
=== cpu_init<br>  ===
 
 
 
Function: [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=cpu/omap3/cpu.c cpu_init]<br>
 
 
 
This function it's the responsable to do the CPU generic initialization and it's the first function called. <br>
 
 
 
=== board_init<br>  ===
 
 
 
Function: [http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=board/igep0020/igep0020.c board_init]<br>
 
 
 
This function it's defined per board and it's the responsable to initialize the board.
 
 
 
Initialization GPMC for access to LAN9221 Ethernet controller and initialization of malloc &amp; free algorithms (from here all code can use malloc &amp; free calls).
 
<pre> 895 int board_init(void)
 
896 {
 
897    // Setup gpmc &lt;-&gt; Ethernet
 
898    setup_net_chip(is_cpu_family());
 
899    // Setup Malloc memory
 
900    mem_malloc_init(XLOADER_MALLOC_IPTR, XLOADER_MALLOC_SIZE);
 
901
 
902    return 0;
 
903 }
 
</pre>
 
=== serial_init<br>  ===
 
 
 
Function:&nbsp;[http://git.igep.es/?p=pub/scm/igep-x-loader.git;a=blob;f=drivers/serial.c serial_init]
 
 
 
This function initializes the serial driver.
 
 
 
 
 
 
 
=== <br> <br> 4 Settings &amp; Configuration:  ===
 
 
 
====== ================  ======
 
 
 
4.1 MMC Boot<br>------------<br>Get a new mmc and create two partitions, the first one must be fat (you can follow <br>this howto: http://code.google.com/p/beagleboard/wiki/LinuxBootDiskFormat)<br>In this first partition (boot partition) you should copy:
 
 
 
*x-loader.bin.ift (you must rename this file to MLO) / This is a signed image using contrib/signGP tool<br>* igep.ini<br>* Your desired kernel image.
 
 
 
Don't use a uImage kernel format (from uboot), only kernel formats be supported.
 
 
 
Compilation Example:<br>$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- zImage modules
 
 
 
Read the kernel documentation about kernel images.
 
 
 
4.2 Setup igep.ini file<br>------------------------<br># Note this format permits use the characters<br># '#' and ';' as comment check file size restrictions
 
 
 
[kernel]<br>kaddress=0x80008000<br>;rdaddress=0x84000000<br>serial.low=00000001<br>serial.high=00000000<br>revision=0001<br>;kImageName=<br>;kRdImageName=
 
 
 
[kparams]<br>console=ttyS2,115200n8<br>;earlyprintk=serial,ttyS2,115200<br>mem=512M<br>boot_delay=0<br>;mpurate=800<br>;loglevel=7<br>omapfb.mode=dvi:1024x768MR-16@60<br>smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde<br>;ubi.mtd=2<br>;root=ubi0:igep0020-rootfs <br>;rootfstype=ubifs<br>root=/dev/mmcblk0p2 rw rootwait
 
 
 
----
 
 
 
Tags Supported<br>---------------
 
 
 
----
 
 
 
[kernel] ----<br>* kaddress=0x80008000
 
 
 
Kernel copy address, you should use the same address used in kernel image<br>configuration. If you don't know what it means maybe it's better don't change it.
 
 
 
*rdaddress=0x84000000<br>Kernel RAM disk copy address. <br>If you don't know what it means maybe it's better don't change it.
 
 
 
*serial.low=00000001<br>* serial.high=00000000<br>Board serial Number, you can read this information using /proc/cpuinfo
 
 
 
*revision=0001<br>Board Revision ID, you can read this information using /proc/cpuinfo
 
 
 
*kImageName=zImage<br>Kernel file name, if you don't provide this tag it try to load these others:<br>// DEFAULT IMAGES<br>"zImage"<br>"zimage"<br>"vmlinuz"<br>"bzImage"<br>"bzimage"
 
 
 
*kRdImageName=rdimage<br>Kernel RAM Disk file, if you don't provide this tag it try to load these others:<br>// DEFAULT IMAGES<br>"initrd"
 
 
 
----
 
  
[kparams] ----<br>Kernel parameters, all these parameters are passed directly to the kernel using the<br>kernel command line.  
+
'''MLO (x-loader), igep.ini, zImage from MMC'''<br />If all it's present in the mmc it don't try to boot from Onenand.
  
kernel parameters documentation:<br>http://www.kernel.org/doc/Documentation/kernel-parameters.txt<br>http://www.kernel.org/pub/linux/kernel/people/gregkh/lkn/lkn_pdf/ch09.pdf
+
'''MLO (x-loader) in MMC, igep.ini and zImage in Onenand.'''<br />If only MLO it's provided this one try to load the other information from&nbsp;the Onenand.
  
4.3 Boot Priority<br>-----------------<br>First try mmc and if it fails then try from OneNand.  
+
It means that XLoader always try to load the information from MMC and if it fails then try to load from OneNand.
  
Examples:<br>a) MLO (x-loader), igep.ini, zImage from MMC<br>If all it's present in the mmc it don't try to boot from Onenand.  
+
==Configuration file: igep.ini==
 +
[http://en.wikipedia.org/wiki/INI_file This entry in wikipedia] can help you how a ini file it's structured.
  
b) MLO (x-loader) in MMC, igep.ini and zImage in Onenand.<br>If only MLO it's provided this one try to load the other information from<br>the Onenand.  
+
Inside the sources/scripts directory you can found a [http://git.isee.biz/?p=pub/scm/igep-x-loader.git;a=blob;f=scripts/igep.ini;h=ce093fe80c81d8888bf79464f847059b312bba83;hb=refs/heads/master igep.ini] example file.
  
4.4 OneNand Partition settings<br>-------------------------------<br>We suggest use minimum 3 partitions on the OneNand.
+
The actual XLoader can handle two kind tags:
  
Creating 3 MTD partitions on "omap2-onenand":<br>0x000000000000-0x000000080000&nbsp;: "X-Loader"<br>0x000000080000-0x000000c80000&nbsp;: "Boot"<br>0x000000c80000-0x000020000000&nbsp;: "File System"
+
[kernel] Used for internal XLoader setup.
  
4.4.1) Xloader partition<br>* Not fs formated (raw)<br>* Suggested size: 0x80000 (512 KiB)<br>* The xloader must be signed before copy it in the flash memory.  
+
[kparams] Used for pass the linux kernel parameters.
  
You should copy the x-loader in the firsts 4 blocks (first 512 KiB), this is not a <br>formated partition due the ROM not permits boot from there, you should use tools:<br>flash_eraseall and nandwrite for copy x-loader in the first blocks.
+
===TAG: [kernel]&nbsp;===
 +
<pre>  1 [kernel]
 +
  2 kaddress=0x80008000
 +
  3 rdaddress=0x81600000
 +
  4 serial.low=00000001
 +
  5 serial.high=00000000
 +
  6 revision=0001
 +
  7 kImageName=zImage-test
 +
  8 kRdImageName=rdImage-test
 +
  9 MachineID=xxxx Where Machine ID = 2344 for IGEPv2,  ID = 2717 for IGEP COM Module, ID = 3203 for IGEP COM PROTON 
 +
  10 Mode=&lt;kernel&gt; or &lt;binary&gt;
 +
  11 dss=&lt;0 or 1&gt; Enable or Disable Video Output
 +
  12 dss_color=&lt;0x00FF8000&gt; Write your desired color in hex value
 +
  13 dss_bitmap=&lt;filename&gt; Raw display image</pre>
 +
{| border="1" width="800" cellspacing="1" cellpadding="1"
 +
|-
 +
||Parameter Name
 +
||Description
 +
||Default Value
 +
||Comments
 +
|-
 +
||kaddress
 +
||Kernel copy address
 +
||0x80008000
 +
||hex memory address
 +
|-
 +
||rdaddress
 +
||Ram Disk location address
 +
||0x81600000
 +
||hex memory address
 +
|-
 +
||serial.low
 +
||Serial number (low part)
 +
||0 - 99999999
 +
||numeric
 +
|-
 +
||serial.high
 +
||Serial number (high part)
 +
||0 - 99999999
 +
||numeric
 +
|-
 +
||revision
 +
||Revision ID
 +
||0 - 9999
 +
||numeric
 +
|-
 +
||kImageName
 +
||Kernel, binary image name
 +
||N/A
 +
||Kernel or binary image name
 +
|-
 +
||kRdImageName
 +
||Ramdisk
 +
||N/A
 +
||Ram Disk image name
 +
|-
 +
||MachineID
 +
||Machine ID (kernel ID)
 +
||2717
 +
||2717 (IGEP COM Module) | 2344 IGEPv2 | 3203 (IGEP COM PROTON)
 +
|-
 +
||Mode
 +
||Boot Mode
 +
||kernel
 +
||kernel=linux kernel / binary=boot binary image
 +
|-
 +
||dss
 +
||Enable Video
 +
||0
 +
||0 = Disable, 1 Enable Video Output
 +
|-
 +
||dss_color
 +
||Video Color
 +
||0x00FF8000
 +
||Solid Color
 +
|-
 +
||dss_bitmap
 +
||Video Bitmap Image
 +
||string
 +
||filename with desired image
 +
|}
  
Suggested procedure:  
+
===TAG:&nbsp;[kparams]===
 +
In this tag you can add all kernel parameters that you need, this is only an example:
  
nand_eraseall /dev/mtd0<br>nandwrite -p /dev/mtd0 &lt;x-loader&gt;  
+
<pre> 10 [kparams]
 +
  11 console=ttyS2,115200n8
 +
  12&nbsp;;earlyprintk=serial,ttyS2,115200
 +
  13 mem=512M
 +
  14 boot_delay=0
 +
  15&nbsp;;mpurate=800
 +
  16&nbsp;;loglevel=7
 +
  17 omapfb.mode=dvi:1024x768MR-16@60\r
 +
  18 smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde\r
 +
  19&nbsp;;ubi.mtd=2
 +
  20&nbsp;;root=ubi0:igep0020-rootfs
 +
  21&nbsp;;rootfstype=ubifs
 +
  22 root=/dev/mmcblk0p2 rw rootwait
  
*Sign x-loader<br>You should execute contrib/signGP for sign the xloader that resides inside the flash memory.
+
Also remember you can comment any line using ';' or '#' characters.
  
contrib/signGP x-load.bin <br>The signed x-loader it's named: x-load.bin.ift
+
</pre>
  
Due the Onenand 512 MiB has two dies it's necessary split the x-loader and convert it to a 1 die binary.<br>This is a know OMAP/DM/AM OneNand/Nand boot limitation.
+
=FAQ=
 +
==How I can boot from NFS?==
 +
Yes, you should add below parameters in the kparams tag:
  
This is the procedure for create the x-loader OneNand binary:<br>You should execute: (You can use copy paste in your console)
+
<pre>#smsc911x.mac fix your mac address
 +
smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde
 +
# IP set you IP settings &lt;local_ip&gt;:&lt;server_ip&gt;:&lt;gateway&gt;:&lt;network_mask&gt;::&lt;interface&gt;:
 +
ip=192.168.2.123:192.168.2.105:192.168.2.1:255.255.255.0::eth0:
 +
# Set root as nfs
 +
root=/dev/nfs
 +
# Set your NFS root path as &lt;server_ip&gt;:&lt;rootfs_path&gt;
 +
nfsroot=192.168.2.105:/srv/nfs/linaro_minimal</pre>
 +
==How I can change the assigned kernel memory?==
 +
You can use the mem kernel variable as assign your desired kernel memory as:
  
split -b 2K x-load.bin.ift split-<br>for file in `ls split-a?`; do cat $file &gt;&gt; x-load-ddp.bin.ift; cat $file &gt;&gt; x-load-ddp.bin.ift; done
+
<pre>[kparams]
 +
mem=430M</pre>
 +
==How I can add more kernel variables?==
 +
You can add more variables creating a new variable - value pair under kparams tag as:
  
This last command generate a file named x-load-ddp.bin.ift this is the x-loader for copy it in the OneNand.  
+
<pre>boot_delay=0</pre>
 +
==How I can modify my MAC address?==
 +
You can assign your desired mac address using the variable&nbsp;smsc911x.mac as:
  
4.4.2 Boot Partition<br>--------------------<br>* fs used jffs2 zlib compressed filesystem.<br>* Suggested size: 0xC00000 (12 MiB)
+
<pre>smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde</pre>
 +
==How I can boot my board using ubi root filesystem?==
 +
You should use these parameters:
  
First time creation:<br>a) Use the same procedure described in point 4.2.1. Copy your jffs2 compressed image in the<br>partition, it can be a empty file.
+
<pre>ubi.mtd=2
  
b) Erase the partition and mount it as jffs2 filesystem then you can copy with cp command.
+
root=ubi0:igep0020-rootfs
  
Next Times:<br>Copy the files using cp command, or edit directly.  
+
rootfstype=ubifs</pre>
 +
==How I can boot my board using a RAM disk?==
 +
Use a RAMdisk it's fully supported.
  
when kernel boots you can enable mount this partition over /boot directory for access all boot content.  
+
<pre>[kernel]
 +
rdaddress=0x81600000
 +
kRdImageName=ramdisk.bin
  
4.4.3 Rootfs <br>------------<br>* fs (your prefered fs supported by linux, maybe a good choice it should be ubifs)<br>* Size, all or you can create more partitions if you wish ...&nbsp;:)
+
[kparams]
 +
root=/dev/ram0 rw
  
<br>5 Build procedure<br>=================  
+
</pre>
 +
==Can I change the Processor frecuency?==
 +
Yes you can, IGEP X-loader configures the processor to boot at 600 Mhz you can select a different boot speed using the variable mpurate as:
  
5.1 Build with Ubuntu Cross Compiler gcc 4.5.1  
+
<pre>mpurate=800</pre>
 +
If you don't force any frequency the linux kernel will put your processor at the maximum speed (ex: DM3730 will run at 1 Ghz)
  
*This is tested with Ubuntu 10.10
 
  
a) Install the cross compiler:<br>apt-get install cpp-4.5-arm-linux-gnueabi g++-4.5-arm-linux-gnueabi
 
  
b) Configure the board<br>make igep0020-sdcard_config
+
==How I can boot downloading the kernel using wget?==
 +
The way for do that it's using one minimal kernel and RAMdisk (ex: using image-core-minimal from poky), the procedure can be more or less:
  
c) Build<br>make
+
a) Copy your minimal kernel and your Ramdisk inside the boot partition.
  
d) Sign x-loader<br>You should execute contrib/signGP for sign the xloader that resides inside the flash memory.<br>contrib/signGP x-load.bin <br>The signed x-loader it's named: x-load.bin.ift
+
b) Boot Normally from this kernel and Ramdisk, create one script your your desired command such wget http://192.168.15.22/mykernel.bin
  
<br>5.2 Build with IGEP SDK
+
c) Execute the script when boot (you can do that adding the script to the init enviroment)
  
a) Source the enviroment<br>source /usr/local/poky/eabi-glibc/environment-setup-arm-none-linux-gnueabi
+
d) if the downloading it's ok then execute the kexec call, first load the kernel and then pass to it your desired parameters.
  
b) Edit the file Makefile<br>Find the define:
+
e) finally boot the new kernel with kexec.
  
And Set the variable as:<br>CROSS_COMPILE = arm-none-linux-gnueabi-
 
  
b) Configure the board<br>make igep0020-sdcard_config
 
  
c) build<br>make
+
==My board not boot and I don't know what to do ...==
 +
When you test your IGEP X-loader, igep.ini file and kernel we suggest use a microsd card in front of use directly the flash nand, if your flash not boot copy all files in one microsd card and boot from there. You can check what happens removing some files from your microsd card for example if you wish test if your flashed kernel it's loaded in a right way then remove the kernel from your microsd card (note: use the same kernel name), IGEP X-loader first try load the file from your microsd card but if it's not found then it try to find the file in the flash.
  
d) Sign x-loader<br>You should execute contrib/signGP for sign the xloader that resides inside the flash memory.<br>contrib/signGP x-load.bin <br>The signed x-loader it's named: x-load.bin.ift
+
==How I can upgrade my old kernel?==
 +
Just copy the new one, the most secure way it's copy the new one and at end replace the igep.ini file with your new one.
  
<br>5.3 Build Native
+
<pre> mount -t jffs2 /dev/mtdblock1 /boot
  
a) Configure the board<br>make igep0020-sdcard_config
+
cp newkernel.bin /boot
  
b) Modify the config.mk file<br>Edit the variable CFLAGS and add the option: -fno-stack-protector
+
cp igep.ini /boot</pre>
 +
Use a different kernel name and you always can boot from your old one.
  
CFLAGS&nbsp;:= $(CPPFLAGS) -Wall -Wstrict-prototypes -fno-stack-protector
+
=6 Contribution &amp; Support &amp; Bugs Report=
 +
Contributions to this project be welcome and you can send your patches to support@iseebcn.com&nbsp;or you can use the igep forum for it.<br />You can access to IGEP-x-Loader repository using our git at [http://git.isee.biz/?p=pub/scm/igep-x-loader.git;a=summary git.isee.biz]<br />IGEP IRC Channel: [http://webchat.freenode.net/?channels=igep http://webchat.freenode.net/?channels=igep]
  
c) build <br>make CROSS_COMPILE=""
 
  
d) Sign x-loader<br>You should execute contrib/signGP for sign the xloader that resides inside the flash memory.<br>contrib/signGP x-load.bin <br>The signed x-loader it's named: x-load.bin.ift
+
{{Message/Forum}}
  
<br>6 Contribution &amp; Support &amp; Report Bugs<br>======================================<br>Contributions to this project be welcome and you can send your patches to support@iseebcn.com<br>or you can use the igep forum for it.<br>You can access to IGEP-x-Loader repository using our git at git.igep.es<br>IGEP IRC Channel: http://webchat.freenode.net/?channels=igep<br><br>
+
[[Category:Boot_loaders|X_Loader]]

Latest revision as of 16:32, 7 May 2019

Contents

Summary

X-Loader, an initial program loader for Embedded boards based on OMAP processors.

Access to the latest version here and read the ISEE_Readme.txt for get the latest release information.

Why IGEP-Xloader

Some important reasons exist for using this bootloader on IGEP boards.

Security

This is one of the most important reasons why we develop this new IGEP X-loader. you will Probably know that flash devices get new bad memory blocks with normal usage that can make unusable or can damange the software residing inside the flash (ex: upgrading the software, copying a new kernel ... ), in these cases your board won't be usable anymore if you don't use a right nand filesystem that insures data integrity. Using the old schema we've 4 important partitions on flash without any protection, x-loader, u-boot, u-boot enviroment and kernel.

IGEP X-loader resolves this situation as the configuration and kernel files reside inside a jffs2 partition.

Maintenance

With the old schema 3 different software existed (x-loader, u-boot, kernel) that did exactly the same job, so you had to reconfigure the board, increasing the complexity of maintenance for the board system and provide a major bug source because we had to assure that all software was aligned with all changes. Also, from a second point of view, we did the job three times so the boot process was more complex and slow.

Easy to use

With this new approach use the software it's more easy to use, if you've the boot information stored inside a jffs2 partition you can use the linux kernel to access it directly without the use of any flash tool to modify the software (ex: using nandwrite it's to risky due to its inability to guarantee data integrity over the Nand Flash memory).

Upgrade faster and easy

Upgradint to a new kernel it's easier and faster, you only need to copy the new kernel inside the boot partition, copy your new igep.ini inside and reboot the board with all security.

Features and Limitations

Improvements & Modifications

  • Added malloc/free functionality.
  • Added mtd framework and onenand support, removed the old onenand drivers.
  • Added fs jffs2 support using mtd & onenand support (Read Only).
  • Added crc32 and zlib.
  • Jffs2 zlib compression support (Read Only).
  • Dual boot mmc & onenand with mmc highest priority.
  • Added Linux kernel boot directly (Support for 2.6.22 and highest version kernels)
  • Linux kernel supported images: vmlinuz, bzImage and zImage.
  • Support for loading Linux Ram disk (EXPERIMENTAL)
  • Added "ini" files parser.
  • The configuration resides in a plain txt (ini format file).
  • Support Windows & Linux formating ini files.
  • boot from mmc, onenand, or mix with mmc highest priority.
  • Added codeblocks project and compilation rules.
  • Added support for vfat32 extra names.
  • Configure TPS65950 voltage to 1.35V if it's used a DM3730 processor.
  • Added new parameter MachineID in kernel tag file, with it you can
  •     - configure the kernel board ID setup
  • Added new parameter buddy for kernels 2.6.35.y and 2.6.37.y
  • Optimize some LPDDR Memory configuration values
  • Removed some OneNand Debug information
  • Removed some FAT incorrect warnings
  • Added Support Initial Ram disk
  • Reconfigure Makefile options
  • Support Kernels 2.6.35, 2.6.37, 3.6.4
  • Added support for boot ARM binary files (such u-boot or QNX kernel)
  • Support for Numonyx, Micron and hynix POP Memories.
  • Memory autodetection.
  • Added GPTimer functionality.
  • Support Numonyx, Micron and hynix memories.
  • DMA Copy support
  • Omtimized memcpy and memset functions.
  • DSS Video driver.
  • Support ISEE toolchain yocto 1.2 based.

Limitations

  • The ini configuration file it's limited to max size: 16 KiB
  • Kernel Command line parameters it's limited to: 4 KiB
  • Malloc it's hardcode limited to 32 MiB.
  • Video is limited to 1024 x 768 x 16 bits.
  • Video Memory is limited to 1280 x 720 x 32 bits.

TODO

  • Remove compilation warnings.
  • System Rescue.
  • Improve boot selection and priority.
  • Remove unused code.

STATUS

  • Support:
    • IGEPv2 DM3730
    • IGEPv2 OMAP3530
    • IGEP COM MODULE DM3730
    • IGEP COM PROTON DM3730
    • IGEP COM MODULE AM3703

VERSION CHANGES

[2.1.0-1] This version only can be build with gcc linaro 4.5.2 other compilers be not supported.

[2.1.0-1] Removed some uncontrolled "printf" with incorrect information.

[2.1.0-1] Modified some code under __DEBUG__ option.

[2.1.0-1] Added Support for TPS65950-A3 initialization at 1.35V

[2.1.0-1] Added support for IGEP Module 0030

[2.1.0-1] Added support dynamic Machine ID selection (same xloader boot IGEPv2 & IGEP Module)


[2.1.0-2] ARM Compilation bug resolved


[2.1.0-3] Update SDRAM structure initialization

[2.1.0-3] Added support for Initial RAM disk

[2.1.0-3] Updated Initial RAM disk destination address


[2.2.0-1] Update Makefile structure

[2.2.0-1] Downgrade the boot processor speed


[2.3.0-1] Add NAND flash devices and Micron MT29CXGXXMAXX memories support

[2.3.0-2] Add Hynix NAND memorie and IGEP0032 support

[2.3.0-2] Added lzo compression schema.


[2.3.0-3] Add Support for execute ARM binaries [2.3.0-3] Bug Fixes related to I and D Cache


[2.4.0-1] Added Memory test feature

[2.4.0-1] Added some boot information

[2.4.0-1] New read_nand_cache function optimized for load from NAND

[2.4.0-1] BUG resolved: Refresh Setup in Micron & Hynix Memories

[2.4.0-1] BUG resolved: Reset Memory controller after initialize Malloc function

[2.4.0-1] BUG resolved: Resolve problems updating the flash content under jffs2


[2.4.0-2] Resolved Memory Autodetection

[2.4.0-2] Better hang board led control

[2.4.0-2] New read_nand_cache function optimized for load from OneNand

[2.4.0-2] Added Hw GPtimer functionality


[2.5.0-1] Added System DMA driver.

[2.5.0-1] Added optimized memcpy & memset functions.

[2.5.0-1] Improved boot speed.

[2.5.0-1] Improve NAND driver support.

[2.5.0-1] Auto x-loader.bin.ift and MLO generation.

[2.5.0-1] Added DSS video support.


[2.5.0-2] Fixed System DMA misconfiguration.

[2.5.0-2] Improve GPMC timming setup.

[2.5.0-2] Added DSS igep.ini variables.

[2.5.0-2] Added Support for new memory capacities.

[2.5.0-2] Auto x-loader.bin.ift and MLO generation.

[2.5.0-2] Minor bug fixes.


[2.5.0-3] platform.S: downgrade MPU boot clock from 1GHz to 800 MHz


[2.6.0-1] Remove OMAP35xx support

[2.6.0-1] New DMA driver, now can handle different DMA channels and transfers

[2.6.0-1] GPMC: Add support for use prefetch engine

[2.6.0-1] NAND: Added a new Nand driver

[2.6.0-1] NAND: Modify memory setup timmings


[2.6.0-2] DMA: disable dma_memcpy function due random kernel memory corruption

Pre-Compiled Binaries

Release Download link Support
2.6.0-2 igep-x-loader-2.6.0-2.tar.bz2 DM3730 Boards
2.5.0-2 igep-x-loader-2.5.0-2.tar.bz2 All OMAP3 Boards
2.4.0-2 igep-x-loader-2.4.0-2.tar.bz2 All OMAP3 Boards except IGEP COM MODULE AM3703
2.1.0-2 igep-x-loader-2.1.0-2.tar.bz2 All OMAP3 Boards except IGEP COM MODULE AM3703
2.1.0-3 igep-x-loader-2.1.0-3.tar.bz2 All OMAP3 Boards except IGEP COM MODULE AM3703
2.2.0-1 igep-x-loader-2.2.0-1.tar.bz2 All OMAP3 Boards except IGEP COM MODULE AM3703

Build Procedure

Build with ISEE SDK Yocto Toolchain 1.2

Download and Install the cross compiler if you not do it before.

Download the toolchain from this link and uncompress it as root in your / directory.

Hint: Remember setup the enviroment before build the source:

source /opt/poky/1.2/environment-setup-armv7a-vfp-neon-poky-linux-gnueabi

Download the sources from our git repository

git clone git://git.isee.biz/pub/scm/igep-x-loader.git

Get your desired tag / release

git checkout <your_desired_release> -b <your_name_release>

git checkout release-2.5.0-2 -b release-2.5.0-2-local

Setup the board build setup

make igep00x0_config

Build the software

make

Sign the binary x-loader (Only versions prior to 2.5.0-x)

You should execute contrib/signGP for sign the xloader.

contrib/signGP x-load.bin
The signed x-loader it's named: x-load.bin.ift

Build Native

Download from git repository

git clone https://git.isee.biz/arm-boot/igep-x-loader.git 

git checkout <your_desired_release> -b <your_name_release>

 git checkout release-2.5.0-2 -b release-2.5.0-2-local

Configure the board settings

make igep00x0_config
Edit the variable CFLAGS and add the option: -fno-stack-protector
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -fno-stack-protector

Build

make CROSS_COMPILE=arm-none-linux-gnueabi-

Sign the binary x-loader

You should execute contrib/signGP for sign the xloader.

contrib/signGP x-load.bin
The signed x-loader it's named: x-load.bin.ift

BOOT

The IGEP X-Loader must reside in the microSD card or in the Nand Memory.

MMC Boot

Prepare the microsd card

You can follow this howto about how prepare the microsd card or How to boot from MicroSD Card

Get a new microsd card and create two partitions, the first one must be fat16/32 and the second one can be formated in any format type supported by linux kernel.

Copy the files in the first (FAT) partition

In the first partition you must copy in this order:

  1. x-loader.bin.ift (you must rename this file to MLO before copy it) / This is a signed image using contrib/signGP tool
  2. x-loader configuration file igep.ini also you can change the configuration file name editing the file: igep00x0.h (#define IGEP_BOOT_CFG_INI_FILE "igep.ini")
  3. Your desired kernel image.

Load Order:

  48 /* Linux Images */
  49 const char* LinuxImageNames [] = {
  50         "kparam"   /* Use kparam first */
  51         "zImage",   /* jffs2 it's case sensitive */
  52         "zimage",   /* fat name it's not case sentitive */
  53         "vmlinuz",
  54         "bzImage",
  55         "bzimage",
  56         0,
  57 };

or you can set the name for your kernel in the configuration file using the tag: kImageName

Don't use a uImage kernel format (from uboot), only standard kernel formats be supported.

kernel build command example:

make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- zImage modules

Second Partition

Copy all your rootfs in this second partition.

Also you can use the linaro 10.11 minimal image download the image and untar (as root) in your microsd card second partition.

Remember install the kernel modules in this partition.

Example:

sudo make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules_install INSTALL_MOD_PATH=[path to your target rootfs]

Nand Boot

Nand Partitions

We've defined 3 partitions on the Nand Memory.

MTD partitions on "omap2-onenand":
(a) 0x000000000000-0x000000080000 : "X-Loader"
(b) 0x000000080000-0x000000c80000 : "Boot"
(c) 0x000000c80000-0x000020000000 : "File System"

X-Loader Partition

  • Not fs formated (onenand raw)
  • Size: 0x80000 (512 KiB)
  • The xloader must be signed before copy it into the flash memory.

You should copy the x-loader in the firsts 4 blocks (first 512 KiB), this is not a formated partition due the ROM not permits boot from a formated partition in flash, you should use flash_eraseall and writeloader for copy x-loader in the first blocks.

Suggested procedure:

Sign the x-loader before write it on the flash or microsd card.
Sign x-loader:
You should execute contrib/signGP for sign the xloader that resides inside the flash memory.
contrib/signGP x-load.bin
The signed x-loader it's named: x-load.bin.ift

Erase and copy the x-loader into the first flash partition (mtd0):
flash_eraseall /dev/mtd0
writeloader -i <x-loader.bin.ift> -o /dev/mtd0

Boot Partition

  • filesystem used jffs2 zlib/lzo compressed filesystem.
  • Suggested size: 0xC00000 (12 MiB).

X-Loader only support jffs2 partitions for boot partition.

Create the boot partition:


Suggested procedure:

Erase all mtd1 content:
flash_eraseall /dev/mtd1

Create your partition:
mount -t jffs2 /dev/mtdblock1 /mnt

Next uses:

You can mount the partition over your boot directory in the rootfs

mount -t jffs2 /dev/mtdblock1 /boot

You can use the cp command for copy your kernel and igep.ini configuration file.

cp igep.ini /boot
cp zImage /boot

Rootfs Partition

  • fs (your prefered fs supported by linux, maybe a good choice it should be ubifs)
  • Size, all or you can create more partitions if you wish ... emoticon

Boot Priority

XLoader first try load from mmc and if it fails then try from OneNand.

MLO (x-loader), igep.ini, zImage from MMC
If all it's present in the mmc it don't try to boot from Onenand.

MLO (x-loader) in MMC, igep.ini and zImage in Onenand.
If only MLO it's provided this one try to load the other information from the Onenand.

It means that XLoader always try to load the information from MMC and if it fails then try to load from OneNand.

Configuration file: igep.ini

This entry in wikipedia can help you how a ini file it's structured.

Inside the sources/scripts directory you can found a igep.ini example file.

The actual XLoader can handle two kind tags:

[kernel] Used for internal XLoader setup.

[kparams] Used for pass the linux kernel parameters.

TAG: [kernel] 

   1 [kernel]
   2 kaddress=0x80008000
   3 rdaddress=0x81600000
   4 serial.low=00000001
   5 serial.high=00000000
   6 revision=0001
   7 kImageName=zImage-test
   8 kRdImageName=rdImage-test
   9 MachineID=xxxx Where Machine ID = 2344 for IGEPv2,  ID = 2717 for IGEP COM Module, ID = 3203 for IGEP COM PROTON   
   10 Mode=<kernel> or <binary>
   11 dss=<0 or 1> Enable or Disable Video Output
   12 dss_color=<0x00FF8000> Write your desired color in hex value
   13 dss_bitmap=<filename> Raw display image
Parameter Name Description Default Value Comments
kaddress Kernel copy address 0x80008000 hex memory address
rdaddress Ram Disk location address 0x81600000 hex memory address
serial.low Serial number (low part) 0 - 99999999 numeric
serial.high Serial number (high part) 0 - 99999999 numeric
revision Revision ID 0 - 9999 numeric
kImageName Kernel, binary image name N/A Kernel or binary image name
kRdImageName Ramdisk N/A Ram Disk image name
MachineID Machine ID (kernel ID) 2717 2717 (IGEP COM Module) | 2344 IGEPv2 | 3203 (IGEP COM PROTON)
Mode Boot Mode kernel kernel=linux kernel / binary=boot binary image
dss Enable Video 0 0 = Disable, 1 Enable Video Output
dss_color Video Color 0x00FF8000 Solid Color
dss_bitmap Video Bitmap Image string filename with desired image

TAG: [kparams]

In this tag you can add all kernel parameters that you need, this is only an example:

  10 [kparams]
  11 console=ttyS2,115200n8
  12 ;earlyprintk=serial,ttyS2,115200
  13 mem=512M
  14 boot_delay=0
  15 ;mpurate=800
  16 ;loglevel=7
  17 omapfb.mode=dvi:1024x768MR-16@60\r
  18 smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde\r
  19 ;ubi.mtd=2
  20 ;root=ubi0:igep0020-rootfs
  21 ;rootfstype=ubifs
  22 root=/dev/mmcblk0p2 rw rootwait

Also remember you can comment any line using ';' or '#' characters.

FAQ

How I can boot from NFS?

Yes, you should add below parameters in the kparams tag:

#smsc911x.mac fix your mac address
smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde
# IP set you IP settings <local_ip>:<server_ip>:<gateway>:<network_mask>::<interface>:
ip=192.168.2.123:192.168.2.105:192.168.2.1:255.255.255.0::eth0:
# Set root as nfs
root=/dev/nfs
# Set your NFS root path as <server_ip>:<rootfs_path>
nfsroot=192.168.2.105:/srv/nfs/linaro_minimal

How I can change the assigned kernel memory?

You can use the mem kernel variable as assign your desired kernel memory as:

[kparams]
mem=430M

How I can add more kernel variables?

You can add more variables creating a new variable - value pair under kparams tag as:

boot_delay=0

How I can modify my MAC address?

You can assign your desired mac address using the variable smsc911x.mac as:

smsc911x.mac=0xb2,0xb0,0x14,0xb5,0xcd,0xde

How I can boot my board using ubi root filesystem?

You should use these parameters:

ubi.mtd=2

root=ubi0:igep0020-rootfs

rootfstype=ubifs

How I can boot my board using a RAM disk?

Use a RAMdisk it's fully supported.

[kernel]
rdaddress=0x81600000
kRdImageName=ramdisk.bin

[kparams]
root=/dev/ram0 rw

Can I change the Processor frecuency?

Yes you can, IGEP X-loader configures the processor to boot at 600 Mhz you can select a different boot speed using the variable mpurate as:

mpurate=800

If you don't force any frequency the linux kernel will put your processor at the maximum speed (ex: DM3730 will run at 1 Ghz)


How I can boot downloading the kernel using wget?

The way for do that it's using one minimal kernel and RAMdisk (ex: using image-core-minimal from poky), the procedure can be more or less:

a) Copy your minimal kernel and your Ramdisk inside the boot partition.

b) Boot Normally from this kernel and Ramdisk, create one script your your desired command such wget http://192.168.15.22/mykernel.bin

c) Execute the script when boot (you can do that adding the script to the init enviroment)

d) if the downloading it's ok then execute the kexec call, first load the kernel and then pass to it your desired parameters.

e) finally boot the new kernel with kexec.


My board not boot and I don't know what to do ...

When you test your IGEP X-loader, igep.ini file and kernel we suggest use a microsd card in front of use directly the flash nand, if your flash not boot copy all files in one microsd card and boot from there. You can check what happens removing some files from your microsd card for example if you wish test if your flashed kernel it's loaded in a right way then remove the kernel from your microsd card (note: use the same kernel name), IGEP X-loader first try load the file from your microsd card but if it's not found then it try to find the file in the flash.

How I can upgrade my old kernel?

Just copy the new one, the most secure way it's copy the new one and at end replace the igep.ini file with your new one.

 mount -t jffs2 /dev/mtdblock1 /boot

 cp newkernel.bin /boot

 cp igep.ini /boot

Use a different kernel name and you always can boot from your old one.

6 Contribution & Support & Bugs Report

Contributions to this project be welcome and you can send your patches to support@iseebcn.com or you can use the igep forum for it.
You can access to IGEP-x-Loader repository using our git at git.isee.biz
IGEP IRC Channel: http://webchat.freenode.net/?channels=igep


Igep forum.png If you have any question, don't ask to ask at the IGEP Community Forum or the IGEP Community Chat Irc.png