# kernel patches

## cherupop

hi guys 

I'm running this application advance mame in my pc and now I'm intending to run a patch on my kernel 

linux-2.4.21-radeonfb-lowclock.diff

I honestly don't know how to do it, can someone enlight me or tell me if there is a tutorial to follow, I don't wanna ruin my installation,

just so you know, I already set my Frame buffer and it's running just fine but in order to run the applicaiton with an arcade monitor I need the patch.

thanks in advance

cherupop  :Rolling Eyes: 

----------

## smitty_one_each

Genkernel is a good place to start:

http://www.gentoo.org/doc/en/genkernel.xml

----------

## dgaffuri

It depends on how the patch is built, but most common is cd to /usr/src/kernel and run

```
patch -p1 </path/to/your/patch>
```

Use the --dry-run option to check if the patch will apply cleanly, then run without it. After applying the patch you've to rebuild and reinstall the kernel (and modules too if they're affected). Could be that the patch changes some Kconfig around, if so you should run make oldconfig befor compiling.

Keep around the option of booting with old kernel.

----------

## cherupop

 :Crying or Very sad: 

Hmm I tried to run the patch like you said but I got an error

```
can't file to patch at input line 3 

Perhaps you used the wrong -p or --strip option?
```

perhaps it's because of the kernel version that I have since the name of the patch is

 *Quote:*   

> linux-2.4.22-radeonfb-id.diff

 

if it's tha the case 

Can I downgrade my kernel to 2.4.21 and be able to run the patch?

Thanks

cherupop

----------

## dgaffuri

Which kernel version do you have? Please post the first few lines of the patch.

----------

## cherupop

Ok this is the whole file

```
--- drivers/video/radeonfb.c.ori   2003-07-25 17:01:15.000000000 +0200

+++ drivers/video/radeonfb.c   2003-07-25 16:56:23.000000000 +0200

@@ -2510,12 +2510,10 @@

    rinfo->hack_crtc_ext_cntl = newmode.crtc_ext_cntl;

    rinfo->hack_crtc_v_sync_strt_wid = newmode.crtc_v_sync_strt_wid;

 

    if (freq > rinfo->pll.ppll_max)

       freq = rinfo->pll.ppll_max;

-   if (freq*12 < rinfo->pll.ppll_min)

-      freq = rinfo->pll.ppll_min / 12;

 

    {

       struct {

          int divider;

          int bitvalue;

@@ -2537,10 +2535,15 @@

          if (rinfo->pll_output_freq >= rinfo->pll.ppll_min  &&

              rinfo->pll_output_freq <= rinfo->pll.ppll_max)

             break;

       }

 

+      if (!post_div->divider) {

+         post_div = post_divs + 5;

+         rinfo->pll_output_freq = post_div->divider * freq;

+      }

+

       rinfo->post_div = post_div->divider;

       rinfo->fb_div = round_div(rinfo->pll.ref_div*rinfo->pll_output_freq,

                  rinfo->pll.ref_clk);

       newmode.ppll_ref_div = rinfo->pll.ref_div;

       newmode.ppll_div_3 = rinfo->fb_div | (post_div->bitvalue << 16);
```

and I'm actually using the live cd version 2005.0 which comes with the kernel 2.6.11-gentoo-r3

I hope this help

cherupop  :Wink: 

----------

## linuxtuxhellsinki

So U're using 2.6.11 & the patch is for 2.4.22   :Rolling Eyes: 

----------

## cherupop

Ok Mr pointdexter 

We already figure it out that, that's why I asked the question

 *Quote:*   

> Can I downgrade my kernel to 2.4.21 and be able to run the patch? 

 

thanks anyway

cherupp  :Confused: 

----------

## i92guboj

Probably not and probably what you intend to fix is already fixed into 2.6.x series.

I highly doubt that that patch does make any sense for a 2.6 kernel. 

The two common ways to apply a patch are that above and this one, in case you feel curious.

```

cat patchfile | patch -p1

```

Or -p0, depending on how the patch was done. That, of course, in the same directory that the kernel resides. Anyway, as I said, both the framebuffer and the riva support has changed a lot since 2.4...

----------

## dgaffuri

 *cherupop wrote:*   

> 
> 
> ```
> --- drivers/video/radeonfb.c.ori   2003-07-25 17:01:15.000000000 +0200
> 
> ...

 

In this case it should be

```
patch -p0
```

The -p option controls how many leading directories should be stripped from the file names.

 *cherupop wrote:*   

> and I'm actually using the live cd version 2005.0 which comes with the kernel 2.6.11-gentoo-r3

 

As linuxtuxhellsinki and 6thpink said, you cannot use that patch for 2.6 kernel, the radeonfb driver is completely different.  Are you sure that 2.6 doesn't already solve your problem? Why do you think that you need that patch, and where did you find it?

----------

## cherupop

The patch is given by the same author of the program that I'm trying to run (advance mame)

The thing is that the way it is now, the video card is not modifying it's frecuency to a 15khz horizonal so an arcade monitor can be used to play mame games, that's why he gave this patch for people since lke he says radeon framebuffer has this bug, the program is telling the card to low it;s frequenc but the card keeps sending a VGA signal at 31.khz.

I tried this card with DOS and there is no problem, so it's not a hardware issue

May be it's like you say the patch for 2.6 is not already out to solve the problem and that's all

Cherupop

----------

## elvis_a_presley

Have a read of this for some good tips on Linux+MAME+Low-res modes:

http://easymamecab.mameworld.net/html/linux.htm

----------

