#!/usr/local/bin/expect -f # install_firmware.tcl - Expect script to install firmware on IP04 # # assumes /etc/minirc/.dfl on RS232 machine has 115200 as default baud rate #exp_internal 1 set rs232 dragonballz set send_slow {1 0.2} set timeout -1 # connect to machine with RS232 port spawn ssh $rs232 expect "$ " send "killall -9 minicom\r" expect "$ " send "minicom\r" expect "on special keys" # get u-boot prompt expect "Hit any key to stop autoboot" send "\r" expect "ip04>" # flash new kernel send -s "set autostart\r" expect "ip04>" send -s "set serverip 192.168.1.2\r" expect "ip04>" send -s "tftp 0x1000000 uImage.alex\r" expect "ip04>" send -s "nand erase clean\r" expect "ip04>" send -s "nand erase\r" expect "ip04>" send -s "nand write 0x1000000 0x0 0x4c0000\r" expect "ip04>" # set bootargs for /dev/mtdblock0 send -s "print bootargs\r" expect -re "(ethaddr=.*)\r" set ethaddr $expect_out(1,string) expect "ip04>" send -s "set bootargs root=/dev/mtdblock0 rw $ethaddr\r" expect "ip04>" # save and reboot into uClinux send -s "set autostart yes\r" expect "ip04>" send -s "save\r" expect "ip04>" send -s "reset\r" expect "root:~> " # set up yaffs, reboot back into u-boot send -s "chmod u+x bin/copy_rootfs.sh\r" expect "root:~> " send -s "chmod u+x bin/install_asterisk_native_sounds.sh\r" expect "root:~> " send -s "copy_rootfs.sh\r" expect "root:~> " send -s "reboot\r" # set yaffs as root fs, reboot into uClinux expect "Hit any key to stop autoboot" send "\r" expect "ip04>" send -s "set bootargs root=/dev/mtdblock2 rw $ethaddr\r" expect "ip04>" send -s "save\r" expect "ip04>" send -s "reset\r" expect "root:~> " # install native prompts send -s "install_asterisk_native_sounds.sh\r" expect "root:~> " send -s "ifconfig eth0 192.168.1.30\r" expect "root:~> " # todo - make host install scripts, and change IP...... # install conf files on target spawn bash expect "$ " send "./install_30.sh\r" expect "$ " close