3 # Firmware flasher creator for Pandora
4 # Copyright (c) 2010, GraÅžvydas Ignotas
14 rdfile_out="tmp/rd-ext2.bin"
15 uboot_script=${uboot_script:-"script.txt"}
17 boot_scr_tmp2=`mktemp`
18 boot_scr_tmp_scr=`mktemp`
20 zipfile="pandora_flasher_v.zip"
22 if test '!' '(' -d $rd_input -a -f ${sysf_in}x-load.bin.ift -a -f ${sysf_in}u-boot.bin \
23 -a -f ${sysf_in}uImage -a -f ${sysf_in}uImage_updater ')'
25 echo "missing input files"
29 rm -rf $out_dir $out_opt_dir
30 mkdir $out_dir 2>/dev/null && mkdir $out_opt_dir 2>/dev/null || true
34 cp ${sysf_in}x-load.bin.ift ${out_opt_dir}MLO
35 cp ${sysf_in}u-boot.bin_updater ${out_opt_dir}u-boot.bin
40 tar czvf $bootf u-boot.bin uImage
42 mv -f ${sysf_in}${bootf} ${out_dir}
46 dd if=/dev/zero of=$rdfile bs=1M count=8
48 sudo mount -o loop $rdfile /mnt/tmp
49 sudo cp -r $rd_input/* /mnt/tmp/
50 if [ -n "$more_rootfs_work" ]
55 cat $rdfile | gzip -9 > $rdfile_out
60 dd if=/dev/zero of=$boot_scr_tmp_scr bs=1 count=4020
61 dd if=/dev/zero of=$boot_scr_tmp bs=4K count=800
63 # 000000 - 000fff: u-boot header, the script
64 dd if=$uboot_script of=$boot_scr_tmp_scr conv=notrunc bs=1
65 # 001000 - 020fff: x-load
66 if [ "$no_xload" != "yes" ]
68 dd if=$rd_input/usr/local/erasednandblk of=$boot_scr_tmp conv=notrunc bs=4K
69 dd if=${sysf_in}x-load.bin.ift of=$boot_scr_tmp conv=notrunc bs=4K
71 # 021000 - 320fff: uImage
72 dd if=${sysf_in}uImage_updater of=$boot_scr_tmp conv=notrunc bs=4K seek=32
73 # 321000 - end: ramdisk
74 cat $boot_scr_tmp $rdfile_out > $boot_scr_tmp2
75 # adjust for u-boot header
76 $mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "script" \
77 -d $boot_scr_tmp_scr:$boot_scr_tmp2 ${out_dir}boot.scr
78 rm $boot_scr_tmp $boot_scr_tmp2 $boot_scr_tmp_scr
82 zip -9 $zipfile $bootf boot.scr
83 mv -f $zipfile ../tmp/