How to cross compile TX2's 4.9 kernel

I want to compile TX2’s 4.9 kernel on an X86 64-bit ubuntu computer. There are various errors in the official source code compilation. Are there any corresponding compilation instructions? I did not find the tegra18_deconfig file in the kernel source code. What should I do?

The instructions are given in the documentation for that specific L4T release. To find your L4T release one of these should work:
head -n 1 /etc/nv_tegra_release
dpkg -l | grep 'nvidia-l4t-core'

The URL to the listing of L4T releases (and documentation) is here:

The document “NVIDIA Jetson Linux Developer Guide” has a section in it, “Kernel Customization”, which contains the information you need.

It is worth noting that downloading just the kernel from the wrong place does not include everything you need. The download for “L4T Driver Package (BSP) Sources” contains “kernel_src.tbz2”. When you unpack “kernel_src.tbz2” you will get more than one directory, and some NVIDIA features, when enabled in the kernel, reference this via relative path.

You will also find that particular tool versions may be required. If you use the instructions with the documentation for that release you should end up with the correct version of tools for an Ubuntu 18.04 host to cross compile.

Note that “tegra18_defconfig” applies only to an L4T R27.x or 28.x release. If you are using a newer release (highly recommended), then it is just “tegra_defconfig”. If you are using documentation suggesting tegra18_defconfig with a newer L4T release, then you are using out of date documents.

cross-compile the unmodified source code downloaded from the official website, and I encountered many errors when compiling. Some of these errors are caused by missing files.
However, I encountered the following error:
drivers/built-in.o: In the function ‘tegra_pinctrl_config_prod’:
/home/lzg/work/tx2/source/public_sources/kernel/kernel-4.9/drivers/pinctrl/tegra/pinctrl-tegra.c:1174: undefined reference to ‘tegra_prod_set_by_name’
what should I do?

this steps including download and build kernel is on tx2 board or host machine?

host PC

See the questions at post #2. It is hard to answer without knowing that information. Even the compiler tool release version requirement changed over time.