-
Notifications
You must be signed in to change notification settings - Fork 0
/
easy-versatilepb-run
executable file
·39 lines (34 loc) · 1.25 KB
/
easy-versatilepb-run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
if [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$#" -lt 1 ]; then
echo './easy-versatilepb-run INPUT'
echo ' -gdb )'
echo ' QEMU will listen for an incoming connection from gdb'
echo ' on TCP port 1234. Execution will not start until told'
echo ' to do so by GDB.'
echo ' -h, --help, * )'
echo ' Print usage information.'
echo ' Note: If you do not halt execution (with SVC 2), QEMU will not quit as'
echo ' the machine is still technically running, even if it has run out of'
echo ' instructions. In the terminal, press CTRL+A, then type "x", to quit QEMU.'
exit
fi
input_1="$1"
input_2="$2"
input="$input_1"
gdb="-s -S"
if [ "$#" -lt 1 ]; then
echo 'Please supply input ARM binary file.'
exit 1
fi
if [ "$input_1" != '-gdb' ] && [ -z "$input_2" ]; then
input="$input_1"
gdb=''
elif [ "$input_1" = '-gdb' ] && [ -n "$input_2" ]; then
input="$input_2"
elif [ "$input_2" = '-gdb' ]; then
input="$input_1"
elif [ "$input_1" = '-gdb' ] && [ -z "$input_2" ]; then
echo 'Please supply input ARM binary file.' 1>&2
exit 1
fi
qemu-system-arm -M versatilepb $gdb -m 128M -nographic -no-reboot -audiodev none,id=none -kernel "$input"