forked from longsleep/build-pine64-image
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install_kernel_modules.sh
executable file
·41 lines (31 loc) · 1.23 KB
/
install_kernel_modules.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
#!/bin/sh
set -e
DEST=$(readlink -f "$1")
if [ -z "$DEST" ]; then
echo "Usage: $0 <destination-folder> [linux-folder]"
exit 1
fi
LINUX="./linux-pine64"
echo "Using Linux from $LINUX ..."
VERSION=$(strings $LINUX/arch/arm64/boot/Image |grep "Linux version"|awk '{print $3}')
echo "Kernel build version $VERSION ..."
if [ -z "$VERSION" ]; then
echo "Failed to get build version, correct <linux-folder>?"
exit 1
fi
# Install Kernel modules
make -C $LINUX ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_install INSTALL_MOD_PATH="$DEST"
# Install Kernel firmware
make -C $LINUX ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- firmware_install INSTALL_MOD_PATH="$DEST"
# Fix symbolic links
rm -f "$DEST/lib/modules/$VERSION/source"
rm -f "$DEST/lib/modules/$VERSION/build"
ln -s "/usr/src/linux-headers-$VERSION" "$DEST/lib/modules/$VERSION/build"
# Install extra mali module if found in Kernel tree.
if [ -e $LINUX/modules/gpu/mali400/kernel_mode/driver/src/devicedrv/mali/mali.ko ]; then
v=
mkdir "$DEST/lib/modules/$VERSION/kernel/extramodules"
cp -v $LINUX/modules/gpu/mali400/kernel_mode/driver/src/devicedrv/mali/mali.ko $DEST/lib/modules/$VERSION/kernel/extramodules
depmod -b $DEST $VERSION
fi
echo "Done - installed Kernel modules to $DEST"