Skip to content

Commit

Permalink
Make OpenWrt memory customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbrechtL committed Nov 27, 2024
1 parent 3ccc1e4 commit b850010
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
15 changes: 10 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ services:
#OPENWRT_VERSION: "master"

environment:
#DEBUG: "y"

# Define number of VM CPUs
CPU_COUNT: 2

# Define which physical or virtual interfaces shall be attach direct to OpenWrt
# If WAN_IF/LAN_IF is missing then "host" mode is selected
# -
Expand All @@ -39,6 +34,16 @@ services:
#USB_1: "0bda:8153"
#USB_2: "0e8d:7961"

# Define number of VM CPUs
# If unset -> 1
CPU_COUNT: 2

# Define amount of VM memory in MB
# If unset -> 256
RAM_COUNT: 256

#DEBUG: "y"

ports:
# Port 8006 is console tty web VNC
- 8006:8006
Expand Down
3 changes: 2 additions & 1 deletion src/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ warn () { printf "%b%s%b" "\E[1;31m❯ " "Warning: $1" "\E[0m\n"; }
trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR

# Docker environment variables
: "${CPU_COUNT:=""}" # Physical LAN interface name
: "${CPU_COUNT:="1"}" # Number of virtualized CPUs
: "${RAM_COUNT:="256"}" # Amount of memory
: "${WAN_IF:=""}" # Physical WAN interface name
: "${LAN_IF:=""}" # Physical LAN interface name
: "${USB_1:=""}" # USB 1 vendor and device ID
Expand Down
2 changes: 1 addition & 1 deletion src/run_openwrt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ info "Booting image using $VERS..."
#************************ FINAL BOOTING ************************
exec qemu-system-"$CPU_ARCH" \
--enable-kvm -cpu host \
-m 256 \
-m $RAM_COUNT \
-nodefaults \
$CPU_ARGS -smp $CPU_COUNT \
-display vnc=:0,websocket=5700 \
Expand Down
26 changes: 25 additions & 1 deletion u-os-app/manifest.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": "0.2",
"version": "APPVERSION_TO_INSERT",
"title": "OpenWrt preview",
"description": "Open source OpenWrt software router project (https://openwrt.org/). This software router preview requires a UC20-M3000/4000 with enabled KVM Linux kernel feature. Otherwise it will be unusable slow.",
"description": "Open source OpenWrt software router project (https://openwrt.org/). This software router preview requires a UC20-M3000/4000 with enabled KVM Linux kernel feature.",
"logo": "openwrt_logo_text_vertical_blue_and_dark_blue.svg",
"vendor": {
"name": "Albrecht Lohofener",
Expand Down Expand Up @@ -174,6 +174,30 @@
"value": "4"
}
]
},
{
"name": "RAM_COUNT",
"label": "Amount of memory",
"description": "You can select how much memory OpenWrt can use. Leave it by default if you are unsure. Default is 256 MB.",
"select": [
{
"label": "250 MB",
"value": "250",
"default": true
},
{
"label": "512 MB",
"value": "512"
},
{
"label": "1024 MB",
"value": "1024"
},
{
"label": "2048 MB",
"value": "2048"
}
]
}
]
}
Expand Down

0 comments on commit b850010

Please sign in to comment.