Compiling Jessie kernel with newer toolchain

If you compile Debian Jessie kernel, or any kernel older than 4.2, using a newer toolchain (GCC or Advance Toolchain), you might hit this problem:

/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S: Assembler messages:
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:42: Error: syntax error; found `@', expected `,'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:42: Error: junk at end of line: `@local'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:48: Error: syntax error; found `@', expected `,'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:48: Error: junk at end of line: `@local'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:83: Error: syntax error; found `@', expected `,'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:83: Error: junk at end of line: `@local'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:87: Error: syntax error; found `@', expected `,'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:87: Error: junk at end of line: `@local'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:195: Error: syntax error; found `@', expected `,'
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/gettimeofday.S:195: Error: junk at end of line: `@local'
make[7]: *** [arch/powerpc/kernel/vdso32/gettimeofday.o] Error 1
/«PKGBUILDDIR»/arch/powerpc/kernel/vdso32/Makefile:42: recipe for target 'arch/powerpc/kernel/vdso32/gettimeofday.o' failed
make[6]: *** [arch/powerpc/kernel/vdso32] Error 2
make[5]: *** [arch/powerpc/kernel] Error 2
make[5]: *** Waiting for unfinished jobs....
/«PKGBUILDDIR»/scripts/Makefile.build:403: recipe for target 'arch/powerpc/kernel/vdso32' failed
/«PKGBUILDDIR»/Makefile:951: recipe for target 'arch/powerpc/kernel' failed

This problem happens because newer toolchain does not allow code generation targeting 32 bits Little Endian, and the kernel code was trying to use it for VDSO.

This problem was later solved by the following commit in kernel 4.2:

commit e0d0059169945c8ee16790d2e7244cea397dfd56
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Mon May 11 20:01:02 2015 +1000

powerpc/vdso: Disable building the 32-bit VDSO on little endian

The only little endian configuration we support is ppc64le. As such if
we’re building little endian we don’t need a 32-bit VDSO, because there
is no 32-bit userspace.

This patch is a fairly ugly mess of #ifdefs, but is the minimal logic
required to disable the 32-bit VDSO. We can hopefully clean up the
result in future with some further refactoring.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

In order to circumvent this problem, you have three options:

  1. Cherry pick this commit into your old kernel, as being worked in Debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=785065
  2. Move to a newer kernel (newer than 4.2)
  3. Use an older toolchain (4.8), that does not block code generation for 32-bits LE.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s