|
|
Line 165: |
Line 165: |
| == Build Kernel == | | == Build Kernel == |
|
| |
|
| 1) In a browser, navigate to: https://developer.nvidia.com/embedded/downloads. Locate and download the L4T Sources: L4T Sources 27.1 2017/03/14 | | 1) Specify the path to the toolchain and architecture: |
| | <pre> |
| | export CROSS_COMPILE=/opt/jetpack3.0/install/bin/aarch64-unknown-linux-gnu- |
| | export ARCH=arm64 |
| | </pre> |
|
| |
|
| 2) Expand the Tarball file.
| | Define and create destination directories. |
|
| |
|
| <pre> | | <pre> |
| sudo tar -vxjf r27.1.0_sources.tbz2
| | export TEGRA_KERNEL_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/images |
| cd source/
| | export TEGRA_MODULES_OUT=/home/$USER/devdirs/tegra-kernel/r27.1.0_sources/modules |
| sudo tar -vxjf kernel_src.tbz2
| | mkdir -p $TEGRA_KERNEL_OUT |
| | mkdir -p $TEGRA_MODULES_OUT |
| | |
| | Compile |
| </pre> | | </pre> |
|
| |
| 1) Specify the path to the toolchain:
| |
|
| |
| <pre> | | <pre> |
| mkdir -p $DEVDIR/images/modules | | mkdir -p $DEVDIR/images/modules |
Line 188: |
Line 192: |
| 2) Clean your kernel and configuration | | 2) Clean your kernel and configuration |
| <pre> | | <pre> |
| cd $DEVDIR/64_TX2/Linux_for_Tegra_64_tx2/sources/kernel_source/
| | make -C kernel/kernel-4.4/ mrproper |
| make mrproper
| |
| </pre> | | </pre> |
|
| |
|
Line 195: |
Line 198: |
|
| |
|
| <pre> | | <pre> |
| make tegra21_defconfig | | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT tegra18_defconfig |
| make menuconfig | | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT menuconfig |
| </pre> | | </pre> |
|
| |
|
| 4) Compile kernel, device tree and modules | | 4) Compile kernel, device tree and modules |
| <pre> | | <pre> |
| make zImage | | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT zImage |
| make dtbs
| | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT dtbs |
| make modules
| | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules |
| make modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT
| | make -C kernel/kernel-4.4/ O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT |
| </pre>
| |
| | |
| 5) Save your binaries in the images directory
| |
| <pre>
| |
| cp arch/arm64/boot/Image arch/arm64/boot/zImage $DEVDIR/images/
| |
| </pre>
| |
| | |
| 6) Create kernel_supplements.tbz2 with kernel modules, this package is needed by Jetpack
| |
| | |
| <pre>
| |
| cd $DEVDIR/images/modules/lib/modules/
| |
| ls .
| |
| </pre>
| |
| | |
| define a variable with the name of the modules directory
| |
| | |
| <pre>
| |
| export KERNEL_MODULES_NAME=3.10.96+
| |
| </pre>
| |
| | |
| fix the symbolic links on the kernel modules directory
| |
| <pre>
| |
| cd $DEVDIR/images/modules/lib/modules/$KERNEL_MODULES_NAME
| |
| rm build source
| |
| </pre>
| |
| | |
| create tarball
| |
| <pre>
| |
| cd $DEVDIR/images/modules/
| |
| tar -cjf kernel_supplements.tbz2 *
| |
| mv kernel_supplements.tbz2 $DEVDIR/images/packages
| |
| </pre>
| |
| | |
| 7) Besides creating the modules and the kernel image you need to create again your kernel_headers.tbz2 file (needed by Jetpack). By default when you patch the kernel code and you don't check your changes in the kernel will add a -dirty suffix to the release version (check ls $DEVDIR/images/modules/lib/modules/ for example). For this specific reason you need to generate your headers tarball again changing it the release version.
| |
| | |
| <pre>
| |
| cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel
| |
| tar -xf kernel_headers.tbz2
| |
| tar -cjf kernel_headers_custom.tbz2 linux-headers-$KERNEL_MODULES_NAME
| |
| mv kernel_headers_custom.tbz2 $DEVDIR/images/packages
| |
| rm -rf linux-headers-$KERNEL_MODULES_NAME
| |
| </pre>
| |
| | |
| 8) Create the dtb directory
| |
| | |
| <pre>
| |
| mkdir -p $DEVDIR/images/dtb
| |
| cp $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/arch/arm64/boot/dts/*.dtb $DEVDIR/images/dtb/
| |
| </pre>
| |
| | |
| 9) Copy the Device Tree Compiler (DTC)
| |
| | |
| <pre>
| |
| cp $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/sources/kernel_source/scripts/dtc/dtc $DEVDIR/images/dtc
| |
| </pre> | | </pre> |
|
| |
|
| 10) Create a backup of the images and packages included in Jetpack
| | 5) Save your Images and device tree |
| <pre> | | <pre> |
| mkdir -p $DEVDIR/images/packages-backup | | mkdir boot |
| cp -rf $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/* $DEVDIR/images/packages-backup | | cp images/arch/arm64/boot/Image boot/ |
| | cp images/arch/arm64/boot/dts/* boot/ |
| </pre> | | </pre> |
|
| |
| 11) Finally overwrite the default images with your own images to install and boot them using jetpack
| |
|
| |
| <pre>
| |
| cd $DEVDIR/images
| |
| rm -rf $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/dtb
| |
| cp -rf Image zImage packages/kernel_supplements.tbz2 dtb/ dtc $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/
| |
| cp -rf packages/kernel_headers_custom.tbz2 $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/kernel/kernel_headers.tbz2
| |
| </pre>
| |
|
| |
| 12) Run the applybinaries script to generate the image to flash
| |
|
| |
| <pre>
| |
| cd $DEVDIR/64_TX1/Linux_for_Tegra_64_tx1/
| |
| sudo ./apply_binaries.sh
| |
| </pre>
| |
| Output:
| |
| <pre>
| |
| Using rootfs directory of: /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs
| |
| Extracting the NVIDIA user space components to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs
| |
| Extracting the BSP test tools to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs
| |
| Extracting the NVIDIA gst test applications to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs
| |
| Extracting the configuration files for the supplied root filesystem to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs
| |
| Creating a symbolic link nvgstplayer pointing to nvgstplayer-0.10
| |
| Creating a symbolic link nvgstcapture pointing to nvgstcapture-0.10
| |
| Adding symlink libcuda.so --> libcuda.so.1.1 in target rootfs
| |
| Adding symlink libGL.so --> libGL.so.1 in target rootfs
| |
| Adding symlink libcuda.so --> tegra/libcuda.so in target rootfs
| |
| Adding symlink libEGL.so --> libEGL.so.1 in target rootfs
| |
| Extracting the firmwares and kernel modules to /home/dsoto/devdirs/tegra/Jetpack/TX1/Linux_for_Tegra_tx1/rootfs
| |
| Extracting the kernel headers to /usr/src in target rootfs
| |
| Installing zImage into /boot in target rootfs
| |
| Installing Image into /boot in target rootfs
| |
| Installing the board *.dtb files into /boot in target rootfs
| |
| Success!
| |
| </pre>
| |
|
| |
| As an important note, kernel will be located not in a partition but in /boot on the filesystem this make easier a kernel update.
| |
|
| |
|
| == Flash your image with Jetpack == | | == Flash your image with Jetpack == |