Unable to build kernel R32 on NX

I’m following Kernel Customization doc and trying to build kernel R32 on NX.

When I run make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfig

It shows:

make[1]: Entering directory '/home/ubuntu/kernel-built'
  GEN     ./Makefile
  HOSTCC  scripts/kconfig/zconf.tab.o
scripts/kconfig/zconf.tab.c: In function ‘zconfparse’:
scripts/kconfig/zconf.tab.c:1940:2: warning: implicit declaration of function ‘zconf_trynextfile’; did you mean ‘zconf_nextfile’? [-Wimplicit-function-declaration]
  zconf_trynextfile((yyvsp[(2) - (3)].string));
  ^~~~~~~~~~~~~~~~~
  zconf_nextfile
In file included from scripts/kconfig/zconf.tab.c:2539:0:
zconf.lex.c: At top level:
zconf.lex.c:2338:7: error: conflicting types for ‘zconf_fopen’
In file included from scripts/kconfig/zconf.tab.c:167:0:
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/kconfig/lkc.h:73:7: note: previous declaration of ‘zconf_fopen’ was here
 FILE *zconf_fopen(const char *name, int init_overlay_id, int *found_overlay_id, const char **found_name);
       ^~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2539:0:
zconf.lex.c: In function ‘zconf_initscan’:
zconf.lex.c:2365:17: error: too few arguments to function ‘file_lookup’
In file included from scripts/kconfig/zconf.tab.c:167:0:
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/kconfig/lkc.h:116:14: note: declared here
 struct file *file_lookup(const char *name, int overlay_id, const char *logical_name);
              ^~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2539:0:
zconf.lex.c: At top level:
zconf.lex.c:2369:6: warning: no previous prototype for ‘zconf_trynextfile’ [-Wmissing-prototypes]
zconf.lex.c:2369:6: warning: conflicting types for ‘zconf_trynextfile’
scripts/kconfig/zconf.tab.c:1940:2: note: previous implicit declaration of ‘zconf_trynextfile’ was here
  zconf_trynextfile((yyvsp[(2) - (3)].string));
  ^~~~~~~~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2539:0:
zconf.lex.c: In function ‘zconf_nextfile’:
zconf.lex.c:2382:22: error: too few arguments to function ‘file_lookup’
In file included from scripts/kconfig/zconf.tab.c:167:0:
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/kconfig/lkc.h:116:14: note: declared here
 struct file *file_lookup(const char *name, int overlay_id, const char *logical_name);
              ^~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2541:0:
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/kconfig/confdata.c: In function ‘conf_read_simple’:
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/kconfig/confdata.c:261:8: error: too many arguments to function ‘zconf_fopen’
   in = zconf_fopen(name, 0, NULL, NULL);
        ^~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2539:0:
zconf.lex.c:2338:7: note: declared here
In file included from scripts/kconfig/zconf.tab.c:2541:0:
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/kconfig/confdata.c:266:8: error: too many arguments to function ‘zconf_fopen’
   in = zconf_fopen(name, 0, NULL, NULL);
        ^~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2539:0:
zconf.lex.c:2338:7: note: declared here
In file included from scripts/kconfig/zconf.tab.c:2541:0:
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/kconfig/confdata.c:278:9: error: too many arguments to function ‘zconf_fopen’
    in = zconf_fopen(name, 0, NULL, NULL);
         ^~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2539:0:
zconf.lex.c:2338:7: note: declared here
scripts/Makefile.host:118: recipe for target 'scripts/kconfig/zconf.tab.o' failed
make[2]: *** [scripts/kconfig/zconf.tab.o] Error 1
/home/ubuntu/Linux_for_Tegra/source/public/kernel/kernel-4.9/Makefile:565: recipe for target 'tegra_defconfig' failed
make[1]: *** [tegra_defconfig] Error 2
make[1]: Leaving directory '/home/ubuntu/kernel-built'
Makefile:171: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

How should I fix this?

Hi,
The document was about build the customize kernel Image from Host(x86) system.

OK Got it. We’ll try that

A note about something you might run into: If you are cross compiling, you use the ARCH=arm64. You would also need to name your cross toolchain location prefix for that case. If you compile natively on a Jetson, then you leave out both the ARCH= and no cross toolchain path would be specified.