最近在忙一个比赛。博创杯。我们选的题是NXP的
用的是NPC的开发板LPC3152。
我想第一步应该是移植Uboot。
我们在官网上下载LPC313X的Uboot(313X兼容3152)以及一个Patch补丁文件。
开始我把Uboot解压,查看顶层makefile,里面没有3132的配置文件。
EA3152_config
是不是下错了uboot?有下载了一次,一样的的结果。看来是没有下错,那么?我忽然想起是不是补丁文件的事情,
patch文件把3152的配置给配进去?
于是对uboot打补丁。
在网上搜索了一下patch,命令的使用方法,发现说的并不清楚,好吧那么我来具体说一下patch命令。
在终端里输入mam patch可以看到该命令的详细介绍。
PATCH(1) PATCH(1)
NAME
patch - apply a diff file to an original
SYNOPSIS
patch [options] [originalfile [patchfile]]
but usually just
patch -pnum <patchfile
DESCRIPTION
patch takes a patch file patchfile containing a difference listing pro-
duced by the diff program and applies those differences to one or more
original files, producing patched versions. Normally the patched ver-
sions are put in place of the originals. Backups can be made; see the
-b or --backup option. The names of the files to be patched are usu-
ally taken from the patch file, but if there’s just one file to be
patched it can specified on the command line as originalfile.
可以参考一下,我想英语也一定会让很多人头痛的。
在看看网上别人的说法。
1:如果当前的目录是和linux-2.6.12的同级目录:
[root@kcn-110mw]#patch -p0 </root/isp1161-2.6.12.patch
2:如果当前的目录为 linux-2.6.12/:
[root@kcn-110mw]#patch -p1 </root/isp1161-2.6.12.patch
3:如果当前的目录为 linux-2.6.12/drivers/:
[root@kcn-110mw]#patch -p2 </root/isp1161-2.6.12.pathc
/*****************************************************************************************************/
我想看过这些大概意思就明白了。
我在uboot文件夹中建立了一个11目录,将patch文件拷到这个目录下
接着执行下面的命令
patch -p1 <11/patch文件
我又试了一下别的命令
我把patch文件直接考的uboot目录下
执行
patch -p1 <patch文件
结果一样好使,但是像网上所说的那样考的同级目录下,使用的
patch -p0 <patch文件 却不会给uboot 打上补丁,反而会在同一目录下
生成一个b目录,里面有我要打补丁的文件。
总之网上说的对了一半吧,我想其实也明白。
因为第二种方法,并没有在要打补丁的目录下也没有知道要打补丁的文件,所以
以后大家在遇到patch的问题用第一种方法好了