summaryrefslogtreecommitdiff
path: root/create_kernel/create_kernel_arm64.sh
blob: 1b8301549a1176cbb95351cbe86b4c5075d80f3d (plain) (blame)
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/dash

KERNEL_VERSION=5.15.113
#KERNEL_VERSION=4.4.187
#KERNEL_VERSION=4.9.120
#KERNEL_VERSION=4.14.63
KERNEL_MAJOR_VERSION=v5.x
#KERNEL_MAJOR_VERSION=v4.x

KERNEL_PAGE=https://cdn.kernel.org
DEVICE_NAME=generic
OUT_DIRECTORY=out-arm64

#prepare
_PWD=`pwd`
mkdir -p $OUT_DIRECTORY/lib/modules

echo "Download kernel"
if [ ! -f linux-$KERNEL_VERSION.tar.xz ]; then
	wget -c $KERNEL_PAGE/pub/linux/kernel/$KERNEL_MAJOR_VERSION/linux-$KERNEL_VERSION.tar.xz 
fi

#echo "Unpack kernel"
#mkdir -p linux-$KERNEL_VERSION-arm64
#tar -xvf linux-$KERNEL_VERSION.tar.xz --strip-components=1 -C linux-$KERNEL_VERSION-arm64
#echo "Copy config to kernel"
#cp configs/$DEVICE_NAME/generic-$KERNEL_VERSION-arm64 ./linux-$KERNEL_VERSION-arm-arm64/.config
#echo "Compile kernel"
cd ./linux-$KERNEL_VERSION-arm64
#	
#ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make defconfig
#ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j4


#make -j4
make INSTALL_MOD_PATH=$_PWD/$OUT_DIRECTORY/  modules_install



#output results
echo "Copy results to out"
cd $_PWD
cp ./linux-$KERNEL_VERSION-arm64/arch/arm64/boot/Image $_PWD/$OUT_DIRECTORY/
cp ./linux-$KERNEL_VERSION-arm64/arch/arm64/boot/Image.gz $_PWD/$OUT_DIRECTORY/
cp ./linux-$KERNEL_VERSION-arm64/vmlinux $_PWD/$OUT_DIRECTORY/vmlinux