summaryrefslogtreecommitdiff
path: root/src/qemu.sh
blob: 207ca6817064c6e3ef510657edf13be07cf189c7 (plain)
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/sh

. samizdat-paths.sh

# iso=debian-live-8.4.0-amd64-gnome-desktop.iso
# iso=debian-live-8.4.0-amd64-standard.iso
# iso=debian-live-8.4.0-amd64-standard.btrfs.iso
iso=${samizdat_iso_dir}/samizdat.iso
disk=${samizdat_iso_dir}/debian-live-8.4.0-amd64-standard.btrfs.disk
layered=${samizdat_iso_dir}/${iso%.iso}.layered.iso

[ -f "$layered" ] && iso=$layered

[ "$1" ] && iso=$1

initrd.sh || { echo "initrd.sh failed" >&2; exit 1; };

NET='tap,vlan=0,ifname=tap0,script=no,downscript=no'

# To test local pxe boot server:
# NET='user,tftp=isolinux,bootfile=/pxelinux.0'

initrd=${samizdat_isolinux_dir}/linux/initrd.img
kernel=${samizdat_isolinux_dir}/linux/vmlinuz
kcmdline='boot=samizdat components quiet splash'

if [ "$QEMU_LOADS_LINUX" ]; then
  set -- -initrd "$initrd" -kernel "$kernel" -append "$kcmdline"
fi

if [ "$USE_ISO" ]; then
  set -- -cdrom "$iso"
else
  set -- -boot n
fi

sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 640 -k en-us \
     -vga qxl \
     -net nic,vlan=0,model=virtio \
     -net "$NET" \
     -rtc base=localtime \
     -hda "$disk" \
     "$@"