cross-compiling kernel using a 32-bit toolchain on a 64-bit machine
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
On Mon, Apr 06, 2015 at 03:50:41PM -0700, Mandeep Sandhu wrote:
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.
Any hints on how to get make to use the toolchain?
after you export CROSS_COMPILE export ARCH=arm
On Mon, Apr 6, 2015 at 5:27 PM, John de la Garza <john@jjdev.com> wrote:
On Mon, Apr 06, 2015 at 03:50:41PM -0700, Mandeep Sandhu wrote:
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.
Any hints on how to get make to use the toolchain?
after you export CROSS_COMPILE export ARCH=arm
This didn't help. I get the same error as before. Thanks, -mandeep
On 2015/4/7 6:50, Mandeep Sandhu wrote:
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
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Edit .config and set CONFIG_CROSS_COMPILE to the path where your cross compiler is located.
On Mon, Apr 6, 2015 at 11:50 PM, Mandeep Sandhu <mandeepsandhu.chd@gmail.com> wrote:
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
Have built this toolchain or just downloaded from coudesourcery ? Go to the source where you downloaded toolchain (on your machine not the website) traverse to bin directory and try ./arm-none-linux-gnueabi-gcc --version. Cheers, --Prabhakar Lad
So I found the issue (it was a PIBKAC issue :/) I was using sudo to try and build the kernel (this was due to a messed up setup where the whole kernel src tree ended up being written by root). When copy-pasting my command here, I missed copying the sudo part and that was precisely the reason for the error. When invoking sudo, I think the current shells environment variables are not copied (probably due to security reasons) and that's why it was not picking up the toolchain paths. Once I fixed the permissions on the source tree and invoke make as regular user, it started working. Sorry about the noise, I should've figured this out earlier. On Tue, Apr 7, 2015 at 9:15 AM, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
On Mon, Apr 6, 2015 at 11:50 PM, Mandeep Sandhu <mandeepsandhu.chd@gmail.com> wrote:
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
Have built this toolchain or just downloaded from coudesourcery ? Go to the source where you downloaded toolchain (on your machine not the website) traverse to bin directory and try ./arm-none-linux-gnueabi-gcc --version.
Cheers, --Prabhakar Lad
participants (4)
-
John de la Garza -
Lad, Prabhakar -
Mandeep Sandhu -
Rock Lee