2,599
edits
Efernandez (talk | contribs) |
Efernandez (talk | contribs) |
||
Line 114: | Line 114: | ||
*[[Compiling_Tegra_X1_source_code#Getting_bootloader_and_kernel | Getting bootloader and kernel]] | *[[Compiling_Tegra_X1_source_code#Getting_bootloader_and_kernel | Getting bootloader and kernel]] | ||
*[[Compiling_Tegra_X1_source_code#Toolchain | Getting Linaro toolchain]] | |||
2) Configure environment: | |||
<pre> | <pre> | ||
Line 123: | Line 124: | ||
export CROSS32CC=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc | export CROSS32CC=/opt/linaro/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc | ||
export KERNEL_MODULES_OUT=$DEVDIR/images/modules | export KERNEL_MODULES_OUT=$DEVDIR/images/modules | ||
export TEGRA_KERNEL_OUT=$DEVDIR/images | |||
export ARCH=arm64 | export ARCH=arm64 | ||
</pre> | </pre> | ||
3) Clean your kernel and configuration | |||
<pre> | <pre> | ||
cd $DEVDIR | cd $DEVDIR/sources/kernel/kernel-4.4 | ||
make mrproper | make mrproper | ||
</pre> | </pre> | ||
4) Apply the following patch from '''$DEVDIR/sources/kernel''' to fix build errors: | |||
< | <syntaxhighlight lang=diff> | ||
Index: | --- | ||
kernel-4.4/drivers/devfreq/governor_pod_scaling.c | 2 +- | |||
kernel-4.4/drivers/devfreq/governor_wmark_active.c | 2 +- | |||
kernel-4.4/drivers/media/platform/tegra/mipical/vmipi/vmipi.c | 2 +- | |||
nvgpu/drivers/gpu/nvgpu/Makefile.nvgpu | 1 + | |||
nvgpu/drivers/gpu/nvgpu/common/linux/kmem.c | 2 +- | |||
5 files changed, 5 insertions(+), 4 deletions(-) | |||
Index: kernel/kernel-4.4/drivers/devfreq/governor_pod_scaling.c | |||
=================================================================== | |||
--- kernel.orig/kernel-4.4/drivers/devfreq/governor_pod_scaling.c | |||
+++ kernel/kernel-4.4/drivers/devfreq/governor_pod_scaling.c | |||
@@ -51,7 +51,7 @@ | |||
#define CREATE_TRACE_POINTS | |||
#include <trace/events/nvhost_podgov.h> | |||
-#include <governor.h> | |||
+#include "governor.h" | |||
#include <linux/platform_device.h> | |||
#include <linux/pm_runtime.h> | |||
Index: kernel/kernel-4.4/drivers/devfreq/governor_wmark_active.c | |||
=================================================================== | |||
--- kernel.orig/kernel-4.4/drivers/devfreq/governor_wmark_active.c | |||
+++ kernel/kernel-4.4/drivers/devfreq/governor_wmark_active.c | |||
@@ -23,7 +23,7 @@ | |||
#include <linux/platform_device.h> | |||
#include <linux/module.h> | |||
-#include <governor.h> | |||
+#include "governor.h" | |||
struct wmark_gov_info { | |||
/* probed from the devfreq */ | |||
Index: kernel/nvgpu/drivers/gpu/nvgpu/Makefile.nvgpu | |||
=================================================================== | |||
--- kernel.orig/nvgpu/drivers/gpu/nvgpu/Makefile.nvgpu | |||
+++ kernel/nvgpu/drivers/gpu/nvgpu/Makefile.nvgpu | |||
@@ -1,5 +1,6 @@ | |||
GCOV_PROFILE := y | |||
+ccflags-y += -I$(srctree)/../nvgpu/drivers/gpu/nvgpu/ | |||
ccflags-y += -Idrivers/gpu/nvgpu/include | |||
ccflags-y += -Idrivers/video/tegra/host | |||
ccflags-y += -Idrivers/devfreq | |||
Index: kernel/nvgpu/drivers/gpu/nvgpu/common/linux/kmem.c | |||
=================================================================== | |||
--- kernel.orig/nvgpu/drivers/gpu/nvgpu/common/linux/kmem.c | |||
+++ kernel/nvgpu/drivers/gpu/nvgpu/common/linux/kmem.c | |||
@@ -27,7 +27,7 @@ | |||
#include <nvgpu/kmem.h> | |||
-#include "gk20a/gk20a.h" | |||
+#include <gk20a/gk20a.h> | |||
#include "kmem_priv.h" | |||
Index: kernel/kernel-4.4/drivers/media/platform/tegra/mipical/vmipi/vmipi.c | |||
=================================================================== | =================================================================== | ||
--- | --- kernel.orig/kernel-4.4/drivers/media/platform/tegra/mipical/vmipi/vmipi.c | ||
+++ | +++ kernel/kernel-4.4/drivers/media/platform/tegra/mipical/vmipi/vmipi.c | ||
@@ - | @@ -24,7 +24,7 @@ | ||
#include <linux/wait.h> | |||
#include <linux/tegra-ivc.h> | |||
-#include "mipi_cal.h" | |||
+#include "../mipi_cal.h" | |||
#include "vmipi.h" | |||
const char *tegra_vmipi_cmd[] = { | |||
</ | </syntaxhighlight> | ||
5) Configure your kernel | |||
* '''For TX1''' | |||
<pre> | <pre> | ||
make O=$TEGRA_KERNEL_OUT tegra21_defconfig | |||
make O=$TEGRA_KERNEL_OUT menuconfig | |||
</pre> | </pre> | ||
* '''For TX2''' | |||
<pre> | <pre> | ||
make | make O=$TEGRA_KERNEL_OUT tegra18_defconfig | ||
make menuconfig | make O=$TEGRA_KERNEL_OUT menuconfig | ||
</pre> | </pre> | ||
6) Compile kernel, device tree and modules | 6) Compile kernel, device tree and modules | ||
<pre> | <pre> | ||
make zImage | make O=$TEGRA_KERNEL_OUT zImage | ||
make dtbs | make O=$TEGRA_KERNEL_OUT dtbs | ||
make modules | make O=$TEGRA_KERNEL_OUT modules | ||
make modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT | make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$KERNEL_MODULES_OUT | ||
</pre> | </pre> | ||
After this the kernel image will be under: | |||
<pre> | <pre> | ||
$DEVDIR/images/arch/arm64/boot/Image | |||
</pre> | </pre> | ||
And the devicetree under: | |||
<pre> | |||
$DEVDIR/images/arch/arm64/boot/dts/*.dtb | |||
</pre> | |||
7) Create kernel_supplements.tbz2 with kernel modules, this package is needed by Jetpack | |||
<pre> | <pre> | ||
Line 199: | Line 256: | ||
<pre> | <pre> | ||
export KERNEL_MODULES_NAME= | export KERNEL_MODULES_NAME=4.4.38+ | ||
</pre> | </pre> | ||
Line 215: | Line 272: | ||
</pre> | </pre> | ||
8) 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> | <pre> | ||
cd $DEVDIR | cd $DEVDIR/kernel | ||
tar -xf kernel_headers.tbz2 | tar -xf kernel_headers.tbz2 | ||
tar -cjf kernel_headers_custom.tbz2 linux-headers-$KERNEL_MODULES_NAME | tar -cjf kernel_headers_custom.tbz2 linux-headers-$KERNEL_MODULES_NAME | ||
Line 225: | Line 282: | ||
</pre> | </pre> | ||
9) Create a backup of the images and packages included in Jetpack | |||
<pre> | <pre> | ||
mkdir -p $DEVDIR/images/ | mkdir -p $DEVDIR/images/packages-backup | ||
cp $DEVDIR/ | cp -rf $DEVDIR/kernel/* $DEVDIR/images/packages-backup | ||
</pre> | </pre> | ||
9) Copy your dtb | |||
*'''TX1''' | |||
<pre> | <pre> | ||
cp $DEVDIR/ | cp $DEVDIR/images/arch/arm64/boot/dts/tegra210-jetson-tx1-p2597-2180-a01-devkit.dtb $DEVDIR/kernel/dtb | ||
</pre> | </pre> | ||
*'''TX2''' | |||
<pre> | <pre> | ||
cp $DEVDIR/images/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb $DEVDIR/kernel/dtb | |||
</pre> | </pre> | ||
10) Finally overwrite the default images with your own images to install and boot them using jetpack | |||
<pre> | <pre> | ||
cd $DEVDIR/images | cd $DEVDIR/images | ||
cp -rf arch/arm64/boot/Image arch/arm64/boot/zImage packages/kernel_supplements.tbz2 $DEVDIR/kernel/ | |||
cp -rf packages/kernel_headers_custom.tbz2 $DEVDIR/kernel/kernel_headers.tbz2 | |||
cp -rf packages/kernel_headers_custom.tbz2 $DEVDIR | |||
</pre> | </pre> | ||
11) Run the applybinaries script to generate the image to flash | |||
<pre> | <pre> | ||
cd $DEVDIR | cd $DEVDIR/ | ||
sudo ./apply_binaries.sh | sudo ./apply_binaries.sh | ||
</pre> | </pre> | ||