forked from jetkvm/rv1106-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.sh
More file actions
executable file
·93 lines (85 loc) · 2.83 KB
/
utils.sh
File metadata and controls
executable file
·93 lines (85 loc) · 2.83 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
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
#!/usr/bin/env bash
# Exit immediately if a command exits with a non-zero status
set -e
# Function to display help message
show_help() {
echo "Usage: $0 <feature>"
echo
echo
echo "Features:"
echo " kernel-menuconfig Configure kernel options"
echo " busybox-menuconfig Configure busybox options"
exit 0
}
# Function to configure kernel options
kernel_menuconfig() {
# get current directory of the file
local config_name="rv1106-jetkvm-v2_defconfig"
local current_dir=$(dirname "$(readlink -f "$0")")
set -x
set -e
pushd "${current_dir}/sysdrv/source/kernel" > /dev/null
cp "./arch/arm/configs/${config_name}" .config
make ARCH=arm menuconfig
make ARCH=arm savedefconfig
cp defconfig "${current_dir}/sysdrv/source/kernel/arch/arm/configs/${config_name}"
make ARCH=arm mrproper
popd > /dev/null
set +x
set +e
# check if git is installed and the current directory is a git repository
# if yes, show the diff of the staged files
if command -v git &> /dev/null && git rev-parse --is-inside-work-tree &> /dev/null; then
echo "Changes made to the kernel configuration:"
git diff "${current_dir}/sysdrv/source/kernel/arch/arm/configs/${config_name}"
else
echo "Git is not installed or not in a git repository."
fi
}
busybox_menuconfig() {
local current_dir=$(dirname "$(readlink -f "$0")")
export RK_PROJECT_TOOLCHAIN_CROSS=arm-rockchip830-linux-uclibcgnueabihf
export PATH="${current_dir}/tools/linux/toolchain/${RK_PROJECT_TOOLCHAIN_CROSS}/bin":$PATH
local cfg_src="${current_dir}/sysdrv/tools/board/busybox/config_normal"
local cfg_dst="${current_dir}/sysdrv/source/busybox/objs_config_normal/.config"
cp "${cfg_src}" "${cfg_dst}"
make -C "${current_dir}/sysdrv" busybox busybox_menuconfig
cp "${cfg_dst}" "${cfg_src}"
# check if git is installed and the current directory is a git repository
# if yes, show the diff of the staged files
if command -v git &> /dev/null && git rev-parse --is-inside-work-tree &> /dev/null; then
echo "Changes made to the busybox configuration:"
git diff "${current_dir}/sysdrv/tools/board/busybox/config_normal"
else
echo "Git is not installed or not in a git repository."
fi
}
# If there's no argument, show the help message
if [ $# -eq 0 ]; then
show_help
exit 0
fi
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
kernel-menuconfig)
shift
kernel_menuconfig
exit 0
;;
busybox-menuconfig)
shift
busybox_menuconfig
exit 0
;;
--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done