本帖最后由 laomao9000 于 2019-6-26 22:48 编辑
缘起:在上个帖子 6月4日-小米路由器PRO(R3P)刷入PandoraBox 19.02,测试完美,稳定 中,刷了PADORABOX固件,使用正常。只是作为不折腾不爽的心理,在反复刷机中又把NAND 固件给搞丢了,机器变砖。手头没有NAND编程器,只能焊接了个16M的SPI 闪存,并刷了一个兼容的SPI固件,目前可以运行,只是不是R3P的专用固件。对于追求完美的发烧友,这是不能接受的,所以,考虑自己适配个SPI固件。
想法:OPENWRT支持R3P,考虑修改其中的闪存配置,支持SPI,编译后刷入SPI闪存。
进展:先用OPENWRT编译,发现没有mt7615的驱动,没有无线;随后找到了MTK的闭源驱动,顺利编译成功。
新驱动支持160MHZ的频宽,2T*2T的网卡可以到1.7G,可玩性大增!
版本:OPENWRT 18.06,LINUX:4.14.127 SPI FLASH:w25q128 16MB ,MTK闭源驱动MT7622_7615_SoftAP_v5.0.2.0_20180430
过程:
一、安装ubuntu a) 下载ubuntu 18.04.2 b) 设置虚拟机 c) 安装ubuntu18.04.2 要点:进入软件和更新,选择阿里云的源 d) 升级组件包 sudo apt-get update 二、准备编译环境 安装依赖关系 sudoapt-get install build-essential asciidoc binutils bzip2 gawk gettext gitlibncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtplibssl-dev texinfo libglib2.0-dev xmlto qemu-utils libelf-dev
下载源码 git clone https://www.github.com/openwrt/openwrt三、配置OPERWRT 进入目录: cd openwrt
更新源: ./scripts/feeds update -a
安装源: ./scripts/feeds install -a
打开配置: make menuconfig 设置必要选项 Target System (MediaTecRalink MIPS) Subtarget (MT7621based board) Target Profile (XiaomiMi Router 3 Pro) LuCI---> 1.Collections ---> <*>luci................... LuCIinterface with Uhttpd as Webserver (default) LuCI ---> 2. Modules---> Translations ---> <*>Chinese (zh-cn) 3.其他部分配置选项,请选择: #添加USB挂载 Base system —> <*>block-mount
#添加硬盘格式支持 Kernel modules —> Filesystems —> <*> kmod-fs-ext4 (移动硬盘EXT4格式选择) Kernel modules —> Filesystems —> <*> kmod-fs-vfat(FAT16 / FAT32 格式 选择) Kernel modules —> Filesystems —> <*> kmod-fs-ntfs (NTFS 格式 选择)
#添加USB相关支持 Kernel modules —> USB Support —> <*> kmod-usb-core. Kernel modules —> USB Support —> <*> kmod-usb-ohci. Kernel modules —> USB Support —> <*> kmod-usb-storage. Kernel modules —> USB Support —> <*> kmod-usb-storage-extras. Kernel modules —> USB Support —> <*> kmod-usb2. Kernel modules —> USB Support —> <*> kmod-usb3.
#添加自动挂载工具 Utilities —> Filesystem —> <*> badblocks
#添加luci应用 LuCI ->Applications —> <*> luci-app-aria2……………………………… LuCI Support for aria2 LuCI ->Applications —> <*> luci-app-ddns……………………… Dynamic DNS configuration module LuCI ->Applications —> <*> luci-app-samba……………….. Network Shares – Samba SMB/CIFSmodule LuCI ->Applications —> <*> luci-app-transmission…………………. LuCI Support forTransmission
完成后,保存退出
3.修改小米路由器PRO的配置,支持SPI闪存。 - 修改~/openwrt/target/linux/ramips/image/mt7621.mk对应的R3P 部分如下,设定了SPI固件大小为16M(可为8M/32M,根据自己的闪存大小来)
define Device/xiaomi_mir3p DTS := MIR3P IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := Xiaomi Mi Router 3 Pro DEVICE_PACKAGES := \ kmod-usb3 kmod-usb-ledtrig-usbportwpad-basic uboot-envtools endef TARGET_DEVICES += xiaomi_mir3p - 修改~/openwrt/target/linux/ramips/dts /MIR3P.dts,
增加SPI支持,设定分区 &spi0{ status = "okay"; m25p80@0 { compatible ="jedec,spi-nor"; reg = <0>; spi-max-frequency =<10000000>; partitions { compatible ="fixed-partitions"; #address-cells =<1>; #size-cells =<1>; partition@0 { label ="u-boot"; reg = <0x00x30000>; read-only; }; partition@30000 { label ="u-boot-env"; reg =<0x30000 0x10000>; read-only; }; factory:partition@40000 { label ="factory"; reg =<0x40000 0x10000>; read-only; }; compatible ="denx,uimage"; label ="firmware"; reg = <0x50000 0xfb0000>; }; }; }; };
删除文件中NAND配置 &nand{ status = "okay"; partitions {
………. …. };
四、编译 1、 先同步软件包: make download V=s -j20 (启动20个线程,加快下载,这样就不用等10个小时了,我用了50分钟下载完毕) 2、 开始编译 make -j1 V=s (第一次编译,不启用多线程。二次编译时可以选-j4,这个考虑你的CPU支持的线程数) 五、刷机
|