@@ -53,6 +53,10 @@ function do_buildroot
53
53
ASSERT make $PARALLEL
54
54
popd
55
55
56
+ if [[ $BUILD_EXTRA_PACKAGES -eq 1 ]]; then
57
+ do_extra_packages
58
+ fi
59
+
56
60
if [[ $EXTERNAL_ROOT -eq 1 ]]; then
57
61
echo " Copying rootfs.cpio to rootfs_full.cpio (external root mode)"
58
62
cp -f buildroot/output/images/rootfs.cpio ./rootfs_full.cpio
@@ -86,12 +90,13 @@ function do_linux
86
90
87
91
function show_help {
88
92
cat << EOF
89
- Usage: $0 [--buildroot] [--linux] [--all] [--external-root] [--clean-build] [--help]
93
+ Usage: $0 [--buildroot] [--linux] [--extra-packages] [-- all] [--external-root] [--clean-build] [--help]
90
94
91
95
Options:
92
96
--buildroot Build Buildroot rootfs
97
+ --extra-packages Build extra packages along with Buildroot
93
98
--linux Build Linux kernel
94
- --all Build both Buildroot and Linux
99
+ --all Build both Buildroot and Linux kernel
95
100
--external-root Use external rootfs instead of initramfs
96
101
--clean-build Remove entire buildroot/ and/or linux/ directories before build
97
102
--help Show this message
101
106
102
107
BUILD_BUILDROOT=0
103
108
BUILD_LINUX=0
109
+ BUILD_EXTRA_PACKAGES=0
104
110
EXTERNAL_ROOT=0
105
111
CLEAN_BUILD=0
106
112
@@ -109,6 +115,9 @@ while [[ $# -gt 0 ]]; do
109
115
--buildroot)
110
116
BUILD_BUILDROOT=1
111
117
;;
118
+ --extra-packages)
119
+ BUILD_EXTRA_PACKAGES=1
120
+ ;;
112
121
--linux)
113
122
BUILD_LINUX=1
114
123
;;
@@ -133,11 +142,57 @@ while [[ $# -gt 0 ]]; do
133
142
shift
134
143
done
135
144
145
+ function do_directfb
146
+ {
147
+ export PATH=$PATH :$PWD /buildroot/output/host/bin
148
+ export BUILDROOT_OUT=$PWD /buildroot/output/
149
+ mkdir -p directfb
150
+
151
+ # Build DirectFB2
152
+ ASSERT git clone https://github.com/directfb2/DirectFB2.git
153
+ pushd DirectFB2
154
+ cp ../configs/riscv-cross-file .
155
+ ASSERT meson -Ddrmkms=true --cross-file riscv-cross-file build/riscv
156
+ ASSERT meson compile -C build/riscv
157
+ DESTDIR=$BUILDROOT_OUT /host/riscv32-buildroot-linux-gnu/sysroot meson install -C build/riscv
158
+ DESTDIR=../../../directfb meson install -C build/riscv
159
+ popd
160
+
161
+ # Build DirectFB2 examples
162
+ ASSERT git clone https://github.com/directfb2/DirectFB-examples.git
163
+ pushd DirectFB-examples/
164
+ cp ../configs/riscv-cross-file .
165
+ ASSERT meson --cross-file riscv-cross-file build/riscv
166
+ ASSERT meson compile -C build/riscv
167
+ DESTDIR=../../../directfb meson install -C build/riscv
168
+ popd
169
+ }
170
+
171
+ function do_extra_packages
172
+ {
173
+ export PATH=" $PWD /buildroot/output/host/bin:$PATH "
174
+ export CROSS_COMPILE=riscv32-buildroot-linux-gnu-
175
+
176
+ rm -rf extra_packages
177
+ mkdir -p extra_packages
178
+ mkdir -p extra_packages/root
179
+
180
+ do_directfb && OK
181
+
182
+ cp -r directfb/* extra_packages
183
+ cp target/run.sh extra_packages/root/
184
+ }
185
+
136
186
if [[ $BUILD_BUILDROOT -eq 0 && $BUILD_LINUX -eq 0 ]]; then
137
187
echo " Error: No build target specified. Use --buildroot, --linux, or --all."
138
188
show_help
139
189
fi
140
190
191
+ if [[ $BUILD_EXTRA_PACKAGES -eq 1 && $BUILD_BUILDROOT -eq 0 ]]; then
192
+ echo " Error: --extra-packages requires --buildroot to be specified."
193
+ show_help
194
+ fi
195
+
141
196
if [[ $CLEAN_BUILD -eq 1 && $BUILD_BUILDROOT -eq 1 && -d buildroot ]]; then
142
197
echo " Removing buildroot/ for clean build..."
143
198
rm -rf buildroot
0 commit comments