答:使用quilt工具
步骤如下:
1. 配置quilt
$cat> ~/.quiltrc <<EOF
QUILT_DIFF_ARGS="--no-timestamps --no-index -pab --color=auto"
QUILT_REFRESH_ARGS="--no-timestamps --no-index -pab"
QUILT_PATCH_OPTS="--unified"
QUILT_DIFF_OPTS="-p"
EDITOR="vim"
EOF
注意:EDITOR=”vim”指定默认的编辑器为vim
2. 为内核生成补丁示例
2.1 清空内核
make target/linux/{clean,prepare} V=s QUILT=1
2.2 创建内核补丁
切换到build_dir/target-<arch>/linux-<board>_<arch>/linux-<version>目录下(也就是openwrt的编译内核的目录)
quilt new my-patch.patch
将要修改的文件arch/arm/boot/dts/Makefile 添加进来以便与patch关联起来:quilt add arch/arm/boot/dts/Makefile
修改arch/arm/boot/dts/Makefile: quilt edit arch/arm/boot/dts/Makefile
quilt refresh (更新补丁)
经过以上操作,内核补丁作完毕,可以在build_dir/target-<arch>/linux-<board>_<arch>/linux-<version>/patches目录中找到补丁
2.3 将补丁放置到适当的目录
切换到openwrt的根目录
将patch会写到对应的补丁目录下:make target/linux/update