Skip to content

Install on Asus stock firmware

rah66 edited this page Jun 28, 2021 · 13 revisions

Introduction

It's related to any modern ASUS router with USB port: RT-N10U, RT-N13U, RT-N15U, RT-N16, RT-N56U, RT-N65U, RT-N66U, RT-AC66U and so on. Asus stock firmware partially based on TomatoUSB code, so we may use a custom start/stop scripts to ignite external services from USB drive.

Newer versions of routers (like RT-AX88U) with recent stock firmware will show '/opt' directory exists and is read-only. So if this is the case for you then please continue reading for workaround. Because this is only a symbolic link that points to '/tmp/opt' (which doesn't exist by default), all we need to do is create/mount it and then '/opt' will work. So for the USB disk that you use, create an NTFS partition with the label 'opt' (I could not mount it manually as EXT2/3/4 so it must be NTFS.) After creating the NTFS partition and plugging the USB disk into your router. SSH/Telnet into your router and type the following:

cd /tmp
mkdir opt
blkid

That last command will show you the partitions of your USB-drive storage. Look for the 'opt' label(for the NTFS partition you created) and take note of the '/dev/sdX#' (where X is the partition letter and # the number) of the 'opt' partition:

mount /dev/sdX# /tmp/opt
cd /root
chmod 644 .wget-hsts

Without doing that last command, you will get 'HSTS will be disabled' errors when running the entware install script below. To have 'opt' auto-mount after reboot you will need to create a startup script and add it to nvram so it survives reboots.

So what we want to do first is create the startup script, to do that we will use vi since it is the only text editor installed by default. In SSH, type 'vi /jffs/scripts/mountOpt' to create and start editing the script. Once it's open hit the 'i' key on your keyboard, this allows us to begin editing. Copy/Paste the following and make sure to edit '/dev/sdX#' to what you used before to mount your 'opt' partition.

#!/bin/sh
# recreate the opt dir after every reboot
mkdir /tmp/opt
# where /dev/sdX# is your usb opt partition
mount /dev/sdX# /tmp/opt

If the command mount /dev/sdX# /tmp/opt raises an error - read-only, use mount /dev/sdX# /opt (working with EXT2/3/4)

Once you have finished editing then hit the 'Esc' key and then type ':x' and 'Enter' to save the file and close the text editor. Finally these are the commands that will run the startup script each time your USB-drive is connected which includes each time your router boots up with your USB-drive attached.

nvram set script_usbmount="/jffs/scripts/mountOpt"
nvram commit

You're all set! Each time your router is rebooted, it will mount 'opt' so that entware and the apps you install can be used. If you had to do this workaround then you can skip the next section and go directly to deploying entware. Good luck!

Prepare USB disk with clean ext2/ext3/ext4 partition with some label (MYPART label is used in script below). USB partitions will be mounted by it's label.

Start scripts

Open telnet/ssh console and copy & past following scripts:

cat << EOF > /tmp/script_usbmount.tmp
if [ \$1 = "/tmp/mnt/MYPART" ]
then
ln -sf \$1 /tmp/opt
/opt/etc/init.d/rc.unslung start
fi
EOF
nvram set script_usbmount="`cat /tmp/script_usbmount.tmp`"

cat << EOF > /tmp/script_usbumount.tmp
if [ \$1 = "/tmp/mnt/MYPART" ]
then
/opt/etc/init.d/rc.unslung stop
fi
EOF
nvram set script_usbumount="`cat /tmp/script_usbumount.tmp`"

nvram commit 
reboot

Deploying Entware

First check your kernel version with uname -rm. If your kernel is 4.1 or higher and your architecture is aarch64 use either aarch64-k3.10 (64-bit) or armv7sf-k3.2 (32-bit) repo. If your kernel is 3.2 or higher and your architecture is arm use armv7sf-k3.2 repo. If your kernel is 2.6.36 and your architecture is arm use armv7sf-k2.6 repo. If your kernel is 2.6.22 and your architecture is mipsel you can use either Entware-backports or legacy Entware-ng (deprecated) repo.

After reboot, open telnet/ssh console and type following command.

  • Standard install on aarch64 4.1+ devices (RT-AC86U, RT-AX88U, e.t.c):
wget -O - http://bin.entware.net/aarch64-k3.10/installer/generic.sh | sh
or
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | sh
  • Standard install on arm 3.2+ devices (RT-AC58U, e.t.c):
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | sh
  • Standard install on arm 2.6.36 devices (RT-AC66U B1, RT-AC68U, RT-AC56U, RT-AC87U, RT-AC3200, RT-AC88U, RT-AC3100, RT-AC5300, e.t.c):
wget -O - http://bin.entware.net/armv7sf-k2.6/installer/generic.sh | sh

refer README.md

  • Entware-ng (deprecated) on mipsel 2.6.22 devices (RT-N66U, RT-AC66U, RT-N16, e.t.c):
wget -O - http://pkg.entware.net/binaries/mipsel/installer/installer.sh | sh

Other arm installers can be found here Alternative-install-vs-standard.

Clone this wiki locally