Linux下打补丁

来源:互联网 发布:小公司网络组建 编辑:程序博客网 时间:2024/05/18 00:53

把改好的u-boot-2010.09复制到文件夹patch,将u-boot-2010.09重命名为u-boot-2010.09-fl2440

进入u-boot-2010.09-fl2440,先make distclean

将源码包解压到patch文件夹下

在此路径下

diff -Nuar u-boot-2010.09 u-boot-2010.09-fl2440 > u-boot-2010.09.patch

这样就得到补丁文件

一般参数就用-Nuar

还有要将两个文件放到同一文件夹下


patch打补丁如下

[luminqi@centos6 u-boot-2010.09]$ cd board
[luminqi@centos6 board]$ mkdir -p lingyun/fl2440
[luminqi@centos6 board]$ cp samsung/smdk2410/* lingyun/fl2440/
[luminqi@centos6 board]$ cd lingyun/fl2440/
[luminqi@centos6 fl2440]$ ls
config.mk  flash.c  lowlevel_init.S  Makefile  smdk2410.c
[luminqi@centos6 fl2440]$ mv smdk2410.c fl2440.c
[luminqi@centos6 fl2440]$ cd ../../../
[luminqi@centos6 u-boot-2010.09]$ cp include/configs/smdk2410.h include/configs/fl2440.h
[luminqi@centos6 u-boot-2010.09]$ patch -p1 < /home/luminqi/my_svn/fl2440test/trunk/src/u-boot-2010.09.patch 
patching file arch/arm/cpu/arm920t/s3c24x0/speed.c
patching file arch/arm/cpu/arm920t/s3c24x0/timer.c
patching file arch/arm/cpu/arm920t/start.S
patching file arch/arm/cpu/arm920t/u-boot.lds
patching file arch/arm/include/asm/arch-s3c24x0/s3c24x0_cpu.h
patching file arch/arm/include/asm/arch-s3c24x0/s3c24x0.h
patching file board/lingyun/fl2440/fl2440.c
patching file board/lingyun/fl2440/lowlevel_init.S
patching file board/lingyun/fl2440/Makefile
patching file board/lingyun/fl2440/nand_read.c
patching file boards.cfg
patching file common/cmd_nand.c
patching file common/serial.c
patching file drivers/mtd/nand/s3c2410_nand.c
patching file drivers/net/dm9000x.c
patching file include/configs/fl2440.h
patching file include/serial.h
patching file Makefile

因为之前对u-boot-2010.09做了一点改动,

如果要用补丁文件为源码的u-boot-2010.09打补丁的话

也要做相应的改动

这里用参数p1,是因为当时路径在u-boot-2010.09目录之下,

若和u-boot-2010.09在同一目录,使用p0也可以


常用命令

diff -nuar 源文件 改动文件 > patch文件

patch -p0(-p1) < patch文件



0 0
原创粉丝点击