LEDE嵌入式无线路由系统定制

选择目标编译固件平台

cd ~/source
编辑前检查

make defconfig
make prereq

设置固件默认大小及自定义新硬件
想生成自定义名称固件、机器型号需要修改8处地方
主板CPU是MT7620N
硬件是和ZBT WR8305RT的硬件一样
板子上的真实型号是JGX-X5
固件容量: 16M
十六进制: 0xfb0000
十进制: 16121856≈15.375

`cd ~/source/target/linux/ramips/``

第1步:定义profile文件,用于make menuconfig显示菜单

file="./image/mt7620.mk"
cat >>$file <<EOF

define Device/jlcsswrt
    DTS:= JLCSSWRT
    BLOCKSIZE := 64k
    IMAGE_SIZE := $(ralink_default_fw_size_16M)
    DEVICE_TITLE := MYWRT
endef
TARGET_DEVICES += jlcsswrt
EOF

第2步:sed使用“”时:\t表示制表符

file="./base-files/lib/ramips.sh"
grep "jlcsswrt" $file
if [ $? -ne 0 ];then
num=`grep -A1 -n 'name.*wr8305rt.*' $file  |grep ';;' |awk -F '-' '{print $NR}'`
sed -i "${num}a\\\t*\"MYWRT\")" $file
num=$[$num+1]
sed -i "${num}a\\\t\\tname=\"jlcsswrt\"" $file
num=$[$num+1]
sed -i "${num}a\\\t\\t;;" $file
fi      
grep ".*jlcsswrt.*" $file -C4 -i

第3步:sed使用‘’时:\t表示制表符

file="./base-files/lib/upgrade/platform.sh"
grep "jlcsswrt" $file
if [ $? -ne 0 ];then
sed-i '/wr8305rt/a\\tjlcsswrt|\\' $file
fi
grep "jlcsswrt" $file -C1

第4步:

file="./base-files/etc/diag.sh"
grep "jlcsswrt" $file
if [ $? -ne 0 ];then
sed -i '/wr8305rt/i\\tjlcsswrt|\\' $file
fi
grep 'jlcsswrt' $file -C1

第5步:定义系统led接口

file="./base-files/etc/board.d/01_leds"
grep "jlcsswrt" $file
if [ $? -ne 0 ];then
sed-i '/wr8305rt/i\jlcsswrt|\\' $file
fi
grep "jlcsswrt" $file -A1

第6步:定义network接口

file="./base-files/etc/board.d/02_network"
grep "jlcsswrt" $file
if [ $? -ne 0 ];then
sed -i '/wr8305rt/i\\tjlcsswrt|\\' $file
fi
grep "jlcsswrt" $file -C1

第7步:定义DTS文件,设备型号、内存大小、分区信息等
修改flash分区
由于我们的flash是16M的,修改firmware分区大小为0xfb0000(L45)
(firmware)+(factory)+(uboot-env)+(uboot)=flash
(kernel)+(rootfs)=firmware
(squashfs(ro))+(jffs2(rw,rootfs_data))=rootfs

\cp ./dts/ZBT-WR8305RT.dts./dts/MYWRT.dts
file="./dts/MYWRT.dts"
com=`grep 'compatible.*mt7620n.*$' $file|awk -F '"' '{print $2}'`
sed -i "s#${com}#jlcsswrt#g"$file
model=`grep 'model.*' $file |awk -F'"' '{print $2}'`
sed -i "s#${model}#MYWRT#g"$file
label=`echo $com |awk -F ',' '{print $2}'`
sed -i "s#${label}#jlcsswrt#g"$file
sed -i '/0x50000/s/0x7b0000/0xfb0000/g'$file    #设置固件大小为16M 

grep -i 'MYWRT' $file

第8步:删除文件并重新选择目标固件

rm -rf ~/source/tmp

进入编译菜单,选择目标平台
make menuconfig

Target System (MediaTek Ralink MIPS)  ---> (X) MediaTek Ralink MIPS #选择厂商
Subtarget (MT7620 based boards)  --->(X) MT7620 based boards         #选择CPU类型
Target Profile (MYWRT)  --->(X) MYWRT                #选择目标平台
LuCI --->1. Collections  ---><*> luci                                        #启用web界面支持
LuCI --->2. Modules  --->Translations  ---><*> Chinese (zh-cn)    #添加中文语言包
LuCI --->3. Modules --->Translations ---><*> English (en)               #添加英文语言包
LuCI --->4. Themes ---><*>luci-theme-material          #添加主题

退出前保存

make V=s 编译;
原文:http://www.luyouqiwang.com/xinwen/20402/


本文转自 Linux_woniu 51CTO博客,原文链接:http://blog.51cto.com/linuxcgi/2044602


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值