Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/homepage-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const HOMEPAGE_SECTIONS: Section[] = [
repo: "fat-chr",
title: "fat-chr",
description:
"Rebuilds RouterOS CHR <code>.raw</code> images into UEFI-bootable images using a FAT EFI partition &mdash; required for UTM, Apple Silicon, and UEFI-strict platforms.",
"Rebuilds RouterOS CHR <code>.raw</code> images into UEFI-bootable images using a FAT EFI partition &mdash; needed for Apple Virtualization (UTM on Intel Macs) and other UEFI-strict platforms.",
actions: [
{ label: "GitHub", href: "https://github.com/tikoci/fat-chr" },
],
Expand Down
106 changes: 94 additions & 12 deletions src/chr-images.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
</label>
<label>
Type
<select id="type-select" title="QEMU: cross-platform emulation &amp; native virt. Apple: macOS Virtualization.framework via UTM (faster startup, fewer device options)" aria-label="Virtualization backend type">
<select id="type-select" title="QEMU: cross-platform emulation &amp; native virt. Apple: macOS Virtualization.framework via UTM, x86_64 on Intel Macs only" aria-label="Virtualization backend type">
</select>
</label>
</div>
Expand Down Expand Up @@ -319,7 +319,12 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
The <code>qemu.sh</code> script auto-detects the best accelerator.</p>
<p><strong>Apple</strong> &mdash; Uses macOS <a href="https://docs.getutm.app/settings-apple/settings-apple/" target="_blank" rel="noopener">Virtualization.framework</a>
via UTM. Faster startup, but limited device support and macOS-only.
Uses a third-party EFI-bootable CHR image from <a href="https://github.com/tikoci/fat-chr" target="_blank" rel="noopener">tikoci/fat-chr</a>.</p>
Offered for x86_64 on Intel Macs only, with a third-party EFI-bootable CHR image from <a href="https://github.com/tikoci/fat-chr" target="_blank" rel="noopener">tikoci/fat-chr</a>.</p>
<p><small>There is no ARM64 Apple option. ARM64 CHR still runs 32-bit ARM code at boot, which
Apple Silicon cannot execute, so Virtualization.framework cannot start it. On Apple Silicon use the
aarch64 QEMU package, which runs under TCG emulation
(<a href="https://github.com/tikoci/mikropkl/issues/13" target="_blank" rel="noopener">mikropkl#13</a>;
<a href="https://github.com/tikoci/quickchr/blob/main/docs/m4-hvf-arm64-investigation.md#root-cause-chain" target="_blank" rel="noopener">root cause</a>).</small></p>
<hr>
<header><strong>ROSE Variant</strong></header>
<p>The <code>rose.*</code> images are standard CHR plus 4&times;10 GB empty qcow2 disks
Expand Down Expand Up @@ -376,6 +381,42 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
const ARCH_LABELS = { aarch64: 'aarch64 (ARM64)', x86_64: 'x86_64 (Intel/AMD)' }
const TYPE_LABELS = { qemu: 'QEMU', apple: 'Apple' }

// Combinations mikropkl still builds but that cannot boot. They are
// left out of the selector; landing on one (an old link, or switching
// arch) falls back to QEMU and shows the note.
const UNSUPPORTED = {
'aarch64.apple': {
label: 'Apple (won’t boot on ARM64)',
note: '<strong>Apple Virtualization can&rsquo;t boot ARM64 CHR</strong> &mdash; use a QEMU package instead. '
+ 'ARM64 CHR images still start a 32-bit ARM (AArch32) <code>/init</code> and userspace. '
+ 'Apple Silicon has no AArch32 support, so UTM&rsquo;s Apple Virtualization backend cannot run them. '
+ 'The aarch64 QEMU package works on any Mac under TCG emulation, which runs the 32-bit code. '
+ 'mikropkl still builds <code>chr.aarch64.apple</code> in case a future CHR fixes this. See '
+ '<a href="https://github.com/tikoci/mikropkl/issues/13" target="_blank" rel="noopener">mikropkl#13</a> and the '
+ '<a href="https://github.com/tikoci/quickchr/blob/main/docs/m4-hvf-arm64-investigation.md#root-cause-chain" target="_blank" rel="noopener">quickchr investigation</a>.'
}
}
function unsupported(arch, type) { return UNSUPPORTED[arch + '.' + type] }

// mikropkl#12: qemu.sh in aarch64 bundles from before this date picks
// HVF on Apple Silicon, which cannot boot ARM64 CHR. mikropkl's
// refresh-scripts workflow re-uploads older bundles with a current
// qemu.sh and notes the date in the release body.
const ARM64_TCG_SCRIPT_SINCE = '2026-07-25'
function scriptDate(release) {
let d = (release.published_at || '').slice(0, 10)
const re = /QEMU launch scripts refreshed\*\* (\d{4}-\d{2}-\d{2})/g
let m
while ((m = re.exec(release.body || '')) !== null) if (m[1] > d) d = m[1]
return d
}
// The launch command for the QEMU CLI steps
function qemuRun(plat, asset) {
const forceTcg = plat === 'mac' && asset.arch === 'aarch64'
&& scriptDate(currentRelease) < ARM64_TCG_SCRIPT_SINCE
return forceTcg ? 'QEMU_ACCEL=tcg,tb-size=256 ./qemu.sh' : './qemu.sh'
}

const VARIANT_INFO = {
'chr': {
label: 'CHR',
Expand Down Expand Up @@ -444,6 +485,9 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
let allReleases = []
let currentRelease = null
let currentAssets = []
let fallbackNote = ''
let requestedNote = '' // set by init for a link to an unsupported combination
let blockedLink = null // that link's arch/type, kept in the URL when nothing replaces it

// --- DOM refs ---
const versionEl = document.getElementById('version-select')
Expand Down Expand Up @@ -486,6 +530,7 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
if (!currentRelease) return
const version = versionFromTag(currentRelease.tag_name)
currentAssets = extractAssetsFromBody(currentRelease.body, version)
.filter(a => !unsupported(a.arch, a.type))

// Show release date
if (currentRelease.published_at) {
Expand Down Expand Up @@ -522,6 +567,8 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
// --- Filter variants by current arch+type, with smart fallback ---
function updateVariants() {
let arch = archEl.value, type = typeEl.value
fallbackNote = requestedNote || unsupported(arch, type)?.note || ''
requestedNote = ''
let matching = currentAssets.filter(a => a.arch === arch && a.type === type)

// Fallback: if no assets for this type, try the other type
Expand Down Expand Up @@ -556,6 +603,13 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
}
}

// Mark types that cannot boot on the chosen arch
for (const o of typeEl.options) {
const u = unsupported(arch, o.value)
o.disabled = Boolean(u)
o.textContent = u ? u.label : (TYPE_LABELS[o.value] || o.value)
}

const variants = [...new Set(matching.map(a => a.variant))].sort()
const prev = variantEl.value

Expand Down Expand Up @@ -603,7 +657,9 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
downloadBtn.style.display = 'none'
utmBtn.style.display = 'none'
shareBtn.style.display = 'none'
calloutsEl.innerHTML = ''
calloutsEl.innerHTML = fallbackNote
? '<div class="callout warning"><small>' + fallbackNote + '</small></div>'
: ''
return
}
const tag = currentRelease.tag_name
Expand All @@ -629,7 +685,14 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik

function syncQueryParams() {
const asset = getSelectedAsset()
if (!asset) return
if (!asset) {
// Keep an unsupported link as given, so a reload shows its note
// again instead of an earlier default such as Intel Apple
if (blockedLink && currentRelease) {
writeQueryParams({ v: versionFromTag(currentRelease.tag_name), ...blockedLink })
}
return
}
const params = {
v: asset.version,
arch: asset.arch,
Expand All @@ -646,9 +709,13 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
// --- Callouts ---
function renderCallouts(asset) {
let html = ''
if (fallbackNote) {
html += '<div class="callout warning"><small>' + fallbackNote + '</small></div>'
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
if (asset.type === 'apple') {
html += '<div class="callout warning"><small>'
+ '<strong>Apple Virtualization.framework</strong> &mdash; '
+ 'Intel Macs only: Apple Silicon cannot run x86_64 guests with this backend. '
+ 'This image uses an EFI-bootable CHR disk from '
+ '<a href="https://github.com/tikoci/fat-chr" target="_blank" rel="noopener">tikoci/fat-chr</a> '
+ '(third-party build) to support UEFI boot required by Apple&rsquo;s virtualization framework. '
Expand Down Expand Up @@ -732,14 +799,16 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
+ '# Open WebFig in browser\n'
+ 'open http://localhost:9180/'
+ '</code></pre>'
+ '<p><small>Change the port with <code>./qemu.sh --port 8080</code></small></p>'
+ '<p><small>Change the port with <code>' + qemuRun(plat, asset) + ' --port 8080</code></small></p>'
}

instructionsEl.innerHTML = html
}

function buildQemuInstructions(plat, asset, dlUrl, dirname, version) {
let h = ''
const run = qemuRun(plat, asset)
const forceTcg = run !== './qemu.sh'

// Install QEMU
if (plat === 'mac') {
Expand Down Expand Up @@ -782,13 +851,18 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
+ ' ' + escapeHtml(dlUrl) + '\n'
+ 'unzip ' + escapeHtml(asset.filename) + '\n'
+ 'cd ' + escapeHtml(dirname) + '\n'
+ './qemu.sh</code></pre>'
+ '<p>Default login: <strong>admin</strong> with empty password (press Enter). '
+ run + '</code></pre>'
if (forceTcg) {
h += '<p><small>This older bundle&rsquo;s <code>qemu.sh</code> picks HVF on Apple Silicon, '
+ 'which cannot boot ARM64 CHR. <code>QEMU_ACCEL</code> forces TCG emulation; '
+ 'bundles built or refreshed since ' + ARM64_TCG_SCRIPT_SINCE + ' do this themselves.</small></p>'
}
h += '<p>Default login: <strong>admin</strong> with empty password (press Enter). '
+ 'Type <kbd>/quit</kbd> to exit, or press <kbd>Ctrl-A</kbd> then <kbd>X</kbd>.</p>'

// Background mode
h += '<h4>Background Mode</h4>'
+ '<pre><code>./qemu.sh --background</code></pre>'
+ '<pre><code>' + run + ' --background</code></pre>'
+ '<p>Connect to serial console:</p>'
+ '<pre><code>socat - UNIX-CONNECT:/tmp/qemu-'
+ escapeHtml(dirname.replace(/\.utm$/, ''))
Expand All @@ -801,9 +875,9 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
+ '(requires <code>sudo</code>):</p>'
+ '<pre><code>'
+ '# Shared NAT network:\n'
+ 'sudo ./qemu.sh --shared\n\n'
+ 'sudo ' + run + ' --shared\n\n'
+ '# Bridge to physical interface (full LAN access):\n'
+ 'sudo ./qemu.sh --bridge en0</code></pre>'
+ 'sudo ' + run + ' --bridge en0</code></pre>'
+ '<p><small>The VM gets its own IP &mdash; access RouterOS directly, '
+ 'no port forwarding needed. Great for testing DHCP, OSPF, or BGP.</small></p>'
}
Expand Down Expand Up @@ -967,11 +1041,18 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
versionEl.value = targetTag
selectRelease(targetTag)

// Override from query params
// Override from query params. A link to an unsupported combination
// gets its note even when this release's options no longer list it.
const blocked = unsupported(params.arch, params.type)
if (params.arch && [...archEl.options].some(o => o.value === params.arch)) {
archEl.value = params.arch
}
if (params.type && [...typeEl.options].some(o => o.value === params.type)) {
if (blocked) {
requestedNote = blocked.note
blockedLink = { arch: params.arch, type: params.type }
// No QEMU package: select nothing rather than the Intel-only Apple one
typeEl.value = [...typeEl.options].some(o => o.value === 'qemu') ? 'qemu' : ''
} else if (params.type && [...typeEl.options].some(o => o.value === params.type)) {
typeEl.value = params.type
}
updateVariants() // re-filter after arch/type overrides
Expand All @@ -988,6 +1069,7 @@ <h1>CHR Images <small><small><i>from </i></small><a href="https://github.com/tik
methodEl.value = params.method
}
renderInstructions()
syncQueryParams() // keep os/method overrides in the rewritten URL

plausible('CHR Page Load', { props: { version: versionFromTag(targetTag), platform: hostPlatform } })
}
Expand Down
6 changes: 3 additions & 3 deletions src/virtualization.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ <h1>Virtualization</h1>
<header>
<h2><a href="https://github.com/tikoci/mikropkl">mikropkl</a> <mark class="lang">PKL</mark> <mark class="lang">Shell</mark></h2>
</header>
<p>Packages RouterOS CHR as macOS UTM virtual machines for automated install. No more fussing with disks or display. <a href="https://github.com/tikoci/mikropkl/releases/latest">Releases</a> include <code>utm://</code> links and <code>.zip</code> files for recent versions of RouterOS CHR, ready-to-use with macOS UTM.</p>
<p>Packages RouterOS CHR as macOS UTM virtual machines for automated install. No more fussing with disks or display. Each <a href="https://github.com/tikoci/mikropkl/releases/latest">release</a> has <code>.utm.zip</code> packages for a RouterOS CHR version: a UTM bundle that also runs with QEMU through its <code>qemu.sh</code>. Not every package runs on every Mac, so get yours from the <a href="chr-images.html">CHR Images</a> picker.</p>
<figure>
<img src="images/chr-utm-serialopen.png" alt="RouterOS CHR running in UTM on macOS" loading="lazy">
<figcaption>RouterOS CHR in UTM with serial console open</figcaption>
</figure>
<footer>
<a href="https://github.com/tikoci/mikropkl">GitHub</a> &middot;
<a href="https://github.com/tikoci/mikropkl/releases/latest">UTM Downloads</a>
<a href="chr-images.html">UTM Downloads</a>
</footer>
</article>

<article>
<header>
<h2><a href="https://github.com/tikoci/fat-chr">fat-chr</a> <mark class="lang">Shell</mark></h2>
</header>
<p>Rebuilds RouterOS CHR <code>.raw</code> images into valid UEFI images for UTM, Apple, and other virtualization platforms. Uses FAT instead of ext2 for the EFI partition. UEFI-enabled CHR images are available in the <a href="https://github.com/tikoci/fat-chr/releases">project releases</a>.</p>
<p>Rebuilds RouterOS CHR <code>.raw</code> images into valid UEFI images for Apple Virtualization (UTM on Intel Macs) and other UEFI-strict platforms. Uses FAT instead of ext2 for the EFI partition. UEFI-enabled CHR images are available in the <a href="https://github.com/tikoci/fat-chr/releases">project releases</a>.</p>
<footer>
<a href="https://github.com/tikoci/fat-chr">GitHub</a> &middot;
<a href="https://github.com/tikoci/fat-chr/releases">UEFI CHR Images</a>
Expand Down