@@ -53,6 +53,10 @@ function do_buildroot
5353 ASSERT make $PARALLEL
5454 popd
5555
56+ if [[ $BUILD_EXTRA_PACKAGES -eq 1 ]]; then
57+ do_extra_packages
58+ fi
59+
5660 if [[ $EXTERNAL_ROOT -eq 1 ]]; then
5761 echo " Copying rootfs.cpio to rootfs_full.cpio (external root mode)"
5862 cp -f buildroot/output/images/rootfs.cpio ./rootfs_full.cpio
@@ -86,12 +90,13 @@ function do_linux
8690
8791function show_help {
8892 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]
9094
9195Options:
9296 --buildroot Build Buildroot rootfs
97+ --extra-packages Build extra packages along with Buildroot
9398 --linux Build Linux kernel
94- --all Build both Buildroot and Linux
99+ --all Build both Buildroot and Linux kernel
95100 --external-root Use external rootfs instead of initramfs
96101 --clean-build Remove entire buildroot/ and/or linux/ directories before build
97102 --help Show this message
101106
102107BUILD_BUILDROOT=0
103108BUILD_LINUX=0
109+ BUILD_EXTRA_PACKAGES=0
104110EXTERNAL_ROOT=0
105111CLEAN_BUILD=0
106112
@@ -109,6 +115,9 @@ while [[ $# -gt 0 ]]; do
109115 --buildroot)
110116 BUILD_BUILDROOT=1
111117 ;;
118+ --extra-packages)
119+ BUILD_EXTRA_PACKAGES=1
120+ ;;
112121 --linux)
113122 BUILD_LINUX=1
114123 ;;
@@ -133,11 +142,57 @@ while [[ $# -gt 0 ]]; do
133142 shift
134143done
135144
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+
136186if [[ $BUILD_BUILDROOT -eq 0 && $BUILD_LINUX -eq 0 ]]; then
137187 echo " Error: No build target specified. Use --buildroot, --linux, or --all."
138188 show_help
139189fi
140190
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+
141196if [[ $CLEAN_BUILD -eq 1 && $BUILD_BUILDROOT -eq 1 && -d buildroot ]]; then
142197 echo " Removing buildroot/ for clean build..."
143198 rm -rf buildroot
0 commit comments