forked from mindboards/ev3dev-rootfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-kernel
More file actions
executable file
·61 lines (50 loc) · 1.6 KB
/
build-kernel
File metadata and controls
executable file
·61 lines (50 loc) · 1.6 KB
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
#!/bin/sh
# ------------------------------------------------------------------------------
# build-kernel - Builds the ev3dev kernel.
# ------------------------------------------------------------------------------
echo
echo -------------------------------------------------------------------------------
echo BUILDING KERNEL
echo -------------------------------------------------------------------------------
echo
. ./setup-env
kernel_src_path="$AM1808_KERNEL"
obj_path="$AM1808_OBJ"
install_path="$AM1808_INSTALL"
make_args="$AM1808_MAKE_ARGS -C ${kernel_src_path} KBUILD_OUTPUT=${obj_path} \
ARCH=arm CROSS_COMPILE=$AM1808_COMPILER/$AM1808_ABI"
if [ ! -d "${obj_path}" ]
then
echo "CREATING OBJ DIRECTORY"
mkdir -p "${obj_path}" || exit $?
fi
if [ ! -f "${obj_path}/.config" ]
then
echo "LOADING DEFAULT KERNEL CONFIGURATION"
make ${make_args} defconfig KBUILD_DEFCONFIG=ev3dev_defconfig || exit $?
fi
if [ $# -eq 0 ]
then
echo "CROSS COMPILING KERNEL"
make ${make_args} uImage modules|| exit $?
if [ ! -d "${install_path}" ]
then
echo "CREATING OUTPUT DIRECTORY"
mkdir -p "${install_path}" || exit $?
fi
echo "COPYING BOOTABLE IMAGE TO LOCAL DIRECTORY"
cp ${obj_path}/arch/arm/boot/uImage ${install_path} || exit $?
echo "COPYING MODULES TO LOCAL DIRECTORY"
make ${make_args} modules_install INSTALL_MOD_PATH=${install_path}/ || exit $?
else
echo "CROSS COMPILING KERNEL"
make ${make_args} $@ || exit $?
for arg in "$@"
do
# If cleaning, remove the files generated by this script too.
if [ "$arg" = "clean" -o "$arg" = "mrproper" -o "$arg" = "distclean" ]
then
rm -rf kernel
fi
done
fi