为什么补丁找不到这个文件?

时间:2013-12-17 23:15:41

标签: linux file patch u-boot

我想在u-boot源代码中应用补丁,但有些方面,Linux不允许我这样做。我有什么:

reg@ubuntu:~/NextGen/trunk/FW/thirdparty/u-boot$ patch -p1 < ../u-boot/u-boot-2013.01-wr.patch 
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -uNr u-boot-2013.01/arch/powerpc/cpu/mpc85xx/cpu_init.c u-boot-2013.01.modified/arch/powerpc/cpu/mpc85xx/cpu_init.c
|--- u-boot-2013.01/arch/powerpc/cpu/mpc85xx/cpu_init.c 2013-01-15 13:47:42.000000000 -0800
|+++ u-boot-2013.01.modified/arch/powerpc/cpu/mpc85xx/cpu_init.c        2013-05-16 10:58:08.973906692 -0700
--------------------------
File to patch: ^C
reg@ubuntu:~/NextGen/trunk/FW/thirdparty/u-boot$ ls -l u-boot-2013.01/arch/powerpc/cpu/mpc85xx/cpu_init.c
-rw-r--r-- 1 reg reg 16745 Jan 15  2013 u-boot-2013.01/arch/powerpc/cpu/mpc85xx/cpu_init.c
reg@ubuntu:~/NextGen/trunk/FW/thirdparty/u-boot$ 

那么为什么它在完美的位置找不到文件呢?这是怎么回事?

1 个答案:

答案 0 :(得分:14)

这里涉及三个文件路径:

  • 补丁的原始文件:u-boot-2013.01/arch/powerpc/cpu/mpc85xx/cpu_init.c
  • 补丁的目标文件:u-boot-2013.01.modified/arch/powerpc/cpu/mpc85xx/cpu_init.c
  • 由于-p1arch/powerpc/cpu/mpc85xx/cpu_init.c
  • 而剥离的目标文件

Patch查找剥离的目标文件,但它不存在。

cd u-boot-2013.01然后patch -p1 < ../../u-boot/u-boot-2013.01-wr.patch,你应该有更多的运气。