forked from procount/pinn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_arch_linux-menuconfig.sh
executable file
·56 lines (43 loc) · 1.31 KB
/
make_arch_linux-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
#!/bin/bash
# Bash script to run linux-menuconfig for a specific arch
set -e
ARCH=$1
MAKECMD=${2:-"linux-menuconfig"}
if [ -n "$ARCH" ]; then
if [ "$ARCH" != "armv6" ] && [ "$ARCH" != "armv7" ]; then
echo "ARCH must be armv6 or armv7">&2
exit 1
fi
else
echo "Missing ARCH parameter">&2
exit 1
fi
function get_kernel_version {
CONFIG_FILE=.config
CONFIG_VAR=BR2_LINUX_KERNEL_VERSION
grep -E "^$CONFIG_VAR=\".+\"$" "$CONFIG_FILE" | tr -d '"' | cut -d= -f2
}
function select_kernelconfig {
ARCH=$1
CONFIG_FILE=.config
CONFIG_VAR=BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
VAR_PREFIX=kernelconfig-recovery
sed -ri "s/(^$CONFIG_VAR=\"$VAR_PREFIX\.).+(\")$/\1$ARCH\2/" "$CONFIG_FILE"
}
function get_kernelconfig {
CONFIG_FILE=.config
CONFIG_VAR=BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
VAR_PREFIX=kernelconfig-recovery
grep -E "^$CONFIG_VAR=\".+\"$" "$CONFIG_FILE" | tr -d '"' | cut -d= -f2 | sed "s/^$VAR_PREFIX\.//"
}
cd buildroot
# Setup kernel for specific arch
if [ "$(get_kernelconfig)" != "$ARCH" ]; then
select_kernelconfig $ARCH
KERNEL_BUILD_DIR=output/build/linux-$(get_kernel_version)
#rm "$KERNEL_BUILD_DIR/.stamp_patched"
rm "$KERNEL_BUILD_DIR/.stamp_configured"
fi
# Run specific command
make "$MAKECMD"
make linux-update-defconfig