OpenWRT - qmeu virtual machine
OpenWRT - qmeu virtual machine
Brief
This topic shared about the way how generate an arm-based openwrt image. OpenWRT provides build-in TARGET (armsr) that genearte arm-based images.
Build openwrt image (armsr)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Download repository
# commit 4ff02b46b9 @ 20250718
$ git clone https://github.com/openwrt/openwrt.git
$ cd openwrt/
$ ./script feed update -a
$ ./script feed install -a
$ make menuconfig
# Configurate
# Change Target System (Arm SystemReady (EFI) compliant)
# Check by ./script/diffconfig.sh
CONFIG_TARGET_armsr=y
CONFIG_TARGET_armsr_armv7=y
CONFIG_TARGET_armsr_armv7_DEVICE_generic=y
# compile
$ make
Run openwrt image on qemu
CLI (qemu-system-arm)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Collect image and uboot
mkdir qemu-arm-virt-image/
cp openwrt/bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-squashfs-combined-efi.img.gz .
cp openwrt/bin/targets/armsr/armv7/u-boot-qemu_armv7/u-boot.bin .
# Move to workspace folder
cd qemu-arm-virt-image/
gzip -d openwrt-armsr-armv7-generic-squashfs-combined-efi.img.gz
# Activate
qemu-system-arm \
-M virt \
-cpu cortex-a15 \
-m 512M \
-bios u-boot.bin \
-drive if=none,file=openwrt-armsr-armv7-generic-squashfs-combined-efi.img,id=hd0,format=raw \
-device virtio-blk-device,drive=hd0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-device virtio-net-device,netdev=net0 \
-nographic
qemu-system-arm \
-M virt \
-cpu cortex-a15 \
-m 512M \
-bios u-boot.bin \
-drive if=none,file=openwrt-armsr-armv7-generic-ext4-combined-efi.img,id=hd0,format=raw \
-device virtio-blk-device,drive=hd0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-device virtio-net-device,netdev=net0 \
-nographic
GUI (UTM)
todo: UTM GUI approach
Install UTM on macos via utm official website
Setup UTM virtual machine via openwrt utm tutorial page
1
2
3
4
5
6
7
# check openwrt LAN configuration
root@openwrt:~# uci show network.lan
# change LAN ipaddress for SSH connection
root@openwrt:~# uci set network.lan.ipaddr='10.0.2.2'
root@openwrt:~# uci commit
root@openwrt:~# service network restart
1
user@mac $ ssh root@10.0.2.2
References
This post is licensed under CC BY 4.0 by the author.