Joshoa,
Ok, then I used your latest image (downloaded might be like 7 hours ago) by following link you provided to older livecd image. I've studied it a little bit -- as far as I can see you have set t*f*t*p server with couple kernels, nfs (/var/umec/code).
All in all not too bad but I came across a problem quite soon. I've attempted to configure NIC alias and system did not allow me to do it - my guess is that probably if IP address assigned statically it does not work. I had to issue
ifconfig eth0 down
dhclient eth0 -- to obtain local IP address from my DHCP server
ifconfig eth0:0 10.73.61.100 netmask 255.0.0.0 up
route add -net 10.73.61.0 netmask 255.0.0.0 dev eth0:0
And here I stumble on other problem -- I was running it in VMWare player/virtual machine and could not get ping to the phone. I decided to move on my linux machine and not waste time to figure out why it does not work in VM as I wanted to test something very quickly
Ok, now about my little test -- how to get into RedBoot without any pain. I know that you already made some improvement on this front but as you wrote yourself it does not work everytime.
Well, what would you say if there is a better way? Which works much more reliable? And what if we can achieve even more automation with this quite useful tool?
What would you expect from "expect"?
Ok, I must admit that I knew about this tool for "ages" but I must confess that I never tried it. Recently I visited some my friend and I mentioned "RedBoot" access problem, after I said that I've attempted to use "Perl" to get into "RedBoot" through Network Sockets and it did not worked as I would expect (I've spent some time trying to figure out why I do not get expected results -- even "WireShark" network snooping on network packets indicates that it should work).
I must admit that I was intrigued with your sequence of "\0377\0364\0377\0375\0006" and was close to contact you about it but "Google" gave the answer quite quick. And through "Google" I got even more than what I was asking for -- several ways to get into "RedBoot" and one of them was through "expect".
To my surprise it works really very well -- unfortunately you have to "rebuild" your "livecd" once more to add this tool. It is quite easy to add "expect" into installed system with one command as "root"
root# apt-get install expect
The command above will install extra package "TCL" Version 8.5 which is required for "expect" as it written in TCL (Tool Command Language).
So bellow is the magic script to get into "RedBoot"
Code:
#!/usr/bin/expect
# expect script to connect to the Iris 3000 RedBoot loader.
# set the IP address and the port for the loader.
set target "10.73.61.201"
set port 9000
# 1. Start ping and wait for a response.
# 2. When RedBoot is alive, start the telnet session.
# 3. Allow .5 seconds after the connect for telnet
# to get his act in order.
# 4. Send the ^C and wait for the RedBoot prompt.
# 5. Get the version information.
# 6. Return control to the user.
spawn ping $target
set timeout -1
expect {
-re "time=.*$" close
}
spawn telnet $target $port
expect -re "Escape character is.*$" {
sleep .5
send \003
expect "RedBoot>" {
send "version\r"
}
}
interact
I must admit that this script is nothing that "borrowed" and "altered" with our IP and port numbers.
With a little alternation this script can "reflash the kernel" or we can modify it to give us most critical information about the phone "MTD" or "SDA", version, settings -- or automatically change default IP address and many many other things can be done with "expect".
Code:
#!/usr/bin/expect
set target "10.73.61.201"
set port 9000
spawn ping $target
set timeout -1
expect {
-re "time=.*$" close
}
spawn telnet $target $port
expect -re "Escape character is.*$" {
sleep .5
send \003
expect "RedBoot>" {
send "load -h 10.73.61.100 -r -b 0x100000 umec-kernel\r"
send "fis delete kernel\r"
send "fis create kernel\r"
send "exec -b 0x100000 -l 0x200000 -c 'noinitrd console=ttymxc0,115200 ip=dhcp root=/dev/nfs rw'\r"
}
}
Or for example to get configuration
Code:
#!/usr/bin/expect
set target "10.73.61.201"
set port 9000
spawn ping $target
set timeout -1
expect {
-re "time=.*$" close
}
spawn telnet $target $port
expect -re "Escape character is.*$" {
sleep .5
send \003
expect "RedBoot>" {
send "fconfig -l\r"
}
}
And one more note in regard of "fconfig -l" output -- "Default server IP address: 10.73.61.56". I guess that some commands can use this IP by default (I did not try "load" command). So it might have sense to change from 10.73.61.100 to 10.73.61.56. I am not sure but it has "Gateway IP address: 10.0.0.81" which was assigned for some reason and it might be significant as well.
Code:
RedBoot> fconfig -l
Run script at boot: true
Boot script:
.. fis load kernel
.. exec -w 1 -b 0x100000 -l 0x200000 -c "noinitrd console=ttymxc0,115200 root=/dev/mtdblock4 rootfstype=jffs2 init=linuxrc ip=none fec_mac=00:04:9f:00:82:4c video=mxcfb:TV-NTSC"
Boot script timeout (1000ms resolution): 1
Use BOOTP for network configuration: false
Gateway IP address: 10.0.0.81
Local IP address: 10.73.61.201
Local IP address mask: 255.0.0.0
Default server IP address: 10.73.61.56
Board specifics: 0
Console baud rate: 115200
Set eth0 network hardware address [MAC]: false
Set FEC network hardware address [MAC]: false
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Default network device: mxc_fec
RedBoot>
So, now with "expect" we can not only get into "RedBoot" automatically. We can get into "RedBoot" load "kernel" over network, replace "kernel" in flash/load into memory and pass control to loaded kernel with one command.
Generally we can through "expect" script, change any parameter as we would do manually through "telnet".
NOTE: "fconfig -l" output has "GDB connection port: 9000" -- somehow I missed it before.
GNU debugger could give us access into debugging mode of "RedBoot" over network if such need would arise.
It is even possible to replace "RedBoot" with our own (a little risky as if we do something incorrectly then only JTAG will be a way to fix the problem).
http://ecos.sourceware.org/redboot/
Iris 3000