@@ -53,6 +53,24 @@ function do_buildroot
53
53
ASSERT make $PARALLEL
54
54
popd
55
55
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
+
56
74
if [[ $EXTERNAL_ROOT -eq 1 ]]; then
57
75
echo " Copying rootfs.cpio to rootfs_full.cpio (external root mode)"
58
76
cp -f buildroot/output/images/rootfs.cpio ./rootfs_full.cpio
@@ -77,21 +95,24 @@ function do_linux
77
95
export PATH=" $PWD /buildroot/output/host/bin:$PATH "
78
96
export CROSS_COMPILE=riscv32-buildroot-linux-gnu-
79
97
export ARCH=riscv
98
+ export INSTALL_MOD_PATH=" out"
80
99
pushd linux
81
100
ASSERT make olddefconfig
82
101
ASSERT make $PARALLEL
102
+ ASSERT make modules_install
83
103
cp -f arch/riscv/boot/Image ../Image
84
104
popd
85
105
}
86
106
87
107
function show_help {
88
108
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]
90
110
91
111
Options:
92
112
--buildroot Build Buildroot rootfs
93
113
--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
95
116
--external-root Use external rootfs instead of initramfs
96
117
--clean-build Remove entire buildroot/ and/or linux/ directories before build
97
118
--help Show this message
101
122
102
123
BUILD_BUILDROOT=0
103
124
BUILD_LINUX=0
125
+ BUILD_PACKAGES=0
104
126
EXTERNAL_ROOT=0
105
127
CLEAN_BUILD=0
106
128
@@ -112,9 +134,13 @@ while [[ $# -gt 0 ]]; do
112
134
--linux)
113
135
BUILD_LINUX=1
114
136
;;
137
+ --packages)
138
+ BUILD_PACKAGES=1
139
+ ;;
115
140
--all)
116
141
BUILD_BUILDROOT=1
117
142
BUILD_LINUX=1
143
+ BUILD_PACKAGES=1
118
144
;;
119
145
--external-root)
120
146
EXTERNAL_ROOT=1
@@ -133,7 +159,56 @@ while [[ $# -gt 0 ]]; do
133
159
shift
134
160
done
135
161
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
137
212
echo " Error: No build target specified. Use --buildroot, --linux, or --all."
138
213
show_help
139
214
fi
0 commit comments