Skip to content

Manual Patch

stang6 edited this page Nov 18, 2025 · 4 revisions

Manually Patch Kernel

a. cd ~/ThinkEdge_FW/Hodaka_switch_firmware

b. make target/linux/{clean,prepare} V=sc QUILT=1

c. cd build_dir/target-aarch64_generic_glibc/linux-layerscape_armv8_64b/linux-4.14.336

d. quilt push -a

e. quilt new platform/900-ssrb-01xx-cve-xxxx-xxxx.patch
(Replace with your patch name)
Note: 如果是產生 kernel 的 patch,檔名必須是 platform/xxxx-*.patch,不然不會產生到 kernel 的 patch。

f. quilt edit drivers/i2c/busses/i2c-imx.c
(Replace with the file/code you want to modify)

g. quilt diff

h. quilt refresh

i. cd ../../../../
(Back to the source code path)

j. make target/linux/update V=sc

k. Check patch directory:
ls target/linux/layerscape/patches-4.14/

l. Build and verify:
make target/linux/{clean,compile} -j22

  • If error:

    1. make target/linux/{clean,compile} -j1 V=sc
    2. Troubleshoot
  • If pass:

    1. git status
    2. git add xxxxx.patch
    3. git commit -m "message for the commit"
    4. git push

m. Go to AP to update triage

Manually Patch Packages

Example: package/system/ubox

  1. make package/system/ubox/{clean,prepare} V=s QUILT=1
    Unpacks the source tarball and prepares existing patches as quilt patch series (if any).

  2. cd build_dir/target-aarch64_generic_glibc/ubox-2021-08-03-205defb5/
    Change to the prepared source directory.

  3. quilt push -a
    Apply all existing patches using quilt push, if any.

  4. quilt new 002-logfile_permissions.patch
    Create a new empty patch file.

  5. quilt edit log/logread.c
    Edit the file you want to modify.

  6. quilt diff
    Review the changes using quilt diff.

  7. quilt refresh
    Update the patch file (e.g., 010-main_code_fix.patch) with the new changes.

  8. cd ../../..
    Return to the top-level directory of the buildroot.

  9. make package/system/ubox/update V=sc
    Move the new patch file over to the buildroot and run update.

  10. make package/system/ubox/{clean,compile} -j1 V=sc
    Rebuild the package to test your changes.

Clone this wiki locally