@@ -53,6 +53,24 @@ function do_buildroot
5353 ASSERT make $PARALLEL
5454 popd
5555
56+ if [[ $BUILD_PACKAGES -eq 1 ]]; then
57+ export PATH=" $PWD /buildroot/output/host/bin:$PATH "
58+ export CROSS_COMPILE=riscv32-buildroot-linux-gnu-
59+
60+ rm -rf extras
61+ mkdir -p extras
62+ do_libepoxy && OK
63+ do_virglrenderer && OK
64+ do_directfb && OK
65+
66+ cp -r libepoxy_out/* extras
67+ cp -r virglrenderer_out/* extras
68+ cp -r directfb/* extras
69+
70+ mkdir -p extras/root
71+ cp target/run.sh extras/root/
72+ fi
73+
5674 if [[ $EXTERNAL_ROOT -eq 1 ]]; then
5775 echo " Copying rootfs.cpio to rootfs_full.cpio (external root mode)"
5876 cp -f buildroot/output/images/rootfs.cpio ./rootfs_full.cpio
@@ -77,21 +95,24 @@ function do_linux
7795 export PATH=" $PWD /buildroot/output/host/bin:$PATH "
7896 export CROSS_COMPILE=riscv32-buildroot-linux-gnu-
7997 export ARCH=riscv
98+ export INSTALL_MOD_PATH=" out"
8099 pushd linux
81100 ASSERT make olddefconfig
82101 ASSERT make $PARALLEL
102+ ASSERT make modules_install
83103 cp -f arch/riscv/boot/Image ../Image
84104 popd
85105}
86106
87107function show_help {
88108 cat << EOF
89- Usage: $0 [--buildroot] [--linux] [--all] [--external-root] [--clean-build] [--help]
109+ Usage: $0 [--buildroot] [--linux] [--packages] [-- all] [--external-root] [--clean-build] [--help]
90110
91111Options:
92112 --buildroot Build Buildroot rootfs
93113 --linux Build Linux kernel
94- --all Build both Buildroot and Linux
114+ --packages Build extra packages
115+ --all Build both Buildroot, Linux kernel, and extra packages
95116 --external-root Use external rootfs instead of initramfs
96117 --clean-build Remove entire buildroot/ and/or linux/ directories before build
97118 --help Show this message
101122
102123BUILD_BUILDROOT=0
103124BUILD_LINUX=0
125+ BUILD_PACKAGES=0
104126EXTERNAL_ROOT=0
105127CLEAN_BUILD=0
106128
@@ -112,9 +134,13 @@ while [[ $# -gt 0 ]]; do
112134 --linux)
113135 BUILD_LINUX=1
114136 ;;
137+ --packages)
138+ BUILD_PACKAGES=1
139+ ;;
115140 --all)
116141 BUILD_BUILDROOT=1
117142 BUILD_LINUX=1
143+ BUILD_PACKAGES=1
118144 ;;
119145 --external-root)
120146 EXTERNAL_ROOT=1
@@ -133,7 +159,56 @@ while [[ $# -gt 0 ]]; do
133159 shift
134160done
135161
136- if [[ $BUILD_BUILDROOT -eq 0 && $BUILD_LINUX -eq 0 ]]; then
162+ function do_libepoxy
163+ {
164+ ASSERT git clone https://github.com/anholt/libepoxy.git
165+ pushd libepoxy
166+ cp ../configs/riscv-cross-file .
167+ ASSERT meson --cross-file riscv-cross-file build/riscv
168+ ASSERT meson compile -C build/riscv
169+ DESTDIR=../../../libepoxy_out meson install -C build/riscv
170+ DESTDIR=../../../buildroot/output/host/riscv32-buildroot-linux-gnu/sysroot meson install -C build/riscv
171+ popd
172+ }
173+
174+ function do_virglrenderer
175+ {
176+ ASSERT git clone https://gitlab.freedesktop.org/virgl/virglrenderer.git
177+ pushd virglrenderer
178+ cp ../configs/riscv-cross-file .
179+ ASSERT meson --cross-file riscv-cross-file build/riscv
180+ ASSERT meson compile -C build/riscv
181+ DESTDIR=../../../virglrenderer_out meson install -C build/riscv
182+ popd
183+ }
184+
185+ function do_directfb
186+ {
187+ export PATH=$PATH :$PWD /buildroot/output/host/bin
188+ export BUILDROOT_OUT=$PWD /buildroot/output/
189+ mkdir -p directfb
190+
191+ # Build DirectFB2
192+ ASSERT git clone https://github.com/directfb2/DirectFB2.git
193+ pushd DirectFB2
194+ cp ../configs/riscv-cross-file .
195+ ASSERT meson -Ddrmkms=true --cross-file riscv-cross-file build/riscv
196+ ASSERT meson compile -C build/riscv
197+ DESTDIR=$BUILDROOT_OUT /host/riscv32-buildroot-linux-gnu/sysroot meson install -C build/riscv
198+ DESTDIR=../../../directfb meson install -C build/riscv
199+ popd
200+
201+ # Build DirectFB2 examples
202+ ASSERT git clone https://github.com/directfb2/DirectFB-examples.git
203+ pushd DirectFB-examples/
204+ cp ../configs/riscv-cross-file .
205+ ASSERT meson --cross-file riscv-cross-file build/riscv
206+ ASSERT meson compile -C build/riscv
207+ DESTDIR=../../../directfb meson install -C build/riscv
208+ popd
209+ }
210+
211+ if [[ $BUILD_BUILDROOT -eq 0 && $BUILD_LINUX -eq 0 && $BUILD_PACKAGES -eq 0 ]]; then
137212 echo " Error: No build target specified. Use --buildroot, --linux, or --all."
138213 show_help
139214fi
0 commit comments