启用jffs

打开Web界面,进入Administration -> Management,找到”JFFS2 Support”节。默认状态下”Internal Flash Storage”应该是”Disable”的。

  1. 设置”Internal Flash Storage”为”Enable”,点击”Save”,再点击”Apply Settings”
  2. 设置”Clean Internal Flash Storage”为”Enable”,点击”Apply Settings”
  3. 此时应该能看到”Total / Free Size”处显示出了容量,例如”93.75MB / 91.33MB”
  4. 将”Clean Internal Flash Storage”改回”Disable”,点击”Save”再”Apply Settings”

启用USB

首先将USB盘插入R7000背面的USB2.0口中。我用的是一个256MB的小优盘。

打开Web界面,进入”Service” -> “USB”。然后进行以下设置:

  1. 设置”Core USB Support”为”Enable”,点击”Apply Settings”。
  2. 设置”USB Storage Support”为”Enable”,点击”Apply Settings”。
  3. 设置”Automatic Drive Mount”为”Enable”,点击”Apply Settings”。

此时通过ssh进入命令行,输入mount命令应该能看到优盘(通常为/dev/sda1)被mount到了/tmp/mnt/sda1。如果优盘不是ext2系统,可以通过fdiskmke2fs命令重新分区并格式化。

最后回到Web界面,将/dev/sda1的UUID(在Web界面上可以看到)填入”Mount this partition to /opt”中,以便路由器启动时能够自动挂载。

安装opkg

Kong的dd-wrt已经自带了opkg,只不过需要在启用USB之后安装一下。将USB挂载到/opt之后,运行

bootstrap

简单回答几个问题即可完成opkg的安装。

安装结束之后,打开/opt/etc/opkg.conf,填写以下内容:

src/gz base http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/base
src/gz kernel http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/kernel
src/gz luci http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/luci
src/gz management http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/management
src/gz packages http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/packages
src/gz routing http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/routing
src/gz targets http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/targets
src/gz telephony http://downloads.openwrt.org/snapshots/trunk/bcm53xx/generic/packages/telephony
dest root /opt
dest ram /tmp
lists_dir ext /opt/var/opkg-lists
option overlay_root /overlay
option check_signature 1

然后执行:

# opkg update
# opkg list

安装时opkg可能会报告找不到libc,只需要加上--force-depends强制安装即可。

# opkg install vim --force-depends

推荐的opkg packages

我只装了两个:

# opkg install vim
# opkg install htop

htop在执行时会报告terminal错误,可以通过以下命令解决:

export TERMINFO=/opt/usr/share/terminfo

我建了个/tmp/root/.profile文件如下:

alias vi='vim'
export TERMINFO=/opt/usr/share/terminfo

为避免重启路由器时内容丢失,可以将这个文件保存到/jffs/profile/.profile,然后通过Web界面添加一条启动命令(”Administration” -> “Commands” -> “Save Startup”):

# copy profile for shell
cp /jffs/profile/.* /tmp/root