Prepare for the move to Fedora
tools/posix/setup-fedora.sh installs the toolchain and reports what it cannot: PowerShell has no Fedora package, and bootcheck is the test suite, so the script says how to get pwsh rather than failing quietly. It also checks /dev/kvm, since a Ryzen box can run the tests at native speed. docs/moving-to-linux.md is the actual procedure: copy the repo, restore the memory, install, build. The memory travels inside the repo and `memory-sync.sh import` puts it under the key this machine derives from its own path -- /home/nexoniarz/Documents/SchOS becomes -home-nexoniarz-Documents-SchOS, where D:\DEV\SchOS was D--DEV-SchOS. OVMF discovery no longer assumes QEMU's Windows layout. Fedora ships edk2-ovmf to /usr/share/edk2/ovmf/, Debian and Arch differ again, so the Makefile searches a list and names the packages when it finds nothing. Tested through the shell rather than $(wildcard): on Windows make is a native binary using Win32 file calls, while `command -v` returns an MSYS path like /c/Users/..., which $(wildcard) cannot see -- it returned nothing on a machine that had the firmware. Two things only that machine can test: `make ports` builds musl, toybox and mksh from source, which Windows cannot do at all; and the SchFS round-trip needs symlinks and hard links, so it has never actually run.
This commit is contained in:
parent
d41a0b1618
commit
4ac7e19397
5 changed files with 249 additions and 4 deletions
94
tools/posix/setup-fedora.sh
Normal file
94
tools/posix/setup-fedora.sh
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
# Install what SchOS needs to build and test, on Fedora.
|
||||
#
|
||||
# tools/posix/setup-fedora.sh install everything
|
||||
# tools/posix/setup-fedora.sh --check report what is missing, install nothing
|
||||
#
|
||||
# Written for Fedora 44. Package names are stable enough that older and newer
|
||||
# releases should work unchanged; the --check mode exists so a wrong guess
|
||||
# reports itself instead of failing halfway through a dnf transaction.
|
||||
|
||||
set -eu
|
||||
|
||||
CHECK=0
|
||||
[ "${1:-}" = "--check" ] && CHECK=1
|
||||
|
||||
# Toolchain. clang and lld are the whole cross-compiler story -- see
|
||||
# docs/building.md for why there is no cross-gcc here.
|
||||
PKGS="clang lld llvm make gcc perl-interpreter python3 git"
|
||||
|
||||
# Running and testing.
|
||||
PKGS="$PKGS qemu-system-x86 edk2-ovmf xorriso"
|
||||
|
||||
# mtools is for building a real FAT ESP image. Not needed yet -- the UEFI
|
||||
# target serves a directory as FAT through QEMU -- but it is what `make iso`
|
||||
# will want once the ISO carries an EFI entry.
|
||||
PKGS="$PKGS mtools"
|
||||
|
||||
# Ports are built from source on this host, which is the reason a Linux box
|
||||
# matters: they cannot be built on Windows at all.
|
||||
PKGS="$PKGS tar curl xz bzip2 diffutils findutils"
|
||||
|
||||
missing=""
|
||||
for p in $PKGS; do
|
||||
rpm -q "$p" >/dev/null 2>&1 || missing="$missing $p"
|
||||
done
|
||||
|
||||
if [ -z "$missing" ]; then
|
||||
echo "all packages present"
|
||||
else
|
||||
echo "missing:$missing"
|
||||
if [ "$CHECK" -eq 0 ]; then
|
||||
echo
|
||||
echo "installing..."
|
||||
sudo dnf install -y $missing
|
||||
fi
|
||||
fi
|
||||
|
||||
# PowerShell is not in Fedora's repositories and is not an rpm you can name.
|
||||
#
|
||||
# It matters because tools/windows/bootcheck.ps1 is the test harness, and pwsh
|
||||
# runs it on Linux perfectly well -- there is simply no dnf package. Microsoft
|
||||
# publish a repo; the tarball is the lighter option and needs no root beyond
|
||||
# the install path.
|
||||
if command -v pwsh >/dev/null 2>&1; then
|
||||
echo "pwsh: $(command -v pwsh)"
|
||||
else
|
||||
cat <<'EOF'
|
||||
|
||||
pwsh is not installed. tools/windows/bootcheck.ps1 is the boot test suite and
|
||||
needs it. Either:
|
||||
|
||||
sudo dnf install -y https://packages.microsoft.com/config/rhel/9/packages-microsoft-prod.rpm
|
||||
sudo dnf install -y powershell
|
||||
|
||||
or take the tarball from https://github.com/PowerShell/PowerShell/releases and
|
||||
put pwsh on PATH. Nothing else in the build depends on it -- `make`,
|
||||
`make schfs-check` and `make qemu` all work without.
|
||||
EOF
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "checks:"
|
||||
for t in clang ld.lld llvm-objcopy make gcc perl python3 qemu-system-x86_64 xorriso; do
|
||||
if command -v "$t" >/dev/null 2>&1; then
|
||||
printf ' %-22s ok\n' "$t"
|
||||
else
|
||||
printf ' %-22s MISSING\n' "$t"
|
||||
fi
|
||||
done
|
||||
|
||||
# KVM is the difference between a boot test that takes seconds and one that
|
||||
# takes half a minute. It needs the module loaded and the user in the kvm
|
||||
# group; a Ryzen box has it unless virtualisation is off in firmware.
|
||||
echo
|
||||
if [ -e /dev/kvm ]; then
|
||||
if [ -r /dev/kvm ] && [ -w /dev/kvm ]; then
|
||||
echo "kvm: available and usable -- add -enable-kvm to QEMU for much faster boots"
|
||||
else
|
||||
echo "kvm: present but not accessible. Fix with:"
|
||||
echo " sudo usermod -aG kvm $(id -un) && newgrp kvm"
|
||||
fi
|
||||
else
|
||||
echo "kvm: /dev/kvm missing -- check that SVM/virtualisation is enabled in firmware"
|
||||
fi
|
||||
Loading…
Reference in a new issue