From 769c7ab0bc9ec7ed6d0a548343f9cf67996b10fe Mon Sep 17 00:00:00 2001 From: Albrecht Lohofener Date: Sun, 28 Jan 2024 22:46:35 +0100 Subject: [PATCH] Add CPU_COUNT variable. Minor stuff. --- docker-compose.yml | 13 +++++++++---- readme.md | 2 +- src/entry.sh | 7 +++---- src/reset.sh | 1 + 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c43191d..8bb401d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,21 +1,26 @@ version: "3" services: qemu: - container_name: openwrt-docker-arm64 + container_name: openwrt + #image: albrechtloh/qemu-openwrt:openwrt-23.05.1-2 image: "openwrt-docker-arm64" environment: DEBUG: "y" + + # Define number of VM CPUs + CPU_COUNT: 4 + # If WAN interface is not specified the Docker network # In this case a port forwarding from port OpenWrt 80 to port 8000 is available #WAN_IF: "enx00e04c0407a6" #LAN_IF: "enx00e04d68033f" - # USB passtrough + # USB passthrough # Format : like 'lsusb' is given # Currently only one USB device is supported - USB_VID_1: "148f" # vendor ID - USB_PID_1: "7601" # product ID + #USB_VID_1: "148f" # vendor ID + #USB_PID_1: "7601" # product ID ports: # Port 8006 is console tty web VNC diff --git a/readme.md b/readme.md index 2d99116..01784b8 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ QEMU in a docker container for running arm64 virtual machines. Tested on Raspber It uses high-performance QEMU options (like KVM acceleration, kernel-mode networking, IO threading, etc.) to achieve near-native speed. -Pre-build images can be found a docker hub (TBD) +Images can be found a docker hub https://hub.docker.com/r/albrechtloh/qemu-openwrt ## Features diff --git a/src/entry.sh b/src/entry.sh index 9a095c0..ec1c65d 100755 --- a/src/entry.sh +++ b/src/entry.sh @@ -5,7 +5,7 @@ set -Eeuo pipefail APP="OpenWrt" -SUPPORT="albrechtloh@gmx.de" +SUPPORT="https://github.com/AlbrechtL/openwrt-docker-arm64-build" attach_eth_if () { HOST_IF=$1 @@ -75,8 +75,7 @@ if [ ! -e /dev/kvm ]; then fi fi if [ -n "$KVM_ERR" ]; then - KVM="N" - warning "KVM acceleration not detected $KVM_ERR, this will cause a major loss of performance." + info "KVM acceleration not detected $KVM_ERR, this will cause a major loss of performance." fi # Attach physical PHY to container @@ -114,7 +113,7 @@ info "Booting image using $VERS..." exec qemu-system-aarch64 -M virt \ -m 128 \ -nodefaults \ - $CPU_ARGS -smp 2 \ + $CPU_ARGS -smp $CPU_COUNT \ -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \ -display vnc=:0,websocket=5700 \ -vga none -device ramfb \ diff --git a/src/reset.sh b/src/reset.sh index a9e7767..75a3c3a 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -16,6 +16,7 @@ echo # Docker environment variables +: "${CPU_COUNT:=""}" # Physical LAN interface name : "${WAN_IF:=""}" # Physical WAN interface name : "${LAN_IF:=""}" # Physical LAN interface name : "${USB_VID_1:=""}" # USB vendor ID