-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun.sh
executable file
·43 lines (35 loc) · 945 Bytes
/
run.sh
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
40
41
42
43
#!/bin/bash
unset REBUILD IDE_MODE DEBUG EXT2 BIG
while getopts 'rldeb' c
do
case $c in
r) REBUILD=TRUE ;;
l) IDE_MODE=TRUE ;;
d) DEBUG=TRUE ;;
e) EXT2=TRUE ;;
b) BIG=TRUE ;;
esac
done
if [ -n "$REBUILD" ]; then
./build.sh || exit 1
fi
DEBUG_OPTS=""
if [ -n "$DEBUG" ]; then
DEBUG_OPTS="-gdb tcp:0.0.0.0:1234 -S"
echo "waiting on GDB..."
fi
ROOT_IMG="fs.vdi"
if [ -n "$EXT2" ]; then
ROOT_IMG="fs-ext2.img"
fi
NETWORK="-net none"
BOOT_DISK="-hda ./bin/boot.vdi"
ROOT_DISK="-drive id=disk,file=./bin/$ROOT_IMG,if=none -device driver=ide-hd,drive=disk,bus=ahci.0"
if [ -n "$IDE_MODE" ]; then
ROOT_DISK="-hdd ./bin/$ROOT_IMG"
fi
CPU="-cpu phenom-v1 -smp sockets=1 -smp cores=4 -smp threads=1"
if [ -n "$BIG" ]; then
CPU="-cpu IvyBridge-v2 -smp sockets=2 -smp cores=12 -smp threads=2"
fi
qemu-system-x86_64 $QEMU_OPTS $DEBUG_OPTS -device ahci,id=ahci $CPU -m 512 $NETWORK $BOOT_DISK $ROOT_DISK