rust-kernel
Rustbelt: a hobby x86_64 kernel written in Rust
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #!/usr/bin/env bash
# Boot the normal (interactive) kernel with no window, type a shell session
# into it through the QEMU monitor's `sendkey` command, then dump the VGA
# screen to a PNG. Doubles as an automated test of the keyboard, the raw
# console mode and the shell's line editor (Backspace, up-arrow history):
# afterwards the serial copy of the console is checked for expected text.
#
# Usage: ./scripts/screenshot.sh [out.png] [session.txt] [expected text...]
# session.txt: one command per line, typed key by key followed by Enter.
# In it, {BS} is Backspace and {UP} is the up arrow.
# Exits 1 if any expected text doesn't show up.
# Force bootimage to repack the disk image (see scripts/runner.sh for why).
IMG=target/x86_64-rust_kernel/debug/bootimage-rustbelt.bin
OUT=""
SESSION=""
if [; then
# The default session (what boot.png shows): the network address from
# DHCP, a ping to QEMU's gateway, and two HTTP downloads from the test
# server that QEMU runs for us (guestfwd, see below), one printed and one
# saved to D:. "vx{BS}er" types a typo and fixes it.
SESSION=
fi
SOCK=
SERIAL_LOG=
&
QPID=
# Talk to the QEMU monitor over its UNIX socket (python avoids needing socat).
||
; # cat -v shows Backspace as ^H
# Replay the serial output like a terminal would (\b = erase one character)
# and check the expected text is there.
if
then
else
fi
|