xref: /freebsd/tools/tools/nanobsd/pcengines/test.sh (revision 315ee00f)
1#!/bin/sh
2#
3#
4
5_run () {
6  case "$1" in
7  "alix_dsk")
8    ARG="-cpu pentium"
9    ARG="$ARG -hda /usr/obj/nanobsd.alix_dsk/_.disk.full -boot c"
10    ARG="$ARG -hdb /z/scratch/scratch"
11    ARG="$ARG -net nic,model=e1000"
12    ARG="$ARG -net tap,ifname=tap0,script=no,downscript=no"
13    ARG="$ARG -m 1024 -k de -localtime -nographic"
14    break
15    ;;
16  "alix_nfs")
17    ARG="-cpu pentium"
18    ARG="$ARG -hda /usr/obj/nanobsd.alix_nfs/_.disk.full -boot c"
19    ARG="$ARG -hdb /z/scratch/scratch"
20    ARG="$ARG -net nic,model=e1000"
21    ARG="$ARG -net tap,ifname=tap0,script=no,downscript=no"
22    ARG="$ARG -m 1024 -k de -localtime -nographic"
23    break
24    ;;
25
26  esac
27  qemu-system-x86_64 -kernel-kqemu $ARG
28}
29
30_init () {
31  kldstat -n kqemu || kldload kqemu
32  kldstat -n aio || kldload aio
33  kldstat -n if_tap || kldload if_tap
34  kldstat -n if_bridge || kldload if_bridge
35  sysctl net.link.tap.up_on_open=1
36  ifconfig bridge0 down destroy
37  ifconfig tap0 down destroy
38  ifconfig tap0 create up
39  ifconfig bridge0 create
40  ifconfig bridge0 addm nfe0 addm tap0 up
41}
42
43_ifup () {
44  sleep 2;
45  ifconfig bridge0 -learn nfe0
46  ifconfig tap0 up
47  ifconfig bridge0 up
48}
49
50_clear () {
51  ifconfig bridge0 down destroy
52  ifconfig tap0 down destroy
53}
54
55_init
56(_ifup) &
57_run "$1"
58_clear
59