#固件生成命令
make image PROFILE=TLWR703 PACKAGES="luci librt libpthread libjpeg kmod-nls-utf8 kmod-fs-vfat kmod-i2c-core kmod-input-core kmod-usb-ohci kmod-usb-storage kmod-usb-storage-extras kmod-usb-uhci kmod-video-core kmod-video-uvc mjpg-streamer kmod-usb-hid kmod-hid kmod-input-evdev block-mount kmod-fs-ext4 kmod-fs-vfat kmod-fs-ntfs" FILES=wr703n
1. WinPM 格式化U盘为ext3(先删除原分区再进行新分区)
2. 插入U盘, 查看相关的设备符
root@OpenWrt:~# ls /dev/sda*
/dev/sda /dev/sda1
执行如下命令
#挂载U盘第一个分区到/mnt
mount /dev/sda1 /mnt
mkdir /tmp/root
#挂载并同步系统根目录“/”到/tmp/root, 此时可以查看本目录
mount -o bind / /tmp/root
#拷贝/tmp/root下所有文件到“/mnt”,这个其实就是你的U盘了
cp /tmp/root/* /mnt -a
umount /mnt
umount /tmp/root
#和USB启动区分
echo Booted from internal rom >> /etc/banner
echo option force_space >> /etc/opkg.conf
#修改配置文件: /etc/config/fstab
config mount
option target /mnt
option device /dev/sda1
option fstype ext3
option options rw,sync
option enabled 1
option is_rootfs 1
option enabled_fsck 1
重启路由器, 正确信息如下
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 1.8G 20.7M 1.7G 1% /
/dev/root 2.5M 2.5M 0 100% /rom
tmpfs 14.4M 80.0K 14.3M 1% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/sda1 1.8G 20.7M 1.7G 1% /overlay
overlayfs:/overlay 1.8G 20.7M 1.7G 1% /
#错误如下
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 4.7M 296.0K 4.4M 6% /
/dev/root 2.5M 2.5M 0 100% /rom
tmpfs 14.4M 80.0K 14.3M 1% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock3 4.7M 296.0K 4.4M 6% /overlay
/dev/sda1 1.8G 33.5M 1.7G 2% /tmp/overlay-disabled
overlayfs:/overlay 4.7M 296.0K 4.4M 6% /
解决: 此时可以挂载在 /tmp/overlay-disabled.
重新用WinPM 格式化U盘, 重新启动后正常.
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 1.8G 13.6M 1.7G 1% /
/dev/root 2.5M 2.5M 0 100% /rom
tmpfs 14.4M 80.0K 14.3M 1% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/sda1 1.8G 13.6M 1.7G 1% /overlay
overlayfs:/overlay 1.8G 13.6M 1.7G 1% /
/dev/sda1 1.8G 13.6M 1.7G 1% /mnt
overlayfs:/overlay 1.8G 13.6M 1.7G 1% /tmp/root
解决:
umount /mnt
umount /tmp/root
-----------------------------------------------------------------------------------------------
root@OpenWrt:~# dmesg | grep usb
[ 8.030000] usbcore: registered new interface driver usbfs
[ 8.040000] usbcore: registered new interface driver hub
[ 8.050000] usbcore: registered new device driver usb
[ 8.890000] usbcore: registered new interface driver usb-storage
[ 8.940000] usb 1-1: new high-speed USB device number 2 using ath79-ehci
[ 9.370000] usb 1-1.3: new full-speed USB device number 3 using ath79-ehci
[ 9.480000] usb 1-1.3: config 1 has an invalid interface number: 1 but max is 0
[ 9.480000] usb 1-1.3: config 1 has no interface number 0
[ 9.570000] usb 1-1.4: new full-speed USB device number 4 using ath79-ehci
[ 9.680000] scsi0 : usb-storage 1-1.4:1.0
[ 34.150000] usbcore: registered new interface driver ums-alauda
[ 34.170000] usbcore: registered new interface driver ums-cypress
[ 34.190000] usbcore: registered new interface driver ums-datafab
[ 34.210000] usbcore: registered new interface driver ums-freecom
[ 34.220000] usbcore: registered new interface driver ums-isd200
[ 34.240000] usbcore: registered new interface driver ums-jumpshot
[ 34.260000] usbcore: registered new interface driver ums-karma
[ 34.280000] usbcore: registered new interface driver ums-sddr09
[ 34.300000] usbcore: registered new interface driver ums-sddr55
[ 34.430000] usbcore: registered new interface driver ums-usbat
[ 34.760000] generic-usb 0003:0483:D0D0.0001: hiddev0: USB HID v1.10 Device [STMicroelectronics CR95HF] on usb-ar933x-ehci-1.3/input1
[ 34.770000] usbcore: registered new interface driver usbhid
[ 34.770000] usbhid: USB HID core driver
[ 34.800000] usbcore: registered new interface driver uvcvideo
[ 202.020000] usb 1-1.4: USB disconnect, device number 4
[ 896.270000] usb 1-1.2: new full-speed USB device number 5 using ath79-ehci
[ 896.380000] scsi1 : usb-storage 1-1.2:1.0
[ 896.380000] usb 1-1.3: USB disconnect, device number 3
[ 1110.050000] usb 1-1.2: USB disconnect, device number 5
[ 1121.040000] usb 1-1.4: new full-speed USB device number 6 using ath79-ehci
[ 1121.150000] scsi2 : usb-storage 1-1.4:1.0
[ 1175.590000] usb 1-1.4: USB disconnect, device number 6
[ 1187.090000] usb 1-1.4: new full-speed USB device number 7 using ath79-ehci
[ 1187.200000] scsi3 : usb-storage 1-1.4:1.0
[ 1215.780000] usb 1-1.4: USB disconnect, device number 7
[ 1220.880000] usb 1-1.4: new full-speed USB device number 8 using ath79-ehci
[ 1221.000000] scsi4 : usb-storage 1-1.4:1.0
[ 1244.710000] usb 1-1.4: USB disconnect, device number 8
[ 1251.860000] usb 1-1.4: new full-speed USB device number 9 using ath79-ehci
[ 1251.980000] scsi5 : usb-storage 1-1.4:1.0