Need help with customizing OpenWrt image for TP-Link Archer c20 AC750

Hi Everyone,

I am a newbie at this. I never flashed a custom firmware in my router not yet at least.
I wanna re-design the Web-UI of openwrt from The pre-built image and maybe remove some features that are not needed. I am happy to build from the source too. If you can link to a step by step guide on how to build and customize(tweak) the firmware for the device that would be a big help. Is there a way to run the openwrt image on a virtual machine cause i dont wanna brick my router on my first try. I am really looking forward to this project.:heart:.
Thank you :smiley:

Do you wanna implement additional feature in the LUCI ?
Or Changes Menus / Icons ... ?

#!/bin/bash
VMNAME="openwrt5"
DISKSIZE='512000000'
VDI="./disk-${VMNAME}.vdi"
IMGC="openwrt-18.06.2-x86-64-combined-ext4.img.gz"
URL="https://downloads.openwrt.org/releases/18.06.2/targets/x86/64/openwrt-18.06.2-x86-64-combined-ext4.img.gz"

if [ ! -f ./$IMGC ]; then
	wget $URL
fi
if [ ! -f ./$VDI ]; then
	gunzip --stdout $IMGC | VBoxManage convertfromraw --format VDI stdin $VDI $DISKSIZE
fi


VBoxManage createvm --name $VMNAME --register && \
VBoxManage modifyvm $VMNAME \
    --description "openwrt vbox" \
    --ostype "Linux26" \
    --memory "512" \
    --cpus "1" \
    --nic1 "intnet" \
    --nictype1 82540EM \
    --intnet1 "port1" \
    --nic2 "intnet" \
    --nictype2 82540EM \
    --intnet2 "port2" \
    --nic3 "intnet" \
    --nictype3 82540EM \
    --intnet3 "port3" \
    --nic4 "nat" \
    --nictype4 82540EM \
    --uart1 "0x3F8" "4" \
    --uartmode1 "disconnected" && \
VBoxManage storagectl $VMNAME \
    --name "SATA Controller" \
    --add "sata" \
    --portcount "4" \
    --hostiocache "on" \
    --bootable "on" && \
VBoxManage storageattach $VMNAME \
    --storagectl "SATA Controller" \
    --port "1" \
    --type "hdd" \
    --nonrotational "on" \
    --medium $VDI

enjoy!

1 Like

Hi , but thats only the answer howto run openwrt on a virtual machine.

I think he wanted to modify the source and test it before enroll and maybe brick his tp-link. To test the own build isnt necessary to emulate the cpu from the tplink instead of use an x86?

Sorry for replying late.
I just wanna change the UI (change icons/menus/background theme) no implementation of new features after testing and knowing which features i dont want i might remove them

Hi wulfy 23.
Thanks for the script, Do i need to apply that script to my VMware virtual machine .vmx file. Ill be using VMware sorry i forgot to mention that in the post.

If you have linux.

The script will setup a virtualbox for you. Ready to click start in a GUI.

If I were you.... I would then backup and play with the files in;

/usr/lib/lua [ luci ]

It is the easiest way to get started.

I do have ubuntu 14.04 on vmware so that script i just have to save it as .sh file and run it ?.

Yes. Save as .sh and > chmod +x ./script.sh

If you run multiple times, you need to change the VMNAME.

You might also want to change the setting in the VBOX-GUI for the first NIC to BRIDGED.

VM-LANIP

When you power on the VM it will;

  • have an ip of 192.168.1.1

  • serve DHCP out the BRIDGED interface.

For me, when I'm testing I prefer to disable DHCP and give it a static ip on the LAN.

/etc/init.d/dhcp disable
/etc/init.d/dhcp stop

Static ip ( change ip range, gateway and dns for YOUR NETWORK )
/etc/config/network

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0'
	option proto 'static'
	option netmask '255.255.255.0'
	option ipaddr '10.2.3.3'
	option gateway '10.2.3.1'
	option dns '10.2.3.10'

Then restart networking

/etc/init.d/network restart

Okay. I`ll change both then.

The script cant find VBoxManage

ok, you ubuntu is IN vmware.... i think?.... the script is intended for a HOST-OS .... i.e. UBUNTU not in VMWARE...

It is quite easy to make a vm, if you are on windows... the script is just and example of that process...

Yeah its in VMware so do i have to remove the lines of VBoxManage ?

Generally, you can't create a VM in a VM..........

qemu might work if that's what you really want to do......

Can i run that script on MacOS ? its a Host-OS

You can try..... should be pretty compatible....

It doesnt work it says wget not found
and VBoxManage not found.

This may work, otherwise maybe you need to install them?

#!/bin/bash
sNAME="openwrtx64-`date +%Y%m%d-%H%M`"
dirCACHE="${HOME}/cache"; mkdir -p $dirCACHE
VMFOLD="`cat ~/.config/VirtualBox/VirtualBox.xml | grep -i SystemProperties | cut -d'"' -f2`"
VDI="${sNAME}.vdi"
DISKSIZE='512000000'
addOVERLAY="y"
VDIO="${sNAME}-overlay.vdi"
VDIOSZ='1920'
VMNAME="${sNAME}"
IMGC="${dirCACHE}/openwrt-18.06.2-x86-64-combined-ext4.img.gz"
URL="https://downloads.openwrt.org/releases/18.06.2/targets/x86/64/openwrt-18.06.2-x86-64-combined-ext4.img.gz"
VBOXMANAGE="`which VBoxManage`"; if [ -z $VBOXMANAGE ]; then echo "Unable to find VBoxManage... install" && exit; fi
WGET="`which wget`"; if [ -z $WGET ]; then echo "Unable to find wget... install" && exit; fi
GUNZIP="`which gunzip`"; if [ -z $GUNZIP ]; then echo "Unable to find gunzip... install" && exit; fi


echo "Creating VM: $VMNAME"
if [ ! -f "${IMGC}" ]; then
	$WGET "${URL}" -O "${IMGC}"
fi


$VBOXMANAGE createvm --name $VMNAME --register
$VBOXMANAGE modifyvm $VMNAME \
    --description "openwrt vbox" \
    --ostype "Linux26" \
    --memory "512" \
    --cpus "1" \
    --nic1 "intnet" \
    --nictype1 82540EM \
    --intnet1 "port1" \
    --nic2 "intnet" \
    --nictype2 82540EM \
    --intnet2 "port2" \
    --nic3 "intnet" \
    --nictype3 82540EM \
    --intnet3 "port3" \
    --nic4 "nat" \
    --nictype4 82540EM \
    --uart1 "0x3F8" "4" \
    --uartmode1 "disconnected"
$VBOXMANAGE storagectl $VMNAME \
    --name "SATA Controller" \
    --add "sata" \
    --portcount "4" \
    --hostiocache "on" \
    --bootable "on" && \


$GUNZIP --stdout "${IMGC}" | $VBOXMANAGE convertfromraw --format VDI stdin ${VMFOLD}/${VMNAME}/${VDI} $DISKSIZE
$VBOXMANAGE storageattach $VMNAME \
    --storagectl "SATA Controller" \
    --port "1" \
    --type "hdd" \
    --nonrotational "on" \
    --medium $VMFOLD/${VMNAME}/$VDI

if [ "$addOVERLAY" == "y" ]; then
$VBOXMANAGE createhd --filename "$VMFOLD/$VMNAME/$VDIO" --size $VDIOSZ --format VDI
$VBOXMANAGE storageattach $VMNAME \
    --storagectl "SATA Controller" \
    --port "2" \
    --type "hdd" \
    --nonrotational "on" \
    --medium $VMFOLD/$VMNAME/$VDIO
fi

While you could probably change the script to use curl, https://brew.sh/ provides a pretty clean package manager for macOS that would let you install wget.

That VBoxManage is missing suggests that either your PATH is not including it (often at /usr/local/bin/VBoxManage) or that your VirtualBox install was not complete. I'm currently running 6.0.6r130049 on macOS 10.14

I was able to get wget installed using homebrew, I dont have virtual box installed which app should i install ?.
Sorry i am new to hackintoshing. Just to let you know i used the first script.

I am running 10.13.6