├── README.md
├── qemustart.sh
├── rootfs
└── README.md
├── rootfs_pic.png
├── runvm_pic.png
└── script
├── CPDFLAG
├── armelcfg.sh
├── armhfcfg.sh
├── ch2vm.sh
├── cpf2vm.sh
├── main.sh
├── mips64cfg.sh
├── mips64elcfg.sh
├── mipscfg.sh
└── mipselcfg.sh
/README.md:
--------------------------------------------------------------------------------
1 | # qemustart
2 | One command to boot the QEMU system
3 |
4 | # Getting Started
5 |
6 | These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
7 |
8 | ## Prerequisites:
9 |
10 | You need to have Ubuntu16 running in your computer, please install them in the download page.
11 |
12 | ## Installing all requisites:
13 |
14 | To install all commands in Ubuntu 16.04
15 |
16 | ```
17 | > sudo apt-get update
18 | > sudo apt-get install net-tools
19 | > sudo apt-get install qemu-system-mips
20 | > sudo apt-get install qemu-system-arm
21 | > sudo apt-get install qemu-user-static
22 | > sudo apt-get install qemu-utils
23 | > sudo apt-get install expect
24 | > sudo apt-get install uml-utilities
25 | > sudo apt-get install gnome-terminal
26 | ```
27 |
28 | # Usage
29 |
30 | To run the script, you need to copy the equipment file system to the rootfs folder, like flowing picture:
31 |
32 |
33 |

34 |
35 |
36 | # Examples
37 |
38 | Here are some commands to see how the tool works.
39 |
40 | ```
41 | > qemustart.sh armel squeeze
42 |
43 | > qemustart.sh armel wheezy
44 |
45 | > qemustart.sh armhf wheezy
46 |
47 | > qemustart.sh mips squeeze 32
48 |
49 | > qemustart.sh mips squeeze 64
50 |
51 | > qemustart.sh mips wheezy 32
52 |
53 | > qemustart.sh mips wheezy 64
54 |
55 | > qemustart.sh mipsel squeeze 32
56 |
57 | > qemustart.sh mipsel squeeze 64
58 |
59 | > qemustart.sh mipsel wheezy 32
60 |
61 | > qemustart.sh mipsel wheezy 64
62 | ```
63 |
64 |
65 |

66 |
67 |
68 | The ip adress of virtual machine is 192.168.3.2
69 |
70 | # Others
71 |
72 | If you want to distinguish the structure of the device, you can use these commands:
73 |
74 | ```
75 | > file ./rootfs/bin/busybox
76 |
77 | > checksec ./rootfs/bin/busybox
78 | ```
79 |
80 | # Authors
81 |
82 | By my friends and richard. Hope you enjoy it.
83 |
--------------------------------------------------------------------------------
/qemustart.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/sudo bash
2 |
3 | ./script/main.sh $1 $2 $3
4 |
--------------------------------------------------------------------------------
/rootfs/README.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/rootfs_pic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LittleRx/qemustart/bd569558e46e2a637e6c8de65d8db585008d015d/rootfs_pic.png
--------------------------------------------------------------------------------
/runvm_pic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LittleRx/qemustart/bd569558e46e2a637e6c8de65d8db585008d015d/runvm_pic.png
--------------------------------------------------------------------------------
/script/CPDFLAG:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/script/armelcfg.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/expect
2 |
3 |
4 | set structure [lindex $argv 0]
5 | set RUNTIME_BOARDB [lindex $argv 1]
6 | set RUNTIME_KERNEL [lindex $argv 2]
7 | set RUNTIME_INITRD [lindex $argv 3]
8 | set RUNTIME_FQCOW2 [lindex $argv 4]
9 | set RUNTIME_COMAND [lindex $argv 5]
10 |
11 | set timeout -1
12 |
13 | spawn qemu-system-arm -M $RUNTIME_BOARDB -kernel ./$structure/$RUNTIME_KERNEL -initrd ./$structure/$RUNTIME_INITRD -hda ./$structure/$RUNTIME_FQCOW2 -append root=/dev/sda1 -net nic -net tap,ifname=tap0,script=no,downscript=no -nographic
14 |
15 | expect {
16 | login { send "root\n"}
17 | }
18 | expect {
19 | Password { send "root\n"}
20 | }
21 | expect {
22 | root@ { send "ifconfig eth0 192.168.3.2/24\n"}
23 | }
24 | expect {
25 | root@ { send "sleep 3\n"}
26 | }
27 | expect {
28 | root@ { send "./ch2vm.sh\n"}
29 | }
30 |
31 |
32 | interact
33 |
34 |
--------------------------------------------------------------------------------
/script/armhfcfg.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/expect
2 |
3 |
4 | set structure [lindex $argv 0]
5 | set RUNTIME_BOARDB [lindex $argv 1]
6 | set RUNTIME_KERNEL [lindex $argv 2]
7 | set RUNTIME_INITRD [lindex $argv 3]
8 | set RUNTIME_FQCOW2 [lindex $argv 4]
9 | set RUNTIME_COMAND [lindex $argv 5]
10 |
11 | set timeout -1
12 |
13 | spawn qemu-system-arm -M $RUNTIME_BOARDB -kernel ./$structure/$RUNTIME_KERNEL -initrd ./$structure/$RUNTIME_INITRD -drive if=sd,file=./$structure/$RUNTIME_FQCOW2 -append root=/dev/mmcblk0p2 -net nic -net tap,ifname=tap0,script=no,downscript=no -nographic
14 |
15 | expect {
16 | login { send "root\n"}
17 | }
18 | expect {
19 | Password { send "root\n"}
20 | }
21 | expect {
22 | root@ { send "ifconfig eth0 192.168.3.2/24\n"}
23 | }
24 | expect {
25 | root@ { send "sleep 3\n"}
26 | }
27 | expect {
28 | root@ { send "./ch2vm.sh\n"}
29 | }
30 |
31 | interact
32 |
33 |
--------------------------------------------------------------------------------
/script/ch2vm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "Wait for the file divert...."
4 |
5 | while [ ! -e ./CPDFLAG ]; do
6 | sleep 1
7 | done
8 |
9 | echo "Welcome to the future..."
10 |
11 | if [ ! -d ./rootfs/dev ];then
12 | mkdir ./rootfs/dev
13 | fi
14 |
15 | if [ ! -d ./rootfs/proc ];then
16 | mkdir ./rootfs/proc
17 | fi
18 |
19 | mount -o bind /dev ./rootfs/dev
20 |
21 | mount -t proc /proc ./rootfs/proc/
22 |
23 | chroot ./rootfs/ sh
24 |
--------------------------------------------------------------------------------
/script/cpf2vm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | count=0
3 | while :
4 | do
5 | ((count++))
6 | dot=''
7 | for ((i=0;i<$count%4;i++))
8 | do
9 | dot=".$dot"
10 | done
11 | echo -e "Wait for virtual machine $dot \r\c"
12 | ping -c 1 192.168.3.2 >/dev/null 2>&1
13 | if [[ $? == 0 ]];then
14 | break
15 | fi
16 | done
17 |
18 | ssh-keygen -R 192.168.3.2
19 |
20 | scp_autoch()
21 | {
22 | /usr/bin/expect<<-EOF
23 | set timeout 30
24 | spawn scp ./script/ch2vm.sh root@192.168.3.2:/root/
25 | expect {
26 | (yes/no) { send "yes\n"}
27 | }
28 | expect {
29 | password { send "root\n"}
30 | }
31 | expect eof
32 | EOF
33 | }
34 |
35 |
36 | scp_rootfs()
37 | {
38 | /usr/bin/expect<<-EOF
39 | set timeout 300
40 | spawn scp -r ./rootfs root@192.168.3.2:/root/
41 | expect {
42 | password { send "root\n"}
43 | }
44 | expect eof
45 | EOF
46 | }
47 |
48 | scp_cpdflag()
49 | {
50 | /usr/bin/expect<<-EOF
51 | set timeout 300
52 | spawn scp -r ./script/CPDFLAG root@192.168.3.2:/root/
53 | expect {
54 | password { send "root\n"}
55 | }
56 | expect eof
57 | EOF
58 | }
59 |
60 |
61 | scp_autoch
62 |
63 | scp_rootfs
64 |
65 | scp_cpdflag
66 |
67 | echo "Transfer File Finished"
68 | echo "quiting..."
69 | sleep 5
70 |
71 |
72 |
--------------------------------------------------------------------------------
/script/main.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/sudo bash
2 |
3 | # armel online resource
4 | armel_squeeze_qcow2="https://people.debian.org/~aurel32/qemu/armel/debian_squeeze_armel_standard.qcow2"
5 | armel_initrd_2_6="https://people.debian.org/~aurel32/qemu/armel/initrd.img-2.6.32-5-versatile"
6 | armel_kernel_2_6="https://people.debian.org/~aurel32/qemu/armel/vmlinuz-2.6.32-5-versatile"
7 | armel_wheezy_qcow2="https://people.debian.org/~aurel32/qemu/armel/debian_wheezy_armel_standard.qcow2"
8 | armel_initrd_3_2="https://people.debian.org/~aurel32/qemu/armel/initrd.img-3.2.0-4-versatile"
9 | armel_kernel_3_2="https://people.debian.org/~aurel32/qemu/armel/vmlinuz-3.2.0-4-versatile"
10 |
11 | # armhf online resource
12 | armhf_wheezy_qcow2="https://people.debian.org/~aurel32/qemu/armhf/debian_wheezy_armhf_standard.qcow2"
13 | armhf_initrd_3_2="https://people.debian.org/~aurel32/qemu/armhf/initrd.img-3.2.0-4-vexpress"
14 | armhf_kernel_3_2="https://people.debian.org/~aurel32/qemu/armhf/vmlinuz-3.2.0-4-vexpress"
15 |
16 | # mips online resource
17 | mips_squeeze_qcow2="https://people.debian.org/~aurel32/qemu/mips/debian_squeeze_mips_standard.qcow2"
18 | mips_wheezy_qcow2="https://people.debian.org/~aurel32/qemu/mips/debian_wheezy_mips_standard.qcow2"
19 | mips_kernel_2_6_4kc="https://people.debian.org/~aurel32/qemu/mips/vmlinux-2.6.32-5-4kc-malta"
20 | mips_kernel_2_6_5kc="https://people.debian.org/~aurel32/qemu/mips/vmlinux-2.6.32-5-5kc-malta"
21 | mips_kernel_3_2_4kc="https://people.debian.org/~aurel32/qemu/mips/vmlinux-3.2.0-4-4kc-malta"
22 | mips_kernel_3_2_5kc="https://people.debian.org/~aurel32/qemu/mips/vmlinux-3.2.0-4-5kc-malta"
23 |
24 | # mipsel online resource
25 | mipsel_squeeze_qcow2="https://people.debian.org/~aurel32/qemu/mipsel/debian_squeeze_mipsel_standard.qcow2"
26 | mipsel_wheezy_qcow2="https://people.debian.org/~aurel32/qemu/mipsel/debian_wheezy_mipsel_standard.qcow2"
27 | mipsel_kernel_2_6_4kc="https://people.debian.org/~aurel32/qemu/mipsel/vmlinux-2.6.32-5-4kc-malta"
28 | mipsel_kernel_2_6_5kc="https://people.debian.org/~aurel32/qemu/mipsel/vmlinux-2.6.32-5-5kc-malta"
29 | mipsel_kernel_3_2_4kc="https://people.debian.org/~aurel32/qemu/mipsel/vmlinux-3.2.0-4-4kc-malta"
30 | mipsel_kernel_3_2_5kc="https://people.debian.org/~aurel32/qemu/mipsel/vmlinux-3.2.0-4-5kc-malta"
31 |
32 | RUNTIME_FQCOW2=""
33 | RUNTIME_KERNEL=""
34 | RUNTIME_INITRD=""
35 | RUNTIME_BOARDB=""
36 | RUNTIME_COMAND=""
37 |
38 | function help(){
39 | echo "Usage: qemustart.sh structure[armel|armhf|mipsel|mips] version[squeeze|wheezy] bit[32|64]"
40 | echo "For example: qemustart.sh armel squeeze"
41 | echo " qemustart.sh armel wheezy"
42 | echo " qemustart.sh armhf wheezy"
43 | echo " qemustart.sh mips squeeze 32"
44 | echo " qemustart.sh mips squeeze 64"
45 | echo " qemustart.sh mips wheezy 32"
46 | echo " qemustart.sh mips wheezy 64"
47 | echo " qemustart.sh mipsel squeeze 32"
48 | echo " qemustart.sh mipsel squeeze 64"
49 | echo " qemustart.sh mipsel wheezy 32"
50 | echo " qemustart.sh mipsel wheezy 64"
51 | }
52 |
53 | structure=$1
54 | version=$2
55 | bit=$3
56 |
57 | case $structure in
58 | "armel")
59 | if [[ "$version" == "squeeze" ]]
60 | then
61 | RUNTIME_COMAND="qemu-system-arm"
62 | RUNTIME_KERNEL=$armel_kernel_2_6
63 | RUNTIME_INITRD=$armel_initrd_2_6
64 | RUNTIME_FQCOW2=$armel_squeeze_qcow2
65 | RUNTIME_BOARDB="versatilepb"
66 | elif [[ "$version" == "wheezy" ]]
67 | then
68 | RUNTIME_COMAND="qemu-system-arm"
69 | RUNTIME_KERNEL=$armel_kernel_3_2
70 | RUNTIME_INITRD=$armel_initrd_3_2
71 | RUNTIME_FQCOW2=$armel_wheezy_qcow2
72 | RUNTIME_BOARDB="versatilepb"
73 | else
74 | help;
75 | exit;
76 | fi
77 | ;;
78 | "armhf")
79 | RUNTIME_COMAND="qemu-system-arm"
80 | RUNTIME_KERNEL=$armhf_kernel_3_2
81 | RUNTIME_INITRD=$armhf_initrd_3_2
82 | RUNTIME_FQCOW2=$armhf_wheezy_qcow2
83 | RUNTIME_BOARDB="vexpress-a9"
84 | ;;
85 | "mips")
86 | if [[ "$version" == "squeeze" ]]
87 | then
88 | if [[ "$bit" == "32" ]]
89 | then
90 | RUNTIME_COMAND="qemu-system-mips"
91 | RUNTIME_KERNEL=$mips_kernel_2_6_4kc
92 | RUNTIME_FQCOW2=$mips_squeeze_qcow2
93 | RUNTIME_BOARDB="malta"
94 | elif [[ "$bit" == "64" ]]
95 | then
96 | RUNTIME_COMAND="qemu-system-mips64"
97 | RUNTIME_KERNEL=$mips_kernel_2_6_5kc
98 | RUNTIME_FQCOW2=$mips_squeeze_qcow2
99 | RUNTIME_BOARDB="malta"
100 | else
101 | help;
102 | exit;
103 | fi
104 | elif [[ "$version" == "wheezy" ]]
105 | then
106 | if [[ "$bit" == "32" ]]
107 | then
108 | RUNTIME_COMAND="qemu-system-mips"
109 | RUNTIME_KERNEL=$mips_kernel_3_2_4kc
110 | RUNTIME_FQCOW2=$mips_wheezy_qcow2
111 | RUNTIME_BOARDB="malta"
112 | elif [[ "$bit" == "64" ]]
113 | then
114 | RUNTIME_COMAND="qemu-system-mips64"
115 | RUNTIME_KERNEL=$mips_kernel_3_2_5kc
116 | RUNTIME_FQCOW2=$mips_wheezy_qcow2
117 | RUNTIME_BOARDB="malta"
118 | else
119 | help;
120 | exit;
121 | fi
122 | else
123 | help;
124 | exit;
125 | fi
126 | ;;
127 | "mipsel")
128 | if [[ "$version" == "squeeze" ]]
129 | then
130 | if [[ "$bit" == "32" ]]
131 | then
132 | RUNTIME_COMAND="qemu-system-mipsel"
133 | RUNTIME_KERNEL=$mipsel_kernel_2_6_4kc
134 | RUNTIME_FQCOW2=$mipsel_squeeze_qcow2
135 | RUNTIME_BOARDB="malta"
136 | elif [[ "$bit" == "64" ]]
137 | then
138 | RUNTIME_COMAND="qemu-system-mips64el"
139 | RUNTIME_KERNEL=$mipsel_kernel_2_6_5kc
140 | RUNTIME_FQCOW2=$mipsel_squeeze_qcow2
141 | RUNTIME_BOARDB="malta"
142 | else
143 | help;
144 | exit;
145 | fi
146 | elif [[ "$version" == "wheezy" ]]
147 | then
148 | if [[ "$bit" == "32" ]]
149 | then
150 | RUNTIME_COMAND="qemu-system-mipsel"
151 | RUNTIME_KERNEL=$mipsel_kernel_3_2_4kc
152 | RUNTIME_FQCOW2=$mipsel_wheezy_qcow2
153 | RUNTIME_BOARDB="malta"
154 | elif [[ "$bit" == "64" ]]
155 | then
156 | RUNTIME_COMAND="qemu-system-mips64el"
157 | RUNTIME_KERNEL=$mipsel_kernel_3_2_5kc
158 | RUNTIME_FQCOW2=$mipsel_wheezy_qcow2
159 | RUNTIME_BOARDB="malta"
160 | else
161 | help;
162 | exit;
163 | fi
164 | else
165 | help;
166 | exit;
167 | fi
168 | ;;
169 | *) help;
170 | exit;
171 | ;;
172 | esac
173 |
174 |
175 | if [ ! -d "./$structure" ]; then
176 | mkdir ./$structure
177 | fi
178 |
179 | echo "[*]Check kernel file ..."
180 | if [[ $RUNTIME_KERNEL != '' ]]; then
181 | if [ ! -f "./$structure/${RUNTIME_KERNEL##*/}" ]; then
182 | wget -P "./$structure/" -q --show-progress $RUNTIME_KERNEL --no-check-certificate
183 | fi
184 | fi
185 | RUNTIME_KERNEL=${RUNTIME_KERNEL##*/}
186 | echo "[+]Done ..."
187 | echo "[*]Check initrd file ..."
188 | if [[ $RUNTIME_INITRD != '' ]]; then
189 | if [ ! -f "./$structure/${RUNTIME_INITRD##*/}" ]; then
190 | wget -P "./$structure/" -q --show-progress $RUNTIME_INITRD --no-check-certificate
191 | fi
192 | else
193 | echo "[x]Don't need an initrd file!"
194 | fi
195 | RUNTIME_INITRD=${RUNTIME_INITRD##*/}
196 | echo "[+]Done ..."
197 | echo "[*]Check QCOW2 file ..."
198 | if [[ $RUNTIME_FQCOW2 != '' ]]; then
199 | if [ ! -f "./$structure/${RUNTIME_FQCOW2##*/}" ]; then
200 | wget -P "./$structure/" -q --show-progress $RUNTIME_FQCOW2 --no-check-certificate
201 | fi
202 | fi
203 | RUNTIME_FQCOW2=${RUNTIME_FQCOW2##*/}
204 | echo "[*]Done ..."
205 |
206 |
207 | echo "[+]Configure the network"
208 | tunctl -t tap0 -u root
209 | echo "[+]Configure the tap0 address to 192.168.3.1"
210 | ifconfig tap0 192.168.3.1/24
211 | echo "[*]Network Configure success"
212 |
213 |
214 | echo "[+]Create a new temp file"
215 | rsync -ah --progress "./$structure/$RUNTIME_FQCOW2" "./$structure/temp_standard.qcow2"
216 | RUNTIME_FQCOW2="temp_standard.qcow2"
217 | echo "[*]temp file setting done"
218 |
219 | gnome-terminal -x ./script/cpf2vm.sh
220 |
221 | case $structure in
222 | "armel")
223 | gnome-terminal -x ./script/armelcfg.sh $structure $RUNTIME_BOARDB $RUNTIME_KERNEL $RUNTIME_INITRD $RUNTIME_FQCOW2 $RUNTIME_COMAND
224 | ;;
225 | "armhf")
226 | gnome-terminal -x ./script/armhfcfg.sh $structure $RUNTIME_BOARDB $RUNTIME_KERNEL $RUNTIME_INITRD $RUNTIME_FQCOW2 $RUNTIME_COMAND
227 | ;;
228 | "mips")
229 | if [[ "$bit" == "32" ]]
230 | then
231 | gnome-terminal -x ./script/mipscfg.sh $structure $RUNTIME_BOARDB $RUNTIME_KERNEL $RUNTIME_FQCOW2 $RUNTIME_COMAND
232 | elif [[ "$bit" == "64" ]]
233 | then
234 | gnome-terminal -x ./script/mips64cfg.sh $structure $RUNTIME_BOARDB $RUNTIME_KERNEL $RUNTIME_FQCOW2 $RUNTIME_COMAND
235 | else
236 | help;
237 | exit;
238 | fi
239 | ;;
240 | "mipsel")
241 | if [[ "$bit" == "32" ]]
242 | then
243 | gnome-terminal -x ./script/mipselcfg.sh $structure $RUNTIME_BOARDB $RUNTIME_KERNEL $RUNTIME_FQCOW2 $RUNTIME_COMAND
244 | elif [[ "$bit" == "64" ]]
245 | then
246 | gnome-terminal -x ./script/mips64elcfg.sh $structure $RUNTIME_BOARDB $RUNTIME_KERNEL $RUNTIME_FQCOW2 $RUNTIME_COMAND
247 | else
248 | help;
249 | exit;
250 | fi
251 | ;;
252 | *) help;
253 | exit;
254 | esac
255 |
--------------------------------------------------------------------------------
/script/mips64cfg.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/expect
2 |
3 |
4 | set structure [lindex $argv 0]
5 | set RUNTIME_BOARDB [lindex $argv 1]
6 | set RUNTIME_KERNEL [lindex $argv 2]
7 | set RUNTIME_FQCOW2 [lindex $argv 3]
8 | set RUNTIME_COMAND [lindex $argv 4]
9 |
10 | set timeout -1
11 |
12 | spawn qemu-system-mips64 -M $RUNTIME_BOARDB -kernel ./$structure/$RUNTIME_KERNEL -hda ./$structure/$RUNTIME_FQCOW2 -append "root=/dev/sda1 console=tty0" -net nic -net tap,ifname=tap0,script=no,downscript=no -nographic -s
13 |
14 | expect {
15 | login { send "root\n"}
16 | }
17 | expect {
18 | Password { send "root\n"}
19 | }
20 | expect {
21 | root@ { send "ifconfig eth0 192.168.3.2/24\n"}
22 | }
23 | expect {
24 | root@ { send "sleep 3\n"}
25 | }
26 | expect {
27 | root@ { send "./ch2vm.sh\n"}
28 | }
29 |
30 | interact
31 |
32 |
--------------------------------------------------------------------------------
/script/mips64elcfg.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/expect
2 |
3 |
4 | set structure [lindex $argv 0]
5 | set RUNTIME_BOARDB [lindex $argv 1]
6 | set RUNTIME_KERNEL [lindex $argv 2]
7 | set RUNTIME_FQCOW2 [lindex $argv 3]
8 | set RUNTIME_COMAND [lindex $argv 4]
9 |
10 | set timeout -1
11 |
12 | spawn qemu-system-mips64el -M $RUNTIME_BOARDB -kernel ./$structure/$RUNTIME_KERNEL -hda ./$structure/$RUNTIME_FQCOW2 -append "root=/dev/sda1 console=tty0" -net nic -net tap,ifname=tap0,script=no,downscript=no -nographic -s
13 |
14 | expect {
15 | login { send "root\n"}
16 | }
17 | expect {
18 | Password { send "root\n"}
19 | }
20 | expect {
21 | root@ { send "ifconfig eth0 192.168.3.2/24\n"}
22 | }
23 | expect {
24 | root@ { send "sleep 3\n"}
25 | }
26 | expect {
27 | root@ { send "./ch2vm.sh\n"}
28 | }
29 |
30 | interact
31 |
32 |
--------------------------------------------------------------------------------
/script/mipscfg.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/expect
2 |
3 |
4 | set structure [lindex $argv 0]
5 | set RUNTIME_BOARDB [lindex $argv 1]
6 | set RUNTIME_KERNEL [lindex $argv 2]
7 | set RUNTIME_FQCOW2 [lindex $argv 3]
8 | set RUNTIME_COMAND [lindex $argv 4]
9 |
10 | set timeout -1
11 |
12 | spawn qemu-system-mips -M $RUNTIME_BOARDB -kernel ./$structure/$RUNTIME_KERNEL -hda ./$structure/$RUNTIME_FQCOW2 -append "root=/dev/sda1 console=tty0" -net nic -net tap,ifname=tap0,script=no,downscript=no -nographic -s
13 |
14 | expect {
15 | login { send "root\n"}
16 | }
17 | expect {
18 | Password { send "root\n"}
19 | }
20 | expect {
21 | root@ { send "ifconfig eth0 192.168.3.2/24\n"}
22 | }
23 | expect {
24 | root@ { send "sleep 3\n"}
25 | }
26 | expect {
27 | root@ { send "./ch2vm.sh\n"}
28 | }
29 |
30 | interact
31 |
32 |
--------------------------------------------------------------------------------
/script/mipselcfg.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/expect
2 |
3 |
4 | set structure [lindex $argv 0]
5 | set RUNTIME_BOARDB [lindex $argv 1]
6 | set RUNTIME_KERNEL [lindex $argv 2]
7 | set RUNTIME_FQCOW2 [lindex $argv 3]
8 | set RUNTIME_COMAND [lindex $argv 4]
9 |
10 | set timeout -1
11 |
12 | spawn qemu-system-mipsel -M $RUNTIME_BOARDB -kernel ./$structure/$RUNTIME_KERNEL -hda ./$structure/$RUNTIME_FQCOW2 -append "root=/dev/sda1 console=tty0" -net nic -net tap,ifname=tap0,script=no,downscript=no -nographic -s
13 |
14 | expect {
15 | login { send "root\n"}
16 | }
17 | expect {
18 | Password { send "root\n"}
19 | }
20 | expect {
21 | root@ { send "ifconfig eth0 192.168.3.2/24\n"}
22 | }
23 | expect {
24 | root@ { send "sleep 3\n"}
25 | }
26 | expect {
27 | root@ { send "./ch2vm.sh\n"}
28 | }
29 |
30 | interact
31 |
32 |
--------------------------------------------------------------------------------