openwrt Adding a new patch
Posted xiehj-mh
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了openwrt Adding a new patch相关的知识,希望对你有一定的参考价值。
Adding a new patch
To add a completely new patch to an existing package example start with preparing the source directory:
make package/example/{clean,prepare} V=s QUILT=1 |
For host-side packages, you may want to detail the make target:
make package/example/host/{clean,prepare} V=s QUILT=1 |
This unpacks the source tarball and prepares existing patches as quilt patch series (if any). The verbose output will show where the source got extracted.
Change to the prepared source directory.
cd build_dir/target-*/example-* |
Note : It can happen that you need to go one level lower as the source is extracted in build_dir/target-*/BUILD_VARIANT/example-* . This happens when multiple build variants of a package are defined in the Makefile.
Apply all existing patches using quilt push.
quilt push -a |
Create a new, empty patch file with the quilt new command:
quilt new 010-main_code_fix.patch |
-
The name should start with a number, followed by a hyphen and a very short description of what is changed
-
The chosen number should be higher than any existing patch - use quilt series to see the list of patches
-
The patch file name should be short but descriptive
After creating the empty patch, files to edit must be associated with it. The quilt add command can be used for that - once the file got added it can be edited as usual.
A shortcut for both adding a file and open it in an editor is the quilt edit command:
quilt edit src/main.c |
-
src/main.c
gets added to010-main_code_fix.patch
-
The file is opened in the editor specified with
EDITOR
in.quiltrc
Repeat that for any file that needs to be edited.
After the changes are finished, they can be reviewed with the quilt diff command.
quilt diff |
If the diff looks okay, proceed with quilt refresh to update the 010-main_code_fix.patch
file with the changes made.
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:
make package/example/update V=s |
Finally rebuild the package to test the changes:
make package/example/{clean,compile} package/index V=s |
If problems occur, the patch needs to be edited again to solve the issues. Refer to the section below to learn how to edit existing patches.
以上是关于openwrt Adding a new patch的主要内容,如果未能解决你的问题,请参考以下文章
Adding a prefix header to an iOS project
JMD Handy Baby 2 to Decode & Adding New BMW 525 ID46 Key