You are not logged in.

#1 2012-04-08 04:40:56

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

[SOLVED] How do I patch the kernel?

EDIT (again): Doesn't seem like the patch is needed anymore. 3.3.1 kernel from the repos seems identical to my custom kernel (also 3.3.1).

EDIT: The patches are for an older kernel but I was able to apply them manually.

Hello. I'm trying to patch the kernel using the patch found on this page: http://lists.freedesktop.org/archives/i … 09584.html

Now, I don't know much about patching but the patch in that post looks more like the program output of several diff commands. How do I format this to create a valid .patch file?

Last edited by Splooshie123 (2012-04-10 04:52:40)

Offline

#2 2012-04-08 05:16:37

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,701

Re: [SOLVED] How do I patch the kernel?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2012-04-08 06:01:18

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

oooookay.

So, the patch is labeled as 3/3. Does that mean I have to apply the other two patches?

Offline

#4 2012-04-08 06:13:04

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,701

Re: [SOLVED] How do I patch the kernel?

I think so.  Try doing --dry-run first.  If there are errors, the answer is yes.  If there are no errors, it may work.  It is also possible that, although the patch can be applied, it may depend on the other patches to be able to compile.

Sorry for the little bit of internet humor there... I find it to be a little more acceptable than some of more crude ways of suggesting that you may not have searched quite enough.  smile

BTW, how do you plan to build the kernel ?

Last edited by ewaller (2012-04-08 06:13:55)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2012-04-08 07:06:38

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] How do I patch the kernel?

Just curious here - those patches were submitted over a year ago. Are you sure they haven't already been applied? And if not, have you checked why they were rejected?

Offline

#6 2012-04-08 10:00:34

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

How will I know they haven't been applied already? By examining the source code. Unfortunately, with my connection it may take a while to download.

I really hope they haven't been applied already. I really need to get this system working. If the patches are already there but don't fix my problem then I'm officially <insert expletive of choice here>.

If it matters, I need to apply that patch to fix a bug as described here: https://help.ubuntu.com/community/UEFIB … en_picture
My dmesg.log contains exactly that error message and I do get screen distortion (artifacts that sometimes make the screen unreadable). The weird thing is the logs don't stop there so it seems to be a graphics issue.

Last edited by Splooshie123 (2012-04-08 10:45:22)

Offline

#7 2012-04-08 10:37:21

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

To get back to my original question, making a patch out of what was in that mailing list post:

Does this look ok?

---
 drivers/gpu/drm/i915/i915_drv.c      |    4 ++++
 drivers/gpu/drm/i915/i915_drv.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |   34 +++++++++++++++++++++-------------
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 004880aa3a948669b8b4e23d9ad73d132cff81d0..1d88f059a27321ecb681e2b7927bb69029fcb49a 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -49,6 +49,10 @@ module_param_named(powersave, i915_powersave, int, 0600);
 unsigned int i915_lvds_fixed = 1;
 module_param_named(lvds_fixed, i915_lvds_fixed, int, 0600);
 
+unsigned int i915_lvds_channels = 0;
+module_param_named(lvds_channels, i915_lvds_channels, int, 0600);
+MODULE_PARM_DESC(lvds_channels, "LVDS channels in use: 0=(default) probe hardware 1=single 2=dual");
+
 unsigned int i915_lvds_downclock = 0;
 module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3fa8681459aa596e12e885568e5b48f0c9a60719..a6aab43e5f39f2d5b92a69a284bf8f72a254ea7c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -886,6 +886,7 @@ extern int i915_max_ioctl;
 extern unsigned int i915_fbpercrtc;
 extern unsigned int i915_powersave;
 extern unsigned int i915_lvds_fixed;
+extern unsigned int i915_lvds_channels;
 extern unsigned int i915_lvds_downclock;
 extern unsigned int i915_lvds_24bit;
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 09f57f29c30c371c213944be473090a780a287db..4dc91400edd8935be45a229cf91292339bca0ce8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -642,6 +642,20 @@ static const intel_limit_t intel_limits_ironlake_display_port = {
         .find_pll = intel_find_pll_ironlake_dp,
 };
 
+static int intel_is_dual_channel_mode(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	if (i915_lvds_channels) {
+		/* User has specified desired channel mode */
+		return (i915_lvds_channels == 2);
+	}
+
+	/* User has not specified mode so let's see
+	   what the hardware is doing. */
+	return ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP);
+}
+
 static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
@@ -653,8 +667,7 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
 		if (dev_priv->lvds_use_ssc && dev_priv->lvds_ssc_freq == 100)
 			refclk = 100;
 
-		if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) ==
-		    LVDS_CLKB_POWER_UP) {
+		if (intel_is_dual_channel_mode(crtc)) {
 			/* LVDS dual channel */
 			if (refclk == 100)
 				limit = &intel_limits_ironlake_dual_lvds_100m;
@@ -677,18 +690,16 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc)
 
 static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
 {
-	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	const intel_limit_t *limit;
 
 	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
-		if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
-		    LVDS_CLKB_POWER_UP)
+		if (intel_is_dual_channel_mode(crtc)) {
 			/* LVDS with dual channel */
 			limit = &intel_limits_g4x_dual_channel_lvds;
-		else
-			/* LVDS with dual channel */
+		} else {
+			/* LVDS with single channel */
 			limit = &intel_limits_g4x_single_channel_lvds;
+		}
 	} else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI) ||
 		   intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) {
 		limit = &intel_limits_g4x_hdmi;
@@ -821,8 +832,7 @@ intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
 		 * reliably set up different single/dual channel state, if we
 		 * even can.
 		 */
-		if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
-		    LVDS_CLKB_POWER_UP)
+		if (intel_is_dual_channel_mode(crtc))
 			clock.p2 = limit->p2.p2_fast;
 		else
 			clock.p2 = limit->p2.p2_slow;
@@ -871,7 +881,6 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
 			int target, int refclk, intel_clock_t *best_clock)
 {
 	struct drm_device *dev = crtc->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	intel_clock_t clock;
 	int max_n;
 	bool found;
@@ -886,8 +895,7 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
 			lvds_reg = PCH_LVDS;
 		else
 			lvds_reg = LVDS;
-		if ((I915_READ(lvds_reg) & LVDS_CLKB_POWER_MASK) ==
-		    LVDS_CLKB_POWER_UP)
+		if (intel_is_dual_channel_mode(crtc))
 			clock.p2 = limit->p2.p2_fast;
 		else
 			clock.p2 = limit->p2.p2_slow;

Offline

#8 2012-04-08 11:27:32

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] How do I patch the kernel?

Splooshie123 wrote:

Unfortunately, with my connection it may take a while to download.

OK... but you have to download it anyway to apply the patch....

Offline

#9 2012-04-08 11:45:39

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

I can't know whether the patches have been applied yet. If they have, then I just wasted a few hours and I still won't have a fix for my system.

Offline

#10 2012-04-08 12:07:20

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [SOLVED] How do I patch the kernel?

Have a look in the kernel's git repo then, and/or bugzilla.

Anyway, so what if you waste a few hours? Start the download, then have lunch/go for a walk/watch a movie/whatever.

Offline

#11 2012-04-08 14:50:41

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: [SOLVED] How do I patch the kernel?

Splooshie123 wrote:

I can't know whether the patches have been applied yet. If they have, then I just wasted a few hours and I still won't have a fix for my system.

You should be able to view the code of the kernel source online, in whatever git frontend kernel.org is using. That way you can just search for code strings in the kernel code (with Ctrl+F) and determine whether the patch has been applied or not.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#12 2012-04-08 15:44:26

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: [SOLVED] How do I patch the kernel?

How up to date is your system? There seem to have been a number of issues with the intel drivers in recent kernels but they ( or at least some of them) may be fixed in the very latest ones.

I don't know if anything affects Mac specific issues, though (if this is one).

Last edited by cfr (2012-04-08 15:44:57)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#13 2012-04-09 01:06:49

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

Ok, so I use the grep search to look for code strings only found in the patch and got nothing. That's a good sign. But the easiest way to find out would be to apply the patch and see if it complains that it has already been applied (reversed patch).

@cfr: I updated the system hoping the bug has been fixed in the latest stable kernel. So unless any major updates were released in the last 8 hours, I'm pretty much up to date.
EDIT: Apparently the latest stable kernel just made it into the core repo a few hours ago...

By the way, this computer has two GPUs: the integrated intel graphics and an NVIDIA GeForce GT 330M. Maybe it could be possible to set the second one as default and blacklist i915?

Last edited by Splooshie123 (2012-04-09 09:46:31)

Offline

#14 2012-04-09 01:55:08

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

Ok. I finished downloading the bloody kernel. Turns out the patches haven't been applied yet. Unfortunately, the code has changed since the patch was made, forcing me to manually apply the patches.

Manually patching it doesn't seem so hard. I've already completed 3 hunks, but it sure would have been nice to just press enter and finish patching in 2 seconds.

Offline

#15 2012-04-09 02:00:21

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,701

Re: [SOLVED] How do I patch the kernel?

After you apply the patch, how to you intend to build the kernel?  I ask because there are several approaches and more than a few pitfalls.

I have little upon which to judge your experience.  Building a kernel for the first time is --- educational.

Are you planning to build it by hand, or by grabbing the PKGBUILD from ABS, and modifying it to add your patches?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#16 2012-04-09 09:43:26

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

I'm compiling manually. This is my first time to compile a kernel but not my first time to compile software.

For configuration, I just loaded the current kernel's .config and tweaked a few things. The wiki was very helpful.

I've already applied the patches and it compiled without problems. I'm not finished with testing it so I'll post if it worked.

SOLVED

Last edited by Splooshie123 (2012-04-09 09:52:23)

Offline

#17 2012-04-10 02:31:50

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

Not directly relevant but, the patch solved my problem. Unfortunately, my keyboard still won't work.

Offline

#18 2012-04-10 02:34:27

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,701

Re: [SOLVED] How do I patch the kernel?

Keyboard?  What is happening with it?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#19 2012-04-10 04:50:58

Splooshie123
Member
Registered: 2012-03-29
Posts: 42

Re: [SOLVED] How do I patch the kernel?

It's not responding. I could roll my face all over it for all it's worth and still get no response. Can't even login. I made a thread about it a while back: https://bbs.archlinux.org/viewtopic.php?pid=1085272

Offline

Board footer

Powered by FluxBB