-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdefconfig
executable file
·95 lines (88 loc) · 2.61 KB
/
defconfig
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
#!/bin/sh
# ------------------------------------------------------------------------------
# defconfig - Manages the ${EV3DEV_DEFCONFIG} file in the kernel tree.
# ------------------------------------------------------------------------------
. ./setup-env
kernel_src_path="$EV3DEV_KERNEL"
obj_path="$EV3DEV_OBJ"
make_args="$EV3DEV_MAKE_ARGS -C ${kernel_src_path} KBUILD_OUTPUT=${obj_path} \
ARCH=arm CROSS_COMPILE=$EV3DEV_TOOLCHAIN/$EV3DEV_ABI"
show_usage ()
{
echo "Usage: ./defconfig load | merge | update [-i]"
echo
echo "COMMANDS"
echo "--------"
echo "load Replaces the current kernel configuration with the configuration"
echo " specified ${EV3DEV_DEFCONFIG}. WARNING: You will lose any changes"
echo " that you made to the local kernel configuration."
echo
echo "merge Calls a merge tool to merges the contents of ${EV3DEV_DEFCONFIG}"
echo " into the current kernel configuration"
echo
echo "update Calls a merge tool to the current kernel configuration into"
echo " arch/arm/configs/${EV3DEV_DEFCONFIG} with the current"
echo
echo "REMARKS"
echo "-------"
echo "${EV3DEV_DEFCONFIG} is located at arch/arm/configs/${EV3DEV_DEFCONFIG} in the"
echo "kernel tree. The current configuration is located at ${obj_path}/.config"
echo
echo "The merge tool is specified by the EV3DEV_MERGE_CMD environment variable."
echo "You can override this in ./local-env."
}
check_for_local_config()
{
if [ ! -f ${obj_path}/.config ]
then
echo "There is no local kernel configuration at ${obj_path}/.config"
exit 1
fi
}
if [ $# -gt 1 ]
then
show_usage
exit 1
fi
case "$1" in
load)
if [ -f ${obj_path}/.config ]
then
echo "This will overwrite your existing kernel configuration!"
echo "Are you sure you want to do this? (y/[n])"
read yes_no
if [[ $yes_no != "y" ]]
then
echo "Canceling..."
exit 1
fi
fi
rm -f ${obj_path}/.config
make ${make_args} defconfig KBUILD_DEFCONFIG=${EV3DEV_DEFCONFIG}
exit $?
;;
merge)
check_for_local_config
mv ${obj_path}/.config ${obj_path}/.config.old
make ${make_args} defconfig KBUILD_DEFCONFIG=${EV3DEV_DEFCONFIG}
mv ${obj_path}/.config ${obj_path}/.config.new
mv ${obj_path}/.config.old ${obj_path}/.config
export file1=${obj_path}/.config.new
export file2=${obj_path}/.config
eval ${EV3DEV_MERGE_CMD}
rm -f ${obj_path}/.config.new
;;
update)
check_for_local_config
make ${make_args} savedefconfig || exit $?
export file1=${obj_path}/defconfig
export file2=${kernel_src_path}/arch/arm/configs/${EV3DEV_DEFCONFIG}
eval ${EV3DEV_MERGE_CMD}
rm -f $file1
exit $?
;;
*)
show_usage
exit 1
;;
esac