Skip to content

Commit 32acd15

Browse files
committed
Support building X11 with Buildroot optionally
1 parent 56721e0 commit 32acd15

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

configs/x11.config

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
BR2_TOOLCHAIN_BUILDROOT_CXX=y
2+
BR2_INSTALL_LIBSTDCPP=y
3+
BR2_PACKAGE_GLMARK2=y
4+
BR2_PACKAGE_KMSCUBE=y
5+
BR2_PACKAGE_MESA3D_DEMOS=y
6+
BR2_PACKAGE_MESA3D=y
7+
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER=y
8+
BR2_PACKAGE_MESA3D_DRIVER=y
9+
BR2_PACKAGE_MESA3D_NEEDS_X11=y
10+
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
11+
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_VIRGL=y
12+
BR2_PACKAGE_MESA3D_GBM=y
13+
BR2_PACKAGE_MESA3D_OPENGL_GLX=y
14+
BR2_PACKAGE_MESA3D_OPENGL_EGL=y
15+
BR2_PACKAGE_MESA3D_OPENGL_ES=y
16+
BR2_PACKAGE_PROVIDES_LIBGBM="mesa3d"
17+
BR2_PACKAGE_XORG7=y
18+
BR2_PACKAGE_XSERVER_XORG_SERVER=y
19+
BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR=y
20+
BR2_PACKAGE_XLIB_LIBX11=y
21+
BR2_PACKAGE_XAPP_TWM=y
22+
BR2_PACKAGE_XAPP_XAUTH=y
23+
BR2_PACKAGE_XAPP_XCLOCK=y
24+
BR2_PACKAGE_XAPP_XINIT=y
25+
BR2_PACKAGE_XDRIVER_XF86_INPUT_LIBINPUT=y
26+
BR2_PACKAGE_XTERM=y
27+
BR2_PACKAGE_EUDEV=y
28+
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
29+
BR2_PACKAGE_PROVIDES_UDEV="eudev"
30+
BR2_PACKAGE_HAS_UDEV=y
31+
BR2_PACKAGE_LIBGLEW=y
32+
BR2_PACKAGE_HAS_LIBGBM=y
33+
BR2_PACKAGE_HAS_LIBGLES=y
34+
BR2_PACKAGE_LIBINPUT=y
35+
BR2_PACKAGE_LIBDRI2=y

scripts/build-image.sh

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,29 @@ function safe_copy {
3131
fi
3232
}
3333

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+
3457
function do_buildroot
3558
{
3659
if [ ! -d buildroot ]; then
@@ -40,7 +63,7 @@ function do_buildroot
4063
echo "buildroot/ already exists, skipping clone"
4164
fi
4265

43-
safe_copy configs/buildroot.config buildroot/.config
66+
copy_buildroot_config
4467
safe_copy configs/busybox.config buildroot/busybox.config
4568
cp -f target/init buildroot/fs/cpio/init
4669

@@ -94,6 +117,7 @@ Usage: $0 [--buildroot] [--linux] [--extra-packages] [--all] [--external-root] [
94117
95118
Options:
96119
--buildroot Build Buildroot rootfs
120+
--x11 Build Buildroot with X11
97121
--extra-packages Build extra packages along with Buildroot
98122
--linux Build Linux kernel
99123
--all Build both Buildroot and Linux kernel
@@ -105,8 +129,9 @@ EOF
105129
}
106130

107131
BUILD_BUILDROOT=0
108-
BUILD_LINUX=0
132+
BUILD_X11=0
109133
BUILD_EXTRA_PACKAGES=0
134+
BUILD_LINUX=0
110135
EXTERNAL_ROOT=0
111136
CLEAN_BUILD=0
112137

@@ -115,6 +140,9 @@ while [[ $# -gt 0 ]]; do
115140
--buildroot)
116141
BUILD_BUILDROOT=1
117142
;;
143+
--x11)
144+
BUILD_X11=1
145+
;;
118146
--extra-packages)
119147
BUILD_EXTRA_PACKAGES=1
120148
;;
@@ -193,6 +221,11 @@ if [[ $BUILD_EXTRA_PACKAGES -eq 1 && $BUILD_BUILDROOT -eq 0 ]]; then
193221
show_help
194222
fi
195223

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+
196229
if [[ $CLEAN_BUILD -eq 1 && $BUILD_BUILDROOT -eq 1 && -d buildroot ]]; then
197230
echo "Removing buildroot/ for clean build..."
198231
rm -rf buildroot

0 commit comments

Comments
 (0)