# problem kernel on gentoo

## electro

install gentoo 64 bit wg handbook, next boot and i have error , stop boot - photo :

http://img33.imageshack.us/img33/3263/dscn0564it.jpg

mice i keyboard I have on usb 

I make in console : 

```
 emerge gentoo-sources 

 make menuconfig //adds 2 option and :

make && make modules_install
```

next compile kernel with  genkernela , and i have also error , log :

```

(chroot) Gentoo-11 boot # genkernel --menuconfig  all

* Gentoo Linux Genkernel; Version 3.4.10.907

* Running with options: --menuconfig all

* Linux Kernel 2.6.38-gentoo-r6 for x86_64...

* kernel: >> Running mrproper...

* config: Using config from /etc/kernels/kernel-config-x86_64-2.6.38-gentoo-r6

*         Previous config backed up to .config.bak

*         >> Running oldconfig...

* kernel: >> Cleaning...

* config: >> Invoking menuconfig...

#

# configuration written to .config

#

*** End of the configuration.

*** Execute 'make' to start the build or try 'make help'.

*         >> Compiling 2.6.38-gentoo-r6 bzImage...

*         >> Compiling 2.6.38-gentoo-r6 modules...

* Copying config for successful build to /etc/kernels/kernel-config-x86_64-2.6.38-gentoo-r6

* busybox: >> Applying patches...

* busybox: >> Configuring...

* ERROR: Failed to compile the "oldconfig" target...

* -- Grepping log... --

  SHIPPED scripts/genksyms/parse.h

  SHIPPED scripts/genksyms/keywords.c

  SHIPPED scripts/genksyms/parse.c

  HOSTCC  scripts/genksyms/lex.o

scripts/genksyms/lex.c: In function 'yylex1':

scripts/genksyms/lex.l:97: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result

--

  CC      fs/gfs2/glops.o

  CC      crypto/shash.o

  CC      fs/gfs2/inode.o

  CC      crypto/algboss.o

fs/gfs2/inode.c: In function 'gfs2_lookup_by_inum':

fs/gfs2/inode.c:188: warning: 'inode' may be used uninitialized in this function

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC      drivers/scsi/scsi_netlink.o

  LD      fs/xfs/xfs.o

  LD      fs/xfs/built-in.o

  CC      fs/eventpoll.o

fs/eventpoll.c: In function 'ep_poll':

fs/eventpoll.c:1143: warning: 'slack' may be used uninitialized in this function

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  LD [M]  sound/pci/snd-sonicvibes.o

  LD [M]  sound/pci/snd-via82xx.o

  LD [M]  sound/pci/snd-via82xx-modem.o

  CC [M]  sound/pcmcia/pdaudiocf/pdaudiocf.o

sound/pcmcia/pdaudiocf/pdaudiocf.c: In function 'pdacf_config':

sound/pcmcia/pdaudiocf/pdaudiocf.c:226: warning: 'pcmcia_request_exclusive_irq' is deprecated (declared at include/pcmcia/ds.h:201)

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/gpu/drm/radeon/radeon_ring.o

  LD [M]  sound/pcmcia/pdaudiocf/snd-pdaudiocf.o

  CC [M]  sound/pcmcia/vx/vxpocket.o

  CC [M]  drivers/gpu/drm/radeon/radeon_irq_kms.o

sound/pcmcia/vx/vxpocket.c: In function 'vxpocket_config':

sound/pcmcia/vx/vxpocket.c:232: warning: 'pcmcia_request_exclusive_irq' is deprecated (declared at include/pcmcia/ds.h:201)

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  net/mac80211/spectmgmt.o

  CC [M]  drivers/md/dm-linear.o

  CC [M]  net/mac80211/tx.o

  CC [M]  drivers/md/dm-stripe.o

net/mac80211/tx.c: In function 'ieee80211_subif_start_xmit':

net/mac80211/tx.c:1753: warning: unused variable 'mppath'

  CC [M]  drivers/md/dm-ioctl.o

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/message/fusion/mptfc.o

  CC [M]  net/netfilter/nf_conntrack_ecache.o

  CC [M]  net/netfilter/nf_conntrack_h323_main.o

  CC [M]  drivers/message/fusion/mptsas.o

drivers/message/fusion/mptsas.c: In function 'mptsas_event_process':

drivers/message/fusion/mptsas.c:5012: warning: unused variable 'log_info'

  CC [M]  net/netfilter/nf_conntrack_h323_asn1.o

  CC [M]  net/netfilter/nf_conntrack_proto_gre.o

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/message/i2o/bus-osm.o

  CC [M]  net/netfilter/nf_conntrack_amanda.o

  CC [M]  drivers/message/i2o/config-osm.o

In file included from drivers/message/i2o/config-osm.c:39:

drivers/message/i2o/i2o_config.c: In function 'i2o_cfg_passthru':

drivers/message/i2o/i2o_config.c:881: warning: cast to pointer from integer of different size

drivers/message/i2o/i2o_config.c:936: warning: cast to pointer from integer of different size

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/net/pcmcia/3c574_cs.o

  CC [M]  drivers/platform/x86/thinkpad_acpi.o

  CC [M]  drivers/net/pcmcia/fmvj18x_cs.o

  CC [M]  drivers/net/pcmcia/nmclan_cs.o

drivers/net/pcmcia/nmclan_cs.c: In function 'nmclan_config':

drivers/net/pcmcia/nmclan_cs.c:628: warning: 'pcmcia_request_exclusive_irq' is deprecated (declared at include/pcmcia/ds.h:201)

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/net/skfp/smtdef.o

  CC [M]  drivers/net/skfp/smtinit.o

  CC [M]  drivers/net/skfp/smttimer.o

  CC [M]  drivers/scsi/advansys.o

  CC [M]  drivers/net/skfp/srf.o

drivers/scsi/advansys.c:72:2: warning: #warning this driver is still not properly converted to the DMA API

--

  CC [M]  drivers/scsi/aic7xxx/aic79xx_proc.o

  CC [M]  drivers/scsi/aic7xxx/aic79xx_osm_pci.o

  CC [M]  drivers/net/wireless/wl3501_cs.o

  CC [M]  drivers/scsi/aic7xxx/aic7xxx_core.o

drivers/net/wireless/wl3501_cs.c: In function 'wl3501_mgmt_scan_confirm':

drivers/net/wireless/wl3501_cs.c:656: warning: 'sig' is used uninitialized in this function

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  LD [M]  drivers/usb/storage/ums-sddr09.o

  LD [M]  drivers/usb/storage/ums-sddr55.o

  LD [M]  drivers/usb/storage/ums-usbat.o

  Building modules, stage 2.

  MODPOST 1060 modules

WARNING: modpost: Found 1 section mismatch(es).

--

COMMAND: make -j2 CC="gcc" LD="ld" AS="as"  

Makefile:405: *** mixed implicit and normal rules.  Stop.

* Gentoo Linux Genkernel; Version 3.4.10.907

* Running with options: --menuconfig all

* ERROR: Failed to compile the "oldconfig" target...

* -- End log... --

* Please consult /var/log/genkernel.log for more information and any

* errors that were reported above.

* Report any genkernel bugs to bugs.gentoo.org and

* assign your bug to genkernel@gentoo.org. Please include

* as much information as you can in your bug report; attaching

* /var/log/genkernel.log so that your issue can be dealt with effectively.

* 

* Please do *not* report compilation failures as genkernel bugs!

* 

* busybox: >> Compiling...

* ERROR: Failed to compile the "all" target...

* -- Grepping log... --

  SHIPPED scripts/genksyms/parse.h

  SHIPPED scripts/genksyms/keywords.c

  SHIPPED scripts/genksyms/parse.c

  HOSTCC  scripts/genksyms/lex.o

scripts/genksyms/lex.c: In function 'yylex1':

scripts/genksyms/lex.l:97: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result

--

  CC      fs/gfs2/glops.o

  CC      crypto/shash.o

  CC      fs/gfs2/inode.o

  CC      crypto/algboss.o

fs/gfs2/inode.c: In function 'gfs2_lookup_by_inum':

fs/gfs2/inode.c:188: warning: 'inode' may be used uninitialized in this function

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC      drivers/scsi/scsi_netlink.o

  LD      fs/xfs/xfs.o

  LD      fs/xfs/built-in.o

  CC      fs/eventpoll.o

fs/eventpoll.c: In function 'ep_poll':

fs/eventpoll.c:1143: warning: 'slack' may be used uninitialized in this function

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  LD [M]  sound/pci/snd-sonicvibes.o

  LD [M]  sound/pci/snd-via82xx.o

  LD [M]  sound/pci/snd-via82xx-modem.o

  CC [M]  sound/pcmcia/pdaudiocf/pdaudiocf.o

sound/pcmcia/pdaudiocf/pdaudiocf.c: In function 'pdacf_config':

sound/pcmcia/pdaudiocf/pdaudiocf.c:226: warning: 'pcmcia_request_exclusive_irq' is deprecated (declared at include/pcmcia/ds.h:201)

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/gpu/drm/radeon/radeon_ring.o

  LD [M]  sound/pcmcia/pdaudiocf/snd-pdaudiocf.o

  CC [M]  sound/pcmcia/vx/vxpocket.o

  CC [M]  drivers/gpu/drm/radeon/radeon_irq_kms.o

sound/pcmcia/vx/vxpocket.c: In function 'vxpocket_config':

sound/pcmcia/vx/vxpocket.c:232: warning: 'pcmcia_request_exclusive_irq' is deprecated (declared at include/pcmcia/ds.h:201)

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  net/mac80211/spectmgmt.o

  CC [M]  drivers/md/dm-linear.o

  CC [M]  net/mac80211/tx.o

  CC [M]  drivers/md/dm-stripe.o

net/mac80211/tx.c: In function 'ieee80211_subif_start_xmit':

net/mac80211/tx.c:1753: warning: unused variable 'mppath'

  CC [M]  drivers/md/dm-ioctl.o

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/message/fusion/mptfc.o

  CC [M]  net/netfilter/nf_conntrack_ecache.o

  CC [M]  net/netfilter/nf_conntrack_h323_main.o

  CC [M]  drivers/message/fusion/mptsas.o

drivers/message/fusion/mptsas.c: In function 'mptsas_event_process':

drivers/message/fusion/mptsas.c:5012: warning: unused variable 'log_info'

  CC [M]  net/netfilter/nf_conntrack_h323_asn1.o

  CC [M]  net/netfilter/nf_conntrack_proto_gre.o

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/message/i2o/bus-osm.o

  CC [M]  net/netfilter/nf_conntrack_amanda.o

  CC [M]  drivers/message/i2o/config-osm.o

In file included from drivers/message/i2o/config-osm.c:39:

drivers/message/i2o/i2o_config.c: In function 'i2o_cfg_passthru':

drivers/message/i2o/i2o_config.c:881: warning: cast to pointer from integer of different size

drivers/message/i2o/i2o_config.c:936: warning: cast to pointer from integer of different size

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/net/pcmcia/3c574_cs.o

  CC [M]  drivers/platform/x86/thinkpad_acpi.o

  CC [M]  drivers/net/pcmcia/fmvj18x_cs.o

  CC [M]  drivers/net/pcmcia/nmclan_cs.o

drivers/net/pcmcia/nmclan_cs.c: In function 'nmclan_config':

drivers/net/pcmcia/nmclan_cs.c:628: warning: 'pcmcia_request_exclusive_irq' is deprecated (declared at include/pcmcia/ds.h:201)

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  CC [M]  drivers/net/skfp/smtdef.o

  CC [M]  drivers/net/skfp/smtinit.o

  CC [M]  drivers/net/skfp/smttimer.o

  CC [M]  drivers/scsi/advansys.o

  CC [M]  drivers/net/skfp/srf.o

drivers/scsi/advansys.c:72:2: warning: #warning this driver is still not properly converted to the DMA API

--

  CC [M]  drivers/scsi/aic7xxx/aic79xx_proc.o

  CC [M]  drivers/scsi/aic7xxx/aic79xx_osm_pci.o

  CC [M]  drivers/net/wireless/wl3501_cs.o

  CC [M]  drivers/scsi/aic7xxx/aic7xxx_core.o

drivers/net/wireless/wl3501_cs.c: In function 'wl3501_mgmt_scan_confirm':

drivers/net/wireless/wl3501_cs.c:656: warning: 'sig' is used uninitialized in this function

At top level:

cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"

--

  LD [M]  drivers/usb/storage/ums-sddr09.o

  LD [M]  drivers/usb/storage/ums-sddr55.o

  LD [M]  drivers/usb/storage/ums-usbat.o

  Building modules, stage 2.

  MODPOST 1060 modules

WARNING: modpost: Found 1 section mismatch(es).

--

COMMAND: make -j2 CC="gcc" LD="ld" AS="as"  

Makefile:405: *** mixed implicit and normal rules.  Stop.

* Gentoo Linux Genkernel; Version 3.4.10.907

* Running with options: --menuconfig all

* ERROR: Failed to compile the "oldconfig" target...

--

* Report any genkernel bugs to bugs.gentoo.org and

* assign your bug to genkernel@gentoo.org. Please include

* as much information as you can in your bug report; attaching

* /var/log/genkernel.log so that your issue can be dealt with effectively.

* 

* Please do *not* report compilation failures as genkernel bugs!

--

make: getcwd: No such file or directory

make: *** No rule to make target `all'.  Stop.

* Gentoo Linux Genkernel; Version 3.4.10.907

* Running with options: --menuconfig all

* ERROR: Failed to compile the "all" target...

* -- End log... --

* Please consult /var/log/genkernel.log for more information and any

* errors that were reported above.

* Report any genkernel bugs to bugs.gentoo.org and

* assign your bug to genkernel@gentoo.org. Please include

* as much information as you can in your bug report; attaching

* /var/log/genkernel.log so that your issue can be dealt with effectively.

* 

* Please do *not* report compilation failures as genkernel bugs!

```

----------

## chithanh

Recent stage3 had a problem with missing device nodes in /dev. See this thread how to create them.

----------

## joxp

i think this is the problem and the solution is there

https://bugs.gentoo.org/show_bug.cgi?id=341943

----------

## LandyZ

 *joxp wrote:*   

> i think this is the problem and the solution is there
> 
> https://bugs.gentoo.org/show_bug.cgi?id=341943

 

Hi, I've checked the bug report and found the workaround

> I added sys-kernel/genkernel * to package.keywords, emerged, and re-ran.  Issue

> fixed, but as you can see from log it is occurring in the stable version...

But I don't know what to do exactly... This is the first time I install Gentoo...

I didn't find package.keywords in my system, and some article says it under /etc/portage/, so I created package.keywords under /etc/portage then add 'sys-kernel/genkernel * ' to it.

Then execute 'emerge --sync' and 'emerge genkernel', and 'genkernel all'

But it didn't work.

Is there anything I miss? Thanks.

----------

## vifia

i am having this same problem. i cant find a working solution. this is so ridiculous, why havent genkernel fixed this problem.

----------

## Palatinux

Since the Fortress Linux kernel is different from the Gentoo kernel, I cannot create a working patch in two minutes, but this is the possible solution:

In the main Makefile replace the line:

```
KBUILD_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
```

with:

```

ifeq ($(call cc-option-yn, -Wunused-but-set-variable), y)

KBUILD_CFLAGS += -Wno-unused-but-set-variable

endif

```

Older GCC versions ignore "-Wno-unused-but-set-variable" but newer versions give an error and exit.

Palatinux

----------

## Palatinux

Ahh, I look liks the Gentoo hardened kernel patches are responsible for this problem. 

Antony B, you should take a look at 2900_disable-wunused-but-set-var-gcc-4-6-0.patch

----------

## blueness

 *Palatinux wrote:*   

> Ahh, I look liks the Gentoo hardened kernel patches are responsible for this problem. 
> 
> Antony B, you should take a look at 2900_disable-wunused-but-set-var-gcc-4-6-0.patch

 

Will do.  I'll test with/without the patch and exclude it from hardened-sources if need be.

----------

## Palatinux

Thanks,

We use this Gentoo patch and the 'set GIDS patch' in Fortress Linux too. But this problem can also be caused by a Debian kernel patch in our kernel.

----------

## blueness

 *Palatinux wrote:*   

> Thanks,
> 
> We use this Gentoo patch and the 'set GIDS patch' in Fortress Linux too. But this problem can also be caused by a Debian kernel patch in our kernel.

 

I need to see the full patchset to do this right.

----------

## Palatinux

Hi Anthony,

I made a mistake. I also included the Gentoo generic patches into the Fortress Linux kernel by accident. I thought they where the hardened patches.

(we use 92 patches, so mixing them up is quite easy  :Smile:  Anyway, it's now fixed in our kernel.

The patchset that contains the "bug" is: http://mirrors.kernel.org/gentoo/distfiles/genpatches-2.6.39-6.base.tar.bz2. The file is "2900_disable-wunused-but-set-var-gcc-4-6-0.patch"

You can exclude this patch completely from Gentoo or adjust this file so it reads:

```

ifeq ($(call cc-option-yn, -Wunused-but-set-variable), y)

KBUILD_CFLAGS += -Wno-unused-but-set-variable

endif

```

This file is the problem. Trust me, I've been a kernel developer for several years.

----------

## blueness

 *Palatinux wrote:*   

> Hi Anthony,
> 
> I made a mistake. I also included the Gentoo generic patches into the Fortress Linux kernel by accident. I thought they where the hardened patches.
> 
> (we use 92 patches, so mixing them up is quite easy  Anyway, it's now fixed in our kernel.
> ...

 

Well a few points here: 1) This error occurs with older compilers that don't recognize -Wunused-but-set-variable, so by conditionally checking for it in the Makefile you protect against this.  However, our current stable compiler is 4.4.5 and we'll soon be stabilizing 4.5.1 so it isn't a problem on a stable gentoo system.  2) We love to support other distros that use our patches, but since you've got the solution, I don't think we need to do anything for Fortress.  3) This patch is already upstream with linux-3, so current stable kernel is already breaking with older compilers.  If you feel strongly about this, the correct solution at this point would be to submit to lkml.  This one is a no brainer, and I think upstream will accept it. (I'd offer help getting it up, but sounds like you know what you're doing.)

----------

## blueness

 *blueness wrote:*   

>  This patch is already upstream with linux-3,

 

Actually psomas and I just checked.  The line upstream reads

    KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)

This makes use of the new cc-disable-warning which effectively does the check you suggest.  For documentation see

https://patchwork.kernel.org/patch/1010172/mbox/

and  Documentation/kbuild/makefiles.txt

----------

## psomas

@Palatinux

Thanks for the help.  :Smile: 

The original patch posted at lkml to address the issue with gcc-4.6.0 and -Wunused-but-set-variable wasn't 'aware' of the >=gcc-4.4 change in handling -Wno options. I guess it was later fixed in the kbuild tree, to use the new disable-warning function.

We'll fix the patch, to work as intended. 

There's one more $(call cc-option, -Wno) in the Makefile, so we'll 'backport'/include the new disable-warning kbuild function, and use it to fix both.

There'll be a new genpatches release including the fixes at ~29/30 Aug for 2.6.32, when the new .2.6.32.46-longterm comes out. 

Since 2.6.39.4-stable was the last release for 2.6.39, there may be a last genpatches release for 2.6.39 including the fixes.

Thanks again!  :Smile: 

----------

## Palatinux

You're welcome,

We don't use this patch (anymore) in Fortress Linux operating system, but I'll hope it will help the Gentoo users.

Besides the set-GIDs patch, we also ported the Gentoo OpenRC to Fortress Linux. After a long audit we found may issues and shortcomings in the init scripts which we fixed.

Is you're team interested in these fixes? Maybe both parties can benefit from it.

----------

## blueness

 *Palatinux wrote:*   

> You're welcome,
> 
> We don't use this patch (anymore) in Fortress Linux operating system, but I'll hope it will help the Gentoo users.
> 
> Besides the set-GIDs patch, we also ported the Gentoo OpenRC to Fortress Linux. After a long audit we found may issues and shortcomings in the init scripts which we fixed.
> ...

 

Yes.  I have commit to the openrc repo.  The best way is to open bug reports and/or pass the patches to me and I'll open the bugs for review by the openrc team.

----------

