Create OpenWrt Style of Patch with Quilt

less than 1 minute read

OpenWrt using its own format of patch file which can be created with quilt. Before creating patches for OpenWrt, we need to create a configuration file for quilt, this is my config file:

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

Creating a patch is straigh-forward, just follow below steps:

make tools/m4/clean V=s QUILT=1
make tools/m4/prepare V=s QUILT=1

cd out/xxx/compile_dir/host/m4-1.4.17
quilt push -a
quilt new 101-Fixed-build-failure.patch
quilt edit lib/fflush.c lib/fpurge.c lib/freadahead.c lib/freading.c lib/fseeko.c lib/stdio-impl.h
quilt diff
quilt refresh
make tools/m4/update V=s
make tools/m4/compile V=s