文章目录
修改linux内核源码生成补丁文件
进入目录修改源码:
$ cd /home/jiejie/linux-imx/
查看修改的内容
$ git status
On branch imx_4.1.15_2.0.0_ga
Your branch is ahead of 'origin/imx_4.1.15_2.0.0_ga' by 5 commits.
(use "git push" to publish your local commits)
Untracked files:
(use "git add <file>..." to include in what will be committed)
arch/arm/configs/imx_v7_jie_defconfig
记录修改
$ git add .
$ git commit -m "add jiejie imx_v7_jie_defconfig file"
[imx_4.1.15_2.0.0_ga 39b3787cbadf] add jiejie imx_v7_jie_defconfig file
1 file changed, 4293 insertions(+)
create mode 100644 arch/arm/configs/imx_v7_jie_defconfig
生成补丁文件
- 生成两个commit间的修改(包含两个commit)
git format-patch <r1>..<r2>
如:
git format-patch xxxxx..xxxxx -o patch
- 生成单个commit的补丁
git format-patch -1 <r1>
- 从指定commit后的修改(不包含该commit)
git format-patch <r1>
生成补丁
$ git format-patch 30278abfe0977b1d2f065271ce1ea23c0e2d1b6e
可以看到生成的补丁在当前目录下。
给linux内核源码打补丁
进入目录:
$ cd /home/jiejie/linux-imx/
查看git分支、版本、log
$ git branch
* imx_4.1.15_2.0.0_ga
确认log
$ git log
# commit 30278abfe0977b1d2f065271ce1ea23c0e2d1b6e
# Author: Robby Cai <[email protected]>
# Date: Thu May 4 14:52:24 2017 +0800
打补丁前确保内容没有被yocto修改,如果修改了就还原。
$ git status
还原
$ git reset --hard imx_4.1.15_2.0.0_ga
# HEAD is now at 30278ab MLK-14762 ARM: dts: imx6sll-evk: correct gpio pin for lcd power control
打补丁
$ git am "补丁"