Compiling Linux JETSON XAVIER NX on the evaluation board

I’m not familiar with NVIDIA product and have this evaluation board.
I have set the Linux on SD card and working with it.
I would like to practice in building my own version of Linux (adding kernel drivers)
I saw this link:

  1. My question is: If I can build the kernel version on the evaluation board itself?
  2. My second question regarding the MIPI driver: Doe’s it plug&play or I have to configure the driver according to the source?
  1. You can build directly on the Jetson if you have downloaded the kernel source to the Jetson.
  2. Don’t know about the MIPI driver, but if the driver is available as a module, then configuring a matching kernel on the Jetson, and then adding MIPI, the driver addition would be a simple file copy to the module location.

FYI, this is “native” compile. Directories in what follows are somewhat arbitrary and can be changed, and this assumes the kernel full source is at “/usr/src/sources/kernel/kernel-4.9”. Note that if you download and unpack kernel source, that this produces “sources/kernel/kernel-4.9”. So if you unpack from “/usr/src” (requires sudo to unpack there), this will produce:
/usr/src/sources/kernel/kernel-4.9
(which the following calls “$TOP”…note that only unpack requires sudo)

# --- Setting Up: -------------------------------------------------------
# DO NOT BUILD AS ROOT/SUDO!!! You might need to install source code as root/sudo.
mkdir -p "${HOME}/build/kernel"
mkdir -p "${HOME}/build/modules"
mkdir -p "${HOME}/build/firmware"

export TOP="/usr/src/sources/kernel/kernel-4.9"
export TEGRA_KERNEL_OUT="${HOME}/build/kernel"
export TEGRA_MODULES_OUT="${HOME}/build/modules"
export TEGRA_FIRMWARE_OUT="${HOME}/build/firmware"
export TEGRA_BUILD="${HOME}/build"

# --- Notes: ------------------------------------------------------------
# It is assumed kernel source is at "/usr/src/sources/kernel/kernel-4.9".
# Check if you have 6 CPU cores, e.g., via "htop".
# If you are missing cores, then experiment with "sudo nvpmodel -m 0, -m 1, and -m 2".
# Perhaps use "htop" to see core counts.
# Using "-j 6" in hints below because of assumption of 6 cores.
# -----------------------------------------------------------------------

# Compile commands start in $TOP, thus:
cd $TOP

# Do not forget to provide a starting configuration. Probably copy of "/proc/config.gz",
# to $TEGRA_KERNEL_OUT, but also perhaps via:
make O=$TEGRA_KERNEL_OUT nconfig

# If building the kernel Image:
make -j 6 O=$TEGRA_KERNEL_OUT Image

# If you did not build Image, but are building modules:
make -j 6 O=$TEGRA_KERNEL_OUT modules_prepare

# To build modules:
make -j 6 O=$TEGRA_KERNEL_OUT modules

# To build device tree content:
make -j 6 O=$TEGRA_KERNEL_OUT dtbs

# To put modules in "$TEGRA_MODULES_OUT":
make -j 6 O=$TEGRA_KERNEL_OUT INSTALL_MOD_PATH=$TEGRA_MODULES_OUT

# To put firmware and device trees in "$TEGRA_FIRMWARE_OUT":
make -j 6 O=$TEGRA_KERNEL_OUT INSTALL_FW_PATH=$TEGRA_FIRMWARE_OUT

Almost forgot…be careful to not run out of disk space. Building a kernel can take significant space.

Thanks for your respond I have 128 Gbytes SD card hope it will be enough

Oh that should be plenty so long as your build location is on that drive. At least for hard disk space, which is by far the most important thing (I’d say you are all set with 128GB).

Note that the “-j 6” says to use six cores during build. If you lack enough RAM, then you might reduce this to something like “-j 4”.