cross-compiling kernel using a 32-bit toolchain on a 64-bit machine

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon Apr 6 18:50:41 EDT 2015


Hi All,

I'm having trouble compiling my kernel using a 32-bit toolchain (for
ARM) on a 64-bit host (Ubuntu 14.10). The kernel version is 3.14.17.

I understand that 32-bit binaries require "ia32-libs" (or equivalent)
for compiling on 64-bit hosts. I installed the required packages
(lib32z1 lib32ncurses5 lib32bz2-1.0 for Ubuntu 14.10), but still keep
getting errors:

$ make CROSS_COMPILE=arm-none-linux-gnueabi- all
Makefile:616: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR:
-fstack-protector not supported by compiler
make: arm-none-linux-gnueabi-gcc: Command not found
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
/bin/sh: 1: arm-none-linux-gnueabi-gcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2

I've ensured that the PATH to the toolchain binaries is correct.

If I try to export CROSS_COMPILE to my environment, then too I get an
error (although it's for a different reason):

$ make all
Makefile:616: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR:
-fstack-protector not supported by compiler
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CC      kernel/bounds.s
gcc: error: unrecognized argument in option ‘-mabi=aapcs-linux’
gcc: note: valid arguments to ‘-mabi=’ are: ms sysv
gcc: error: unrecognized command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mapcs’
gcc: error: unrecognized command line option ‘-mno-sched-prolog’
gcc: error: unrecognized command line option ‘-mno-thumb-interwork’
gcc: error: unrecognized command line option ‘-mfpu=vfp’
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

It looks like make is starting a new shell which does not have either
PATH (1st case) or  CROSS_COMPILE (2nd case) set.

Any hints on how to get make to use the toolchain?

Thanks,
-mandeep



More information about the Kernelnewbies mailing list