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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | #!/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
# screen (the virtio-gpu framebuffer) to a PNG, or a PPM if the file name
# ends in .ppm (scripts/gpu-check.sh reads its pixels). 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|out.ppm] [session.txt] [expected text...]
# session.txt: one command per line, typed key by key followed by Enter.
# In it, {BS} is Backspace, {UP} the up arrow and {^C} Ctrl+C (a line that
# is just {^C} isn't followed by Enter).
# 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 tiling demo moves the
# text console into the left window of the virtio-gpu framebuffer, a
# CPU hog stopped with Ctrl+C (the tty turns ^C into SIGINT), then
# stage 15's libc plumbing (threads summing on all CPUs, the epoll/poll
# echo server over 127.0.0.1) and stage 15.1's musl prerequisites: the
# FPU and path-syscall tests and rawabi, a no-libc Linux binary.
# "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
|