blob: d4ab0bbc6badcaeb35375ddd24443e010004d699 [file] [log] [blame]
Lorenz Brunf95909d2019-09-11 19:48:26 +02001#!/bin/sh
2
Leopold Schabel7670e672019-11-15 13:49:53 +01003TMP=$(mktemp -d)
4trap "{ rm -rf "$TMP"; pkill -9 -P $$; }" EXIT
5
6# sandbox uses a symlink farm - without -L, we would just copy the symlinks
7cp -Lr core/tpm/* "${TMP}"
8
9swtpm socket --tpmstate dir=${TMP} --ctrl type=unixio,path=tpm-socket --tpm2 &
Lorenz Brunf95909d2019-09-11 19:48:26 +020010
Leopold Schabel67f9d092019-10-22 15:41:42 +020011qemu-system-x86_64 \
Serge Bazanskibb7db922020-04-30 12:43:10 +020012 -cpu host -smp sockets=1,cpus=1,cores=2,threads=2,maxcpus=4 -m 2048 -machine q35 -enable-kvm -nographic -nodefaults \
Leopold Schabel5c80aca2019-10-22 15:48:58 +020013 -drive if=pflash,format=raw,readonly,file=external/edk2/OVMF_CODE.fd \
14 -drive if=pflash,format=raw,snapshot=on,file=external/edk2/OVMF_VARS.fd \
Hendrik Hofstadt0d7c91e2019-10-23 21:44:47 +020015 -drive if=virtio,format=raw,snapshot=on,cache=unsafe,file=core/smalltown.img \
Serge Bazanski1a5a6672020-02-18 10:09:43 +010016 -netdev user,id=net0,net=10.42.0.0/24,dhcpstart=10.42.0.10,hostfwd=tcp::7833-:7833,hostfwd=tcp::7834-:7834,hostfwd=tcp::6443-:6443,hostfwd=tcp::7835-:7835 \
Lorenz Brunf95909d2019-09-11 19:48:26 +020017 -device virtio-net-pci,netdev=net0 \
Leopold Schabel5c80aca2019-10-22 15:48:58 +020018 -chardev socket,id=chrtpm,path=tpm-socket \
Lorenz Brunf95909d2019-09-11 19:48:26 +020019 -tpmdev emulator,id=tpm0,chardev=chrtpm \
20 -device tpm-tis,tpmdev=tpm0 \
Leopold Schabel5c80aca2019-10-22 15:48:58 +020021 -debugcon file:debug.log \
Lorenz Brunf95909d2019-09-11 19:48:26 +020022 -global isa-debugcon.iobase=0x402 \
23 -device ipmi-bmc-sim,id=ipmi0 \
24 -device virtio-rng-pci \
Leopold Schabel7670e672019-11-15 13:49:53 +010025 -serial stdio \
26 | stdbuf -oL tr -d '\r' | cat -v