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