Difference between revisions of "How to boot from MicroSD Card"
From IGEP - ISEE Wiki
Manel Caro (talk | contribs) |
Manel Caro (talk | contribs) |
||
Line 206: | Line 206: | ||
You can follow this other howto about [[The Linux kernel|how compile and install the Linux Kernel]]. | You can follow this other howto about [[The Linux kernel|how compile and install the Linux Kernel]]. | ||
− | In our case we build the kernel sources from zero:<br> | + | In our case we build the kernel sources from zero:<br> |
<pre>a) Clone the Kernel git repository | <pre>a) Clone the Kernel git repository | ||
Line 224: | Line 224: | ||
$/home/jdoe/linux-omap-2.6> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules | $/home/jdoe/linux-omap-2.6> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules | ||
− | </pre> | + | </pre> |
− | Notes: The kernel binary resides inside the directory: $/home/jdoe/linux-omap-2.6/arch/arm/boot/'''zImage''' | + | Notes: The kernel binary resides inside the directory: $/home/jdoe/linux-omap-2.6/arch/arm/boot/'''zImage''' |
We will use the [http://downloads.igep.es/files/linaro-m-headless-tar-20101108-2.tar.gz linaro headless] image as rootfs but you can use your favorite rootfs also. | We will use the [http://downloads.igep.es/files/linaro-m-headless-tar-20101108-2.tar.gz linaro headless] image as rootfs but you can use your favorite rootfs also. | ||
Line 244: | Line 244: | ||
Copy "linaro-m-headless-tar-20101108-2.tar.gz" file inside the /media directory and untar the file | Copy "linaro-m-headless-tar-20101108-2.tar.gz" file inside the /media directory and untar the file | ||
− | <pre>$ media > sudo tar xvfz linaro-m-headless-tar-20101108-2.tar.gz</pre> | + | <pre>$ media > 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.<br> | ||
+ | === [[Image:Linaro RootFS.png|thumb|center]]Install the kernel modules<br> === | ||
− | + | Now you should install your kernel modules inside your root file system.<br> | |
− | |||
− | |||
− | |||
− | Now you should install your kernel modules inside your root file system.<br> | ||
<pre>$ media > cd /home/jdoe/linux-omap-2.6 | <pre>$ media > cd /home/jdoe/linux-omap-2.6 | ||
$ /home/jdoe/linux-omap-2.6> sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary | $ /home/jdoe/linux-omap-2.6> sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary | ||
− | </pre> | + | </pre> |
− | === Install the kernel Image<br> === | + | === Install the kernel Image<br> === |
− | Just copy the zImage inside your boot partition, remember before that you must mount your mmc boot partition.<br> | + | Just copy the zImage inside your boot partition, remember before that you must mount your mmc boot partition.<br> |
<pre>$ /home/jdoe/linux-omap-2.6> sudo cp arch/arm/boot/zImage /media/boot/ | <pre>$ /home/jdoe/linux-omap-2.6> sudo cp arch/arm/boot/zImage /media/boot/ | ||
− | </pre> | + | </pre> |
− | + | After that you can unmount the boot & rootfs partitions. | |
+ | Now we're ready for test our new microsd car<br> | ||
+ | <br> | ||
− | <br> | + | <br> |
− | <br> | + | <br> |
<br> | <br> |
Revision as of 18:54, 2 June 2011
Introduction
This how to explains how to boot IGEPv2 or IGEP Module using a microSD card.
Theory
OMAP35xx or DM37xx processors can 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 boot from a microSD card.
- 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 filesystem.
- All names used in this partition must be msdos names, it means you cannot use a extended names.
- The processor must load a first program called MLO, this program must reside in the first partition, this program it's also called x-loader.
The processor ONLY load and execute the MLO program and ignore all the rest.
Prerequisites
- PC 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 ...
Preparing the microSD card
Insert a new microsd card in your PC, you should see in your dmesg somthing like this after insert a new microsd card:
mmc0: new high speed SDHC card at address 0001 mmcblk0: mmc0:0001 00000 3.79 GiB mmcblk0: unknown partition table
Ensure all in your microsd card it's erased:
$ 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
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:
sudo apt-get install gparted
GParted
When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.
Create the MSDOS 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.
Check the default option it's create a msdos partition table after that you can apply.Create the BOOT Partition
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:
We will configure the partition as:- Primary Partition
- Format: FAT32
- Size: 100 MegaBytes
- Label: Boot
- Align to: cylinder
Create the ROOTFS Partition
The Next step it's create the root filesystem partition.
First you should select the unallocated partition area and then you should go to the partition menu and select the "New" option then the application show a window like this:We will configure the rootfs partition as:
- Primary Partition
- Format: EXT4
- Size: All the Rest
- Label: Rootfs
- Align to: cylinder
At end we will click on "Add" button.
Apply all Changes
Clink on Apply changes button in the main menu after that gparted show a window like this for confirm all operations
We should click on apply button. When the process finish we can see all changes appliedNow we can see all partitions and configurations done in the main gparted window
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
Now we have the microsd prepared for copy the boot filesBoot Partition Structure
We commented in the theory point the OMAP needs only the MLO (x-loader) file for boot, we will start checking this point.
Before you follow the next points you should mount the microsd boot partition in your host pc.
Select the boot partition and mount it in your host.
X-Loader (MLO)
You can follow this other howto about the IGEP-X-loader.
Copy the x-loader.bin.ift into the boot partition.
Rename the x-loader.bin.ift to MLO
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
Power UP the board.Configure the IGEP-X-Loader
You can use a file like this:
[kernel] ; Kernel load address, NOT Modify kaddress=0x80008000 ; RAM disk load Address, NOT Modify ;rdaddress=0x84000000 ; Board Serial ID serial.low=00000001 serial.high=00000000 ; Board Revision revision=0003 ; Kernel Image Name kImageName=zImage ; Kernel RAM Disk Image Name ;kRdImageName=initrd.img-2.6.35-1010-linaro-omap [kparams] ; Setup the Kernel console params console=ttyS2,115200n8 ; Enable early printk ;earlyprintk=serial,ttyS2,115200 ; Setup the Board Memory Configuration mem=430M ;mem=512M ; Setup the Boot Delay boot_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 variable nocompcache=1 ; Configure Frame Buffer Configuration ;omapfb.mode=dvi:1280x720MR-16@60 omapfb.mode=dvi:hd720-16@60 ; Configure Video Ram assigned vram=40M ; Configure Video RAM assigned to every frame buffer omapfb.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 Address smsc911x.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
Create a new file into the boot partition named igep.ini with these content and save the file.
Kernel & Rootfs
You can follow this other howto about how compile and install the Linux Kernel.
In our case we build the kernel sources from zero:
a) Clone the Kernel git repository $/home/jdoe/> git clone git://git.igep.es/pub/scm/linux-omap-2.6.git $/home/jdoe> cd linux-omap-2.6 b) Checkout your desired branch (we used for this howto 2.6.35.y) $/home/jdoe/linux-omap-2.6> git checkout origin/linux-2.6.35.y -b linux-2-6-35.y c) Configure the kernel $/home/jdoe/linux-omap-2.6> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- igep0020-defconfig d) Build the kernel and Modules $/home/jdoe/linux-omap-2.6> make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules
Notes: The kernel binary resides inside the directory: $/home/jdoe/linux-omap-2.6/arch/arm/boot/zImage
We will use the linaro headless image as rootfs but you can use your favorite rootfs also.
Create the Rootfs mount point
Go to /media directory and create one subfolder called "binary"
$ cd /media $ sudo mkdir binary
Mount the RootFS partition
Mount the rootfs partition using the 'binary' directory
$ media > sudo mount /dev/mmcblkp2 /media/binary
Untar the rootfs package
Copy "linaro-m-headless-tar-20101108-2.tar.gz" file inside the /media directory and untar the file
$ media > sudo tar xvfz linaro-m-headless-tar-20101108-2.tar.gz
Now you should see inside your rootfs partition a similar structure like this.
Install the kernel modules
Now you should install your kernel modules inside your root file system.
$ media > cd /home/jdoe/linux-omap-2.6 $ /home/jdoe/linux-omap-2.6> sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary
Install the kernel Image
Just copy the zImage inside your boot partition, remember before that you must mount your mmc boot partition.
$ /home/jdoe/linux-omap-2.6> sudo cp arch/arm/boot/zImage /media/boot/
After that you can unmount the boot & rootfs partitions.
Now we're ready for test our new microsd car