patron 10 ماه پیش
والد
کامیت
fd413bc3de
4فایلهای تغییر یافته به همراه69 افزوده شده و 0 حذف شده
  1. 25 0
      Yocto-bhyve/LICENSE
  2. 4 0
      Yocto-bhyve/README.md
  3. 1 0
      Yocto-bhyve/direct.map
  4. 39 0
      Yocto-bhyve/direct.sh

+ 25 - 0
Yocto-bhyve/LICENSE

@@ -0,0 +1,25 @@
+BSD 2-Clause License
+
+Copyright (c) 2018, David Marec
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 4 - 0
Yocto-bhyve/README.md

@@ -0,0 +1,4 @@
+
+
+[Documentation](https://wiki.fug-fr.org/doku.php?id=vm:bhyve-linux)
+

+ 1 - 0
Yocto-bhyve/direct.map

@@ -0,0 +1 @@
+(hd0) /root/vms/direct.sda

+ 39 - 0
Yocto-bhyve/direct.sh

@@ -0,0 +1,39 @@
+#!/bin/sh
+vmname=test
+memorystamp=2048M
+
+# create a tap interface
+#   ifconfig tap1 create
+# add to bridge
+#   ifconfig bridge0 addm tap1
+
+# kill (if any)
+
+bhyvectl --vm=${vmname} --destroy
+
+list_sda () {
+
+	hddisk="./"`ls -1 -t direct*.sda | head -1`
+}
+
+hddisk=${1}
+[ -z ${hddisk} ] && list_sda 
+
+echo "building map file for grub"
+echo "(hd0) "${hddisk} > direct.map
+
+grub-bhyve -m direct.map -r hd0,msdos1 -M ${memorystamp} ${vmname}
+
+# at prompt, type
+#   linux (hd0,msdos1)/vmlinuz root=/dev/vda2
+#   boot
+
+echo "starting linux on root=" ${hddisk}
+bhyve -A -H -P -s 0:0,hostbridge \
+-s 1:0,lpc \
+-s 2:0,virtio-net,tap1 \
+-s 3:0,virtio-blk,${hddisk} \
+-l com1,stdio \
+-c 2 -m ${memorystamp} ${vmname}
+
+bhyvectl --vm=${vmname} --destroy