美文网首页路由联盟我用 Linux工具癖
XiaomiRouter自学之路(11-Openwrt配置编译烧

XiaomiRouter自学之路(11-Openwrt配置编译烧

作者: Creator_Ly | 来源:发表于2017-03-07 17:30 被阅读962次
    题图:gratisography

    XiaomiRouter自学之路(11-Openwrt配置编译烧录)

    已经从官方clone了Openwrt系统,接下去就对其进行配置编译,通过U-boot在线烧录firmware查看是否能正常启动。

    对于如何clone编译Openwrt,可以查看以前的文章Openwrt clone and bulid,里面有详细的说明,这边也进行简要的步骤说明。

    1.通过make menuconfig进行配置,选择小米路由器的平台,如下:

    Target System ---> (Ralink RT288x/RT3xxx)                  
    Subtarget ---> (MT7620 based boards)          
    Target Profile ---> (Xiaomi MiWiFi Mini)  
    Target Images  ---> (jffs2、squashfs)
    

    2.由于以前已经有编译过Openwrt,dl下面的很多文件都是公用的,所以将以前的dl文件夹通过ln -s链接到小米路由器的Openwrt下,省去重新下载tar包的时间。(如果以前没有搭建过Openwrt的环境,那就不需要这一步了,直接执行下一步)

    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.通过make V=99对Openwrt进行编译,编译完成后,在bin目录下会有如下文件,我们将openwrt-ramips-mt7620-xiaomi-miwifi-mini-squashfs-sysupgrade.bin文件拷贝出去用来更新用。

    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.启动路由器后,根据提示可以知道选择2为更新firmware到spi flash并启动。

    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后进行网络和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.一切准备就绪后就可以按下Enter键进行上传烧录启动了,如果一切正常,在console上应该可以观察到,先是上传数据,然后是写入到spi中,最后进行启动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好像帮我们把什么都做好了,这么的匹配,烧录完就直接就启动了,不知道该开心还是伤心,没办法在遇到问题中学习。

    8.当系统启动完成后,这时按下Enter键,发现没办法进入命令行模式,会看到如下信息:

    [    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.提示找不到文件系统,说明上面配置编译出来的image里面不包含文件系统或其他原因?这边由于以前没弄过,暂时还没有什么思路,后期将往这方面接着努力。

    Openwrt配置编译烧录的分析就到这边,有感悟时会持续会更新。

    注:以上内容都是本人在学习过程积累的一些心得,难免会有参考到其他文章的一些知识,如有侵权,请及时通知我,我将及时删除或标注内容出处,如有错误之处也请指出,进行探讨学习。文章只是起一个引导作用,详细的数据解析内容还请查看XiaomiRouter相关教程,感谢您的查阅。

    相关文章

      网友评论

        本文标题:XiaomiRouter自学之路(11-Openwrt配置编译烧

        本文链接:https://www.haomeiwen.com/subject/kfbegttx.html