SteveG posted:
Here is a script I use (many thanks and acknowledgements to the original authors). You may need to adapt it for your own SD card device and paths - please don't use it until you have checked these- it is capable of erasing a drive! I place this in my ltib directory and run it from there in a terminal.
-------------------------------------------------------------------------------------------
#! /bin/sh
################################################################################ # # Flashes the images produced by LTIB on a block device # # By RL (Adeneo Embedded http://www.adeneo-embedded.com/) # Adapted by Steve G
# # USAGE: # ./flash_ltib.sh # # WARNING: reformats and partitions the block device! Make sure you are using # the correct device node! # ################################################################################
####################################### # Constants (customizable) #######################################
LTIB_PATH=$(pwd)
echo "Path to LTIB: $LTIB_PATH"
####################################### # Check input parameters #######################################
# IMPORTANT: YOU MAY NEED TO CHANGE THIS TO MATCH YOUR OWN DEVICE !!!!!!!!!!! SDCARD_DEV=/dev/sdb
# Simplify the device to its minimal expression SDCARD_DEV="$(dirname $SDCARD_DEV)/$(basename $SDCARD_DEV)"
if [ -z $SDCARD_DEV ]; then echo "\ERROR: Must set the destination device\n" echo "Syntax: $0 [device]" echo "Example: $0 /dev/sdg\n" exit 1 fi
# Make sure we are not trying to write to the primary partition if [ $SDCARD_DEV = "/dev/sda" ]; then echo "\nERROR: Forbidden to write to /dev/sda\n" echo "Syntax: $0 [device]" echo "Example: $0 /dev/sdg\n" exit 1 fi
# Check that we are writing to a block device if [ ! -b $SDCARD_DEV ]; then echo "\nERROR: $SDCARD_DEV is not a block device\n" exit 1 fi
####################################### # Copy the bootloader #######################################
BOOTLOADER_IMG=$LTIB_PATH/rootfs/boot/u-boot.bin
echo "Path to BOOTLOADER: $BOOTLOADER_IMG"
echo "Copying u-boot..." sudo dd if=$BOOTLOADER_IMG of=$SDCARD_DEV bs=512 || exit 1 sync
####################################### # Copy the kernel #######################################
KERNEL_IMG=$LTIB_PATH/rootfs/boot/uImage
echo "Path to KERNEL: $KERNEL_IMG"
echo "Copying kernel..." sudo dd if=$KERNEL_IMG of=$SDCARD_DEV bs=512 seek=2048 || exit 1 sync
####################################### # Create Partition Table #######################################
# Unmount everyone sudo umount ${SDCARD_DEV}*
# Check if the device name is mmcblkX if echo "${SDCARD_DEV}" | grep -q mmcblk; then PART_NAME=${SDCARD_DEV}p1 else PART_NAME=${SDCARD_DEV}1 fi
SIZE=`sudo fdisk -l ${SDCARD_DEV} | grep Disk | awk '{print $5}'` CYLINDERS=`echo $SIZE/8225280 | bc`
if [ $CYLINDERS -eq 0 ]; then echo "\nERROR: 0 cylinders\n" exit 1 fi
echo "DISK SIZE - $SIZE bytes" echo "CYLINDERS - $CYLINDERS"
# Create a single ext3 partition while leaving space for U-Boot and kernel { echo 4,,,* } | sudo sfdisk -H 255 -S 63 -C $CYLINDERS ${SDCARD_DEV}
# Format the ext3 partition echo "Formatting partition $PART_NAME..." sudo mkfs.ext3 $PART_NAME -L linux_ltib || exit 1
####################################### # Write the root filesytem #######################################
#echo "Writing root filesystem..."
mkdir -p sdcard && \ sudo mount $PART_NAME sdcard && \ sudo cp -rpav $LTIB_PATH/rootfs/* sdcard && \ sudo cp directfbrc sdcard/etc && \ sudo umount sdcard rmdir sdcard
sync && sync
# end of script
-------------------------------------------------------------------------------------------
you need to create .sh file with a unique name for example enaud_sd_script.sh and paste the above inside and save.
then put that file in ltib directory and make sure your sd is sdb (sudo fdisk -l)
if so insert your sd to host pc and run: "sh enaud_sd_script.sh" this will copy u-boot.bin kernel and root filesystem from ltib/rootfs to your sd. then put your micro sd to the qsb and set the enviroment for example as SteveG posted like this:
setenv lvds 'video=mxcdi0fb:RGB666,XGA ldb'
setenv lcd 'video=mxcdi0fb:RGB24,SEIKO-WVGA' setenv vga 'video=mxcdi1fb:GBR24,VGA-XGA di1_primary tve' setenv hdmi 'video=mxcdi0fb:RGB24,1024x768M@60'
setenv bootcmd_obds 'ext2load mmc 0:1 0x70800000 /unit_tests/obds.bin; go 70800000' setenv bootargs_base 'setenv bootargs console=ttymxc0,115200 ${vga}' setenv bootargs_nfs 'setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp' setenv bootcmd_net 'run bootargs_base bootargs_nfs; tftpboot ${loadaddr} ${kernel}; bootm' setenv bootargs_mmc 'set bootargs ${bootargs} root=/dev/mmcblk0p1 rw rootwait'
setenv bootcmd_mmc 'run bootargs_base bootargs_nfs bootargs_mmc; mmc dev 0; mmc read ${loadaddr} 0x800 0x1800; bootm'
setenv bootcmd 'run bootcmd_mmc'
saveenv
this will let you enter as root to your file system.
hope it helps.