-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsetup-env
executable file
·103 lines (99 loc) · 5.26 KB
/
setup-env
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
# ------------------------------------------------------------------------------
# setup-env - Sets up a bunch of standard environment variables in
# preparation for a cross-compile of the kernel, modules,
# or other code that needs to run on the ev3dev distro.
#
# You can override the variables here by creating a file either in the
# working directory (./local-env) or in your home directory (~/.ev3dev-env).
# If both files are present, the one in the working directory takes
# precedence.
#
# BE SURE TO ALWAYS USE ABSOLUTE FILE PATHS!
#
# Common variables are:
#
# EV3DEV_KERNEL_FLAVOR: The kernel flavor to build (i.e. ev3, rpi, rpi2, bb.org)
# EV3DEV_KERNEL: Where the ev3dev linux kernel git repository is checked out.
# EV3DEV_BUILD_AREA: Where the scripts put all of generated files.
# EV3DEV_INSTALL_KERNEL: Where the kernel uImage will be installed.
# EV3DEV_INSTALL_MODULES: Where the kernel modules will be installed.
# EV3DEV_INSTALL_DTBS: Where the device tree blocks will be installed.
# EV3DEV_INSTALL_UENV_TXT: Where the uEnv.txt file is installed (BeagleBoard only).
# EV3DEV_TOOLCHAIN: Where to find the cross-compiler toolchain.
# EV3DEV_MERGE_CMD: The command that the defconfig script uses to merge files.
#
# Advanced/internal variables variables are:
#
# EV3DEV_ABI: The abi used for cross-compiling.
# EV3DEV_OBJ: The directory where the kernel will be built.
# EV3DEV_DIST: The directory where the kernel files will be installed.
# EV3DEV_DEFCONFIG: The default configuration to use when building the kernel.
# EV3DEV_APPEND_DTB: Name of the .dtb file to append to the kernel image.
# EV3DEV_COPY_DTB: Name of a .dtb file to copy from $EV3DEV_INSTALL_DTBS to $EV3DEV_INSTALL_KERNEL,
# EV3DEV_EXTRA_DEFAULT_TARGETS: Extra make targets that are run by ./build-kernel
#
# This file is normally sourced from within the actual build script using:
#
# . ./setup-env
#
# ------------------------------------------------------------------------------
# This is how you override these values (by creating one of these files)
if [ -f ~/.ev3dev-env ]
then
. ~/.ev3dev-env
fi
if [ -f local-env ]
then
. ./local-env
fi
export EV3DEV_KERNEL_FLAVOR=${EV3DEV_KERNEL_FLAVOR-"ev3"}
export EV3DEV_BUILD_AREA=${EV3DEV_BUILD_AREA-"$(pwd)/build-area"}
export EV3DEV_MERGE_CMD=${EV3DEV_MERGE_CMD-"vimdiff \$file1 \$file2"}
export EV3DEV_TOOLCHAIN=${EV3DEV_TOOLCHAIN-"/usr/lib/x86_64-linux-gnu/gcc-arm-linux-gnueabihf-8.3/bin"}
export EV3DEV_ABI=${EV3DEV_ABI-"arm-linux-gnueabihf-"}
if [ "$EV3DEV_KERNEL_FLAVOR" = "ev3" ]; then
export EV3DEV_KERNEL=${EV3DEV_KERNEL-"$(pwd)/../ev3-kernel"}
export EV3DEV_DEFCONFIG=${EV3DEV_DEFCONFIG-"ev3dev_defconfig"}
export EV3DEV_OBJ=${EV3DEV_OBJ-${EV3DEV_BUILD_AREA}/linux-ev3dev-ev3-obj}
export EV3DEV_DIST=${EV3DEV_DIST-${EV3DEV_BUILD_AREA}/linux-ev3dev-ev3-dist}
export EV3DEV_INSTALL_KERNEL=${EV3DEV_INSTALL_KERNEL-${EV3DEV_DIST}}
export EV3DEV_INSTALL_MODULES=${EV3DEV_INSTALL_MODULES-${EV3DEV_DIST}}
export EV3DEV_INSTALL_DTBS=${EV3DEV_INSTALL_DTBS-${EV3DEV_DIST}/dtbs}
export EV3DEV_EXTRA_DEFAULT_TARGETS=${EV3DEV_EXTRA_DEFAULT_TARGETS-"uImage dtbs"}
elif [ "$EV3DEV_KERNEL_FLAVOR" = "bb.org" ]; then
export EV3DEV_KERNEL=${EV3DEV_KERNEL-"$(pwd)/../bb.org-kernel"}
export EV3DEV_DEFCONFIG=${EV3DEV_DEFCONFIG-"bb.org_defconfig"}
export EV3DEV_OBJ=${EV3DEV_OBJ-${EV3DEV_BUILD_AREA}/linux-ev3dev-bb.org-obj}
export EV3DEV_DIST=${EV3DEV_DIST-${EV3DEV_BUILD_AREA}/linux-ev3dev-bb.org-dist}
export EV3DEV_INSTALL_UENV_TXT=${EV3DEV_INSTALL_UENV_TXT=${EV3DEV_DIST}}
export EV3DEV_INSTALL_KERNEL=${EV3DEV_INSTALL_KERNEL-${EV3DEV_DIST}}
export EV3DEV_INSTALL_MODULES=${EV3DEV_INSTALL_MODULES-${EV3DEV_DIST}}
export EV3DEV_INSTALL_DTBS=${EV3DEV_INSTALL_DTBS-${EV3DEV_DIST}/dtbs}
export EV3DEV_EXTRA_DEFAULT_TARGETS="zImage dtbs"
export KBUILD_DEBARCH=${KBUILD_DEBARCH-armhf}
export EV3DEV_CAPE=${EV3DEV_CAPE-evb}
elif [ "$EV3DEV_KERNEL_FLAVOR" = "rpi" ]; then
export EV3DEV_KERNEL=${EV3DEV_KERNEL-"$(pwd)/../rpi-kernel"}
export EV3DEV_DEFCONFIG=${EV3DEV_DEFCONFIG-"bcmrpi_defconfig"}
export EV3DEV_OBJ=${EV3DEV_OBJ-${EV3DEV_BUILD_AREA}/linux-ev3dev-rpi-obj}
export EV3DEV_DIST=${EV3DEV_DIST-${EV3DEV_BUILD_AREA}/linux-ev3dev-rpi-dist}
export EV3DEV_INSTALL_KERNEL=${EV3DEV_INSTALL_KERNEL-${EV3DEV_DIST}}
export EV3DEV_INSTALL_MODULES=${EV3DEV_INSTALL_MODULES-${EV3DEV_DIST}}
export EV3DEV_INSTALL_DTBS=${EV3DEV_INSTALL_DTBS-${EV3DEV_DIST}/dtbs}
export EV3DEV_EXTRA_DEFAULT_TARGETS="zImage dtbs"
export KBUILD_DEBARCH=${KBUILD_DEBARCH-armhf}
elif [ "$EV3DEV_KERNEL_FLAVOR" = "rpi2" ]; then
export EV3DEV_KERNEL=${EV3DEV_KERNEL-"$(pwd)/../rpi-kernel"}
export EV3DEV_DEFCONFIG=${EV3DEV_DEFCONFIG-"bcm2709_defconfig"}
export EV3DEV_OBJ=${EV3DEV_OBJ-${EV3DEV_BUILD_AREA}/linux-ev3dev-rpi2-obj}
export EV3DEV_DIST=${EV3DEV_DIST-${EV3DEV_BUILD_AREA}/linux-ev3dev-rpi2-dist}
export EV3DEV_INSTALL_KERNEL=${EV3DEV_INSTALL_KERNEL-${EV3DEV_DIST}}
export EV3DEV_INSTALL_MODULES=${EV3DEV_INSTALL_MODULES-${EV3DEV_DIST}}
export EV3DEV_INSTALL_DTBS=${EV3DEV_INSTALL_DTBS-${EV3DEV_DIST}/dtbs}
export EV3DEV_EXTRA_DEFAULT_TARGETS="zImage dtbs"
export KBUILD_DEBARCH=${KBUILD_DEBARCH-armhf}
else
echo "'$EV3DEV_KERNEL_FLAVOR' is not a known kernel flavor"
exit 1
fi