-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·44 lines (34 loc) · 1.27 KB
/
build.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
#!/bin/sh -e
test -z "$KERNEL_DIR" -o -z "$BUILD_DIR" && {
echo "Looks like KERNEL_DIR or BUILD_DIR is undefined"
exit 1
}
test -d "$KERNEL_DIR" || {
echo "KERNEL_DIR is not directory"
exit 2
}
if [ $1 ]; then
(
cd "${KERNEL_DIR}" && rm -rf ./*
kernel_ref=`curl -L https://github.com/raspberrypi/firmware/raw/$1/extra/git_hash`
echo "Fetch kernel from https://github.com/raspberrypi/linux/tree/${kernel_ref}"
curl -L "https://github.com/raspberrypi/linux/archive/${kernel_ref}.tar.gz" -o kernel.tar.gz
tar -xzf kernel.tar.gz
find . -mindepth 2 -maxdepth 2 -exec mv -t . '{}' +
rm -rf "linux-${kernel_ref}"
rm kernel.tar.gz
curl -L "https://github.com/raspberrypi/firmware/raw/$1/extra/Module.symvers" -o Module.symvers
)
fi
if [ ! "$(ls ${KERNEL_DIR})" ]; then
echo "No kernel source found. Try to pass your firmware version tag (e.g. '1.20181112') or commit hash from https://github.com/raspberrypi/firmware repo"
exit 3
fi
test -f "${BUILD_DIR}/.config" && {
cp "${BUILD_DIR}/.config" "${KERNEL_DIR}"
}
cd ${KERNEL_DIR} && \
make ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig && \
make ARCH=arm CROSS_COMPILE=${CCPREFIX} modules_prepare && \
cd ${BUILD_DIR} && \
make ARCH=arm CROSS_COMPILE=${CCPREFIX} -C ${KERNEL_DIR} M=$(pwd)