find . -type f -name "*.c" | xargs grep -i "abc"
-type f 查找类型为文件
-name ".c" 文件名称(.c文件)
-i 不区分大小写
或者:
grep -rns "XXX" ./
寻找带 . 或者 \ 的字符串 如 adc.de ,注意符号前面加\
grep -rns "adc\.de" ./
制作patch:
repo diff > XXX.patch
git format-patch -s 2ca00efd094e4c91b6aca1d92fef5600fa9dfc6a // 对比该commit号 打包
{如果补丁中的文件本地已经修改,那么对比文件夹(beyond compare):
cp --parents device/softwinner/crane-ipc/init.sun8i.usb.rc ./ipc_en_adb_camdroid // --parents 拷贝文件目录,这样才可以文件夹对比,要一个一个文件的cp
}
子目录下打规范的patch:
1. git status.
2. git add .
3. git commit -m "add nor flash"
4. git log
5. git format-patch -1 xxx (从 git log获得 commit 04789f0eee6e504fe56abf81a318f8670eb028ca ) ,xxx代表 04789f0eee6e504fe56abf81a318f8670eb028ca
打补丁patch:
patch -p0 < XXX.patch
repo forall -c git am ~/V3_ipc/camdroid/ipc_en_adb_camdroid.patch
// 对比该commit号 打补丁,出现process错误要: repo forall -c git am --skip
提交代码(例如在Linux3.4\tools下面提价cfg)
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git remote -v
lichee ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git (fetch)
lichee ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git (push)
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git remote add center ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git remote -v
center ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git (fetch)
center ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git (push)
lichee ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git (fetch)
lichee ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git (push)
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git push center
撤销已经提交的commit:
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git log --oneline -5
618e307 config:axp:cfg:enable led_flashing when battery charging
7730a54 uboot:charging:cfg:enable battery charging mode
f7ee271 config:sdv:hdmi:fix hdmi sound issue
0ba599d sys_config: add gpio_2 of lcd used in boot to control power.
ac4d14d Merge branch 'dev-stable' of ssh://172.16.1.19/git_repo/product/eyesee/lichee/tools into dev-stable
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git revert 7730a54
[dev-stable d8b431b] Revert "uboot:charging:cfg:enable battery charging mode"
1 file changed, 1 insertion(+), 3 deletions(-)
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$ git log --oneline -5
d8b431b Revert "uboot:charging:cfg:enable battery charging mode"
618e307 config:axp:cfg:enable led_flashing when battery charging
7730a54 uboot:charging:cfg:enable battery charging mode
f7ee271 config:sdv:hdmi:fix hdmi sound issue
0ba599d sys_config: add gpio_2 of lcd used in boot to control power.
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git push
Counting objects: 15, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 684 bytes, done.
Total 8 (delta 7), reused 0 (delta 0)
To ssh://V3@172.16.1.19/git_repo/product/eyesee/lichee/tools.git
618e307..d8b431b dev-stable -> dev-stable
marywang@Exdroid30:~/v3_sdv_mary/lichee/tools$
git pull
已经提交的commit生成
多个patch:
marywang@Exdroid30:~/a20cdr/camdroid/camdroid$
git log --oneline -10
7ac73ae add a20 surfaceflinger and gpu setting
9290fc7 Fixed a play back crash bug
9f82e96 change video thumbnail size
a87dfdd cedarx update for field mode error detect.
2f9ad00 Merge branch 'a20-cdr-stable' of ssh://172.16.1.19/git_repo/product/A10T_CDR/camlinux/camlinux into a20-cdr-stable
1f59c3c fix bugs about video's node, startup.wav's path, video's tester
d98e478 fix some bugs about UVC&&TVIN and mic&spk
c88871e Fixed bug that sos happen and stop record all in 5s after start record then the save file is normal file where sos file is expected.
caa8a92 Fixed bug that sos occur in 5s after start record then first file can't be played and is not 0Kb
a941438 add app DragonBoard tool
marywang@Exdroid30:~/a20cdr/camdroid/camdroid$
git format-patch 1f59c3c //git format-patch -3 1f59c3c ;加数字往下走(时间旧的前面的commit),不加数字往上走(时间新的后面的commit)
0001-Fixed-bug-that-sos-occur-in-5s-after-start-record-th.patch
0002-Fixed-bug-that-sos-happen-and-stop-record-all-in-5s-.patch
0003-cedarx-update-for-field-mode-error-detect.patch
0004-change-video-thumbnail-size.patch
0005-Fixed-a-play-back-crash-bug.patch
0006-add-a20-surfaceflinger-and-gpu-setting.patch
marywang@Exdroid30:~/a20cdr/camdroid/camdroid$
已经提交的commit生成1个patch:
git reset commit编号 //不是git checkout commit编号
reset在当前目录下保存diff, 可以手动生成一个patch
checkout全部清理,没有红色的diff
p*代表目录的第几个
如果出现:can't find file to patch at input line **
那么需要一个一个手动添加文件的位置
make ARCH=arm menuconfig 来源于Kconfig(源)
如果menuconfig有所改变,会更新到Linux3.*目录下的.config (所以两者效果一样,至少在V3s上是这样)
决定某个module是否编译.o和.ko的条件是:
1. Makefile中obj-m=CONFIG_**.c配置
2. .config(或menuconfig) 中CONFIG_**配置
3. 两者名称一定要完全一致(这次就是因为Makefile的编写人员在
CONFIG_**.c名字前面没有加CONFIG_,导致与.config中的配置名称不一样,那么当然不会编译!!!)