mirror of
https://github.com/kairos-io/packages.git
synced 2025-08-18 16:09:06 +00:00
Bump linux-tegra
This commit is contained in:
parent
ff689ea93f
commit
a2419264b3
@ -4,26 +4,27 @@
|
|||||||
image: "ubuntu:20.04"
|
image: "ubuntu:20.04"
|
||||||
|
|
||||||
prelude:
|
prelude:
|
||||||
- apt update && apt install -y git-core build-essential bc wget xxd kmod
|
- apt update && apt install -y git-core build-essential bc wget xxd kmod flex libelf-dev bison libssl-dev
|
||||||
- wget https://developer.nvidia.com/downloads/remetpack-463r32releasev73t210jetson-210linur3273aarch64tbz2 -O Jetson-210_Linux_R32.7.3_aarch64.tbz2
|
- wget https://developer.nvidia.com/downloads/remetpack-463r32releasev73t210jetson-210linur3273aarch64tbz2 -O Jetson-210_Linux_R32.7.3_aarch64.tbz2
|
||||||
- tar xvf Jetson-210_Linux_R32.7.3_aarch64.tbz2
|
- tar xvf Jetson-210_Linux_R32.7.3_aarch64.tbz2
|
||||||
|
- git clone --branch v5.15 --depth 1 https://github.com/torvalds/linux.git kernel-4.9
|
||||||
- wget https://developer.nvidia.com/downloads/remack-sdksjetpack-463r32releasev73sourcest210publicsourcestbz2 -O public_sources.tbz2
|
- wget https://developer.nvidia.com/downloads/remack-sdksjetpack-463r32releasev73sourcest210publicsourcestbz2 -O public_sources.tbz2
|
||||||
- tar xvf public_sources.tbz2
|
- tar xvf public_sources.tbz2
|
||||||
- wget https://developer.nvidia.com/embedded/dlc/l4t-gcc-7-3-1-toolchain-64-bit
|
- wget https://developer.nvidia.com/embedded/dlc/l4t-gcc-7-3-1-toolchain-64-bit
|
||||||
- tar xvf l4t-gcc-7-3-1-toolchain-64-bit
|
- tar xvf l4t-gcc-7-3-1-toolchain-64-bit
|
||||||
|
- |
|
||||||
# https://forums.developer.nvidia.com/t/kernel-build-script-nvbuild-sh-with-output-dir-option-not-working/173087
|
cd Linux_for_Tegra/source/public && tar xvf kernel_src.tbz2 && rm -rf kernel/kernel-4.9 && mv /luetbuild/kernel-4.9 ./kernel/ && \
|
||||||
|
mkdir kernel_out && \
|
||||||
|
cp -rfv /luetbuild/config ./kernel/kernel-4.9/arch/arm64/configs/defconfig && \
|
||||||
|
cp -rfv /luetbuild/nvbuild.sh nvbuild.sh && chmod +x nvbuild.sh
|
||||||
|
# gcc 12
|
||||||
|
- cd Linux_for_Tegra/source/public/kernel/kernel-4.9 && patch -p1 < /luetbuild/patch.patch
|
||||||
steps:
|
steps:
|
||||||
- |
|
- |
|
||||||
cd Linux_for_Tegra/source/public && tar xvf kernel_src.tbz2 && \
|
cd Linux_for_Tegra/source/public && \
|
||||||
mkdir kernel_out && \
|
|
||||||
echo "CONFIG_EFI_STUB=y" >> ./kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig && \
|
|
||||||
echo "CONFIG_EFI=y" >> ./kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig && \
|
|
||||||
sed -i '86s/.*/ O_OPT=(O="${KERNEL_OUT_DIR}")/' nvbuild.sh && \
|
|
||||||
CROSS_COMPILE_AARCH64_PATH=/luetbuild/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/ ./nvbuild.sh -o $PWD/kernel_out
|
CROSS_COMPILE_AARCH64_PATH=/luetbuild/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/ ./nvbuild.sh -o $PWD/kernel_out
|
||||||
- mkdir -p /out/boot
|
- mkdir -p /out/boot
|
||||||
- cp -rfv Linux_for_Tegra/source/public/kernel_out/arch/arm64/boot/dts/*.dtb /out/boot
|
- cp -rfv Linux_for_Tegra/source/public/kernel_out/arch/arm64/boot/dts/nvidia/*.dtb /out/boot
|
||||||
- cp -rfv Linux_for_Tegra/source/public/kernel_out/arch/arm64/boot/dts/*.dtbo /out/boot
|
|
||||||
- cp Linux_for_Tegra/source/public/kernel_out/arch/arm64/boot/Image /out/boot
|
- cp Linux_for_Tegra/source/public/kernel_out/arch/arm64/boot/Image /out/boot
|
||||||
- cd Linux_for_Tegra/source/public/kernel/kernel-4.9/ && make CROSS_COMPILE=/luetbuild/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/ LOCALVERSION="-tegra" ARCH=arm64 O=/luetbuild/Linux_for_Tegra/source/public/kernel_out modules_install INSTALL_MOD_PATH=/out
|
- cd Linux_for_Tegra/source/public/kernel/kernel-4.9/ && make CROSS_COMPILE=/luetbuild/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/ LOCALVERSION="-tegra" ARCH=arm64 O=/luetbuild/Linux_for_Tegra/source/public/kernel_out modules_install INSTALL_MOD_PATH=/out
|
||||||
# https://blog.kevmo314.com/compiling-custom-kernel-modules-on-the-jetson-nano.html
|
# https://blog.kevmo314.com/compiling-custom-kernel-modules-on-the-jetson-nano.html
|
||||||
|
6578
packages/kernels/linux-tegra/config
Normal file
6578
packages/kernels/linux-tegra/config
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,3 @@
|
|||||||
category: "kernels"
|
category: "kernels"
|
||||||
name: "linux-tegra"
|
name: "linux-tegra"
|
||||||
version: "4.9.299+1"
|
version: "5.15"
|
||||||
|
130
packages/kernels/linux-tegra/nvbuild.sh
Normal file
130
packages/kernels/linux-tegra/nvbuild.sh
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# This script was modified to be compatible with 5.15 kernel and other small things around the build environment
|
||||||
|
# among: https://forums.developer.nvidia.com/t/kernel-build-script-nvbuild-sh-with-output-dir-option-not-working/173087
|
||||||
|
#
|
||||||
|
# Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# * Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# * Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# * Neither the name of NVIDIA CORPORATION nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products derived
|
||||||
|
# from this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||||
|
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
# This script builds kernel sources in this directory.
|
||||||
|
# Usage: ./${SCRIPT_NAME}.sh [OPTIONS]
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
SCRIPT_DIR="$(dirname $(readlink -f "${0}"))"
|
||||||
|
SCRIPT_NAME="$(basename "${0}")"
|
||||||
|
|
||||||
|
source "${SCRIPT_DIR}/nvcommon_build.sh"
|
||||||
|
|
||||||
|
function usage {
|
||||||
|
cat <<EOM
|
||||||
|
Usage: ./${SCRIPT_NAME} [OPTIONS]
|
||||||
|
This script builds kernel sources in this directory.
|
||||||
|
It supports following options.
|
||||||
|
OPTIONS:
|
||||||
|
-h Displays this help
|
||||||
|
-o <outdir> Creates kernel build output in <outdir>
|
||||||
|
EOM
|
||||||
|
}
|
||||||
|
|
||||||
|
# parse input parameters
|
||||||
|
function parse_input_param {
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case ${1} in
|
||||||
|
-h)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-o)
|
||||||
|
KERNEL_OUT_DIR="${2}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: Invalid option ${1}"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_arm64_kernel_sources {
|
||||||
|
kernel_version="${1}"
|
||||||
|
echo "Building kernel-${kernel_version} sources"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2153
|
||||||
|
build_dir="${BUILD_DIR}/kernel_build"
|
||||||
|
rm -rf "${build_dir}"
|
||||||
|
|
||||||
|
# execute building steps
|
||||||
|
source_dir="${SCRIPT_DIR}/kernel/kernel-${kernel_version}/"
|
||||||
|
config_file="defconfig"
|
||||||
|
tegra_kernel_out="${source_dir}"
|
||||||
|
|
||||||
|
# shellcheck disable=SC2236
|
||||||
|
if [ ! -z "${KERNEL_OUT_DIR}" ] ; then
|
||||||
|
O_OPT=(O="${KERNEL_OUT_DIR}")
|
||||||
|
tegra_kernel_out="${KERNEL_OUT_DIR}"
|
||||||
|
else
|
||||||
|
O_OPT=()
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
|
||||||
|
LOCALVERSION="-tegra" \
|
||||||
|
CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
|
||||||
|
"${O_OPT[@]}" "${config_file}"
|
||||||
|
|
||||||
|
"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
|
||||||
|
LOCALVERSION="-tegra" \
|
||||||
|
CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
|
||||||
|
"${O_OPT[@]}" -j"${NPROC}" \
|
||||||
|
--output-sync=target Image
|
||||||
|
|
||||||
|
"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
|
||||||
|
LOCALVERSION="-tegra" \
|
||||||
|
CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
|
||||||
|
"${O_OPT[@]}" -j"${NPROC}" \
|
||||||
|
--output-sync=target dtbs
|
||||||
|
|
||||||
|
"${MAKE_BIN}" -C "${source_dir}" ARCH=arm64 \
|
||||||
|
LOCALVERSION="-tegra" \
|
||||||
|
CROSS_COMPILE="${CROSS_COMPILE_AARCH64}" \
|
||||||
|
"${O_OPT[@]}" -j"${NPROC}" \
|
||||||
|
--output-sync=target modules
|
||||||
|
|
||||||
|
image="${tegra_kernel_out}/arch/arm64/boot/Image"
|
||||||
|
if [ ! -f "${image}" ]; then
|
||||||
|
echo "Error: Missing kernel image ${image}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Kernel sources compiled successfully."
|
||||||
|
}
|
||||||
|
|
||||||
|
# shellcheck disable=SC2068
|
||||||
|
parse_input_param $@
|
||||||
|
|
||||||
|
# Compile kernel sources for "arm64"
|
||||||
|
build_arm64_kernel_sources "4.9"
|
24
packages/kernels/linux-tegra/patch.patch
Normal file
24
packages/kernels/linux-tegra/patch.patch
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h
|
||||||
|
index 794a375dad36..7009fc176636 100644
|
||||||
|
--- a/tools/lib/subcmd/subcmd-util.h
|
||||||
|
+++ b/tools/lib/subcmd/subcmd-util.h
|
||||||
|
@@ -49,13 +49,12 @@ static NORETURN inline void die(const char *err, ...)
|
||||||
|
|
||||||
|
static inline void *xrealloc(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
- void *ret = realloc(ptr, size);
|
||||||
|
- if (!ret && !size)
|
||||||
|
- ret = realloc(ptr, 1);
|
||||||
|
+ void *ret;
|
||||||
|
+ if (!size)
|
||||||
|
+ size = 1;
|
||||||
|
+ ret = realloc(ptr, size);
|
||||||
|
if (!ret) {
|
||||||
|
ret = realloc(ptr, size);
|
||||||
|
- if (!ret && !size)
|
||||||
|
- ret = realloc(ptr, 1);
|
||||||
|
if (!ret)
|
||||||
|
die("Out of memory, realloc failed");
|
||||||
|
}
|
||||||
|
--
|
||||||
|
|
Loading…
Reference in New Issue
Block a user