i.MX35 PDK Linux Booting SD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX35 PDK Linux Booting SD

i.MX35 PDK Linux Booting SD

Booting Linux Directly from SD/MMC Card

   

You can create a self-bootable SD or MMC card with Linux.

   

This tutorial describes how to create a complete Linux system (bootloader + Linux kernel + root file system) that boots from SD/MMC card.

   

This is very useful for people willing to demonstrate several Linux images that can be self-contained in SD/MMC cards.

Flashing RedBoot on MMC using ATK

   

To boot Linux from a SD card, the first thing to do is to program the bootloader to the card. For this, click on the link below:

   

I.MX35 PDK Board Flashing SDCard

Flashing RedBoot on MMC using DD

   

You can also use dd on any linux system to load redboot:

 

$ sudo dd if=./Desktop/mx35_3stack_redboot_mmc.bin of=/dev/sdd bs=512 skip=2 seek=2 

Configuring Kernel to Boot From SD/MMC

   

Creating a Linux bootable MMC/SD Card.

   

Execute LTIB:

 

$ ./ltib -c 

   

Choose configure the kernel:

 

[*] Configure the kernel 

   

Change image generation to NFS:

   

Target Image Generation

   

Options --->

   

(X) NFS only

   

Compile Linux kernel with built-in support to MMC/SD and ext3:

   

Follow that sequence:

   

Device Drivers --->

   

<*> MMC/SD card support --->

   

<*> UniFi SDIO glue for Freescale MMC/SDIO

   

<*> Freescale i.MX Secure Digital Host Controller Interface support

 

   

File systems --->

   

<*> Ext3 journalling file system support

   

After the compilation copy the file ~/ltib/rootfs/boot/zImage to tftpboot directory:

 

$ cp ~/ltib/rootfs/boot/zImage /tftpboot 

Creating RedBoot Kernel Partition

   

Create RedBoot partitions and copy Linux kernel to it:

   

Turn MMC active:

 

RedBoot> factive MMC 

   

Initialize flash partitions:

 

RedBoot> fis init 

 

   

RedBoot> fis list

   

... Read from 0x07ee0000-0x07eff000 at 0x00060000: .

   

Name FLASH addr Mem addr Length Entry point

   

RedBoot 0x00000000 0x00000000 0x00040000 0x00000000

   

FIS directory 0x00060000 0x00060000 0x0001F000 0x00000000

   

RedBoot config 0x0007F000 0x0007F000 0x00001000 0x00000000

   

Load kernel to RAM:

 

RedBoot> load -r -b 0x100000 /tftpboot/zImage

   

Using default protocol (TFTP)

   

Raw file loaded 0x00100000-0x002c31b7, assumed entry at 0x00100000

   

Create a kernel partition with content of kernel image loaded to RAM:

 

   

RedBoot> fis create -f 0x200000 kernel

   

   

RedBoot> fis list

   

... Read from 0x07ee0000-0x07eff000 at 0x00060000: .

   

Name FLASH addr Mem addr Length Entry point

   

RedBoot 0x00000000 0x00000000 0x00040000 0x00000000

   

FIS directory 0x00060000 0x00060000 0x0001F000 0x00000000

   

RedBoot config 0x0007F000 0x0007F000 0x00001000 0x00000000

   

kernel 0x00200000 0x00100000 0x001E0000 0x00100000

   

If you reset your board you need to see:

 

Booting from [SD card, CSD Version 1.0] 

   

If instead you see this message:

 

Booting from [unknown version card ] 

   

This means your card is not support, please replace it with other card.

Creating the Root File System

   

After storing the kernel image in the SD card, remove the card from the target board and insert it in your computer (running Linux).

   

In this example, Linux detected the SD card as /dev/sdb.

   

Now we need to create two partitions. The first partition will not be used, this is just reserved to RedBoot and kernel. The second partition will be used to store Linux Root File System.

 

# fdisk /dev/sdb

   

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

   

Building a new DOS disklabel with disk identifier 0x526c22da.

   

Changes will remain in memory only, until you decide to write them.

   

After that, of course, the previous content won't be recoverable.

   

   

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

   

   

Command (m for help): p

   

   

Disk /dev/sdb: 1023 MB, 1023934464 bytes

   

32 heads, 62 sectors/track, 1008 cylinders

   

Units = cylinders of 1984 * 512 = 1015808 bytes

   

Disk identifier: 0x526c22da

   

   

  Device Boot Start End Blocks Id System

   

Create the first partition with 8 MB; it already contains RedBoot and the kernel, as we stored previously:

       

   

Command (m for help): n

   

Command action

   

  e extended

   

  p primary partition (1-4)

   

p

   

Partition number (1-4): 1

   

First cylinder (1-1008, default 1):

   

Using default value 1

   

Last cylinder, +cylinders or +size{K,M,G} (1-1008, default 1008): +8M

   

Now, create the second partition using all remaining space on SD card:

 

   

Command (m for help): n

   

Command action

   

  e extended

   

  p primary partition (1-4)

   

p

   

Partition number (1-4): 2

   

First cylinder (10-1008, default 10):

   

Using default value 10

   

Last cylinder, +cylinders or +size{K,M,G} (10-1008, default 1008):

   

Using default value 1008

   

   

Command (m for help): p

   

   

Disk /dev/sdb: 1023 MB, 1023934464 bytes

   

32 heads, 62 sectors/track, 1008 cylinders

   

Units = cylinders of 1984 * 512 = 1015808 bytes

   

Disk identifier: 0x526c22da

   

Device Boot Start End Blocks Id System

   

/dev/sdb1 1 9 8897 83 Linux

   

/dev/sdb2 10 1008 991008 83 Linux

   

   

Command (m for help): w

 

Now format the second partition as EXT3:

# mkfs.ext3 /dev/sdb2 

 

Remove the SD card from your computer and insert again. Probably your Linux distribution will dectect it and will mount automatically.

 

On Ubuntu 8.10 it was mounted on /dev/media:

 

# mount

 

...

 

/dev/sdb2 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)


If your Linux didn't mount it, then you can mount it manually:

 

# mkdir -p /media/disk

 

# mount /dev/sdb2 -t ext3 /media/disk

 

Enter in your LTIB directory and copy the rootfs content to SD card:

 

# cd /home/alan/ltib-imx35/rootfs/

 

# cp -a * /media/disk/

 

Verify if it was copied correctly:

 

# ls -l /media/disk/

 

total 80

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:55 bin

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:53 boot

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:55 dev

 

drwxr-xr-x 6 root root 4096 2009-03-12 14:41 etc

 

drwxr-xr-x 3 root root 4096 2009-03-12 09:53 home

 

drwxr-xr-x 4 root root 4096 2009-03-12 09:55 lib

 

lrwxrwxrwx 1 root root 11 2009-03-12 14:47 linuxrc -> bin/busybox

 

drwx------ 2 root root 16384 2009-03-12 14:37 lost+found

 

drwxr-xr-x 7 root root 4096 2009-03-12 09:53 mnt

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:53 opt

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:53 proc

 

drwxr-xr-x 2 root root 4096 2009-03-12 10:10 root

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:55 sbin

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:53 sys

 

drwxrwxrwt 3 root root 4096 2009-03-12 09:53 tmp

 

drwxr-xr-x 2 root root 4096 2009-03-12 09:55 unit_tests

 

drwxr-xr-x 9 root root 4096 2009-03-12 09:55 usr

 

drwxr-xr-x 11 root root 4096 2009-03-12 09:55 var

 

root@urubu:~/ltib-imx25/rootfs#

   

Now umount the SD card:

 

# umount /media/disk 

Configuring RedBoot to Load Kernel and Rootfs from SD/MMC Card

   

Remove the SD card from your computer and place again in the board.

   

Configure RedBoot to load the kernel from SD/MMC card and set up the kernel command parameter "root" to load the root file system from second SD/MMC card partition (/dev/mmcblk0p2)

   

RedBoot> fc

   

Run script at boot: true

   

Boot script:

   

Enter script, terminate with empty line

   

>> fis load kernel

   

>> exec -b 0x100000 -l 0x200000 -c "noinitrd console=ttymxc0,115200 root=/dev/mmcblk0p2 init=/linuxrc ip=none"

   

>>

   

Boot script timeout (1000ms resolution): 1

   

Use BOOTP for network configuration: false

   

Gateway IP address: 10.29.244.254

   

Local IP address: 10.29.244.135

   

Local IP address mask: 255.255.0.0

   

Default server IP address: 10.29.240.182

   

Board specifics: 0

   

Console baud rate: 115200

   

Set eth0 network hardware address [MAC]: false

   

Set FEC network hardware address [MAC]: false

   

GDB connection port: 9000

   

Force console for special debug messages: false

   

Network debug at boot time: false

   

Default network device: lan92xx_eth0

   

Update RedBoot non-volatile configuration - continue (y/n)? y

   

... Read from 0x07ee0000-0x07eff000 at 0x00060000: .

   

... Erase from 0x00060000-0x00080000: .

   

... Program from 0x07ee0000-0x07f00000 at 0x00060000: .

 

   

Now just reset the board and it will boot directly from SD/MMC card.

Labels (1)
Tags (2)
No ratings
Version history
Last update:
‎09-10-2020 03:11 AM
Updated by: