Browse Source

bootstrap: add qtap

qtap builds harvey and looks for 

    Hello, I am Harvey :-)

Signed-off-by: sevki <s@sevki.org>
Sevki 3 years ago
parent
commit
745ddb0c80
5 changed files with 40 additions and 26 deletions
  1. 7 1
      .github/workflows/harvey.yml
  2. 2 0
      bootstrap.sh
  3. 2 0
      rc/bin/cpurc
  4. 0 25
      util/SERIALQRUN
  5. 29 0
      util/src/harvey/cmd/qtap/main.go

+ 7 - 1
.github/workflows/harvey.yml

@@ -26,9 +26,15 @@ jobs:
         sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
         sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main' -y
         sudo apt-get update
-        sudo apt-get install -y --force-yes ${{ matrix.cc }} rc golang-1.11-go
+        sudo apt-get install -y --force-yes ${{ matrix.cc }} rc golang-1.11-go qemu
+    - name: bootstrap
+      run: ./bootstrap.sh
     - name: build
       env:
         ARCH: amd64
         CC: ${{ matrix.cc }}
       run: ./util/ci.sh
+    - name: boot
+      env:
+        HARVEY: ${{github.workspace}}
+      run: ./util/qtap

+ 2 - 0
bootstrap.sh

@@ -6,6 +6,8 @@ GO111MODULE=on GOBIN="$(pwd)/util" go get -u github.com/Harvey-OS/ninep/cmd/ufs
 # GO111MODULE=on GOBIN="$(pwd)/util" go get -f -u bldy.build/bldy
 GO111MODULE=on GOBIN="$(pwd)/util" go get ./util/src/harvey/cmd/...
 
+GOOS=plan9 GOARCH=amd64 GO111MODULE=on GOBIN="$(pwd)/util" go get golang.org/dl/gotip
+
 
 # this will make booting a VM easier
 mkdir -p tmp

+ 2 - 0
rc/bin/cpurc

@@ -87,5 +87,7 @@ if(test -e /env/onstartup) {
 	eval $onstartup
 }
 
+./util/gotip
+
 # echo `{date} $sysname >>/sys/log/boot
 exit ''

+ 0 - 25
util/SERIALQRUN

@@ -1,25 +0,0 @@
-sudo qemu-system-x86_64 -s -cpu Opteron_G1 -smp 8 -m 2048  \
--serial stdio \
---machine pc \
--net nic,model=rtl8139 \
--net user,hostfwd=tcp::5555-:23 \
- -nographic \
--kernel 9k.32bit $*
-
-#-S -gdb tcp::1234 \
-# -nographic \
-#-kernel mnt/hdd/kernel $*
-
-# if you need the dump.
-#-net dump,file=/tmp/vm0.pcap \
-
-#sudo qemu-system-x86_64 -s -cpu phenom -smp 8 -m 4096 -nographic  \
-#-net nic,model=rtl8139 mnt/hdd268mb.img \
-#-net user,hostfwd=tcp::5555-:23 \
-#-net dump,file=/tmp/vm0.pcap \
-#-kernel mnt/hdd/kernel $*
-#
-#sudo qemu-system-x86_64 -s -cpu phenom -smp 8 -m 6024 -nographic  -net nic,model=rtl8139 mnt/hdd268mb.img -netdev user,id=mynet0 -kernel mnt/hdd/kernel $*
-#sudo qemu-system-x86_64 -s -cpu phenom -smp 8 -m 6024 -nographic  -net nic,model=rtl8139 mnt/hdd268mb.img -netdev user,id=mynet0,net=192.168.76.0/24,dhcpstart=192.168.76.9 -kernel mnt/hdd/kernel $*
-
-# 

+ 29 - 0
util/src/harvey/cmd/qtap/main.go

@@ -0,0 +1,29 @@
+package main
+
+import (
+	"fmt"
+	"log"
+	"os"
+	"time"
+
+	"github.com/u-root/u-root/pkg/qemu"
+)
+
+func main() {
+	opts := &qemu.Options{
+		QEMUPath:     "qemu-system-x86_64",
+		Kernel:       os.ExpandEnv("$HARVEY/sys/src/9/amd64/harvey.32bit"),
+		SerialOutput: os.Stdout,
+		KernelArgs:   "service=terminal nobootprompt=tcp maxcores=1024 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1",
+	}
+	log.Println(opts.Cmdline())
+	vm, err := opts.Start()
+	if err != nil {
+		log.Fatal()
+	}
+	if err := vm.ExpectTimeout("Hello, I am Harvey :-)", time.Minute); err != nil {
+		log.Fatal(err)
+	}
+	vm.Close()
+	fmt.Println("Harvey booted successfully")
+}