openwrt 打PATCH方法

来源:互联网 发布:手机淘宝怎么看直通车 编辑:程序博客网 时间:2024/04/27 22:13

http://wiki.openwrt.org/doc/devel/patches

全来官网


package目录打法
Adding a new patch
1>make package/example/{clean,prepare} V=s QUILT=1
make package/procd/{clean,prepare} V=s QUILT=1


2> cd build_dir/target-*/example-*
quilt new 010-main_code_fix.patch


3>quilt edit src/main.c
src/main.c gets added to 010-main_code_fix.patch


4>quilt refresh
Change back to the toplevel directory of the buildroot.
cd ../../../
To move the new patch file over to the buildroot, run update on the package:


5>make package/example/update V=s
make package/procd/update V=s
Finally rebuild the package to test the changes:


6>make package/example/{clean,compile} package/index V=s
make package/procd/{clean,compile} package/index V=s


tools目录打法
make tools/mkimage/{clean,prepare} V=s QUILT=1
cd build_dir/host/u-boot-2013.07-rc1/
quilt series
quilt new 080-image_h_fangshuaji.patch
quilt edit include/image.h 
quilt refresh 
cd ../../../
make tools/mkimage/update V=s
ls tools/mkimage/patches/
cat tools/mkimage/patches/080-image_h_fangshuaji.patch 
make tools/mkimage/{clean,compile,install} V=s  




内核的打法:
操作步骤:
1、 进入Openwrt目录, make target/linux/{clean,prepare} V=s QUILT=1,这一步将linux内核清理干净,准备修改
2、 进入解压出来的linux内核目录,cd build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-2.6.36/
3、 可以用quilt series来查看对当前内核有什么patch,
4、 使用quilt new platform/0928-sky-mtd.patch,准备开始新patch
5.      quilt edit drivers/mtd/mtdpart.c
5、 进入drivers/mtd目录,编辑mtdpart.c,函数split_rootfs完成flash分区切分
ROOTFS_SPLIT_NAME就是rootfs_data,你模仿这个方式,划分好分区name,size和offset,然后调用add_one_partition添加分区。
6、 将代码修改好后,运行 quilt refresh
7、 回到最顶层目录,执行 make target/linux/update,这时候会生成patch,你可以在target/linux/ramips/patches-2.6.36目录下看到0928-sky-mtd.patch这个patch
8、 客户还要在升级的时候写入一个分区,还要做一个标记,这个你可以直接修改package/base-files/files/sbin/sysupgrade脚本,这个不是用patch形式来修改的
9、 执行make V=s编译生成image。

0 0
原创粉丝点击