-
Notifications
You must be signed in to change notification settings - Fork 30
/
menuconfig.sh
executable file
·60 lines (50 loc) · 1.67 KB
/
menuconfig.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
#!/bin/bash
# simple script for executing menuconfig
# root directory of universal8890 kernel git repo (default is this script's location)
RDIR=$(pwd)
# directory containing cross-compile arm64 toolchain
TOOLCHAIN=$HOME/build/toolchain/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu
export ARCH=arm64
export CROSS_COMPILE=$TOOLCHAIN/bin/aarch64-linux-gnu-
ABORT()
{
[ "$1" ] && echo "Error: $*"
exit 1
}
[ -x "${CROSS_COMPILE}gcc" ] ||
ABORT "Unable to find gcc cross-compiler at location: ${CROSS_COMPILE}gcc"
[ "$1" ] && TARGET=$1
[ "$TARGET" ] || TARGET=samsung
DEFCONFIG=${TARGET}_defconfig
DEFCONFIG_FILE=$RDIR/arch/$ARCH/configs/$DEFCONFIG
[ -f "$DEFCONFIG_FILE" ] ||
ABORT "Config $DEFCONFIG not found in $ARCH configs!"
cd "$RDIR" || ABORT "Failed to enter $RDIR!"
echo "Cleaning build..."
rm -rf build
mkdir build
make -s -i -C "$RDIR" O=build "$DEFCONFIG" menuconfig
echo "Showing differences between old config and new config"
echo "-----------------------------------------------------"
if command -v colordiff >/dev/null 2>&1; then
diff -Bwu --label "old config" "$DEFCONFIG_FILE" --label "new config" build/.config | colordiff
else
diff -Bwu --label "old config" "$DEFCONFIG_FILE" --label "new config" build/.config
echo "-----------------------------------------------------"
echo "Consider installing the colordiff package to make diffs easier to read"
fi
echo "-----------------------------------------------------"
echo -n "Are you satisfied with these changes? Y/N: "
read option
case $option in
y|Y)
cp build/.config "$DEFCONFIG_FILE"
echo "Copied new config to $DEFCONFIG_FILE"
;;
*)
echo "That's unfortunate"
;;
esac
echo "Cleaning build..."
rm -rf build
echo "Done."