From: <abe...@us...> - 2016-02-28 23:35:55
|
Revision: 7566 http://sourceforge.net/p/astlinux/code/7566 Author: abelbeck Date: 2016-02-28 23:35:53 +0000 (Sun, 28 Feb 2016) Log Message: ----------- qemu, tweaks from Darid Kerr Modified Paths: -------------- branches/1.0/package/qemu/Config.in branches/1.0/package/qemu/qemu.mk Added Paths: ----------- branches/1.0/package/qemu/bridge.conf Modified: branches/1.0/package/qemu/Config.in =================================================================== --- branches/1.0/package/qemu/Config.in 2016-02-28 00:11:39 UTC (rev 7565) +++ branches/1.0/package/qemu/Config.in 2016-02-28 23:35:53 UTC (rev 7566) @@ -28,6 +28,14 @@ http://qemu.org/ + Required Kernel Config: + CONFIG_VIRTUALIZATION=y + CONFIG_KVM=m + CONFIG_KVM_INTEL=m + CONFIG_KVM_AMD=m + CONFIG_VHOST_NET=m + + if BR2_PACKAGE_QEMU comment "QEMU Emulators selection" @@ -92,6 +100,7 @@ config BR2_PACKAGE_QEMU_SYSTEM_VNC bool "Enable system VNC" + default y help Say 'y' to build VNC display. Added: branches/1.0/package/qemu/bridge.conf =================================================================== --- branches/1.0/package/qemu/bridge.conf (rev 0) +++ branches/1.0/package/qemu/bridge.conf 2016-02-28 23:35:53 UTC (rev 7566) @@ -0,0 +1,22 @@ +## +## bridge.conf for AstLinux +## Access Control (ACL) for QEMU access to network bridges +## Detailed description can be found at: +## http://git.qemu.org/?p=qemu.git;a=commit;h=bdef79a2994d6f0383e07e9597675711662b3031 +## +## AstLinux admin should create a bridge network to the internal LAN interface. +## This can be done in user.conf with, for example, the line... +## BRIDGE1="eth1 eth2" +## In this case bridging two physical interfaces together, but you could just bridge to one. +## This creates "br1" which you should select as the internal interface in the network tab of AstLinux Web Interface. +## +## Then in this file permit qemu to access the bridge... (uncomment) +#allow br1 +## +## More complex ACL using deny and include statements possible. See above link. +## +## When invoking QEMU the network device is created with these flags... +## -netdev bridge,id=nd1,br=br1 +## -device virtio-net-pci,netdev=nd1,id=nic1,mac=52:54:00:xx:yy:yy +## Be sure to select a random mac address, if unspecified then qemu will default to 52:54:00:12:34:56 +## Modified: branches/1.0/package/qemu/qemu.mk =================================================================== --- branches/1.0/package/qemu/qemu.mk 2016-02-28 00:11:39 UTC (rev 7565) +++ branches/1.0/package/qemu/qemu.mk 2016-02-28 23:35:53 UTC (rev 7566) @@ -76,6 +76,7 @@ ./configure \ --prefix=/usr \ --cross-prefix=$(TARGET_CROSS) \ + --sysconfdir=/etc \ --with-system-pixman \ --audio-drv-list= \ --enable-kvm \ @@ -111,6 +112,16 @@ define QEMU_INSTALL_TARGET_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(QEMU_MAKE_ENV) DESTDIR=$(TARGET_DIR) install + $(INSTALL) -m 0644 -D package/qemu/bridge.conf $(TARGET_DIR)/etc/qemu/bridge.conf + if [ -f $(TARGET_DIR)/usr/bin/qemu-system-x86_64 ]; then \ + ln -sf qemu-system-x86_64 $(TARGET_DIR)/usr/bin/qemu ; \ + fi endef +define QEMU_UNINSTALL_TARGET_CMDS + rm -rf $(TARGET_DIR)/etc/qemu + rm -f $(TARGET_DIR)/usr/bin/qemu + rm -f $(TARGET_DIR)/usr/bin/qemu-* +endef + $(eval $(call GENTARGETS,package,qemu)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2016-03-10 14:04:52
|
Revision: 7577 http://sourceforge.net/p/astlinux/code/7577 Author: abelbeck Date: 2016-03-10 14:04:50 +0000 (Thu, 10 Mar 2016) Log Message: ----------- qemu, additional contributions by David Kerr, functional init.d script Modified Paths: -------------- branches/1.0/package/qemu/bridge.conf branches/1.0/package/qemu/qemu.mk Added Paths: ----------- branches/1.0/package/qemu/qemu.init Modified: branches/1.0/package/qemu/bridge.conf =================================================================== --- branches/1.0/package/qemu/bridge.conf 2016-03-09 00:52:24 UTC (rev 7576) +++ branches/1.0/package/qemu/bridge.conf 2016-03-10 14:04:50 UTC (rev 7577) @@ -6,17 +6,17 @@ ## ## AstLinux admin should create a bridge network to the internal LAN interface. ## This can be done in user.conf with, for example, the line... -## BRIDGE1="eth1 eth2" +## BRIDGE0="eth1 eth2" ## In this case bridging two physical interfaces together, but you could just bridge to one. -## This creates "br1" which you should select as the internal interface in the network tab of AstLinux Web Interface. +## This creates "br0" which you should select as the internal interface in the network tab of AstLinux Web Interface. ## ## Then in this file permit qemu to access the bridge... (uncomment) -#allow br1 +#allow br0 ## ## More complex ACL using deny and include statements possible. See above link. ## ## When invoking QEMU the network device is created with these flags... -## -netdev bridge,id=nd1,br=br1 +## -netdev bridge,id=nd1,br=br0 ## -device virtio-net-pci,netdev=nd1,id=nic1,mac=52:54:00:xx:yy:yy ## Be sure to select a random mac address, if unspecified then qemu will default to 52:54:00:12:34:56 ## Added: branches/1.0/package/qemu/qemu.init =================================================================== --- branches/1.0/package/qemu/qemu.init (rev 0) +++ branches/1.0/package/qemu/qemu.init 2016-03-10 14:04:50 UTC (rev 7577) @@ -0,0 +1,175 @@ +#!/bin/sh + +# Default settings. Override in user.conf file. +QEMU_START=yes +# QEMU_RUN_IMAGE=/path/to/vm/image -- Required, must be set in user.conf file +# QEMU_MEM=1024 -- (value in MB) default set below to lesser of 50% of total memory or 90% of free memory +# QEMU_VCPU=2 -- default set below to half of available CPU cores +QEMU_NET_DEVICE=virtio-net-pci +QEMU_NET_BRIDGE=br0 +QEMU_NET_MACADDR=52:54:00:AB:CD:EF +QEMU_BLOCK_DEVICE=virtio +QEMU_VNC_DISPLAY=1 + +. /etc/rc.conf + +start () { + + if [ "$QEMU_START" = "yes" ] && [ -n "$QEMU_RUN_IMAGE" ]; then + echo "Starting qemu..." + # find system memory in MB + TotMem=$(free -m | awk '/^Mem:/{print $2}') + FreeMem=$(free -m | awk '/^Mem:/{print $4}') + if [ -z "$QEMU_MEM" ]; then + # set Memory to the smaller of 50% of total system memory or 90% of available free memory + QemuMemory=$((`expr $TotMem / 2` < `expr $FreeMem \* 9 / 10` ? `expr $TotMem / 2` : `expr $FreeMem \* 9 / 10`)) + else + # set Memory to user provided value + QemuMemory=$QEMU_MEM + if [ $QemuMemory -gt $FreeMem ]; then + /usr/bin/logger -s -p user.warning -id -t qemu "WARNING: $QemuMemory MB exceeds system available memory of $FreeMem" + fi + fi + + CpuCores=$(lscpu -p | /bin/egrep -v '^#' | wc -l) + if [ -z "$QEMU_VCPU" ]; then + # Set vCPU cores to half available system cores + QemuVCpu=$(($CpuCores>1 ? `expr $CpuCores / 2` : 1)) + else + # set vCPU cores to user provided value + QemuVCpu=$QEMU_VCPU + if [ $QemuVCpu -gt $CpuCores ]; then + /usr/bin/logger -s -p user.warning -id -t qemu "WARNING: $QemuVCpu cores exceeds system available cores of $CpuCores" + fi + fi + if [ $QemuVCpu == 1 ]; then + QemuVCpuStr="" + else + QemuVCpuStr="-smp cpus=$QemuVCpu" + fi + + # Make sure network bridge exists. If not then exit + /usr/sbin/brctl showmacs $QEMU_NET_BRIDGE > /dev/null + if [ $? == 1 ]; then + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: Bridge $QEMU_NET_BRIDGE does not exist. Exiting" + exit + fi + # Make sure that the bridge helper ACL list allows access to the network bridge we selected. + /bin/grep -v '^$' /etc/qemu/bridge.conf | /bin/grep -v '^ *#' | /bin/grep "allow $QEMU_NET_BRIDGE" > /dev/null + if [ $? == 1 ]; then + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: ACL permissions for bridge $QEMU_NET_BRIDGE not set in /etc/qemu/bridge.conf. Exiting" + exit + fi + # Check tcp-segmentation-offload and general-segmentation-offload + /usr/sbin/ethtool -k br0 | /bin/grep "segmentation-offload" | /bin/grep ": off" > /dev/null + if [ $? == 0 ]; then + /usr/bin/logger -s -p user.warning -id -t qemu "WARNING: host $QEMU_NET_BRIDGE interface has TSO and GSO set to off. Consider setting guest network interface to match with ethtool command" + fi + + # If network device virtio then set enable host support + if [ "$QEMU_NET_DEVICE" = "virtio-net-pci" ]; then + QemuVHost=",vhost=on" + else + QemuVHost="" + fi + + # Load required modules in case they are not already loaded... kvm kvm-amd or kvm-intel and vhost_net + /bin/grep "flags" /proc/cpuinfo | /bin/grep " lm" > /dev/null + # Presence of 'lm' flag indicates 64-bit processor + if [ $? == 0 ]; then + /sbin/modprobe kvm + if [ $? == 1 ]; then + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: Failed to load kernel module kvm. Exiting" + exit + fi + /bin/grep "flags" /proc/cpuinfo | /bin/grep " vmx" > /dev/null + # Presence of 'vmx' indicates intel virtualization extensions + if [ $? == 0 ]; then + /sbin/modprobe kvm-intel + if [ $? == 1 ]; then + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: Failed to load kernel module kvm-intel. Exiting" + exit + fi + else + /bin/grep "flags" /proc/cpuinfo | /bin/grep " svm" > /dev/null + # Presence of 'svm' indicates AMD virtualization extensions + if [ $? == 0 ]; then + /sbin/modprobe kvm-amd + if [ $? == 1 ]; then + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: Failed to load kernel module kvm-amd. Exiting" + exit + fi + else + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: Host CPU does not support virtualization. Exiting" + exit + fi + fi + if [ -n "QemuVHost" ]; then + # Only load vhost_net if virtio network device selected + /sbin/modprobe vhost_net + if [ $? == 1 ]; then + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: Failed to load kernel module vhost_net. Exiting" + exit + fi + fi + else + /usr/bin/logger -s -p user.err -id -t qemu "ERROR: Host CPU is not 64-bit architecture. Exiting" + exit + fi + + # And now run qemu. + /usr/bin/logger -s -p user.info -id -t qemu "Run image $QEMU_RUN_IMAGE with $QemuMemory MB of Memory and $QemuVCpu CPU cores on Network $QEMU_NET_BRIDGE. Console on VNC port 590$QEMU_VNC_DISPLAY" + /usr/bin/qemu \ + -m $QemuMemory \ + -drive file="$QEMU_RUN_IMAGE",if=$QEMU_BLOCK_DEVICE,index=0 \ + -netdev tap,id=nd1,helper="/usr/libexec/qemu-bridge-helper --br=$QEMU_NET_BRIDGE"$QemuVHost \ + -device $QEMU_NET_DEVICE,netdev=nd1,id=nic1,mac=$QEMU_NET_MACADDR \ + -enable-kvm \ + $QemuVCpuStr \ + -qmp tcp:localhost:4444,server,nowait \ + -daemonize \ + -usbdevice tablet \ + -display vnc=:$QEMU_VNC_DISPLAY + fi +} + +stop () { + + /bin/netstat -ln | /bin/grep :4444 > /dev/null + if [ $? == 0 ]; then + echo "Stopping qemu..." + echo -e "{ \"execute\": \"qmp_capabilities\" }\n{ \"execute\": \"system_powerdown\" }\n" | /usr/bin/nc -w 10 localhost 4444 >/dev/null + else + /usr/bin/logger -s -p user.warning -id -t qemu "WARNING: cannot stop -- qemu not running." + fi +} + +if [ ! -x /usr/bin/qemu ]; then + exit +fi + +case $1 in + +start) + start + ;; + +stop) + stop + ;; + +init) + start + ;; + +restart) + stop + sleep 2 + start + ;; + +*) + echo "Usage: start|stop|restart" + ;; + +esac Property changes on: branches/1.0/package/qemu/qemu.init ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/package/qemu/qemu.mk =================================================================== --- branches/1.0/package/qemu/qemu.mk 2016-03-09 00:52:24 UTC (rev 7576) +++ branches/1.0/package/qemu/qemu.mk 2016-03-10 14:04:50 UTC (rev 7577) @@ -116,12 +116,18 @@ if [ -f $(TARGET_DIR)/usr/bin/qemu-system-x86_64 ]; then \ ln -sf qemu-system-x86_64 $(TARGET_DIR)/usr/bin/qemu ; \ fi + $(INSTALL) -D -m 0755 package/qemu/qemu.init $(TARGET_DIR)/etc/init.d/qemu + ln -sf ../../init.d/qemu $(TARGET_DIR)/etc/runlevels/default/S95qemu + ln -sf ../../init.d/qemu $(TARGET_DIR)/etc/runlevels/default/K04qemu endef define QEMU_UNINSTALL_TARGET_CMDS rm -rf $(TARGET_DIR)/etc/qemu rm -f $(TARGET_DIR)/usr/bin/qemu rm -f $(TARGET_DIR)/usr/bin/qemu-* + rm -f $(TARGET_DIR)/etc/init.d/qemu + rm -f $(TARGET_DIR)/etc/runlevels/default/S95qemu + rm -f $(TARGET_DIR)/etc/runlevels/default/K04qemu endef $(eval $(call GENTARGETS,package,qemu)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <abe...@us...> - 2016-10-03 13:50:41
|
Revision: 7873 http://sourceforge.net/p/astlinux/code/7873 Author: abelbeck Date: 2016-10-03 13:50:40 +0000 (Mon, 03 Oct 2016) Log Message: ----------- qemu, version bump to 2.6.2 and CDROM fix thanks to David Kerr Modified Paths: -------------- branches/1.0/package/qemu/qemu.init branches/1.0/package/qemu/qemu.mk Modified: branches/1.0/package/qemu/qemu.init =================================================================== --- branches/1.0/package/qemu/qemu.init 2016-10-01 19:54:10 UTC (rev 7872) +++ branches/1.0/package/qemu/qemu.init 2016-10-03 13:50:40 UTC (rev 7873) @@ -52,7 +52,7 @@ # Was a CDROM ISO file provided? QemuCdrom="" if [ -n "$QEMU_CDROM_IMAGE" ]; then - QemuCdrom="-cdrom $QEMU_CDROM_IMAGE" + QemuCdrom="-boot once=d -cdrom $QEMU_CDROM_IMAGE" fi # If network device virtio then enable host support Modified: branches/1.0/package/qemu/qemu.mk =================================================================== --- branches/1.0/package/qemu/qemu.mk 2016-10-01 19:54:10 UTC (rev 7872) +++ branches/1.0/package/qemu/qemu.mk 2016-10-03 13:50:40 UTC (rev 7873) @@ -4,7 +4,7 @@ # ################################################################################ -QEMU_VERSION = 2.5.0 +QEMU_VERSION = 2.6.2 QEMU_SOURCE = qemu-$(QEMU_VERSION).tar.bz2 QEMU_SITE = http://wiki.qemu.org/download This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |