-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-kernel.sh
executable file
·46 lines (31 loc) · 1.35 KB
/
build-kernel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# Copyright (C) 2021 optiMEAS GmbH. All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-only
MYDIR=$(pwd)
KERNEL_DIR="kernel"
VMDB2_DIR="vmdb2"
DEB_DIR="${VMDB2_DIR}/debian-packages"
KERNEL_CROSS_COMPILE="arm-linux-gnueabihf-"
KERNEL_LD="arm-linux-gnueabihf-ld.bfd"
set -ex
rm "${MYDIR}/linux*5.10*" || true
if [ ! -d "$KERNEL_DIR" ]; then
echo "prepare kernel directory"
git clone https://github.com/optimeas/linux-tx6-5.10.git "${KERNEL_DIR}"
# git clone git@github.com:optimeas/linux-tx6-5.10.git ${KERNEL_DIR}
mkdir -p "${KERNEL_DIR}/imx/sdma"
cp -v sdma-imx6q.bin "${KERNEL_DIR}/imx/sdma/"
cp -v "${MYDIR}/kernel-config" "${KERNEL_DIR}/.config"
cd "${KERNEL_DIR}"
make ARCH=arm CROSS_COMPILE="${KERNEL_CROSS_COMPILE}" LD="${KERNEL_LD}" olddefconfig
cd "${MYDIR}"
fi
cd "${KERNEL_DIR}"
#TODO: add a command line option "-c" to clean the tree with "make mrproper"
#make ARCH=arm CROSS_COMPILE="${KERNEL_CROSS_COMPILE}" LD="${KERNEL_LD}" zImage
#make ARCH=arm CROSS_COMPILE="${KERNEL_CROSS_COMPILE}" LD="${KERNEL_LD}" modules
#make ARCH=arm CROSS_COMPILE="${KERNEL_CROSS_COMPILE}" LD="${KERNEL_LD}" dtbs
make ARCH=arm CROSS_COMPILE="${KERNEL_CROSS_COMPILE}" LD="${KERNEL_LD}" bindeb-pkg
rm -f "${MYDIR}/${DEB_DIR}/linux-image-*.deb"
cp -v ../linux-image-*.deb "${MYDIR}/${DEB_DIR}/linux-image-tx6-latest.deb"