wr703n路由器搭載openwrt系統掛載U盤歷程

去年買的TP-wr703n路由器,刷了openWRT的系統,做了一個簡單的無線監控裝置,最近又給翻出來了想再擴充一下功能,發現內存太小,掛載U盤路程好艱辛,現在寫下來與君共享。

首先什麼是openwrt,這個維基百科裏有很詳細的介紹,這裏只簡要介紹,所謂的openwrt就是一個開源的路由器專用的嵌入式linux系統,輔助龐大的opkg軟件包能擴展很多很多功能。

TP-WR703N路由器  是 TP 在 2011 年推出的一款便攜式 3G 路由器,具備一個可連接 3G 上網卡的標準 USB 口,802.11N 150M 無線網絡,microUSB 供電接口,搭載 Atheros AR7240 CPU 及 Atheros AR9331 芯片組。小巧省電,不到手掌心大,功耗不及 0.5W。

openwrt通用固件中默認不包含usb存儲設備的支持,需要額外安裝,但是由於是一年前刷的固件,現在的軟件包好多都不支持了,opkg update的時候發現所有軟件包源的地址都是錯誤的,只能重新升級固件版本纔行。

升級最新固件

1、從 OpenWrt 官網下載對應型號的固件,由於這個時基於 AR7240 CPU 的,所以在名爲 ar71xx 的目錄下尋找 wr703n 即可。

2、通過 ssh連接上路由器,並用wget 命令下載最新的固件。

3、使用 mtd -r write /tmp/固件名字.bin firmware 成功後會出現 rebooting…… 

安裝usb存儲設備支持包

1、opkg update 更新包列表

2、opkg install kmod-usb-storage block-mount kmod-fs-ext4

安裝完後會出現以下結果

root@OpenWrt:~# opkg install kmod-usb-storage block-mount kmod-fs-ext4
Installing kmod-usb-storage (3.10.49-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/kmod-usb-storage_3.10.49-1_ar71xx.ipk.
Installing kmod-scsi-core (3.10.49-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/kmod-scsi-core_3.10.49-1_ar71xx.ipk.
Installing block-mount (2014-06-22-e0430f5c62f367e5a8e02755412977b02c3fc45e) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/block-mount_2014-06-22-e0430f5c62f367e5a8e02755412977b02c3fc45e_ar71xx.ipk.
Installing kmod-fs-ext4 (3.10.49-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/kmod-fs-ext4_3.10.49-1_ar71xx.ipk.
Installing kmod-lib-crc16 (3.10.49-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/kmod-lib-crc16_3.10.49-1_ar71xx.ipk.
Installing kmod-crypto-hash (3.10.49-1) to root...
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/base/kmod-crypto-hash_3.10.49-1_ar71xx.ipk.
Configuring kmod-scsi-core.
kmod: failed to insert /lib/modules/3.10.49/sd_mod.ko</span><span style="color:#444444;">
Configuring kmod-usb-storage.
Configuring kmod-crypto-hash.
Configuring kmod-lib-crc16.
Configuring block-mount.
Configuring kmod-fs-ext4.
kmod: failed to insert /lib/modules/3.10.49/ext4.ko</span>
不知道爲什麼會出現以上錯誤(有大神知道的話請不吝賜教),
#cat /proc/filesystems 發現並沒有ext4 格式文件系統的支持
#ls /dev 也沒有sdX的設備。

重啓並查看啓動信息

#reboot

#dmesg

發現有以下幾行

[    9.750000] scsi 0:0:0:0: Direct-Access     General  USB Flash Disk   1.00 PQ: 0 ANSI: 2
[    9.760000] sd 0:0:0:0:<span style="color:#ff0000;"> [sda] 15669248 512-byte logical blocks: (8.02 GB/7.47 GiB)</span>
[    9.770000] sd 0:0:0:0: [sda] Write Protect is off
[    9.770000] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[    9.770000] sd 0:0:0:0: [sda] No Caching mode page found
[    9.780000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    9.790000] sd 0:0:0:0: [sda] No Caching mode page found
[    9.790000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    9.810000]  sda: unknown partition table
[    9.810000] sd 0:0:0:0: [sda] No Caching mode page found
[    9.820000] sd 0:0:0:0: [sda] Assuming drive cache: write through
[    9.820000] sd 0:0:0:0: [sda] Attached SCSI removable disk
說明已經檢測到我的U盤了,再查看 /dev 發現 多了一個 sda的文件 ,這就是U盤
趕緊掛載一下 #mkdir /mnt/usb  #mount /dev/sda /mnt/usb 成功…… 

df -h 一下

root@OpenWrt:/mnt/usb# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                  640.0K    564.0K     76.0K  88% /
/dev/root                 2.3M      2.3M         0 100% /rom
tmpfs                    14.1M     76.0K     14.0M   1% /tmp
/dev/mtdblock3          640.0K    564.0K     76.0K  88% /overlay
overlayfs:/overlay      640.0K    564.0K     76.0K  88% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda                  7.2G     16.8M      6.8G   0% /mnt/usb

大功告成,接下來就可以把根文件系統 整個複製到U盤上,然後就可以隨便耍了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章