i.MX51 Flashing Linux Application Only with SD Card Reader

Document created by jesseg Employee on Aug 21, 2012Last modified by Jodi Paul on May 16, 2013
Version 3Show Document
  • View in full screen mode

It is often not easy to use company network to flash application, due to network security (proxy, etc...). We will see in this tutorial, how to flash a Linux application in a SD card with ONLY a SD card reader and simple standard Linux commands.


SD card Memory Map

A Linux application is divided in 3 parts:

  • the bootloader
  • the Linux Kernel
  • the Linux Rootfs

SD_Linux_app_memory_map.png

We will flash sequentially these 3 parts


Flashing U-boot

 

With the SD card Reader, we will flash the yellow part. In the [...]/ltib/rootfs/boot/ folder

 $ sudo dd if=u-boot.bin of=/dev/sdb bs=512 skip=2 seek=2 && sudo sync 


Flashing Linux Kernel

 

With the SD card reader, we will flash the green part. Keep in mind that 1MB=1048576B -> Kernel Offset.

 $ sudo dd if=uImage of=/dev/sdb bs=1048576 seek=1 && sudo sync 


Configure U-boot variables

 

To launch the Kernel, you need to configure U-boot.

  • Plug the serial cable on the EVK:

115kbps, 8 bits, 1 stop and no parity

  • EVK switches must be configured as below:

 

DS1 DS2 DS3 DS4 DS5 DS5 DS7 DS8 DS9 DS10
Boot from SD/MMC Card0000001100
  • Put the SD card in the EVK (bottom slot) and launch the app. In the hyperterminal type:

  BBG U-Boot > printenv

To print environnement variables

  • Modify the bootcmd:
 BBG U-Boot > setenv bootcmd_mmc 'run bootargs_base bootargs_mmc;mmc read 0 ${loadaddr} 0x800 0x1800;bootm' 

"0x1800" is the size of the kernel. Must be bigger than uImage Kernel file (0x1800x512Byte=3MB)

  • If you want to use the WVGA as display screen (kernel need to be configured with CLAA support), for LTIB1007 and after (before it was 'wvga' option):

Script for LTIB1007's u-boot on i.MX51 EVK (copy/paste in the hyperterminal):

setenv bootcmd_mmc 'run bootargs_base bootargs_mmc; mmc read 0 ${loadaddr} 800 1800 ; bootm' 
setenv bootargs_mmc 'setenv bootargs ${bootargs} root=/dev/mmcblk0p1 rootwait rw  init=/init' setenv bootargs_base'
setenv bootargs console=ttymxc0,115200 di1_primary console=tty1' 
setenv bootcmd 'run bootcmd_mmc' 
saveenv

Script for LTIB1007's u-boot on i.MX53 EVK (copy/paste in the hyperterminal):

setenv bootcmd_mmc 'run bootargs_base bootargs_mmc; mmc read 0 ${loadaddr} 800 1800 ; bootm'
setenv bootargs_mmc 'setenv bootargs ${bootargs} root=/dev/mmcblk0p1 rootwait rw  init=/init'
setenv bootargs_base 'setenv bootargs console=ttymxc0,115200 di0_primary console=tty1'
setenv bootcmd 'run bootcmd_mmc'
saveenv
  • You must have the following printenv:
BBG U-Boot > printenv 
bootdelay=3 
baudrate=115200 
loadaddr=0x90800000 
netdev=eth0 
ethprime=FEC0 
uboot_addr=0xa0000000 
uboot=u-boot.bin 
kernel=uImage 
bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serveri
p}:${nfsroot},v3,tcp
bootcmd_net=run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; boot
m
load_uboot=tftpboot ${loadaddr} ${uboot}
ethact=FEC0
bootargs=console=ttymxc0,115200 di1_primary root=/dev/mmcblk0p1 rootwait rw init
=/init
bootcmd_mmc=run bootargs_base bootargs_mmc; mmc read 0 ${loadaddr} 800 1800 ; bo
otm
bootargs_mmc=setenv bootargs ${bootargs} root=/dev/mmcblk0p1 rootwait rw init=/i
nit
bootargs_base=setenv bootargs console=ttymxc0,115200 di1_primary
bootcmd=run bootcmd_mmc
stdin=serial
stdout=serial
stderr=serial</br>

Environment size: 748/131068 bytes
BBG U-Boot >

Create ext3 partition

 

With the SD card reader, create an ext3 partition. You can use gparted, a graphical partition manager tool. Launch gparted:

 $ sudo gparted 

Create a new ext3 partition, with 20MB of offset:
Gparted_SD.png


Copying Linux

 

To copy rootfs folder generated by LTIB, type in the shell:

 $ sudo cp -r /[…]/ltib/rootfs/* /media/FreescaleSD/ && sudo sync 

 

Test application

 

Put the SD in the slot slot and launch the application. Password is root.
Linux_shell_password.png


Attachments

    Outcomes