forked from ikwzm/udmabuf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbld_module.sh
88 lines (82 loc) · 2.19 KB
/
bld_module.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# Description: This script is used to build the kernel module.
# Primarily meant for cross compiling the kernel module in fpga setup.
# To be made part of the bigger build script or put in the top level folder.
export TOP_FOLDER=`pwd`
cd $TOP_FOLDER
echo "Current working dir (TOP_FOLDER): $TOP_FOLDER"
export PATH=/proj/local/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin:$PATH
export ARCH=arm64
export CROSS_COMPILE=aarch64-none-linux-gnu-
export ARM_GCC_TOOLCHAIN=/proj/local/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc
set -e
if [ -e linux-socfpga ]
then
echo "linux-socfpga exists"
cd linux-socfpga
export KERNEL_SRC=`pwd`
echo "KERNEL_SRC: $KERNEL_SRC"
cd $TOP_FOLDER
else
echo "linux-socfpga does not exist"
echo "cloning linux-socfpga.."
git clone -b socfpga-6.6.22-lts [email protected]:tsisw/linux-socfpga.git --depth=1;
cd linux-socfpga/
echo "building linux-socfpga.."
make clean && make mrproper
make defconfig
#make -j $(nproc) Image dtbs
#make -j $(nproc) Image.lzma dtbs
make modules
export KERNEL_SRC=`pwd`
echo "KERNEL_SRC: $KERNEL_SRC"
cd $TOP_FOLDER
fi
if [ -e contig_mem ]
then
cd contig_mem
if [ -e udmabuf ]
then
cd udmabuf
make clean
make all
if [ -e udmabuf.ko ]
then
echo "module built successfully"
else
echo "module build failed"
fi
if [ -e usage_example ]
then
cd usage_example
make clean
make all
else
echo "usage_example directory does not exist"
fi
else
echo "udambuf directory does not exist"
fi
else
echo "contig_mem does not exist"
mkdir contig_mem
cd contig_mem
git clone [email protected]:tsisw/udmabuf.git
cd udmabuf
make clean
make all
if [ -e udmabuf.ko ]
then
echo "module built successfully"
else
echo "module build failed"
fi
if [ -e usage_example ]
then
cd usage_example
make clean
make all
else
echo "usage_example directory does not exist"
fi
fi