# fbsplash kernel error when compiling

## Juventus

i try to patch kernel with fbsplah like write here

```

For patching the kernel...

# cd /usr/src

# wget http://dev.gentoo.org/~spock/projects/gensplash/archive/fbsplash-0.9.2-r4-2.6.13-rc6.patch

# cd linux

# patch -p1 < ../fbsplash-0.9.2-r4-2.6.13-rc6.patch

```

and i get error when patching

```

patch -p1 < /usr/src/fbsplash-0.9.2-r4-2.6.13-rc6.patch

patching file Documentation/fb/00-INDEX

Reversed (or previously applied) patch detected!  Assume -R? [n] y

The next patch would create the file Documentation/fb/splash.txt,

which already exists!  Assume -R? [n] y

patching file Documentation/fb/splash.txt

patching file drivers/Makefile

Reversed (or previously applied) patch detected!  Assume -R? [n] y

patching file drivers/video/Kconfig

Reversed (or previously applied) patch detected!  Assume -R? [n] y

Hunk #1 succeeded at 813 (offset 26 lines).

Hunk #2 succeeded at 1543 (offset 26 lines).

patching file drivers/video/Makefile

Reversed (or previously applied) patch detected!  Assume -R? [n] y

The next patch would create the file drivers/video/cfbsplash.c,

which already exists!  Assume -R? [n] y

patching file drivers/video/cfbsplash.c

patching file drivers/video/console/bitblit.c

Reversed (or previously applied) patch detected!  Assume -R? [n] y

Hunk #3 succeeded at 383 (offset 15 lines).

patching file drivers/video/console/fbcon.c

Reversed (or previously applied) patch detected!  Assume -R? [n] y

Hunk #3 succeeded at 212 (offset 1 line).

Hunk #7 succeeded at 914 (offset 5 lines).

Hunk #8 succeeded at 1062 (offset 5 lines).

Hunk #9 succeeded at 1081 (offset 5 lines).

Hunk #10 succeeded at 1100 (offset 5 lines).

Hunk #11 succeeded at 1581 (offset 5 lines).

Hunk #12 succeeded at 1667 (offset 5 lines).

Hunk #13 succeeded at 1809 (offset 5 lines).

Hunk #14 succeeded at 1863 (offset 5 lines).

Hunk #15 succeeded at 1909 (offset 5 lines).

Hunk #16 succeeded at 1935 (offset 5 lines).

Hunk #17 succeeded at 1969 (offset 5 lines).

Hunk #18 succeeded at 2049 (offset 5 lines).

Hunk #19 succeeded at 2203 (offset 5 lines).

Hunk #20 succeeded at 2331 (offset 5 lines).

Hunk #21 succeeded at 2357 (offset 5 lines).

Hunk #22 succeeded at 2578 (offset 5 lines).

patching file drivers/video/fbcmap.c

Reversed (or previously applied) patch detected!  Assume -R? [n] y

Hunk #2 FAILED at 235.

Hunk #3 FAILED at 250.

2 out of 3 hunks FAILED -- saving rejects to file drivers/video/fbcmap.c.rej

The next patch would create the file drivers/video/fbsplash.c,

which already exists!  Assume -R? [n] y

patching file drivers/video/fbsplash.c

The next patch would create the file drivers/video/fbsplash.h,

which already exists!  Assume -R? [n] y

patching file drivers/video/fbsplash.h

The next patch would create the file include/linux/console_splash.h,

which already exists!  Assume -R? [n] y

patching file include/linux/console_splash.h

patching file include/linux/console_struct.h

Reversed (or previously applied) patch detected!  Assume -R? [n] y

patching file include/linux/fb.h

Reversed (or previously applied) patch detected!  Assume -R? [n] y

patching file include/linux/sysctl.h

Hunk #1 FAILED at 146.

1 out of 1 hunk FAILED -- saving rejects to file include/linux/sysctl.h.rej

patching file kernel/sysctl.c

Reversed (or previously applied) patch detected!  Assume -R? [n] y

Hunk #1 succeeded at 84 (offset -1 lines).

Hunk #2 succeeded at 400 (offset -6 lines).

```

then i enable it in kernel and use command

```

make && make modules_install

```

but i get this error

```

 make && make modules_install

  CHK     include/linux/version.h

  SPLIT   include/linux/autoconf.h -> include/config/*

make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.

  CHK     include/asm-i386/asm_offsets.h

  CHK     include/linux/compile.h

  CC      init/do_mounts.o

  CC      init/do_mounts_rd.o

  CC      init/do_mounts_initrd.o

  LD      init/mounts.o

  LD      init/built-in.o

  CHK     usr/initramfs_list

  AS      arch/i386/kernel/vsyscall-note.o

  SYSCALL arch/i386/kernel/vsyscall-int80.so

  SYSCALL arch/i386/kernel/vsyscall-sysenter.so

  AS      arch/i386/kernel/vsyscall.o

  SYSCALL arch/i386/kernel/vsyscall-syms.o

  LD      arch/i386/kernel/built-in.o

  CC      kernel/sysctl.o

kernel/sysctl.c:408: error: `KERN_FBSPLASH' undeclared here (not in a function)

kernel/sysctl.c:408: error: initializer element is not constant

kernel/sysctl.c:408: error: (near initialization for `kern_table[15].ctl_name')

kernel/sysctl.c:415: error: initializer element is not constant

kernel/sysctl.c:415: error: (near initialization for `kern_table[15]')

kernel/sysctl.c:435: error: initializer element is not constant

kernel/sysctl.c:435: error: (near initialization for `kern_table[16]')

kernel/sysctl.c:445: error: initializer element is not constant

kernel/sysctl.c:445: error: (near initialization for `kern_table[17]')

kernel/sysctl.c:453: error: initializer element is not constant

kernel/sysctl.c:453: error: (near initialization for `kern_table[18]')

kernel/sysctl.c:461: error: initializer element is not constant

kernel/sysctl.c:461: error: (near initialization for `kern_table[19]')

kernel/sysctl.c:469: error: initializer element is not constant

kernel/sysctl.c:469: error: (near initialization for `kern_table[20]')

kernel/sysctl.c:477: error: initializer element is not constant

kernel/sysctl.c:477: error: (near initialization for `kern_table[21]')

kernel/sysctl.c:485: error: initializer element is not constant

kernel/sysctl.c:485: error: (near initialization for `kern_table[22]')

kernel/sysctl.c:493: error: initializer element is not constant

kernel/sysctl.c:493: error: (near initialization for `kern_table[23]')

kernel/sysctl.c:512: error: initializer element is not constant

kernel/sysctl.c:512: error: (near initialization for `kern_table[24]')

kernel/sysctl.c:520: error: initializer element is not constant

kernel/sysctl.c:520: error: (near initialization for `kern_table[25]')

kernel/sysctl.c:526: error: initializer element is not constant

kernel/sysctl.c:526: error: (near initialization for `kern_table[26]')

kernel/sysctl.c:533: error: initializer element is not constant

kernel/sysctl.c:533: error: (near initialization for `kern_table[27]')

kernel/sysctl.c:545: error: initializer element is not constant

kernel/sysctl.c:545: error: (near initialization for `kern_table[28]')

kernel/sysctl.c:556: error: initializer element is not constant

kernel/sysctl.c:556: error: (near initialization for `kern_table[29]')

kernel/sysctl.c:597: error: initializer element is not constant

kernel/sysctl.c:597: error: (near initialization for `kern_table[30]')

kernel/sysctl.c:605: error: initializer element is not constant

kernel/sysctl.c:605: error: (near initialization for `kern_table[31]')

kernel/sysctl.c:614: error: initializer element is not constant

kernel/sysctl.c:614: error: (near initialization for `kern_table[32]')

kernel/sysctl.c:622: error: initializer element is not constant

kernel/sysctl.c:622: error: (near initialization for `kern_table[33]')

kernel/sysctl.c:630: error: initializer element is not constant

kernel/sysctl.c:630: error: (near initialization for `kern_table[34]')

kernel/sysctl.c:649: error: initializer element is not constant

kernel/sysctl.c:649: error: (near initialization for `kern_table[35]')

kernel/sysctl.c:658: error: initializer element is not constant

kernel/sysctl.c:658: error: (near initialization for `kern_table[36]')

kernel/sysctl.c:660: error: initializer element is not constant

kernel/sysctl.c:660: error: (near initialization for `kern_table[37]')

make[1]: *** [kernel/sysctl.o] Error 1

make: *** [kernel] Error 2

```

I am using vanila-sourcesLast edited by Juventus on Mon Sep 19, 2005 1:31 pm; edited 4 times in total

----------

## Juventus

can someone please help me, someone who knows how to fix that!

PLEASE i REALLY NEED HELP!

----------

## Juventus

no developers or moderators here?  :Shocked:   :Crying or Very sad: 

----------

## Oliv

Hello,

Well in fact you apply a patch which was previously applied... From kernel 2.6.8 fbsplash pacth is included in gentoo kernel sources.

so the easiest way to get clean sources is to reinstall them. Then recompile your kernel and don't forget to enable Splash option  :Wink: 

----------

## Juventus

NO I AM USING vanilla-sources which doen't has fbsplash already in it! I am not using gentoo-sources!

----------

## Oliv

sorry but the error message from patch are typically due to a patch previously applied

----------

## Juventus

yes i figure out that i apply it twice becouse of this i get the FAILURE error.

What about compiling error?

Why i get error when compiling?

----------

## Oliv

I suppose that's due to this:

```
patching file include/linux/sysctl.h

Hunk #1 FAILED at 146.

1 out of 1 hunk FAILED -- saving rejects to file include/linux/sysctl.h.rej 
```

so you'll have to edit include/linux/sysctl.h.rej file and see what have failed and then patch manually the file.

----------

## Juventus

i look in this fail but i don't know whow to fix the problem in line 145! I try everything but i don't know how to fix it!

Can someone help me?

----------

## Oliv

Well if you don't post the .rej file, no one will be able to help you.

----------

## Juventus

ok no problem

this is fbcmap.c.rej

```

fbcmap.c.rej

***************

*** 235,248 ****

           if (transp)

              htransp = *transp++;

           if (info->fbops->fb_setcolreg(start++,

-                         hred, hgreen, hblue,

                          htransp, info))

              break;

        }

     }

-    if (rc == 0)

        fb_copy_cmap(cmap, &info->cmap);

- 

     return rc;

  }

  

--- 236,252 ----

           if (transp)

              htransp = *transp++;

           if (info->fbops->fb_setcolreg(start++,

+                         hred, hgreen, hblue, 

                          htransp, info))

              break;

        }

     }

+    if (rc == 0) {

        fb_copy_cmap(cmap, &info->cmap);

+       if (fbsplash_active(info, vc_cons[fg_console].d) &&

+           info->fix.visual == FB_VISUAL_DIRECTCOLOR)

+          fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);

+    }

     return rc;

  }

  

***************

*** 250,256 ****

  {

     int rc, size = cmap->len * sizeof(u16);

     struct fb_cmap umap;

- 

     if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&

                   !info->fbops->fb_setcmap))

        return -EINVAL;

--- 254,260 ----

  {

     int rc, size = cmap->len * sizeof(u16);

     struct fb_cmap umap;

+    

     if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&

                   !info->fbops->fb_setcmap))

        return -EINVAL;

```

and this is sysctl.h.rej

```

sysctl.h.rej

***************

*** 146,151 ****

     KERN_RANDOMIZE=68, /* int: randomize virtual address space */

     KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */

     KERN_SPIN_RETRY=70,   /* int: number of spinlock retries */

  };

  

  

--- 146,152 ----

     KERN_RANDOMIZE=68, /* int: randomize virtual address space */

     KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */

     KERN_SPIN_RETRY=70,   /* int: number of spinlock retries */

+    KERN_FBSPLASH=71,   /* string: path to fbsplash helper */

  };

  

```

what must i do now that fbslash will be compiled!

----------

## Oliv

for sysctl.h:

-open sysctl.h and do a search on "KERN_SPIN_RETRY" pattern...

-when you find the line "KERN_SPIN_RETRY=70" add a new line after it: 

```
KERN_FBSPLASH=71,   /* string: path to fbsplash helper */ 
```

for fbcmap.c:

-do nearly the same... I mean, find the line:

```

if (rc == 0) {

        fb_copy_cmap(cmap, &info->cmap);
```

and add in this "if" statement, the following one:

```
if (fbsplash_active(info, vc_cons[fg_console].d) &&

           info->fix.visual == FB_VISUAL_DIRECTCOLOR)

          fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d); 
```

then do a make clean and retry compilation

----------

## Juventus

i can't find any f this lines you enetered here.

Can i just eneter this lines in the file becouse i can't find

```

KERN_SPIN_RETRY

or

if (rc == 0) { 

        fb_copy_cmap(cmap, &info->cmap);

```

i just found

```

fb_copy_cmap(fb_default_cmap(len), cmap);

```

----------

## Oliv

Well for sysctl.h... you have an enum struct and the style of the enum struct is:

KERN_SOMETHING=number

go at the end of this enum and add your case (be carefull that 71 number is not used)

For the other case... You can try to add it after (not sure as I don't have seen the code)

----------

## Juventus

now i get this when compiling

```

drivers/video/fbcmap.c: In function `fb_alloc_cmap':

drivers/video/fbcmap.c:116: error: `info' undeclared (first use in this function)

drivers/video/fbcmap.c:116: error: (Each undeclared identifier is reported only once

drivers/video/fbcmap.c:116: error: for each function it appears in.)

make[2]: *** [drivers/video/fbcmap.o] Error 1

make[1]: *** [drivers/video] Error 2

```

fbcmap.ci is like this

```

int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp)

{

    int size = len*sizeof(u16);

    if (cmap->len != len) {

        fb_dealloc_cmap(cmap);

        if (!len)

            return 0;

        if (!(cmap->red = kmalloc(size, GFP_ATOMIC)))

            goto fail;

        if (!(cmap->green = kmalloc(size, GFP_ATOMIC)))

            goto fail;

        if (!(cmap->blue = kmalloc(size, GFP_ATOMIC)))

            goto fail;

        if (transp) {

            if (!(cmap->transp = kmalloc(size, GFP_ATOMIC)))

                goto fail;

        } else

            cmap->transp = NULL;

    }

    cmap->start = 0;

    cmap->len = len;

    fb_copy_cmap(fb_default_cmap(len), cmap);

 

       if (fbsplash_active(info, vc_cons[fg_console].d) && info->fix.visual == FB_VISUAL_DIRECTCOLOR)

          fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);

return 0;

```

i think that i must add this

```

  if (fbsplash_active(info, vc_cons[fg_console].d) && 

            info->fix.visual == FB_VISUAL_DIRECTCOLOR) 

           fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);

```

into this but don't know where!

```

int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *info)

{

   int i, start;

   u16 *red, *green, *blue, *transp;

   u_int hred, hgreen, hblue, htransp = 0xffff;

   red = cmap->red;

   green = cmap->green;

   blue = cmap->blue;

   transp = cmap->transp;

   start = cmap->start;

   if (start < 0 || (!info->fbops->fb_setcolreg &&

           !info->fbops->fb_setcmap))

      return -EINVAL;

   if (info->fbops->fb_setcmap)

      return info->fbops->fb_setcmap(cmap, info);

   for (i = 0; i < cmap->len; i++) {

      hred = *red++;

      hgreen = *green++;

      hblue = *blue++;

      if (transp)

         htransp = *transp++;

      if (info->fbops->fb_setcolreg(start++,

                     hred, hgreen, hblue, htransp,

                     info))

         break;

   }

   return 0;

}

```

----------

## Oliv

Yes you are right, you have to add your patch code in "fb_set_cmap" function  :Wink: 

Have a look at my kernel sources, and think you can put it after for loop... I mean:

```
for (i = 0; i < cmap->len; i++) {

      hred = *red++;

      hgreen = *green++;

      hblue = *blue++;

      if (transp)

         htransp = *transp++;

      if (info->fbops->fb_setcolreg(start++,

                     hred, hgreen, hblue, htransp,

                     info))

         break;

   }

if (fbsplash_active(info, vc_cons[fg_console].d) &&

            info->fix.visual == FB_VISUAL_DIRECTCOLOR)

           fbsplash_fix_pseudo_pal(info, vc_cons[fg_console].d);
```

----------

