Posted to tcl by hirnpfirsich at Mon Jan 09 00:42:33 GMT 2023view raw

  1. hirnpfirsich@eima:~/ap_11_flashing$ cat flash-aruba-instant-on-11
  2. #!/usr/bin/expect -f
  3.  
  4. set FIRMWARE_FILE "openwrt-22.03.2-ipq40xx-generic-aruba_ap-303-squashfs-sysupgrade.bin"
  5.  
  6. lappend UBOOT_COMMANDS "setenv bootargs_openwrt \"setenv bootargs console=ttyMSM1,9600n8\""
  7. lappend UBOOT_COMMANDS "setenv nandboot_openwrt \"run bootargs_openwrt; ubi part aos1; ubi read 0x85000000 kernel; set fdt_high 0x87000000; bootm 0x85000000\""
  8. lappend UBOOT_COMMANDS "setenv ramboot_openwrt \"run bootargs_openwrt; setenv ipaddr 192.168.1.105; setenv serverip 192.168.1.75; netget; set fdt_high 0x87000000; bootm\""
  9. lappend UBOOT_COMMANDS "setenv bootcmd \"run nandboot_openwrt\""
  10. lappend UBOOT_COMMANDS "saveenv"
  11.  
  12. expect_before {
  13. timeout { puts "timeout"; exit 1 }
  14. #timeout { interact ~. exit 0 }
  15. }
  16.  
  17. # set the portID and open it for reading and writing
  18. set device [lindex $argv 0]
  19. set portID [open $device r+]
  20. set baud 9600
  21.  
  22. # Configure the port with the baud rate
  23. # and dont block on read, dont buffer output
  24. fconfigure $portID -mode "9600,n,8,1"
  25. fconfigure $portID -blocking 0 -buffering none
  26.  
  27. spawn -open $portID
  28. set serialID $spawn_id
  29.  
  30. # stop autobooting procedure
  31. expect "Hit <Enter> to stop autoboot"
  32. send "\r"
  33.  
  34. # configure uboot to be able to boot OpenWrt
  35. foreach command $UBOOT_COMMANDS {
  36. send -i $serialID "$command\r"
  37. expect -i $serialID "apboot>"
  38. }
  39.  
  40. [...]
  41. hirnpfirsich@eima:~/ap_11_flashing$ sudo ./flash-aruba-instant-on-11 /dev/ttyUSB0
  42. spawn [open ...]
  43.  
  44.  
  45. APBoot 2.5.0.2 (build 70487)
  46. Built: 2019-05-14 at 12:27:57
  47.  
  48. Model: AP11
  49. DRAM: 512 MiB
  50. Flash: Detected MX25R3235F: with write protection total 4 MiB
  51. NAND: 128 MiB
  52. Power: DC
  53. Net: eth0
  54. Radio: ipq4019#0, ipq4019#1
  55. FIPS: passed
  56.  
  57. Hit <Enter> to stop autoboot: 0
  58. apboot> setenv bootargs_openwrt "setenv bootargs console=ttyMSM1,9600n8"
  59. þÚÚڂíííííííííííííííííííííííííííí
  60.  
  61. ^Chirnpfirsich@eima:~/ap_11_flashing$

Comments

Posted by hirnpfirsich at Mon Jan 09 01:20:22 GMT 2023 [text] [code]

just printing them works fine hirnpfirsich@eima:~/ap_11_flashing$ sudo ./flash-aruba-instant-on-11 /dev/ttyUSB0 spawn [open ...] 0 apboot> APBoot 2.5.0.2 (build 70487) Built: 2019-05-14 at 12:27:57 Model: AP11 DRAM: 512 MiB Flash: Detected MX25R3235F: with write protection total 4 MiB NAND: 128 MiB Power: DC Net: eth0 Radio: ipq4019#0, ipq4019#1 FIPS: passed Hit <Enter> to stop autoboot: 2 Would send command: setenv bootargs_openwrt "setenv bootargs console=ttyMSM1,9600n8" Would send command: setenv nandboot_openwrt "run bootargs_openwrt; ubi part aos1; ubi read 0x85000000 kernel; set fdt_high 0x87000000; bootm 0x85000000" Would send command: setenv ramboot_openwrt "run bootargs_openwrt; setenv ipaddr 192.168.1.105; setenv serverip 192.168.1.75; netget; set fdt_high 0x87000000; bootm" Would send command: setenv bootcmd "run nandboot_openwrt" Would send command: saveenv