Cross compile TX2 kernel failed

Hi everyone,

I am a beginner with Jetson.
I am trying to modify and compile the Kernel for Jetson TX2. But I think I am facing a toolchain issue.
I’ve followed the instructions on documentation but I think I’ve done something wrong…
Could someone help me ?

– Error
@:~/nvidia/kernel/kernel-4.4$ sudo make O=$TKO ARCH=arm64 zImage
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 command line option ‘-mlittle-endian’
gcc: error: unrecognized command line option ‘-mgeneral-regs-only’

– I have CROSS_COMPILE variable
:~/nvidia/kernel/kernel-4.4$ echo $CROSS_COMPILE

Thanks in advance,


For reference, which L4T version is on the Jetson? See “head -n 1 /etc/nv_tegra_release” and “uname -r”.

Much of what you have is correct, but did you configure prior to running the build command? The best starting config is if you take a running unmodified TX2 and copy “/proc/config.gz” to your host in a safe place. Then copy this to the “$TKO”, gunzip it, rename it to “.config”, and edit “CONFIG_LOCALVERSION” in that to match the current “uname -r” suffix; so the edit would probably would be this result:


Once that is in place you can make edits, e.g.:

make O=$TKO nconfig

…then build as you did above. I would avoid the “defconfig” method of setting initial config if you can avoid it.

NOTE: Many config editors require having package “libncurses5-dev” installed:

sudo apt-get install libncurses5-dev

Thank you for answering me.

My Tegra version is 4.4.38-tegra
Yes, I defined the CROSS_COMPILE before to build the kernel.
I followed your method… Same error…

CC      kernel/bounds.s
gcc: error: unrecognized command line option ‘-mlittle-endian’; did you mean ‘-fconvert=little-endian’?
Kbuild:45: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1070: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2


What do you get from (appends “gcc --version” to your existing tool chain path):

/home/guillaume/nvidia/install/bin/aarch64-unknown-linux-gnu-<b>gcc --version</b>

Is the toolchain installed by standard Ubuntu apt-get? Was the toolchain from the NVIDIA downloads? I’m wondering if you perhaps got a version which is “too new”.

That’s what I get from …gnu-gcc --version.

aarch64-unknown-linux-gnu-gcc: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)

According to others topics on that log, I got it because of my locales, so I tried to modified that.
Finally, as it didn’t work, I checked other forums and finally created a VM to try it on Ubuntu 16.04.
Now, I am able to display the version (4.8.5) but the error log is still the same…
This toolchain was downloaded from NVidia download center.

Once again, thank you for helping me !


There have been installer issues in the past for non-en_US locales, though even that was usually when there were spaces in the path (or perhaps with dual byte characters). GCC itself should not be particularly sensitive to this, and cross compiling a kernel is about as simple as package requirements get (there is no linking stage, so bare metal might be harder to code, but is easier to set up a compile environment). I’m thinking perhaps there is an install issue for tool chain or related environment, perhaps a missing development package which isn’t documented.

As an experiment, what happens with this entered as a single command:

<b>LANG=en_US.UTF-8</b> /home/guillaume/nvidia/install/bin/aarch64-unknown-linux-gnu-<b>gcc --version</b>

If this works without error, then perhaps for a compile you could first “export LANG=en_US.UTF-8”. If there is no change, then it will be necessary to look closer at the tool chain.

Although a VM is difficult to work with for flashing or running JetPack I doubt this would interfere with cross compiles…in this case a VM should be just as good as a native install. You mentioned a VM, but what was the host prior to this? Ubuntu 16.04 should work great either way.

Hi again,

I had the same error when adding LANG=en_US.UTF-8…

aarch64-unknown-linux-gnu-gcc: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.
Aborted (core dumped)

Yes, I installed a Ubuntu 16.04 because I read that version should be supported.
So, I tried to compile on the VM again (even if I doesn’t work very well with JetPack, I agree, it should nut interfere with the compilation), and I confirm that my toolchain seems not to be recognized.

gcc: errror: unrecognized command line option '-mlittle-endian'
gcc: errror: unrecognized command line option '-mgeneral-regs-only'
Kbuild:44: recipe for target 'kernel/bounds.s' failed


It is strange to see that error. What was the actual install file you used? I know there is a 4.8.something (a couple of somethings…depending on which release you look at…but all “4.8”) available as an NVIDIA download, but there is also an officially available Ubuntu package for cross compile. Ubuntu 18.04 does not make available an old enough compiler to work, but if you use 16.04 or earlier, then the cross tools of “apt-get” would do the job (from the PC see “apt search gcc-4.8-aarch64”).

However, it would be useful to know more about the exact file you installed after download from NVIDIA. What is the original exact file name? What is the exact Ubuntu version of the host PC?

For whom still having the issue, you can try specifing full path to LANG=. In my case:

<b>LANG=/usr/lib/locale/C.UTF-8</b> /path_to_cross_compiler/bin/aarch64-unknown-linux-gnu-gcc --version

export LANG=C got me past the error

1 Like

This compiling Jetson TX1/TX2 source code guide may be useful for you:

Best regards,