How to burn image to T-Flash on Linux.

92 views
Skip to first unread message

Jourge Sena

unread,
Mar 22, 2010, 12:42:38 PM3/22/10
to odroid developer discuss
Checked with Odroid image Release-2010_03_22.

Connect the T-Flash reader to your Linux PC.

Check the T-Flash's device name.
$ su
# ls -l /dev/disk/by-id
--------
lrwxrwxrwx 1 root root 9 2010-03-22 23:23
usb-SD_Card_Reader_and_so_on -> ../../sdx
--------
In this case, the T-Flash's device name is /dev/sdx

Check the T-Flash's total sector number.
# fdisk -l -u /dev/sdx
--------
Disk /dev/sdx: 1977 MB, 1977614336 bytes
61 heads, 62 sectors/track, 1021 cylinders, total 3862528 sectors
--------
In this case, the T-Flash's total sector number is 3862528

Calculate offset.
TFLASH_SECTORS = (T-Flash's total sector number)
OFFSET_BL1 = TFLASH_SECTORS - 18
OFFSET_BL2 = TFLASH_SECTORS - 1074
OFFSET_KERNEL = TFLASH_SECTORS - 9266

Now burn it.
# dd bs=512 seek=OFFSET_BL1 count=16 if=u-boot.bin of=/dev/sdx
# dd bs=512 seek=OFFSET_BL2 if=u-boot.bin of=/dev/sdx
# dd bs=512 seek=OFFSET_KERNEL if=zImage of=/dev/sdx
# dd bs=512 if=Odroid-eclair-2.1.r2-100322.img of=/dev/sdx

(in this case)
TFLASH_SECTORS = 3862528
OFFSET_BL1 = TFLASH_SECTORS - 18 = 3862510
OFFSET_BL2 = TFLASH_SECTORS - 1074 = 3861454
OFFSET_KERNEL = TFLASH_SECTORS - 9266 = 3853262
# dd bs=512 seek=3862510 count=16 if=u-boot.bin of=/dev/sdx
# dd bs=512 seek=3861454 if=u-boot.bin of=/dev/sdx
# dd bs=512 seek=3853262 if=zImage of=/dev/sdx
# dd bs=512 if=Odroid-eclair-2.1.r2-100322.img of=/dev/sdx

Baptiste

unread,
Mar 23, 2010, 9:40:04 PM3/23/10
to odroid developer discuss
1/ Can somebody put the content of this thread on the wiki, I am not
sure on which page it should go.
2/ I created a script with previous content

-------------
#!/bin/bash
# Customise this line
TFLASH="/dev/sdd"

#
TFLASH_SECTORS=`fdisk -l -u $TFLASH | grep sectors | head -n 1 | cut -
d',' -f4 | cut -d' ' -f3`

# Do calculation
OFFSET_BL1=$(($TFLASH_SECTORS-18))
OFFSET_BL2=$(($TFLASH_SECTORS-1074))
OFFSET_KERNEL=$(($TFLASH_SECTORS-9266))

# Ask for correct calculation
echo -n "NSectors: $TFLASH_SECTORS, Do you want to continue: "
read ANS

#Do job
if [ "$ANS" == "yes" ]; then
dd bs=512 seek=$OFFSET_BL1 count=16 if=u-boot.bin of=$TFLASH
dd bs=512 seek=$OFFSET_BL2 if=u-boot.bin of=$TFLASH
dd bs=512 seek=$OFFSET_KERNEL if=zImage of=$TFLASH
dd bs=512 if=Odroid-eclair-2.1.r2-100322.img of=$TFLASH
sync

fi
-------------

Jourge Sena

unread,
Mar 24, 2010, 12:29:53 PM3/24/10
to odroid developer discuss
Cool! Thanks!
I modified it a bit for convenience.

tfburner.sh
-------------
#!/bin/bash
LC_ALL="C"
TFLASH=$1
ROOTFS=$2
# Check args
if [ -z "$TFLASH" ] || [ -z "$ROOTFS" ]; then
echo "Usage: $0 T-Flash-device Odroid-img"
exit 1
fi
# Check TFlash Sectors


TFLASH_SECTORS=`fdisk -l -u $TFLASH | grep sectors | head -n 1 \

| cut -d',' -f4 | cut -d' ' -f3`


# Do calculation
OFFSET_BL1=$(($TFLASH_SECTORS-18))
OFFSET_BL2=$(($TFLASH_SECTORS-1074))
OFFSET_KERNEL=$(($TFLASH_SECTORS-9266))
# Ask for correct calculation

echo "T-Flash-device:$TFLASH Odroid-image:$ROOTFS"
echo -n "NSectors:$TFLASH_SECTORS, Do you want to continue(yes/no): "


read ANS
#Do job
if [ "$ANS" == "yes" ]; then
dd bs=512 seek=$OFFSET_BL1 count=16 if=u-boot.bin of=$TFLASH
dd bs=512 seek=$OFFSET_BL2 if=u-boot.bin of=$TFLASH
dd bs=512 seek=$OFFSET_KERNEL if=zImage of=$TFLASH

dd bs=512 if=$ROOTFS of=$TFLASH
sync
fi
-------------

Reply all
Reply to author
Forward
0 new messages