Skip to content

Commit 0d6b03c

Browse files
docs: Add build deps and distro testing wrappers (#191)
- Add missing build dependencies (html2markdown, qemu) - Document distro testing wrapper scripts with usage examples - Add interactive shell targets for debugging docker builds - Fix usage in krun-ubuntu.sh
1 parent 3908b43 commit 0d6b03c

File tree

5 files changed

+180
-23
lines changed

5 files changed

+180
-23
lines changed

README.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ quark can be built natively or via a container, native is preferred and depends
9595
- clang
9696
- gnumake
9797
- gcc
98-
- mandoc (for docs).
98+
- mandoc (for docs)
99+
- html2markdown utility
100+
(for docs, pre-built binaries are available at
101+
https://github.com/JohannesKaufmann/html-to-markdown/releases)
99102
- m4
103+
- qemu (for testing)
104+
- zstd
100105

101106
Make sure to clone the repository recursively: [*git clone --recursive*](#git).
102107

@@ -116,6 +121,10 @@ Clean object files from quark.
116121

117122
Builds quark inside a docker container, so you don't have to worry about having build dependencies.
118123

124+
[*docker-shell*](#docker-shell)
125+
126+
Spawns an interactive shell inside the same builder container created by ‘make docker’. Handy for debugging failed builds, inspecting artifacts etc.
127+
119128
[*docker-cross-arm64*](#docker-cross-arm64)
120129

121130
Builds quark for arm64 inside a docker container.
@@ -124,9 +133,17 @@ Builds quark for arm64 inside a docker container.
124133

125134
Builds quark inside a centos7 docker container, useful for linking against ancient glibc-2.17.
126135

136+
[*centos7-shell*](#centos7-shell)
137+
138+
Opens an interactive shell in the centos7 builder container.
139+
127140
[*alpine*](#alpine)
128141

129-
Builds quark inside an alpine docker container, so we can track musl builds.
142+
Builds quark inside an Alpine Linux docker container, so we can track musl builds.
143+
144+
[*alpine-shell*](#alpine-shell)
145+
146+
Interactive shell inside the Alpine builder image.
130147

131148
[*test*](#test)
132149

@@ -201,7 +218,24 @@ $ make initramfs.gz
201218
$ ./krun.sh initramfs.gz kernel-images/amd64/linux-4.18.0-553.el8_10.x86_64 quark-test -vvv
202219
```
203220

204-
Note that you can pass arguments to the utility and you have to make initramfs.gz first.
221+
Convenience wrappers for Fedora, RHEL, and Ubuntu, automate the above by fetching the appropriate kernel packages, extracting vmlinuz and boot-strapping qemu-system-x86\_64:
222+
223+
```
224+
$ make initramfs.gz
225+
$ ./krun-fedora.sh initramfs.gz 40 quark-test -vvv
226+
$ ./krun-rhel.sh -v initramfs.gz 9 quark-test
227+
$ ./krun-ubuntu.sh initramfs.gz 24.04 quark-test -b t_dns
228+
```
229+
230+
The version number after ‘initramfs.gz’ selects the Fedora, RHEL, or Ubuntu version. All remaining arguments are passed verbatim to [quark-test(8)](https://elastic.github.io/quark/quark-test.8.html), enabling targeted runs such as:
231+
232+
```
233+
$ ./krun-fedora.sh initramfs.gz 41 quark-test -b t_fork_exec_exit
234+
```
235+
236+
These scripts require KVM access and therefore must be executed on a host kernel as root. They are unsuitable for container environments; the docker targets only build quark and do not attempt to run the test suite.
237+
238+
*make test-valgrind* runs the same suite under valgrind and is useful for catching memory errors, while *make test-kernel* cycles through a set of kernel images in kernel\_images folder to ensure probe compatibility.
205239

206240
# [INCLUDED BINARIES](#INCLUDED_BINARIES)
207241

docs/index.html

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,15 @@ <h1 class="Sh" id="BUILDING"><a class="permalink" href="#BUILDING">BUILDING</a><
163163
<li>clang</li>
164164
<li>gnumake</li>
165165
<li>gcc</li>
166-
<li>mandoc (for docs).</li>
166+
<li>mandoc (for docs)</li>
167+
<li>html2markdown utility
168+
<br/>
169+
(for docs, pre-built binaries are available at
170+
<br/>
171+
https://github.com/JohannesKaufmann/html-to-markdown/releases)</li>
167172
<li>m4</li>
173+
<li>qemu (for testing)</li>
174+
<li>zstd</li>
168175
</ul>
169176
<p class="Pp" id="git">Make sure to clone the repository recursively:
170177
<a class="permalink" href="#git"><i class="Em">git clone
@@ -190,15 +197,23 @@ <h1 class="Sh" id="BUILDING"><a class="permalink" href="#BUILDING">BUILDING</a><
190197
<dt id="docker"><a class="permalink" href="#docker"><i class="Em">docker</i></a></dt>
191198
<dd>Builds <code class="Nm">quark</code> inside a docker container, so you
192199
don't have to worry about having build dependencies.</dd>
200+
<dt id="docker-shell"><a class="permalink" href="#docker-shell"><i class="Em">docker-shell</i></a></dt>
201+
<dd>Spawns an interactive shell inside the same builder container created by
202+
&#x2018;make docker&#x2019;. Handy for debugging failed builds, inspecting
203+
artifacts etc.</dd>
193204
<dt id="docker-cross-arm64"><a class="permalink" href="#docker-cross-arm64"><i class="Em">docker-cross-arm64</i></a></dt>
194205
<dd>Builds <code class="Nm">quark</code> for arm64 inside a docker
195206
container.</dd>
196207
<dt id="centos7"><a class="permalink" href="#centos7"><i class="Em">centos7</i></a></dt>
197208
<dd>Builds <code class="Nm">quark</code> inside a centos7 docker container,
198209
useful for linking against ancient glibc-2.17.</dd>
210+
<dt id="centos7-shell"><a class="permalink" href="#centos7-shell"><i class="Em">centos7-shell</i></a></dt>
211+
<dd>Opens an interactive shell in the centos7 builder container.</dd>
199212
<dt id="alpine"><a class="permalink" href="#alpine"><i class="Em">alpine</i></a></dt>
200-
<dd>Builds <code class="Nm">quark</code> inside an alpine docker container, so
201-
we can track musl builds.</dd>
213+
<dd>Builds <code class="Nm">quark</code> inside an Alpine Linux docker
214+
container, so we can track musl builds.</dd>
215+
<dt id="alpine-shell"><a class="permalink" href="#alpine-shell"><i class="Em">alpine-shell</i></a></dt>
216+
<dd>Interactive shell inside the Alpine builder image.</dd>
202217
<dt id="test"><a class="permalink" href="#test"><i class="Em">test</i></a></dt>
203218
<dd>Builds and runs
204219
<a class="Xr" href="quark-test.8.html">quark-test(8)</a>.</dd>
@@ -267,8 +282,31 @@ <h1 class="Sh" id="TESTING"><a class="permalink" href="#TESTING">TESTING</a></h1
267282
<pre>$ make initramfs.gz
268283
$ ./krun.sh initramfs.gz kernel-images/amd64/linux-4.18.0-553.el8_10.x86_64 quark-test -vvv</pre>
269284
</div>
270-
<p class="Pp">Note that you can pass arguments to the utility and you have to
271-
make <span class="Pa">initramfs.gz</span> first.</p>
285+
<p class="Pp">Convenience wrappers for Fedora, RHEL, and Ubuntu, automate the
286+
above by fetching the appropriate kernel packages, extracting
287+
<span class="Pa">vmlinuz</span> and boot-strapping
288+
<span class="Pa">qemu-system-x86_64</span>:</p>
289+
<div class="Bd Pp Li">
290+
<pre>$ make initramfs.gz
291+
$ ./krun-fedora.sh initramfs.gz 40 quark-test -vvv
292+
$ ./krun-rhel.sh -v initramfs.gz 9 quark-test
293+
$ ./krun-ubuntu.sh initramfs.gz 24.04 quark-test -b t_dns</pre>
294+
</div>
295+
The version number after &#x2018;initramfs.gz&#x2019; selects the Fedora, RHEL,
296+
or Ubuntu version. All remaining arguments are passed verbatim to
297+
<a class="Xr" href="quark-test.8.html">quark-test(8)</a>, enabling targeted
298+
runs such as:
299+
<div class="Bd Pp Li">
300+
<pre>$ ./krun-fedora.sh initramfs.gz 41 quark-test -b t_fork_exec_exit</pre>
301+
</div>
302+
These scripts require KVM access and therefore must be executed on a host kernel
303+
as root. They are unsuitable for container environments; the
304+
<span class="Pa">docker</span> targets only build
305+
<code class="Nm">quark</code> and do not attempt to run the test suite.
306+
<p class="Pp"><i class="Em">make test-valgrind</i> runs the same suite under
307+
valgrind and is useful for catching memory errors, while <i class="Em">make
308+
test-kernel</i> cycles through a set of kernel images in kernel_images
309+
folder to ensure probe compatibility.</p>
272310
</section>
273311
<section class="Sh">
274312
<h1 class="Sh" id="INCLUDED_BINARIES"><a class="permalink" href="#INCLUDED_BINARIES">INCLUDED
@@ -416,7 +454,7 @@ <h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1
416454
</div>
417455
<table class="foot">
418456
<tr>
419-
<td class="foot-date">June 4, 2025</td>
457+
<td class="foot-date">June 16, 2025</td>
420458
<td class="foot-os">Linux</td>
421459
</tr>
422460
</table>

docs/quark.7.html

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,15 @@ <h1 class="Sh" id="BUILDING"><a class="permalink" href="#BUILDING">BUILDING</a><
163163
<li>clang</li>
164164
<li>gnumake</li>
165165
<li>gcc</li>
166-
<li>mandoc (for docs).</li>
166+
<li>mandoc (for docs)</li>
167+
<li>html2markdown utility
168+
<br/>
169+
(for docs, pre-built binaries are available at
170+
<br/>
171+
https://github.com/JohannesKaufmann/html-to-markdown/releases)</li>
167172
<li>m4</li>
173+
<li>qemu (for testing)</li>
174+
<li>zstd</li>
168175
</ul>
169176
<p class="Pp" id="git">Make sure to clone the repository recursively:
170177
<a class="permalink" href="#git"><i class="Em">git clone
@@ -190,15 +197,23 @@ <h1 class="Sh" id="BUILDING"><a class="permalink" href="#BUILDING">BUILDING</a><
190197
<dt id="docker"><a class="permalink" href="#docker"><i class="Em">docker</i></a></dt>
191198
<dd>Builds <code class="Nm">quark</code> inside a docker container, so you
192199
don't have to worry about having build dependencies.</dd>
200+
<dt id="docker-shell"><a class="permalink" href="#docker-shell"><i class="Em">docker-shell</i></a></dt>
201+
<dd>Spawns an interactive shell inside the same builder container created by
202+
&#x2018;make docker&#x2019;. Handy for debugging failed builds, inspecting
203+
artifacts etc.</dd>
193204
<dt id="docker-cross-arm64"><a class="permalink" href="#docker-cross-arm64"><i class="Em">docker-cross-arm64</i></a></dt>
194205
<dd>Builds <code class="Nm">quark</code> for arm64 inside a docker
195206
container.</dd>
196207
<dt id="centos7"><a class="permalink" href="#centos7"><i class="Em">centos7</i></a></dt>
197208
<dd>Builds <code class="Nm">quark</code> inside a centos7 docker container,
198209
useful for linking against ancient glibc-2.17.</dd>
210+
<dt id="centos7-shell"><a class="permalink" href="#centos7-shell"><i class="Em">centos7-shell</i></a></dt>
211+
<dd>Opens an interactive shell in the centos7 builder container.</dd>
199212
<dt id="alpine"><a class="permalink" href="#alpine"><i class="Em">alpine</i></a></dt>
200-
<dd>Builds <code class="Nm">quark</code> inside an alpine docker container, so
201-
we can track musl builds.</dd>
213+
<dd>Builds <code class="Nm">quark</code> inside an Alpine Linux docker
214+
container, so we can track musl builds.</dd>
215+
<dt id="alpine-shell"><a class="permalink" href="#alpine-shell"><i class="Em">alpine-shell</i></a></dt>
216+
<dd>Interactive shell inside the Alpine builder image.</dd>
202217
<dt id="test"><a class="permalink" href="#test"><i class="Em">test</i></a></dt>
203218
<dd>Builds and runs
204219
<a class="Xr" href="quark-test.8.html">quark-test(8)</a>.</dd>
@@ -267,8 +282,31 @@ <h1 class="Sh" id="TESTING"><a class="permalink" href="#TESTING">TESTING</a></h1
267282
<pre>$ make initramfs.gz
268283
$ ./krun.sh initramfs.gz kernel-images/amd64/linux-4.18.0-553.el8_10.x86_64 quark-test -vvv</pre>
269284
</div>
270-
<p class="Pp">Note that you can pass arguments to the utility and you have to
271-
make <span class="Pa">initramfs.gz</span> first.</p>
285+
<p class="Pp">Convenience wrappers for Fedora, RHEL, and Ubuntu, automate the
286+
above by fetching the appropriate kernel packages, extracting
287+
<span class="Pa">vmlinuz</span> and boot-strapping
288+
<span class="Pa">qemu-system-x86_64</span>:</p>
289+
<div class="Bd Pp Li">
290+
<pre>$ make initramfs.gz
291+
$ ./krun-fedora.sh initramfs.gz 40 quark-test -vvv
292+
$ ./krun-rhel.sh -v initramfs.gz 9 quark-test
293+
$ ./krun-ubuntu.sh initramfs.gz 24.04 quark-test -b t_dns</pre>
294+
</div>
295+
The version number after &#x2018;initramfs.gz&#x2019; selects the Fedora, RHEL,
296+
or Ubuntu version. All remaining arguments are passed verbatim to
297+
<a class="Xr" href="quark-test.8.html">quark-test(8)</a>, enabling targeted
298+
runs such as:
299+
<div class="Bd Pp Li">
300+
<pre>$ ./krun-fedora.sh initramfs.gz 41 quark-test -b t_fork_exec_exit</pre>
301+
</div>
302+
These scripts require KVM access and therefore must be executed on a host kernel
303+
as root. They are unsuitable for container environments; the
304+
<span class="Pa">docker</span> targets only build
305+
<code class="Nm">quark</code> and do not attempt to run the test suite.
306+
<p class="Pp"><i class="Em">make test-valgrind</i> runs the same suite under
307+
valgrind and is useful for catching memory errors, while <i class="Em">make
308+
test-kernel</i> cycles through a set of kernel images in kernel_images
309+
folder to ensure probe compatibility.</p>
272310
</section>
273311
<section class="Sh">
274312
<h1 class="Sh" id="INCLUDED_BINARIES"><a class="permalink" href="#INCLUDED_BINARIES">INCLUDED
@@ -416,7 +454,7 @@ <h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1
416454
</div>
417455
<table class="foot">
418456
<tr>
419-
<td class="foot-date">June 4, 2025</td>
457+
<td class="foot-date">June 16, 2025</td>
420458
<td class="foot-os">Linux</td>
421459
</tr>
422460
</table>

krun-ubuntu.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ usage() {
3030
echo " command... Command to run in guest"
3131
echo
3232
echo "Examples:"
33-
echo " $SCRIPT initramfs.gz 40 /bin/bash"
34-
echo " $SCRIPT -v initramfs.gz rawhide quark-test -vvv"
33+
echo " $SCRIPT initramfs.gz 22.04 /bin/bash"
34+
echo " $SCRIPT -v initramfs.gz 24.04 quark-test -vvv"
3535
exit 1
3636
}
3737

@@ -51,7 +51,7 @@ while getopts "vh" opt; do
5151
done
5252
shift $((OPTIND - 1))
5353

54-
[[ $# -lt 2 ]] && usage
54+
[[ $# -lt 3 ]] && usage
5555
[[ $ARCH =~ ^(amd64|arm64)$ ]] || die "Invalid architecture: $ARCH"
5656

5757
INITRAMFS="$1"; shift

quark.7

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,17 @@ gnumake
152152
.It
153153
gcc
154154
.It
155-
mandoc (for docs).
155+
mandoc (for docs)
156+
.It
157+
html2markdown utility
158+
(for docs, pre-built binaries are available at
159+
https://github.com/JohannesKaufmann/html-to-markdown/releases)
156160
.It
157161
m4
162+
.It
163+
qemu (for testing)
164+
.It
165+
zstd
158166
.El
159167
.Pp
160168
Make sure to clone the repository recursively:
@@ -201,6 +209,10 @@ Builds
201209
.Nm quark
202210
inside a docker container, so you don't have to worry about
203211
having build dependencies.
212+
.It Em docker-shell
213+
Spawns an interactive shell inside the same builder container created by
214+
.Sq make docker .
215+
Handy for debugging failed builds, inspecting artifacts etc.
204216
.It Em docker-cross-arm64
205217
Builds
206218
.Nm quark
@@ -210,10 +222,14 @@ Builds
210222
.Nm quark
211223
inside a centos7 docker container, useful for linking against
212224
ancient glibc-2.17.
225+
.It Em centos7-shell
226+
Opens an interactive shell in the centos7 builder container.
213227
.It Em alpine
214228
Builds
215229
.Nm quark
216-
inside an alpine docker container, so we can track musl builds.
230+
inside an Alpine Linux docker container, so we can track musl builds.
231+
.It Em alpine-shell
232+
Interactive shell inside the Alpine builder image.
217233
.It Em test
218234
Builds and runs
219235
.Xr quark-test 8 .
@@ -294,9 +310,40 @@ $ make initramfs.gz
294310
$ ./krun.sh initramfs.gz kernel-images/amd64/linux-4.18.0-553.el8_10.x86_64 quark-test -vvv
295311
.Ed
296312
.Pp
297-
Note that you can pass arguments to the utility and you have to make
298-
.Pa initramfs.gz
299-
first.
313+
Convenience wrappers for Fedora, RHEL, and Ubuntu, automate the
314+
above by fetching the appropriate kernel packages, extracting
315+
.Pa vmlinuz
316+
and boot-strapping
317+
.Pa qemu-system-x86_64 :
318+
.Bd -literal
319+
$ make initramfs.gz
320+
$ ./krun-fedora.sh initramfs.gz 40 quark-test -vvv
321+
$ ./krun-rhel.sh -v initramfs.gz 9 quark-test
322+
$ ./krun-ubuntu.sh initramfs.gz 24.04 quark-test -b t_dns
323+
.Ed
324+
The version number after
325+
.Sq initramfs.gz
326+
selects the Fedora, RHEL, or Ubuntu version.
327+
All remaining arguments are passed verbatim to
328+
.Xr quark-test 8 ,
329+
enabling targeted runs such as:
330+
.Bd -literal
331+
$ ./krun-fedora.sh initramfs.gz 41 quark-test -b t_fork_exec_exit
332+
.Ed
333+
These scripts require KVM access and therefore must be executed on a host
334+
kernel as root.
335+
They are unsuitable for container environments; the
336+
.Pa docker
337+
targets only build
338+
.Nm
339+
and do not attempt to run the test suite.
340+
.Pp
341+
.Em make test-valgrind
342+
runs the same suite under valgrind
343+
and is useful for catching memory errors, while
344+
.Em make test-kernel
345+
cycles through a set of kernel images in kernel_images
346+
folder to ensure probe compatibility.
300347
.Sh INCLUDED BINARIES
301348
.Xr quark-mon 8
302349
is a program that dumps

0 commit comments

Comments
 (0)