Flashing an SD Card from scratch takes many steps and can be error-prone. The attached script will partition, format an SD Card, then write the files generated by LTIB in one single line.
It copies the bootloader, the kernel, then creates an ext3 partition where the root filesystem is copied.
32MB are reserved for the bootloader and the kernel. The rest of the SD Card is allocated for the ext3 partition.
Usage:
# export LTIB_PATH=~/training_mx53/linux/ltib (only needs to be done once in your current shell)
# ./flash_ltib.sh [SD Card block device]
The first command tells the script where the root directory of LTIB is located
You will be prompted for super-user rights (so you do not need to call the script with sudo)
Example:
# export LTIB_PATH=~/training_mx53/linux/ltib
# ./flash_ltib.sh /dev/sdb
Target setup:
To boot from the SD Card, you can set the following environment variables in U-Boot:
U-Boot> setenv bootargs_mmc 'setenv bootargs ${bootargs} console=tty1 root=/dev/mmcblk0p1 rootwait rw'
U-Boot> setenv loadk 'mmc read 0 ${loadaddr} 0x800 0x1800'
U-Boot> setenv bootcmd_mmc 'run bootargs_base bootargs_mmc; run loadk; bootm'
U-Boot> setenv bootcmd 'run bootcmd_mmc'
If you want the board to boot on the SD Card by default, you can save the environment using:
U-Boot> saveenv
Caution:
This script will repartition and reformat the block device. Make sure you are supplying the right parameter!
Note:
The script uses the unstripped version of the root filesystem.
Original Attachment has been moved to: 777-flash_ltib.sh