@@ -31,6 +31,29 @@ function safe_copy {
31
31
fi
32
32
}
33
33
34
+ function copy_buildroot_config
35
+ {
36
+ local buildroot_config=" configs/buildroot.config"
37
+ local x11_config=" configs/x11.config"
38
+ local output_config=" buildroot/.config"
39
+ local merge_tool=" buildroot/support/kconfig/merge_config.sh"
40
+
41
+ if [ ! -f " $output_config " ]; then
42
+ echo " Preparing initial Buildroot config..."
43
+
44
+ # Check X11 option
45
+ if [[ $BUILD_X11 -eq 1 ]]; then
46
+ # Compile Buildroot with X11
47
+ " $merge_tool " -m -r -O buildroot " $buildroot_config " " $x11_config "
48
+ else
49
+ # Compile Buildroot without X11
50
+ cp -f " $buildroot_config " " $output_config "
51
+ fi
52
+ else
53
+ echo " $output_config already exists, skipping copy"
54
+ fi
55
+ }
56
+
34
57
function do_buildroot
35
58
{
36
59
if [ ! -d buildroot ]; then
@@ -40,7 +63,7 @@ function do_buildroot
40
63
echo " buildroot/ already exists, skipping clone"
41
64
fi
42
65
43
- safe_copy configs/buildroot.config buildroot/.config
66
+ copy_buildroot_config
44
67
safe_copy configs/busybox.config buildroot/busybox.config
45
68
cp -f target/init buildroot/fs/cpio/init
46
69
@@ -94,6 +117,7 @@ Usage: $0 [--buildroot] [--linux] [--extra-packages] [--all] [--external-root] [
94
117
95
118
Options:
96
119
--buildroot Build Buildroot rootfs
120
+ --x11 Build Buildroot with X11
97
121
--extra-packages Build extra packages along with Buildroot
98
122
--linux Build Linux kernel
99
123
--all Build both Buildroot and Linux kernel
105
129
}
106
130
107
131
BUILD_BUILDROOT=0
108
- BUILD_LINUX =0
132
+ BUILD_X11 =0
109
133
BUILD_EXTRA_PACKAGES=0
134
+ BUILD_LINUX=0
110
135
EXTERNAL_ROOT=0
111
136
CLEAN_BUILD=0
112
137
@@ -115,6 +140,9 @@ while [[ $# -gt 0 ]]; do
115
140
--buildroot)
116
141
BUILD_BUILDROOT=1
117
142
;;
143
+ --x11)
144
+ BUILD_X11=1
145
+ ;;
118
146
--extra-packages)
119
147
BUILD_EXTRA_PACKAGES=1
120
148
;;
@@ -193,6 +221,11 @@ if [[ $BUILD_EXTRA_PACKAGES -eq 1 && $BUILD_BUILDROOT -eq 0 ]]; then
193
221
show_help
194
222
fi
195
223
224
+ if [[ $BUILD_X11 -eq 1 && $BUILD_BUILDROOT -eq 0 ]]; then
225
+ echo " Error: --x11 requires --buildroot to be specified."
226
+ show_help
227
+ fi
228
+
196
229
if [[ $CLEAN_BUILD -eq 1 && $BUILD_BUILDROOT -eq 1 && -d buildroot ]]; then
197
230
echo " Removing buildroot/ for clean build..."
198
231
rm -rf buildroot
0 commit comments