|
# 前言
开发板flash为w25q256,是16MByte的,所以需要修改分区表.
# 新建profile
使用下面命令创建一个属于自己的profile(修改会更方便一些,我们直接拷贝一个,然后再修改)
cd target/linux/ramips/mt7628/profiles/
cp 00-default.mk 01-gizwits.mk
修改后的01-gizwits.mk文件如下
#
# Copyright (C) 2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
define Profile/GizWits
NAME:=GizWits Profile
PACKAGES:=\
kmod-usb-core kmod-usb2 kmod-usb-ohci \
kmod-ledtrig-usbdev
endef
define Profile/GizWits/Description
Default package set compatible with most boards.
endef
$(eval $(call Profile,GizWits))
# 新建dts文件
同理,我们基于MT7628.dts,新建一个dts文件。
cd ../../dts/ #切换目录到target/linux/ramips/dts/
cp MT7628.dts GIZWITS.dts
修改GIZWITS.dts,以适配开发板的flash,修改后的GIZWITS.dts
model = "Mediatek MT7628AN evaluation board for Gizwits";
...
palmbus@10000000 {
spi@b00 {
status = "okay";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "w25q256";
reg = <0 0>;
linux,modalias = "m25p80", "w25q256";
spi-max-frequency = <10000000>;
m25p,chunked-io = <32>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "firmware";
reg = <0x50000 0xfb0000>;
};
};
};
# 修改image/Makefile文件
目录target/linux/ramips/image
cd ../image
找到MT7628对应的位置,添加我们的支持
#
# MT7628 Profiles
#
Image/Build/Profile/MT7628=$(call BuildFirmware/Default4M/$(1),$(1),mt7628,MT7628)
Image/Build/Profile/GizWits=$(call BuildFirmware/Default16M/$(1),$(1),GizWits,GIZWITS)
ifeq ($(SUBTARGET),mt7628)
define Image/Build/Profile/Default
$(call Image/Build/Profile/MT7628,$(1))
$(call Image/Build/Profile/GizWits,$(1))
endef
endif
# 编译测试
要使新的profile生效,需要删除tmp目录并重新选择profile
cd ~/openwrt
rm -rf tmp
make menuconfig
在配置页面中选择新建的profile
Target Profile --->
GizWits Profile
重新编译可得到新的固件文件
make V=s
可在bin/ramips中看到新生成的bin文件openwrt-ramips-mt7628-GizWits-squashfs-sysupgrade.bin
# 参考
> http://blog.csdn.net/kobe_zero/article/details/51769635
> http://blog.csdn.net/hnhkj/article/details/54630098
|
|