求问:patch 补丁文件怎么安装?
Tofloor
poster avatar
152******14
deepin
2018-05-13 01:51
Author
网上下载  patch 文件 怎么安装在 深度  比如  

0001-drm-radeon-dp-add-back-special-handling-for-NUTMEG.patch

  • 请直接给代码。网上的看不懂。。。
  • 具体文件见附件。
  • 谢谢。




Reply Favorite View the author
All Replies
avatar
woodelf
deepin
2018-05-13 03:11
#1
  1. $ patch -pN < foo.patch
Copy the Code

其中-pN里面的N是数字,具体取决于补丁文件里面的目标路径和当前工作目录路径的关系。
举个例子,比如补丁文件里面的目标路径是类似:
---a/usr/src/linux/foo.c
+++b/usr/src/linux/foo.c
那么你只需要把补丁文件放到/usr/src/linux下,然后运行patch -p4 < foo.patch就行了。
也就是说,-pN里面的数字其实是告诉patch命令,需要忽略补丁文件里面的前N层目录。以上面为例,就是忽略从a开始的四层目录。
Reply View the author
avatar
152******14
deepin
2018-05-13 03:42
#2
https://bbs.deepin.org/post/156369
其中-pN里面的N是数字,具体取决于补丁文件里面的目标路径和当前工作目录路径的关系。
举个例子,比如补丁 ...

ifang@ifang-PC:~$ patch -pN < 0001-drm-radeon-dp-add-back-special-handling-for-NUTMEG.patch
patch: **** strip count N is not a number
ifang@ifang-PC:~$ patch -n < 0001-drm-radeon-dp-add-back-special-handling-for-NUTMEG.patch
can't find file to patch at input line 56
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|From 1db865c3e24dd17c7d05e12b6957600573cb3559 Mon Sep 17 00:00:00 2001
|From: Alex Deucher <alexander.deucher@amd.com>
|Date: Thu, 3 Mar 2016 19:26:24 -0500
|Subject: [PATCH 1/2] drm/radeon/dp: add back special handling for NUTMEG
|
|When I fixed the dp rate selection in:
|092c96a8ab9d1bd60ada2ed385cc364ce084180e
|drm/radeon: fix dp link rate selection (v2)
|I accidently dropped the special handling for NUTMEG
|DP bridge chips.  They require a fixed link rate.
|
|Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|Cc: stable@vger.kernel.org
|---
| drivers/gpu/drm/radeon/atombios_dp.c | 20 ++++++++++++++++----
| 1 file changed, 16 insertions(+), 4 deletions(-)
|
|diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
|index 44ee72e..6af8325 100644
|--- a/drivers/gpu/drm/radeon/atombios_dp.c
|+++ b/drivers/gpu/drm/radeon/atombios_dp.c
|@@ -315,15 +315,27 @@ int radeon_dp_get_dp_link_config(struct drm_connector *connector,
|         unsigned max_lane_num = drm_dp_max_lane_count(dpcd);
|         unsigned lane_num, i, max_pix_clock;
|
|-        for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
|-                for (i = 0; i < ARRAY_SIZE(link_rates) && link_rates <= max_link_rate; i++) {
|-                        max_pix_clock = (lane_num * link_rates * 8) / bpp;
|+        if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) ==
|+            ENCODER_OBJECT_ID_NUTMEG) {
|+                for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
|+                        max_pix_clock = (lane_num * 270000 * 8) / bpp;
|                         if (max_pix_clock >= pix_clock) {
|                                 *dp_lanes = lane_num;
|-                                *dp_rate = link_rates;
|+                                *dp_rate = 270000;
|                                 return 0;
|                         }
|                 }
|+        } else {
|+                for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
|+                        for (i = 0; i < ARRAY_SIZE(link_rates) && link_rates <= max_link_rate; i++) {
|+                                max_pix_clock = (lane_num * link_rates * 8) / bpp;
|+                                if (max_pix_clock >= pix_clock) {
|+                                        *dp_lanes = lane_num;
|+                                        *dp_rate = link_rates;
|+                                        return 0;
|+                                }
|+                        }
|+                }
|         }
|
|         return -EINVAL;
|--
|2.5.0
|
--------------------------
File to patch:
Skip this patch? [y] y
Skipping patch.
ifang@ifang-PC:~$ patch -n < 0002-drm-amdgpu-dp-add-back-special-handling-for-NUTMEG.patch
can't find file to patch at input line 56
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|From 154d7e44f0e50ea2fd92d162794d23d876a7abd2 Mon Sep 17 00:00:00 2001
|From: Alex Deucher <alexander.deucher@amd.com>
|Date: Thu, 3 Mar 2016 19:34:28 -0500
|Subject: [PATCH 2/2] drm/amdgpu/dp: add back special handling for NUTMEG
|
|When I fixed the dp rate selection in:
|3b73b168cffd9c392584d3f665021fa2190f8612
|drm/amdgpu: fix dp link rate selection (v2)
|I accidently dropped the special handling for NUTMEG
|DP bridge chips.  They require a fixed link rate.
|
|Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
|Cc: stable@vger.kernel.org
|---
| drivers/gpu/drm/amd/amdgpu/atombios_dp.c | 20 ++++++++++++++++----
| 1 file changed, 16 insertions(+), 4 deletions(-)
|
|diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
|index 21aacc1..bf731e9 100644
|--- a/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
|+++ b/drivers/gpu/drm/amd/amdgpu/atombios_dp.c
|@@ -265,15 +265,27 @@ static int amdgpu_atombios_dp_get_dp_link_config(struct drm_connector *connector
|         unsigned max_lane_num = drm_dp_max_lane_count(dpcd);
|         unsigned lane_num, i, max_pix_clock;
|
|-        for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
|-                for (i = 0; i < ARRAY_SIZE(link_rates) && link_rates <= max_link_rate; i++) {
|-                        max_pix_clock = (lane_num * link_rates * 8) / bpp;
|+        if (amdgpu_connector_encoder_get_dp_bridge_encoder_id(connector) ==
|+            ENCODER_OBJECT_ID_NUTMEG) {
|+                for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
|+                        max_pix_clock = (lane_num * 270000 * 8) / bpp;
|                         if (max_pix_clock >= pix_clock) {
|                                 *dp_lanes = lane_num;
|-                                *dp_rate = link_rates;
|+                                *dp_rate = 270000;
|                                 return 0;
|                         }
|                 }
|+        } else {
|+                for (lane_num = 1; lane_num <= max_lane_num; lane_num <<= 1) {
|+                        for (i = 0; i < ARRAY_SIZE(link_rates) && link_rates <= max_link_rate; i++) {
|+                                max_pix_clock = (lane_num * link_rates * 8) / bpp;
|+                                if (max_pix_clock >= pix_clock) {
|+                                        *dp_lanes = lane_num;
|+                                        *dp_rate = link_rates;
|+                                        return 0;
|+                                }
|+                        }
|+                }
|         }
|
|         return -EINVAL;
|--
|2.5.0
|
--------------------------
File to patch:
Skip this patch? [y] y
Skipping patch.
这就可以了?
Reply View the author
avatar
woodelf
deepin
2018-05-13 04:19
#3
https://bbs.deepin.org/post/156369
ifang@ifang-PC:~$ patch -pN < 0001-drm-radeon-dp-add-back-special-handling-for-NUTMEG.patch
patch: ...

只看命令没看我后面的说明?
只能说,单从patch内容来看,需要把这两个文件放到驱动解压目录中,然后分别运行patch -p1 < foo.patch。
如果还不行,建议自己研究。
Reply View the author
avatar
152******14
deepin
2018-05-13 05:15
#4
https://bbs.deepin.org/post/156369
只看命令没看我后面的说明?
只能说,单从patch内容来看,需要把这两个文件放到驱动解压目录中,然后分别 ...

要是有个自动添加补丁的工具就好了
Reply View the author