Removes the "-unix" element and with it any trademark exposure to The
Open Group.
The split follows the ecosystem layout: SchOS is the system, and the
kernel has its own name. Kernel-identity strings are the only places
that take SchIFT -- uname(2) sysname, /proc/version, and the two licence
sentences that say "kernel" outright. That is what every Unix does here:
`uname -s` on Linux reports the kernel, not the distribution. Everything
a user reads as the product -- panic screen, boot menu, error prefixes,
docs, LICENSE, NOTICE -- is SchOS.
schunix.img is schos.img, the logo assets and the musl TLS patch are
renamed, and __SCHUNIX__ is __SCHOS__ (the define and the patch that
consumes it moved together).
Two things the rename broke, both found by the bootcheck suite:
- shmtest wrote "SCHUNIX-MMAP-OK" with a hardcoded length of 15 and
compared it back by hand-counted offsets (m[3]=='U', m[14]=='K').
The shorter marker left the write running two bytes past the literal
and the compare reading past the data, failing a file-backed mmap
that was working correctly. Now written and compared through one
constant with sizeof.
- bootcheck asserted a 31-byte file after appending to
"hello-from-schunix"; the shorter string makes it 29.
Both are the same mistake: a string literal whose length is written out
somewhere else. Full suite green -- base, Tty, Ps, Sock, Fb, Usb, Evdev.
116 lines
4.2 KiB
PowerShell
116 lines
4.2 KiB
PowerShell
# Boot SchOS, run the display self-test, and capture the result as an image.
|
|
#
|
|
# The display class cannot be checked without a display: the assertion is "did
|
|
# the right pixels reach the screen", and the only instrument for that is a
|
|
# screendump. This drives it through `echo d > /proc/sysrq` and takes a picture.
|
|
#
|
|
# What the pattern proves: four solid quadrants in theme colours (a stride error
|
|
# would slant the bands, a bpp error would change the colours), a white frame one
|
|
# pixel inside the edge (an off-by-one in the present rectangle would clip it),
|
|
# and the fact that every pixel was drawn into RAM before a single byte reached
|
|
# the framebuffer -- which is what double buffering means.
|
|
#
|
|
# QEMU's monitor is on its own socket so the serial console stays free for the
|
|
# shell. screendump writes a PPM; the PNG conversion is optional and skipped if
|
|
# ImageMagick is not around.
|
|
#
|
|
# tools\crashshot.ps1 crash the ramdisk-root build
|
|
# tools\crashshot.ps1 -SchFS with a SchFS volume attached
|
|
|
|
param(
|
|
[switch]$SchFS,
|
|
[int]$BootSeconds = 20,
|
|
[string]$Out = "build\dispshot.ppm",
|
|
[string]$Qemu = "$env:USERPROFILE\scoop\apps\qemu\current\qemu-system-x86_64.exe"
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path $PSScriptRoot -Parent
|
|
$hda = Join-Path $root 'schos.img'
|
|
$hdb = if ($SchFS) { Join-Path $root 'build\schfs.img' } else { Join-Path $root 'build\fs.img' }
|
|
$log = Join-Path $root 'build\crashshot.log'
|
|
$ppm = Join-Path $root $Out
|
|
$mon = Join-Path $root 'build\qemu-mon.sock'
|
|
|
|
Remove-Item -Force $log, $ppm -ErrorAction SilentlyContinue
|
|
|
|
# The monitor goes to a TCP port rather than a unix socket: PowerShell can open
|
|
# a TCP client without any extra machinery, and QEMU on Windows has no unix
|
|
# sockets anyway.
|
|
$monPort = 55555
|
|
|
|
$psi = New-Object System.Diagnostics.ProcessStartInfo
|
|
$psi.FileName = $Qemu
|
|
$psi.Arguments = @(
|
|
"-drive file=`"$hda`",format=raw,index=0,media=disk"
|
|
"-drive file=`"$hdb`",format=raw,index=1,media=disk"
|
|
'-m 1G -smp 1 -cpu qemu64,+rdtscp -machine pc-i440fx-9.2'
|
|
'-display none'
|
|
"-chardev stdio,id=c0,logfile=`"$log`""
|
|
'-serial chardev:c0'
|
|
"-monitor tcp:127.0.0.1:$monPort,server,nowait"
|
|
) -join ' '
|
|
$psi.RedirectStandardInput = $true
|
|
$psi.UseShellExecute = $false
|
|
|
|
Write-Host "==> booting" -ForegroundColor Cyan
|
|
$p = [System.Diagnostics.Process]::Start($psi)
|
|
|
|
function Send-Line($text) {
|
|
foreach ($ch in ($text + "`n").ToCharArray()) {
|
|
$p.StandardInput.Write($ch)
|
|
$p.StandardInput.Flush()
|
|
Start-Sleep -Milliseconds 30 # serial has no flow control
|
|
}
|
|
}
|
|
|
|
try {
|
|
Start-Sleep -Seconds $BootSeconds
|
|
|
|
# Show the device list first, so the transcript records what was bound.
|
|
Write-Host " > listing devices" -ForegroundColor DarkGray
|
|
Send-Line 'cat /proc/devices'
|
|
Start-Sleep -Seconds 3
|
|
|
|
Write-Host " > echo d > /proc/sysrq" -ForegroundColor DarkGray
|
|
Send-Line 'echo d > /proc/sysrq'
|
|
Start-Sleep -Seconds 4
|
|
|
|
Write-Host "==> capturing the framebuffer" -ForegroundColor Cyan
|
|
$client = New-Object System.Net.Sockets.TcpClient('127.0.0.1', $monPort)
|
|
$stream = $client.GetStream()
|
|
$writer = New-Object System.IO.StreamWriter($stream)
|
|
$writer.AutoFlush = $true
|
|
Start-Sleep -Milliseconds 500
|
|
# QEMU on Windows wants a native path here, not the one PowerShell shows.
|
|
$writer.WriteLine("screendump $ppm")
|
|
Start-Sleep -Seconds 2
|
|
$writer.WriteLine('quit')
|
|
Start-Sleep -Milliseconds 500
|
|
$client.Close()
|
|
} finally {
|
|
if (-not $p.HasExited) { $p.Kill() }
|
|
Start-Sleep -Milliseconds 800
|
|
}
|
|
|
|
if (Test-Path $log) {
|
|
$text = Get-Content $log -Raw
|
|
Write-Host "==> serial transcript" -ForegroundColor Cyan
|
|
# Only the crash report, not the whole boot.
|
|
$idx = $text.IndexOf('display: presented')
|
|
if ($idx -ge 0) { Write-Host $text.Substring($idx) } else { Write-Host $text }
|
|
}
|
|
|
|
if (Test-Path $ppm) {
|
|
$size = (Get-Item $ppm).Length
|
|
Write-Host "==> $ppm ($size bytes)" -ForegroundColor Green
|
|
$png = [System.IO.Path]::ChangeExtension($ppm, '.png')
|
|
$magick = Get-Command magick -ErrorAction SilentlyContinue
|
|
if ($magick) {
|
|
& magick $ppm $png
|
|
Write-Host "==> $png" -ForegroundColor Green
|
|
}
|
|
} else {
|
|
Write-Host "FAIL: no screendump was produced" -ForegroundColor Red
|
|
exit 1
|
|
}
|