Prepare quilt configuration
cat << EOF > ~/.quiltrc
QUILT_DIFF_ARGS="--no-timestamps --no-index -p ab --color=auto"
QUILT_REFRESH_ARGS="--no-timestamps --no-index -p ab"
QUILT_SERIES_ARGS="--color=auto"
QUILT_PATCH_OPTS="--unified"
QUILT_DIFF_OPTS="-p"
EDITOR="vim"
EOF
EDITOR
specifies the preferred editor for interactive patch editing- The other variables control the patch format property like a/, b/ directory names and no timestamps
- FreeBSD does not support the
--color=auto
option and-pab
must be written as-p ab
-p ab
is working with quilt 0.63 on Linux and is documented in man page.
Adding a new patch
make package/example/{clean,prepare} V=s QUILT=1
# or
make package/example/host/{clean,prepare} V=s QUILT=1
cd build_dir/target-*/example-*
quilt push -a
# or add patch other file
quilt import /path/to/010-main_code_fix.patch
quilt new 010-main_code_fix.patch
quilt edit src/main.c
quilt diff
quilt refresh
cd ../../..
make package/example/update V=s
make package/example/{clean,compile} package/index V=s
Edit an existing patch
make package/example/{clean,prepare} V=s QUILT=1
cd build_dir/target-*/example-*
quilt series
quilt push 010-main_code_fix.patch
quilt edit src/main.c
quilt files
quilt diff
quilt refresh
cd ../../../
make package/example/update V=s
make package/example/{clean,compile} package/index V=s
Adding or editing kernel patches
make target/linux/{clean,prepare} V=s QUILT=1
cd build_dir/target-*/linux-*/linux-*
quilt push -a
quilt new generic/010-main_code_fix.patch
or
quilt new platform/010-main_code_fix.patch
quilt edit arch/mips/xxx/xxx.c
quilt diff
quilt refresh
cd ../../../..
make target/linux/update V=s
Adding or editing toolchain patches
make toolchain/gcc/{clean,prepare} V=99 QUILT=1
cd build_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/gcc-4.3.3
make toolchain/gcc/update V=99
Naming patches
The patches-* subdirectories contain the kernel patches applied for every OpenWrt target. All patches should be named 'NNN-lowercase_shortname.patch' and sorted into the following categories: 0xx - upstream backports 1xx - code awaiting upstream merge 2xx - kernel build / config / header patches 3xx - architecture specific patches 4xx - mtd related patches (subsystem and drivers) 5xx - filesystem related patches 6xx - generic network patches 7xx - network / phy driver patches 8xx - other drivers 9xx - uncategorized other patches ALL patches must be in a way that they are potentially upstreamable, meaning: - they must contain a proper subject - they must contain a proper commit message explaining what they change - they must contain a valid Signed-off-by line
Refreshing patches
# packge make package/example/refresh V=s # kernel make target/linux/refresh V=s
套件路經
make package/feeds/packages/rp-pppoe/prepare V=s QUILT=1
make package/feeds/packages/rp-pppoe/update V=s
make package/feeds/packages/rp-pppoe/compile package/index V=s
make package/easycwmp/prepare V=s QUILT=1
make package/easycwmp/update V=s
make package/easycwmp/compile package/index V=s
make package/network/services/ppp/prepare V=s QUILT=1
make package/network/services/ppp/update V=s
make package/network/services/ppp/compile package/index V=s
make package/boot/uboot-mediatek/prepare V=s QUILT=1
make package/boot/uboot-mediatek/update V=s
make package/boot/uboot-mediatek/compile package/index V=s
make package/feeds/packages/rp-pppoe/prepare V=s QUILT=1
make package/feeds/packages/rp-pppoe/update V=s
make package/feeds/packages/rp-pppoe/compile package/index V=s
參考資料
https://openwrt.org/docs/guide-developer/toolchain/use-patches-with-buildsystem