為 RT-AC56U 安裝 Entware

為 RT-AC56U 安裝 Entware


這裡配合的 firmware 是 Asuswrt-merlin 384.6_0 版.

首先, 準備一個 USB stick 或是 SD card + reader, 然後建立 partition 並且 format 成 ext2, 是的, ext2.

接著, 插上 RT-AC56U 後方的 USB port, 在 web 管理界面開啟 ssh 服務, ssh 上去, 並 mount 剛插上的 USB stick 到以下位置 (如果只插了一根 USB stick, 那 disk 的 device node 應該為 /dev/sda, 第一個 partition 的 device node 則為 /dev/sda1)

$ ssh [email protected]
[email protected]:/tmp/home/root# mkdir -p /tmp/mnt/sda1
[email protected]:/tmp/home/root# mount /dev/sda1 /tmp/mnt/sda1

接著, 直接執行 firewmare 中的 script 初始 Entware, 會立即跟你確認 Entware 放置的位置

[email protected]:/tmp/home/root# entware-setup.sh
 Info:  This script will guide you through the Entware installation.
 Info:  Script modifies "entware" folder only on the chosen drive,
 Info:  no other data will be changed. Existing installation will be
 Info:  replaced with this one. Also some start scripts will be installed,
 Info:  the old ones will be saved on Entware partition with name
 Info:  like /tmp/mnt/sda1/jffs_scripts_backup.tgz

 Info:  Looking for available partitions...
[1] --> /tmp/mnt/sda1
 =>  Please enter partition number or 0 to exit
[0-1]: 1
 Info:  /tmp/mnt/sda1 selected.

接下來會下載一些 package 提供 package 管理功能

 Info:  Creating /tmp/mnt/sda1/entware folder...
 Info:  Creating /tmp/opt symlink...
 Info:  Creating /jffs scripts backup...
tar: /jffs/scripts/*: No such file or directory
tar: error exit delayed from previous errors
 Info:  Modifying start scripts...
 Info:  Enabling custom scripts and configs from /jffs...
Info: Checking for prerequisites and creating folders...
Warning: Folder /opt exists!
Info: Opkg package manager deployment...
--2018-09-01 20:47:48--  http://bin.entware.net/armv7sf-k2.6/installer/opkg
Resolving bin.entware.net...
Connecting to bin.entware.net||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 130968 (128K) [application/octet-stream]
Saving to: '/opt/bin/opkg'

/opt/bin/opkg                               100%[========================================================================================>] 127.90K   170KB/s    in 0.8s    

2018-09-01 20:47:49 (170 KB/s) - '/opt/bin/opkg' saved [130968/130968]

--2018-09-01 20:47:49--  http://bin.entware.net/armv7sf-k2.6/installer/opkg.conf
Resolving bin.entware.net...
Connecting to bin.entware.net||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 190 [application/octet-stream]
Saving to: '/opt/etc/opkg.conf'

/opt/etc/opkg.conf                          100%[========================================================================================>]     190  --.-KB/s    in 0s      

2018-09-01 20:47:50 (4.70 MB/s) - '/opt/etc/opkg.conf' saved [190/190]

--2018-09-01 20:47:50--  http://bin.entware.net/armv7sf-k2.6/installer/ld-2.23.so
Resolving bin.entware.net...
Connecting to bin.entware.net||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 142752 (139K) [application/octet-stream]
Saving to: '/opt/lib/ld-2.23.so'

/opt/lib/ld-2.23.so                         100%[========================================================================================>] 139.41K   190KB/s    in 0.7s    

2018-09-01 20:47:51 (190 KB/s) - '/opt/lib/ld-2.23.so' saved [142752/142752]

--2018-09-01 20:47:51--  http://bin.entware.net/armv7sf-k2.6/installer/libc-2.23.so
Resolving bin.entware.net...
Connecting to bin.entware.net||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1215124 (1.2M) [application/octet-stream]
Saving to: '/opt/lib/libc-2.23.so'

/opt/lib/libc-2.23.so                       100%[========================================================================================>]   1.16M   466KB/s    in 2.5s    

2018-09-01 20:47:54 (466 KB/s) - '/opt/lib/libc-2.23.so' saved [1215124/1215124]

--2018-09-01 20:47:54--  http://bin.entware.net/armv7sf-k2.6/installer/libgcc_s.so.1
Resolving bin.entware.net...
Connecting to bin.entware.net||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 45272 (44K) [application/octet-stream]
Saving to: '/opt/lib/libgcc_s.so.1'

/opt/lib/libgcc_s.so.1                      100%[========================================================================================>]  44.21K  95.0KB/s    in 0.5s    

2018-09-01 20:47:55 (95.0 KB/s) - '/opt/lib/libgcc_s.so.1' saved [45272/45272]

--2018-09-01 20:47:55--  http://bin.entware.net/armv7sf-k2.6/installer/libpthread-2.23.so
Resolving bin.entware.net...
Connecting to bin.entware.net||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 92640 (90K) [application/octet-stream]
Saving to: '/opt/lib/libpthread-2.23.so'

/opt/lib/libpthread-2.23.so                 100%[========================================================================================>]  90.47K   171KB/s    in 0.5s    

2018-09-01 20:47:56 (171 KB/s) - '/opt/lib/libpthread-2.23.so' saved [92640/92640]

Info: Basic packages installation...
Downloading http://bin.entware.net/armv7sf-k2.6/Packages.gz
Updated list of available packages in /opt/var/opkg-lists/entware
Installing entware-opt (227000-3) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/entware-opt_227000-3_all.ipk
Installing libc (2.23-8) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/libc_2.23-8_armv7-2.6.ipk
Installing libgcc (7.3.0-8) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/libgcc_7.3.0-8_armv7-2.6.ipk
Installing libssp (7.3.0-8) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/libssp_7.3.0-8_armv7-2.6.ipk
Installing librt (2.23-8) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/librt_2.23-8_armv7-2.6.ipk
Installing libpthread (2.23-8) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/libpthread_2.23-8_armv7-2.6.ipk
Installing libstdcpp (7.3.0-8) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/libstdcpp_7.3.0-8_armv7-2.6.ipk
Installing entware-release (1.0-2) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/entware-release_1.0-2_all.ipk
Installing zoneinfo-asia (2018e-1) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/zoneinfo-asia_2018e-1_armv7-2.6.ipk
Installing zoneinfo-europe (2018e-1) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/zoneinfo-europe_2018e-1_armv7-2.6.ipk
Installing findutils (4.6.0-1) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/findutils_4.6.0-1_armv7-2.6.ipk
Installing terminfo (6.1-1) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/terminfo_6.1-1_armv7-2.6.ipk
Installing locales (2.23-8) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/locales_2.23-8_armv7-2.6.ipk
Installing grep (2.26-1) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/grep_2.26-1_armv7-2.6.ipk
Installing libpcre (8.41-2) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/libpcre_8.41-2_armv7-2.6.ipk
Installing opkg (2011-04-08-9c97d5ec-17b) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/opkg_2011-04-08-9c97d5ec-17b_armv7-2.6.ipk
Installing entware-upgrade (1.0-1) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/entware-upgrade_1.0-1_all.ipk
Configuring libgcc.
Configuring libc.
Configuring libssp.
Configuring libpthread.
Configuring librt.
Configuring terminfo.
Configuring libpcre.
Configuring grep.
Configuring locales.
Entware uses separate locale-archive file independent from main system
Creating locale archive - /opt/usr/lib/locale/locale-archive
Adding en_EN.UTF-8
Adding ru_RU.UTF-8
You can download locale sources from http://pkg.entware.net/sources/i18n_glib223.tar.gz
You can add new locales to Entware using /opt/bin/localedef.new
Configuring entware-upgrade.
Upgrade operations are not required
Configuring opkg.
Configuring zoneinfo-europe.
Configuring zoneinfo-asia.
Configuring libstdcpp.
Configuring entware-release.
Configuring findutils.
Configuring entware-opt.
Info: Congratulations!
Info: If there are no errors above then Entware was successfully initialized.
Info: Add /opt/bin & /opt/sbin to your PATH variable
Info: Add '/opt/etc/init.d/rc.unslung start' to startup script for Entware services to start
Info: Found a Bug? Please report at https://github.com/Entware/Entware/issues

如果你跟我一樣幸運的的話, 至此 Entware 就裝好了. 確認下

[email protected]:/tmp/home/root# cd /tmp/mnt/sda1
[email protected]:/tmp/mnt/sda1# ls
entware                                   jffs_scripts_backup_2018-09-01_20-47.tgz  lost+found

主要的內容都在新增的 entware 目錄下. 此時 opkg 命令已經可用, 參數如下

[email protected]:/tmp/home/root# opkg 
opkg must have one sub-command argument
usage: opkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
	update			Update list of available packages
	upgrade			Upgrade installed packages
	install <pkgs>		Install package(s)
	configure <pkgs>	Configure unpacked package(s)
	remove <pkgs|regexp>	Remove package(s)
	flag <flag> <pkgs>	Flag package(s)
	 <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)

Informational Commands:
	list			List available packages
	list-installed		List installed packages
	list-upgradable		List installed and upgradable packages
	list-changed-conffiles	List user modified configuration files
	files <pkg>		List files belonging to <pkg>
	search <file|regexp>	List package providing <file>
	find <regexp>		List packages whose name or description matches <regexp>
	info [pkg|regexp]	Display all info for <pkg>
	status [pkg|regexp]	Display all status for <pkg>
	download <pkg>		Download <pkg> to current directory
	compare-versions <v1> <op> <v2>
	                    compare versions using <= < > >= = << >>
	print-architecture	List installable package architectures
	depends [-A] [pkgname|pat]+
	whatdepends [-A] [pkgname|pat]+
	whatdependsrec [-A] [pkgname|pat]+
	whatrecommends[-A] [pkgname|pat]+
	whatsuggests[-A] [pkgname|pat]+
	whatprovides [-A] [pkgname|pat]+
	whatconflicts [-A] [pkgname|pat]+
	whatreplaces [-A] [pkgname|pat]+

	-A			Query all packages not just those installed
	-V[<level>]		Set verbosity level to <level>.
	--verbosity[=<level>]	Verbosity levels:
					0 errors only
					1 normal messages (default)
					2 informative messages
					3 debug
					4 debug level 2
	-f <conf_file>		Use <conf_file> as the opkg configuration file
	--conf <conf_file>
	--cache <directory>	Use a package cache
	-d <dest_name>		Use <dest_name> as the the root directory for
	--dest <dest_name>	package installation, removal, upgrading.
				<dest_name> should be a defined dest name from
				the configuration file, (but can also be a
				directory name in a pinch).
	-o <dir>		Use <dir> as the root directory for
	--offline-root <dir>	offline installation of packages.
	--add-arch <arch>:<prio>	Register architecture with given priority
	--add-dest <name>:<path>	Register destination with given path

Force Options:
	--force-depends		Install/remove despite failed dependencies
	--force-maintainer	Overwrite preexisting config files
	--force-reinstall	Reinstall package(s)
	--force-overwrite	Overwrite files from other package(s)
	--force-downgrade	Allow opkg to downgrade packages
	--force-space		Disable free space checks
	--force-postinstall	Run postinstall scripts even in offline mode
	--force-remove	Remove package even if prerm script fails
	--force-checksum	Don't fail on checksum mismatches
	--noaction		No action -- test only
	--download-only	No action -- download only
	--nodeps		Do not follow dependencies
	--nocase		Perform case insensitive pattern matching
	--size			Print package size when listing available packages
				Remove package and all dependencies
	--autoremove		Remove packages that were installed
				automatically to satisfy dependencies
	-t			Specify tmp-dir.
	--tmp-dir		Specify tmp-dir.
	-l			Specify lists-dir.
	--lists-dir		Specify lists-dir.

 regexp could be something like 'pkgname*' '*file*' or similar
 e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'

例如, 我們想把 shell 改成 bash, 確認下是否有這個 package

[email protected]:/tmp/home/root# opkg list | grep bash
bash - 4.4.18-1 - Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh and csh).

有的, 那裝上

[email protected]:/tmp/home/root# opkg install bash
Installing bash (4.4.18-1) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/bash_4.4.18-1_armv7-2.6.ipk
Configuring bash.

看一下 bash 被裝在了什麼位置

[email protected]:/tmp/home/root# opkg files bash
Package bash (4.4.18-1) is installed on root and has the following files: