-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmenuconfig.sh
executable file
·91 lines (77 loc) · 2.93 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
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
#!/usr/bin/env bash
source lib/common.sh
function usage() {
echo "Usage: $0 [-b|--busybox] [-k|--kernel] [-u|--u-boot]"
echo "Options:"
echo " -b, --busybox Run BusyBox menuconfig"
echo " -k, --kernel Run Kernel menuconfig"
echo " -u, --u-boot Run U-Boot menuconfig"
exit 1
}
error_exit() {
echo "Error: $1" >&2
exit 1
}
[ -z "$POKY_DIR_NAME" ] && error_exit "POKY_DIR_NAME is not set."
[ -z "$BMROS_BUILD_DIR_NAME" ] && error_exit "BMROS_BUILD_DIR_NAME is not set."
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-k|--kernel)
MENU="kernel"
shift
;;
-b|--busybox)
MENU="busybox"
shift
;;
-u|--u-boot)
MENU="u-boot"
shift
;;
*)
usage
;;
esac
done
if [ -z "$MENU" ]; then
usage
fi
START_DIR=$(pwd)
cd "$POKY_DIR_NAME" || error_exit "Failed to change directory to $POKY_DIR_NAME"
display_banner "Starting $MENU MenuConfig"
source oe-init-build-env "$BMROS_BUILD_DIR_NAME" || error_exit "Failed to source oe-init-build-env"
copy_config_files() {
local config_file=$1
local target_dir=$2
display_banner "Copying $MENU config: $config_file to $target_dir"
cp "$config_file" "../../$BMROS_META_LAYERS/$target_dir" || error_exit "Failed to copy $MENU config"
}
case $MENU in
kernel)
bmros_linux_recipe="${BB_LAYER_BARE_METAL_ROUTER}/recipes-kernel/linux/files"
bitbake virtual/kernel -c menuconfig || error_exit "Failed to run bitbake virtual/kernel -c menuconfig"
#bitbake virtual/kernel -c diffconfig || error_exit "Failed to run bitbake busybox -c diffconfig"
kernel_config_file=$(find . -regex '.*/linux-qemux86_64-standard-build/.config')
copy_config_files "$kernel_config_file" "$bmros_linux_recipe"
;;
busybox)
bmros_poky_busybox_recipe="${BB_LAYER_BARE_METAL_ROUTER}/recipes-core/busybox/files"
bitbake busybox -c menuconfig || error_exit "Failed to run bitbake busybox -c menuconfig"
bitbake busybox -c diffconfig || error_exit "Failed to run bitbake busybox -c diffconfig"
busybox_fragment_file=$(find . -regex '.*/busybox-[0-9]+\(\.[0-9]+\)+/fragment.cfg')
copy_config_files "$busybox_fragment_file" "$bmros_poky_busybox_recipe"
;;
u-boot)
bmros_uboot_recipe="${BB_LAYER_BARE_METAL_ROUTER}/recipes-bsp/u-boot/files"
bitbake u-boot -c menuconfig || error_exit "Failed to run bitbake u-boot -c menuconfig"
#bitbake u-boot -c diffconfig || error_exit "Failed to run bitbake u-boot -c diffconfig"
uboot_config_file=$(find . -regex '.*/u-boot/.*/build/.config')
copy_config_files "$uboot_config_file" "$bmros_uboot_recipe"
;;
*)
usage
;;
esac
cd "$START_DIR" || error_exit "Failed to return to the starting directory"
display_banner "$MENU MenuConfig Completed"