add steps to install a RISCV-64 OpenBSD qemu vm + regen + sync - www.codemadness.org - www.codemadness.org saait content files
(HTM) git clone git://git.codemadness.org/www.codemadness.org
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d19cdc4efa32a78c71df5155eaec2a0600483e57
(DIR) parent 473eb033ba2b2c92fbe81ae0d99048fee3bd4789
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 23 Oct 2021 15:08:25 +0200
add steps to install a RISCV-64 OpenBSD qemu vm + regen + sync
Diffstat:
M config.cfg | 2 +-
M output/atom.xml | 14 +++++++++++++-
M output/atom_content.xml | 112 ++++++++++++++++++++++++++++++-
M output/index | 1 +
M output/index.html | 1 +
M output/rss.xml | 8 ++++++++
M output/rss_content.xml | 105 +++++++++++++++++++++++++++++++
M output/sitemap.xml | 4 ++++
M output/twtxt.txt | 1 +
M output/urllist.txt | 1 +
A pages/openbsd-riscv64-vm.cfg | 6 ++++++
A pages/openbsd-riscv64-vm.md | 98 +++++++++++++++++++++++++++++++
12 files changed, 350 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/config.cfg b/config.cfg
@@ -1,5 +1,5 @@
# last updated the site.
-siteupdated = 2021-09-25
+siteupdated = 2021-10-23
sitetitle = Codemadness
siteurl = https://www.codemadness.org
(DIR) diff --git a/output/atom.xml b/output/atom.xml
@@ -2,11 +2,23 @@
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">Codemadness</title>
<subtitle type="text">blog with various projects and articles about computer-related things</subtitle>
- <updated>2021-09-25T00:00:00Z</updated>
+ <updated>2021-10-23T00:00:00Z</updated>
<link rel="alternate" type="text/html" href="https://www.codemadness.org" />
<id>https://www.codemadness.org/atom.xml</id>
<link rel="self" type="application/atom+xml" href="https://www.codemadness.org/atom.xml" />
<entry>
+ <title type="text">Setup an OpenBSD RISCV-64 VM in QEMU</title>
+ <link rel="alternate" type="text/html" href="https://www.codemadness.org/openbsd-riscv64-vm.html" />
+ <id>https://www.codemadness.org/openbsd-riscv64-vm.html</id>
+ <updated>2021-10-23T00:00:00Z</updated>
+ <published>2021-10-23T00:00:00Z</published>
+ <author>
+ <name>hiltjo</name>
+ <uri>https://www.codemadness.org</uri>
+ </author>
+ <summary type="text">Setup an OpenBSD RISCV-64 VM in QEMU</summary>
+</entry>
+<entry>
<title type="text">Sfeed_curses: a curses UI front-end for sfeed</title>
<link rel="alternate" type="text/html" href="https://www.codemadness.org/sfeed_curses-ui.html" />
<id>https://www.codemadness.org/sfeed_curses-ui.html</id>
(DIR) diff --git a/output/atom_content.xml b/output/atom_content.xml
@@ -2,11 +2,121 @@
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">Codemadness</title>
<subtitle type="text">blog with various projects and articles about computer-related things</subtitle>
- <updated>2021-09-25T00:00:00Z</updated>
+ <updated>2021-10-23T00:00:00Z</updated>
<link rel="alternate" type="text/html" href="https://www.codemadness.org" />
<id>https://www.codemadness.org/atom.xml</id>
<link rel="self" type="application/atom+xml" href="https://www.codemadness.org/atom.xml" />
<entry>
+ <title type="text">Setup an OpenBSD RISCV-64 VM in QEMU</title>
+ <link rel="alternate" type="text/html" href="https://www.codemadness.org/openbsd-riscv64-vm.html" />
+ <id>https://www.codemadness.org/openbsd-riscv64-vm.html</id>
+ <updated>2021-10-23T00:00:00Z</updated>
+ <published>2021-10-23T00:00:00Z</published>
+ <author>
+ <name>hiltjo</name>
+ <uri>https://www.codemadness.org</uri>
+ </author>
+ <summary type="text">Setup an OpenBSD RISCV-64 VM in QEMU</summary>
+ <content type="html"><![CDATA[<h1>Setup an OpenBSD RISCV-64 VM in QEMU</h1>
+ <p><strong>Last modification on </strong> <time>2021-10-23</time></p>
+ <p>This describes how to setup an OpenBSD RISCV-64 VM in QEMU.</p>
+<p>The below script does the following:</p>
+<ul>
+<li>Set up the disk image (raw format).</li>
+<li>Patch the disk image with OpenBSD miniroot file for the installation.</li>
+<li>Downloads the opensbi and u-boot firmware files for qemu.</li>
+<li>Run the VM with the supported settings.</li>
+</ul>
+<p>The script is tested on the host GNU/Void Linux and OpenBSD-current.</p>
+<p><strong>IMPORTANT!: The signature and checksum for the miniroot, u-boot and opensbi
+files are not verified. If the host is OpenBSD make sure to instead install the
+packages (pkg_add u-boot-riscv64 opensbi) and adjust the firmware path for the
+qemu -bios and -kernel options. </strong></p>
+<h2>Script</h2>
+<pre><code>
+mirror="https://ftp.bit.nl/pub/OpenBSD/"
+release="7.0"
+arch="riscv64"
+
+# base URL for the OpenBSD release for the VM.
+baseurl="${mirror}/${release}/${arch}"
+
+n="$(printf '%s' "${release}" | tr -d '.')" # remove dot
+minirootname="miniroot${n}.img"
+
+# for the opensbi and uboot package to extract the firmware needed for qemu.
+hostarch="amd64"
+packagebaseurl="${mirror}/${release}/packages/${hostarch}"
+
+opensbi() {
+ pkg="opensbi-0.9p0.tgz"
+ f="opensbi.tgz"
+ test -f "${f}" && return # download and extract once.
+
+ url="${packagebaseurl}/${pkg}"
+ curl -o "${f}" "${url}"
+
+ # extract firmware.
+ tar -xzf "${f}" share/opensbi/generic/fw_jump.bin
+}
+
+uboot() {
+ pkg="u-boot-riscv64-2021.07p0.tgz"
+ f="uboot.tgz"
+ test -f "${f}" && return # download and extract once.
+
+ url="${packagebaseurl}/${pkg}"
+ curl -o "${f}" "${url}"
+
+ tar -xzf "${f}" share/u-boot/qemu-riscv64_smode/u-boot.bin
+}
+
+miniroot() {
+ test -f "${minirootname}" && return # download once
+
+ minirooturl="${baseurl}/${minirootname}"
+ curl -o "${minirootname}" "${minirooturl}"
+}
+
+createdisk() {
+ qemu-img create disk.raw 10G
+}
+
+patchminiroot() {
+ dd conv=notrunc if=${minirootname} of=disk.raw
+}
+
+createrootdisk() {
+ test -f disk.raw && return # create once
+ createdisk
+ patchminiroot
+}
+
+setup() {
+ miniroot
+ createrootdisk
+ opensbi
+ uboot
+}
+
+run() {
+ qemu-system-riscv64 \
+ -machine virt \
+ -nographic \
+ -m 2048M \
+ -smp 2 \
+ -bios share/opensbi/generic/fw_jump.bin \
+ -kernel share/u-boot/qemu-riscv64_smode/u-boot.bin \
+ -drive file=disk.raw,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \
+ -netdev user,id=net0,ipv6=off -device virtio-net-device,netdev=net0
+}
+
+setup
+run
+</code></pre>
+]]></content>
+</entry>
+<entry>
<title type="text">Sfeed_curses: a curses UI front-end for sfeed</title>
<link rel="alternate" type="text/html" href="https://www.codemadness.org/sfeed_curses-ui.html" />
<id>https://www.codemadness.org/sfeed_curses-ui.html</id>
(DIR) diff --git a/output/index b/output/index
@@ -11,6 +11,7 @@ i codemadness.org 70
i codemadness.org 70
iPhlog posts codemadness.org 70
i codemadness.org 70
+12021-10-23 Setup an OpenBSD RISCV-64 VM in QEMU /phlog/openbsd-riscv64-vm codemadness.org 70
12020-06-25 Sfeed_curses: a curses UI front-end for sfeed /phlog/sfeed_curses codemadness.org 70
12019-11-10 hurl: HTTP, HTTPS and Gopher file grabber /phlog/hurl codemadness.org 70
12019-10-13 json2tsv: a JSON to TSV converter /phlog/json2tsv codemadness.org 70
(DIR) diff --git a/output/index.html b/output/index.html
@@ -39,6 +39,7 @@
<div id="main">
<h1>Posts</h1>
<table>
+<tr><td><time>2021-10-23</time></td><td><a href="openbsd-riscv64-vm.html">Setup an OpenBSD RISCV-64 VM in QEMU</a></td></tr>
<tr><td><time>2020-06-25</time></td><td><a href="sfeed_curses-ui.html">Sfeed_curses: a curses UI front-end for sfeed</a></td></tr>
<tr><td><time>2019-11-10</time></td><td><a href="hurl.html">hurl: HTTP, HTTPS and Gopher file grabber</a></td></tr>
<tr><td><time>2019-10-13</time></td><td><a href="json2tsv.html">json2tsv: a JSON to TSV converter</a></td></tr>
(DIR) diff --git a/output/rss.xml b/output/rss.xml
@@ -7,6 +7,14 @@
<description>blog with various projects and articles about computer-related things</description>
<link>https://www.codemadness.org</link>
<item>
+ <title>Setup an OpenBSD RISCV-64 VM in QEMU</title>
+ <link>https://www.codemadness.org/openbsd-riscv64-vm.html</link>
+ <guid>https://www.codemadness.org/openbsd-riscv64-vm.html</guid>
+ <dc:date>2021-10-23T00:00:00Z</dc:date>
+ <author>hiltjo</author>
+ <description>Setup an OpenBSD RISCV-64 VM in QEMU</description>
+</item>
+<item>
<title>Sfeed_curses: a curses UI front-end for sfeed</title>
<link>https://www.codemadness.org/sfeed_curses-ui.html</link>
<guid>https://www.codemadness.org/sfeed_curses-ui.html</guid>
(DIR) diff --git a/output/rss_content.xml b/output/rss_content.xml
@@ -7,6 +7,111 @@
<description>blog with various projects and articles about computer-related things</description>
<link>https://www.codemadness.org</link>
<item>
+ <title>Setup an OpenBSD RISCV-64 VM in QEMU</title>
+ <link>https://www.codemadness.org/openbsd-riscv64-vm.html</link>
+ <guid>https://www.codemadness.org/openbsd-riscv64-vm.html</guid>
+ <dc:date>2021-10-23T00:00:00Z</dc:date>
+ <author>hiltjo</author>
+ <description><![CDATA[<h1>Setup an OpenBSD RISCV-64 VM in QEMU</h1>
+ <p><strong>Last modification on </strong> <time>2021-10-23</time></p>
+ <p>This describes how to setup an OpenBSD RISCV-64 VM in QEMU.</p>
+<p>The below script does the following:</p>
+<ul>
+<li>Set up the disk image (raw format).</li>
+<li>Patch the disk image with OpenBSD miniroot file for the installation.</li>
+<li>Downloads the opensbi and u-boot firmware files for qemu.</li>
+<li>Run the VM with the supported settings.</li>
+</ul>
+<p>The script is tested on the host GNU/Void Linux and OpenBSD-current.</p>
+<p><strong>IMPORTANT!: The signature and checksum for the miniroot, u-boot and opensbi
+files are not verified. If the host is OpenBSD make sure to instead install the
+packages (pkg_add u-boot-riscv64 opensbi) and adjust the firmware path for the
+qemu -bios and -kernel options. </strong></p>
+<h2>Script</h2>
+<pre><code>
+mirror="https://ftp.bit.nl/pub/OpenBSD/"
+release="7.0"
+arch="riscv64"
+
+# base URL for the OpenBSD release for the VM.
+baseurl="${mirror}/${release}/${arch}"
+
+n="$(printf '%s' "${release}" | tr -d '.')" # remove dot
+minirootname="miniroot${n}.img"
+
+# for the opensbi and uboot package to extract the firmware needed for qemu.
+hostarch="amd64"
+packagebaseurl="${mirror}/${release}/packages/${hostarch}"
+
+opensbi() {
+ pkg="opensbi-0.9p0.tgz"
+ f="opensbi.tgz"
+ test -f "${f}" && return # download and extract once.
+
+ url="${packagebaseurl}/${pkg}"
+ curl -o "${f}" "${url}"
+
+ # extract firmware.
+ tar -xzf "${f}" share/opensbi/generic/fw_jump.bin
+}
+
+uboot() {
+ pkg="u-boot-riscv64-2021.07p0.tgz"
+ f="uboot.tgz"
+ test -f "${f}" && return # download and extract once.
+
+ url="${packagebaseurl}/${pkg}"
+ curl -o "${f}" "${url}"
+
+ tar -xzf "${f}" share/u-boot/qemu-riscv64_smode/u-boot.bin
+}
+
+miniroot() {
+ test -f "${minirootname}" && return # download once
+
+ minirooturl="${baseurl}/${minirootname}"
+ curl -o "${minirootname}" "${minirooturl}"
+}
+
+createdisk() {
+ qemu-img create disk.raw 10G
+}
+
+patchminiroot() {
+ dd conv=notrunc if=${minirootname} of=disk.raw
+}
+
+createrootdisk() {
+ test -f disk.raw && return # create once
+ createdisk
+ patchminiroot
+}
+
+setup() {
+ miniroot
+ createrootdisk
+ opensbi
+ uboot
+}
+
+run() {
+ qemu-system-riscv64 \
+ -machine virt \
+ -nographic \
+ -m 2048M \
+ -smp 2 \
+ -bios share/opensbi/generic/fw_jump.bin \
+ -kernel share/u-boot/qemu-riscv64_smode/u-boot.bin \
+ -drive file=disk.raw,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \
+ -netdev user,id=net0,ipv6=off -device virtio-net-device,netdev=net0
+}
+
+setup
+run
+</code></pre>
+]]></description>
+</item>
+<item>
<title>Sfeed_curses: a curses UI front-end for sfeed</title>
<link>https://www.codemadness.org/sfeed_curses-ui.html</link>
<guid>https://www.codemadness.org/sfeed_curses-ui.html</guid>
(DIR) diff --git a/output/sitemap.xml b/output/sitemap.xml
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
+ <loc>https://www.codemadness.org/openbsd-riscv64-vm.html</loc>
+ <lastmod>2021-10-23</lastmod>
+</url>
+<url>
<loc>https://www.codemadness.org/sfeed_curses-ui.html</loc>
<lastmod>2021-03-29</lastmod>
</url>
(DIR) diff --git a/output/twtxt.txt b/output/twtxt.txt
@@ -1,3 +1,4 @@
+2021-10-23T00:00:00Z Setup an OpenBSD RISCV-64 VM in QEMU: https://www.codemadness.org/openbsd-riscv64-vm.html
2020-06-25T00:00:00Z Sfeed_curses: a curses UI front-end for sfeed: https://www.codemadness.org/sfeed_curses-ui.html
2019-11-10T00:00:00Z hurl: HTTP, HTTPS and Gopher file grabber: https://www.codemadness.org/hurl.html
2019-10-13T00:00:00Z json2tsv: a JSON to TSV converter: https://www.codemadness.org/json2tsv.html
(DIR) diff --git a/output/urllist.txt b/output/urllist.txt
@@ -1,3 +1,4 @@
+https://www.codemadness.org/openbsd-riscv64-vm.html
https://www.codemadness.org/sfeed_curses-ui.html
https://www.codemadness.org/hurl.html
https://www.codemadness.org/json2tsv.html
(DIR) diff --git a/pages/openbsd-riscv64-vm.cfg b/pages/openbsd-riscv64-vm.cfg
@@ -0,0 +1,6 @@
+title = Setup an OpenBSD RISCV-64 VM in QEMU
+id = openbsd-riscv64-vm
+description = Setup an OpenBSD RISCV-64 VM in QEMU
+keywords = OpenBSD, RISCV-64, QEMU, vm
+created = 2021-10-23
+updated = 2021-10-23
(DIR) diff --git a/pages/openbsd-riscv64-vm.md b/pages/openbsd-riscv64-vm.md
@@ -0,0 +1,98 @@
+This describes how to setup an OpenBSD RISCV-64 VM in QEMU.
+
+The below script does the following:
+
+* Set up the disk image (raw format).
+* Patch the disk image with OpenBSD miniroot file for the installation.
+* Downloads the opensbi and u-boot firmware files for qemu.
+* Run the VM with the supported settings.
+
+The script is tested on the host GNU/Void Linux and OpenBSD-current.
+
+**IMPORTANT!: The signature and checksum for the miniroot, u-boot and opensbi
+files are not verified. If the host is OpenBSD make sure to instead install the
+packages (pkg_add u-boot-riscv64 opensbi) and adjust the firmware path for the
+qemu -bios and -kernel options. **
+
+
+## Script
+
+ mirror="https://ftp.bit.nl/pub/OpenBSD/"
+ release="7.0"
+ arch="riscv64"
+
+ # base URL for the OpenBSD release for the VM.
+ baseurl="${mirror}/${release}/${arch}"
+
+ n="$(printf '%s' "${release}" | tr -d '.')" # remove dot
+ minirootname="miniroot${n}.img"
+
+ # for the opensbi and uboot package to extract the firmware needed for qemu.
+ hostarch="amd64"
+ packagebaseurl="${mirror}/${release}/packages/${hostarch}"
+
+ opensbi() {
+ pkg="opensbi-0.9p0.tgz"
+ f="opensbi.tgz"
+ test -f "${f}" && return # download and extract once.
+
+ url="${packagebaseurl}/${pkg}"
+ curl -o "${f}" "${url}"
+
+ # extract firmware.
+ tar -xzf "${f}" share/opensbi/generic/fw_jump.bin
+ }
+
+ uboot() {
+ pkg="u-boot-riscv64-2021.07p0.tgz"
+ f="uboot.tgz"
+ test -f "${f}" && return # download and extract once.
+
+ url="${packagebaseurl}/${pkg}"
+ curl -o "${f}" "${url}"
+
+ tar -xzf "${f}" share/u-boot/qemu-riscv64_smode/u-boot.bin
+ }
+
+ miniroot() {
+ test -f "${minirootname}" && return # download once
+
+ minirooturl="${baseurl}/${minirootname}"
+ curl -o "${minirootname}" "${minirooturl}"
+ }
+
+ createdisk() {
+ qemu-img create disk.raw 10G
+ }
+
+ patchminiroot() {
+ dd conv=notrunc if=${minirootname} of=disk.raw
+ }
+
+ createrootdisk() {
+ test -f disk.raw && return # create once
+ createdisk
+ patchminiroot
+ }
+
+ setup() {
+ miniroot
+ createrootdisk
+ opensbi
+ uboot
+ }
+
+ run() {
+ qemu-system-riscv64 \
+ -machine virt \
+ -nographic \
+ -m 2048M \
+ -smp 2 \
+ -bios share/opensbi/generic/fw_jump.bin \
+ -kernel share/u-boot/qemu-riscv64_smode/u-boot.bin \
+ -drive file=disk.raw,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 \
+ -netdev user,id=net0,ipv6=off -device virtio-net-device,netdev=net0
+ }
+
+ setup
+ run