3 # Firmware flasher creator for Pandora
4 # Copyright (c) 2010, GraÅžvydas Ignotas
14 rdfile_out="tmp/rd-ext2.bin"
16 boot_scr_tmp2=`mktemp`
17 boot_scr_tmp_scr=`mktemp`
19 zipfile="pandora_flasher_v.zip"
21 if test '!' '(' -d $rd_input -a -f ${sysf_in}x-load.bin.ift -a -f ${sysf_in}u-boot.bin \
22 -a -f ${sysf_in}uImage -a -f ${sysf_in}uImage_updater ')'
24 echo "missing input files"
28 rm -rf $out_dir $out_opt_dir
29 mkdir $out_dir 2>/dev/null && mkdir $out_opt_dir 2>/dev/null || true
33 cp ${sysf_in}x-load.bin.ift ${out_opt_dir}MLO
34 cp ${sysf_in}u-boot.bin_updater ${out_opt_dir}u-boot.bin
39 tar czvf $bootf u-boot.bin uImage
41 mv -f ${sysf_in}${bootf} ${out_dir}
45 dd if=/dev/zero of=$rdfile bs=1M count=8
47 sudo mount -o loop $rdfile /mnt/tmp
48 sudo cp -r $rd_input/* /mnt/tmp/
50 cat $rdfile | gzip -9 > $rdfile_out
55 dd if=/dev/zero of=$boot_scr_tmp_scr bs=1 count=4020
56 dd if=/dev/zero of=$boot_scr_tmp bs=4K count=800
58 # 000000 - 000fff: u-boot header, the script
59 dd if=script.txt of=$boot_scr_tmp_scr conv=notrunc bs=1
60 # 001000 - 020fff: x-load
61 dd if=$rd_input/usr/local/erasednandblk of=$boot_scr_tmp conv=notrunc bs=4K
62 dd if=${sysf_in}x-load.bin.ift of=$boot_scr_tmp conv=notrunc bs=4K
63 # 021000 - 320fff: uImage
64 dd if=${sysf_in}uImage_updater of=$boot_scr_tmp conv=notrunc bs=4K seek=32
65 # 321000 - end: ramdisk
66 cat $boot_scr_tmp $rdfile_out > $boot_scr_tmp2
67 # adjust for u-boot header
68 $mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "script" \
69 -d $boot_scr_tmp_scr:$boot_scr_tmp2 ${out_dir}boot.scr
70 rm $boot_scr_tmp $boot_scr_tmp2 $boot_scr_tmp_scr
74 zip -9 $zipfile $bootf boot.scr
75 mv -f $zipfile ../tmp/