# Error compiling updated kernel

## ONEEYEMAN

Hi, ALL,

I just ran the upgrade of the system and decided to upgrade the kernel to the latest stable version.

So I made a copy of my configuration, then I copy the old .config file over to the new /usr/src/linux, then did this:

```

IgorDellGentoo linux # make oldconfig

scripts/kconfig/conf --oldconfig Kconfig

#

# configuration written to .config

#

IgorDellGentoo linux # make menuconfig

scripts/kconfig/mconf Kconfig

*** End of the configuration.

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

IgorDellGentoo linux # make 

scripts/kconfig/conf --silentoldconfig Kconfig

make[1]: Nothing to be done for 'all'.

make[1]: Nothing to be done for 'relocs'.

  CHK     include/config/kernel.release

  CHK     include/generated/uapi/linux/version.h

  CHK     include/generated/utsrelease.h

  CC      kernel/bounds.s

In file included from include/linux/compiler.h:54:0,

                 from include/uapi/linux/stddef.h:1,

                 from include/linux/stddef.h:4,

                 from /usr/src/linux-3.12.20-gentoo/include/uapi/linux/posix_types.h:4,

                 from include/uapi/linux/types.h:13,

                 from include/linux/types.h:5,

                 from include/linux/page-flags.h:8,

                 from kernel/bounds.c:9:

include/linux/compiler-gcc.h:103:30: fatal error: linux/compiler-gcc5.h: No such file or directory

compilation terminated.

/usr/src/linux-3.12.20-gentoo/./Kbuild:35: recipe for target 'kernel/bounds.s' failed

make[1]: *** [kernel/bounds.s] Error 1

Makefile:838: recipe for target 'prepare0' failed

make: *** [prepare0] Error 2

```

My current configuration is:

```

IgorDellGentoo linux # emerge --info

Portage 2.2.26 (python 2.7.10-final-0, default/linux/amd64/13.0/desktop/kde, gcc-5.2.0, glibc-2.21-r2, 3.12.20-gentoo x86_64)

=================================================================

System uname: Linux-3.12.20-gentoo-x86_64-Pentium-R-_Dual-Core_CPU_T4200_@_2.00GHz-with-gentoo-2.2

KiB Mem:     2014420 total,    287636 free

KiB Swap:    1913852 total,   1276084 free

Timestamp of repository gentoo: Mon, 04 Apr 2016 23:30:01 +0000

sh bash 4.3_p42-r1

ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1

app-shells/bash:          4.3_p42-r1::gentoo

dev-lang/perl:            5.20.2::gentoo

dev-lang/python:          2.7.10-r1::gentoo, 3.4.3-r1::gentoo

dev-util/cmake:           3.3.1-r1::gentoo

dev-util/pkgconfig:       0.28-r2::gentoo

sys-apps/baselayout:      2.2::gentoo

sys-apps/openrc:          0.19.1::gentoo

sys-apps/sandbox:         2.10-r1::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo

sys-devel/automake:       1.12.6::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo

sys-devel/binutils:       2.25.1-r1::gentoo

sys-devel/gcc:            4.7.3-r1::gentoo, 4.8.4::gentoo, 5.2.0::gentoo

sys-devel/gcc-config:     1.7.3::gentoo

sys-devel/libtool:        2.4.6::gentoo

sys-devel/make:           4.1-r1::gentoo

sys-kernel/linux-headers: 4.3::gentoo (virtual/os-headers)

sys-libs/glibc:           2.21-r2::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

rainyday

    location: /var/lib/layman/rainyday

    masters: gentoo

    priority: 0

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=native"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -pipe -march=native"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://distfiles.gentoo.org"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

USE="X a52 aac acl acpi alsa amd64 berkdb bindist bluetooth branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cxx dbus declarative dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gpm gtk iconv ipv6 jpeg kde kipi lcms ldap libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit ppds qt3support qt4 readline sdl seccomp semantic-desktop session spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="ru" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

How do I fix it?

Thank you.

----------

## khayyam

 *ONEEYEMAN wrote:*   

> So I made a copy of my configuration, then I copy the old .config file over to the new /usr/src/linux, then did this:

 

ONEEYEMAN ... the /usr/src/linux symlink doesn't point to the new sources, 3.12.20-gentoo isn't in the tree and this is what you're both attempting to build, and are currently booting:

 *ONEEYEMAN wrote:*   

> 
> 
> ```
> /usr/src/linux-3.12.20-gentoo/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
> ```
> ...

 

... 'eselect kernel list' will show what kernels are available/installed, and which is set as /usr/src/linux, 'eselect kernel set {n}' to change. 

best ... khay

----------

## Buffoon

 *Quote:*   

> Timestamp of repository gentoo: Mon, 04 Apr 2016 23:30:01 +0000

 

Before doing any upgrades it would make sense to sync.

----------

## ONEEYEMAN

Buffoon,

I already upgraded.

Thank you.

----------

## ONEEYEMAN

khaaym,

```

IgorDellGentoo linux # pwd

/usr/src/linux

IgorDellGentoo linux # ls -la ..

total 28

drwxr-xr-x  7 root root 4096 Apr 19 20:27 .

drwxr-xr-x 14 root root 4096 Apr  7 19:56 ..

-rw-r--r--  1 root root    0 May 28  2014 .keep

lrwxrwxrwx  1 root root   22 Apr 19 20:27 linux -> linux-4.1.15-gentoo-r1

drwxr-xr-x 25 root root 4096 Apr 19 20:33 linux-3.12.20-gentoo

drwxr-xr-x 24 root root 4096 Aug  8  2014 linux-3.12.21-gentoo-r1

drwxr-xr-x 24 root root 4096 Nov  2  2014 linux-3.16.5-gentoo

drwxr-xr-x 24 root root 4096 Jun 20  2015 linux-3.18.12-gentoo

drwxr-xr-x 24 root root 4096 Apr 19 20:29 linux-4.1.15-gentoo-r1

IgorDellGentoo linux # eselect kernel list

Available kernel symlink targets:

  [1]   linux-3.12.20-gentoo

  [2]   linux-3.12.21-gentoo-r1

  [3]   linux-3.16.5-gentoo

  [4]   linux-3.18.12-gentoo

  [5]   linux-4.1.15-gentoo-r1 *

```

I am building the newly installed 4.1.15.

Thank you.

----------

## khayyam

 *ONEEYEMAN wrote:*   

> I am building the newly installed 4.1.15.

 

ONEEYEMAN ... not according to the output provided you're not:

 *ONEEYEMAN wrote:*   

> 
> 
> ```
> /usr/src/linux-3.12.20-gentoo/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
> ```
> ...

 

best ... khay

----------

## ONEEYEMAN

khayyam,

That's weird. The current directory is /usr/src/linux, which points to the linux-4.1.15-gentoo-r1.

Maybe it is because I copied the .config file - I copied it from the currently running kernel directory.

So what do I do?

Thank you.

----------

## Syl20

Just delete the .config file (no need to copy it to the sources dir) and run make oldconfig again.

----------

## ONEEYEMAN

According to this my old kernel configuration needs to be copied over.

Or is it only for the commands the guide uses?

Thank you.

----------

## Syl20

Never had to make a copy of a .config file, nowhere (except for backups, obviously. But I do not, the scripts do  :Laughing:  ). The make oldconfig command gets the running kernel config, asks you how to fill the new parameters if needed, and writes the .config file. If there isn't one before, it creates it, period.

----------

## Buffoon

 *Syl20 wrote:*   

> Never had to make a copy of a .config file, nowhere (except for backups, obviously. But I do not, the scripts do  ). The make oldconfig command gets the running kernel config, asks you how to fill the new parameters if needed, and writes the .config file. If there isn't one before, it creates it, period.

 

Never heard this one before, where from you think it gets the old .config?

----------

## ONEEYEMAN

Yeah, it is weird.

Especially since the official upgrade doc says "Copy"...

Thank you.

----------

## khayyam

 *Syl20 wrote:*   

> The make oldconfig command gets the running kernel config, asks you how to fill the new parameters if needed, and writes the .config file. If there isn't one before, it creates it, period.

 

Syl20 ... no, it utilises a provided .config

```
oldconfig - Update current config utilising a provided .config as base

silentoldconfig - Same as oldconfig, but quietly, additionally update deps
```

@ONEEYEMAN ... no idea, that is not some I've ever encountered before. Please recount the steps taken.

best ... khay

----------

## Buffoon

When you create new symlink and you are still in /usr/src/linux (where old symlink was pointing to) you must change dir as this: 

```
cd ../linux
```

----------

## ONEEYEMAN

Buffoon,

You are right. I exited the directory and then entered it again. And everything was working. I am configuring the new kernel right now.

BTW, it did pickup the old configuration without copying the old config.

Thank you.

----------

## Buffoon

I think you copied it over earlier? I do not believe it will go and start digging for old .config by itself.

----------

## ONEEYEMAN

On this page it says:

 *Quote:*   

> 
> 
> Change the system bootloader to pick up the new configuration.
> 
> 

 

but it does not explain what exctly needs to be done on this page.

Can someone explain how to change configuration of GRUB2? I want to just add the new kernel to an existing configuration for the test reboot and then after reboot get rid of the old one.

Thank you.

----------

## Syl20

 *Buffoon wrote:*   

> Never heard this one before, where from you think it gets the old .config?

 

/boot/config-$(uname -r) (if /boot is mounted) ?

/proc/config.gz (if CONFIG_IKCONFIG is set) ?

/usr/src/linux-$(uname -r)/.config (if it still exists) ?

Honestly, I don't know. But what I know is, on all the computers I ever owned, "make oldconfig" always wrote a valid (i.e. with the right parameters, when they exist) .config file, either there was one or not on the sources directory before I ran it. And it asks me what to do with the "NEW" parameters, compared to the running kernel ones. You should try.

----------

