XiaomiRouter自學(xué)之路(11-Openwrt配置編譯燒錄)
已經(jīng)從官方clone了Openwrt系統(tǒng),接下去就對(duì)其進(jìn)行配置編譯,通過(guò)U-boot在線燒錄firmware查看是否能正常啟動(dòng)。
對(duì)于如何clone編譯Openwrt,可以查看以前的文章Openwrt clone and bulid,里面有詳細(xì)的說(shuō)明米罚,這邊也進(jìn)行簡(jiǎn)要的步驟說(shuō)明。
1.通過(guò)make menuconfig
進(jìn)行配置丈探,選擇小米路由器的平臺(tái)录择,如下:
Target System ---> (Ralink RT288x/RT3xxx)
Subtarget ---> (MT7620 based boards)
Target Profile ---> (Xiaomi MiWiFi Mini)
Target Images ---> (jffs2、squashfs)
2.由于以前已經(jīng)有編譯過(guò)Openwrt碗降,dl下面的很多文件都是公用的隘竭,所以將以前的dl文件夾通過(guò)ln -s
鏈接到小米路由器的Openwrt下,省去重新下載tar包的時(shí)間遗锣。(如果以前沒有搭建過(guò)Openwrt的環(huán)境货裹,那就不需要這一步了,直接執(zhí)行下一步)
linye@ubuntu:~/XiaomiRouter/Openwrt$ ln -s ../../Openwrt/dl dl
linye@ubuntu:~/XiaomiRouter/Openwrt$ ls
BSDmakefile dl include package scripts tmp
config docs LICENSE README staging_dir toolchain
Config.in feeds.conf.default Makefile rules.mk target tools
3.通過(guò)make V=99
對(duì)Openwrt進(jìn)行編譯精偿,編譯完成后弧圆,在bin目錄下會(huì)有如下文件,我們將openwrt-ramips-mt7620-xiaomi-miwifi-mini-squashfs-sysupgrade.bin
文件拷貝出去用來(lái)更新用笔咽。
linye@ubuntu:~/XiaomiRouter/Openwrt/bin/ramips$ ls
md5sums
openwrt-ramips-mt7620-root.jffs2-128k
openwrt-ramips-mt7620-root.jffs2-64k
openwrt-ramips-mt7620-root.squashfs
openwrt-ramips-mt7620-uImage.bin
openwrt-ramips-mt7620-vmlinux.bin
openwrt-ramips-mt7620-vmlinux.elf
openwrt-ramips-mt7620-xiaomi-miwifi-mini-squashfs-sysupgrade.bin
packages
sha256sums
4.啟動(dòng)路由器后搔预,根據(jù)提示可以知道選擇2為更新firmware到spi flash并啟動(dòng)。
Please choose the operation:
0: System Load Linux then write to Flash via Serial.
1: Load system code to SDRAM via TFTP.
2: Load system code then write to Flash via TFTP.
3: Boot system code via Flash.
4: Entr boot command line interface.(default)
7: Load Boot Loader code then write to Flash via Serial.
8: System Load UBoot to SDRAM via TFTP.
9: Load Boot Loader code then write to Flash via TFTP.
5.選擇2后進(jìn)行網(wǎng)絡(luò)和firmware名稱的輸入叶组,把Tftpd32開啟并選擇firmware所在的位置
2: System Load Linux Kernel then write to Flash via TFTP.
Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)
Please Input new ones /or Ctrl-C to discard
Input device IP (192.168.128.1) ==:192.168.128.1
Input server IP (192.168.128.32) ==:192.168.128.32
Input Linux Kernel filename () ==:openwrt-ramips-mt7620-xiaomi-miwifi-mini-squashfs-sysupgrade.bin
6.一切準(zhǔn)備就緒后就可以按下Enter鍵進(jìn)行上傳燒錄啟動(dòng)了拯田,如果一切正常,在console上應(yīng)該可以觀察到甩十,先是上傳數(shù)據(jù)船庇,然后是寫入到spi中,最后進(jìn)行啟動(dòng)image侣监,大概如下信息:
TFTP from server 192.168.128.32; our IP address is 192.168.128.1
Filename 'openwrt-ramips-mt7620-xiaomi-miwifi-mini-squashfs-sysupgrade.bin'.
TIMEOUT_COUNT=10,Load address: 0x80100000
Loading: Got ARP REPLY, set server/gtwy eth addr (00:0c:07:14:05:2d)
Got it
#################################################################
#################################################################
#################################################################
################
done
Bytes transferred = 3407876 (340004 hex)
NetBootFileXferSize= 00340004
raspi_erase_write: offs:40000, count:340004
raspi_erase: offs:40000 len:340000
....................................................
raspi_write: 80100000 to:40000 len:340000
....................................................
raspi_read: from:40000 len:10000
raspi_read: from:50000 len:10000
raspi_read: from:60000 len:10000
raspi_read: from:380000 len:10000
Done!
## Booting image at bc040000 ...
raspi_read: from:40000 len:40
Image Name: MIPS OpenWrt Linux-3.18.45
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 1140795 Bytes = 1.1 MB
Load Address: 80000000
Entry Point: 80000000
raspi_read: from:40040 len:11683b
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128
Starting kernel ...
[ 0.000000] Linux version 3.18.45 (linye@ubuntu) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r49389) ) #1 Tue Feb 21 06:02:12 PST 2017
[ 0.000000] Board has DDR2
[ 0.000000] Analog PMU set to hw control
[ 0.000000] Digital PMU set to hw control
[ 0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
7.看到這些信息感覺一切都是那么的順利鸭轮,官方的Uboot、Openwrt好像幫我們把什么都做好了橄霉,這么的匹配窃爷,燒錄完就直接就啟動(dòng)了,不知道該開心還是傷心姓蜂,沒辦法在遇到問題中學(xué)習(xí)按厘。
8.當(dāng)系統(tǒng)啟動(dòng)完成后,這時(shí)按下Enter鍵钱慢,發(fā)現(xiàn)沒辦法進(jìn)入命令行模式逮京,會(huì)看到如下信息:
[ 1.070000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 1.070000] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[ 82.560000] random: nonblocking pool is initialized
9.提示找不到文件系統(tǒng),說(shuō)明上面配置編譯出來(lái)的image里面不包含文件系統(tǒng)或其他原因束莫?這邊由于以前沒弄過(guò)懒棉,暫時(shí)還沒有什么思路御吞,后期將往這方面接著努力。
Openwrt配置編譯燒錄的分析就到這邊漓藕,有感悟時(shí)會(huì)持續(xù)會(huì)更新。
注:以上內(nèi)容都是本人在學(xué)習(xí)過(guò)程積累的一些心得挟裂,難免會(huì)有參考到其他文章的一些知識(shí)享钞,如有侵權(quán),請(qǐng)及時(shí)通知我诀蓉,我將及時(shí)刪除或標(biāo)注內(nèi)容出處栗竖,如有錯(cuò)誤之處也請(qǐng)指出,進(jìn)行探討學(xué)習(xí)渠啤。文章只是起一個(gè)引導(dǎo)作用狐肢,詳細(xì)的數(shù)據(jù)解析內(nèi)容還請(qǐng)查看XiaomiRouter相關(guān)教程,感謝您的查閱沥曹。