diff options
| author | salmonik <salmonik@tuta.io> | 2026-08-01 18:25:55 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-08-01 18:25:55 +0200 |
| commit | 1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5 (patch) | |
| tree | f28246586e387293d0c8beaf6b445210aaab8c48 /scripts | |
| parent | klog/tty/pager: no more truncated lines — full lines flow, terminal wraps (diff) | |
| download | rs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.tar.gz rs-dos-1ea2f68e6a9af135e6cb3274fdf28d4ddc5812d5.zip | |
fix pi-lens warnings: unwraps, shell SC2046, dup code (fmtbuf/scripts/hexdump/cat/ahci/pci)
- memory.rs: self-test Layout::from_size_align no longer panics — the
test fails cleanly on an invalid layout
- fat.rs: v() no longer unwraps the active-volume slot — invariant
violation logs + halts instead of panicking mid-disk-io
- strbuf: shared FmtBuf replaces the duplicated PanicBuf/FmtBuf
(main.rs + sched.rs)
- test-disk.sh: SC2046 — conditional --fresh arg no longer relies on
word splitting
- scripts: boot.sh/boot-image.sh share lib-boot-args.sh (dup args loop)
- shell: cat/hexdump stdin pairs unified with Option<&str> marker;
hexdump format_row folded into format_partial
- ahci: read/write_sectors unified behind dma_sectors
- pci: config_read/write share config_addr
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/boot-image.sh | 25 | ||||
| -rwxr-xr-x | scripts/boot.sh | 22 | ||||
| -rw-r--r-- | scripts/lib-boot-args.sh | 38 | ||||
| -rwxr-xr-x | scripts/test-disk.sh | 6 |
4 files changed, 50 insertions, 41 deletions
diff --git a/scripts/boot-image.sh b/scripts/boot-image.sh index 913e5cb..e8c093c 100755 --- a/scripts/boot-image.sh +++ b/scripts/boot-image.sh | |||
| @@ -34,29 +34,8 @@ GUI="" | |||
| 34 | DEBUG="" | 34 | DEBUG="" |
| 35 | 35 | ||
| 36 | # ---- args ---- | 36 | # ---- args ---- |
| 37 | while [ $# -gt 0 ]; do | 37 | source "$SCRIPT_DIR/lib-boot-args.sh" |
| 38 | case "$1" in | 38 | parse_boot_args "$@" |
| 39 | --gui | -g) GUI="-vga std" ;; | ||
| 40 | --debug | -d) DEBUG="-s -S" ;; | ||
| 41 | --mem) | ||
| 42 | shift | ||
| 43 | MEM="$1" | ||
| 44 | ;; | ||
| 45 | --smp) | ||
| 46 | shift | ||
| 47 | SMP="$1" | ||
| 48 | ;; | ||
| 49 | --help | -h) | ||
| 50 | head -20 "$0" | grep "^#" | sed 's/^# //' | ||
| 51 | exit 0 | ||
| 52 | ;; | ||
| 53 | *) | ||
| 54 | echo "unknown: $1" | ||
| 55 | exit 1 | ||
| 56 | ;; | ||
| 57 | esac | ||
| 58 | shift | ||
| 59 | done | ||
| 60 | 39 | ||
| 61 | # ---- build image if missing ---- | 40 | # ---- build image if missing ---- |
| 62 | if [ ! -f "$IMAGE" ]; then | 41 | if [ ! -f "$IMAGE" ]; then |
diff --git a/scripts/boot.sh b/scripts/boot.sh index 99fd103..5b8e6fa 100755 --- a/scripts/boot.sh +++ b/scripts/boot.sh | |||
| @@ -45,33 +45,21 @@ GUI="" | |||
| 45 | DEBUG="" | 45 | DEBUG="" |
| 46 | 46 | ||
| 47 | # ---- args ---- | 47 | # ---- args ---- |
| 48 | while [ $# -gt 0 ]; do | 48 | source "$SCRIPT_DIR/lib-boot-args.sh" |
| 49 | # boot.sh-specific flags live here; everything else is shared. | ||
| 50 | handle_arg() { | ||
| 49 | case "$1" in | 51 | case "$1" in |
| 50 | --gui | -g) GUI="-vga std" ;; | ||
| 51 | --debug | -d) DEBUG="-s -S" ;; | ||
| 52 | --release | -r) | 52 | --release | -r) |
| 53 | PROFILE="release" | 53 | PROFILE="release" |
| 54 | CARGO_FLAGS="--release" | 54 | CARGO_FLAGS="--release" |
| 55 | ;; | 55 | ;; |
| 56 | --mem) | ||
| 57 | shift | ||
| 58 | MEM="$1" | ||
| 59 | ;; | ||
| 60 | --smp) | ||
| 61 | shift | ||
| 62 | SMP="$1" | ||
| 63 | ;; | ||
| 64 | --help | -h) | ||
| 65 | head -20 "$0" | grep "^#" | sed 's/^# //' | ||
| 66 | exit 0 | ||
| 67 | ;; | ||
| 68 | *) | 56 | *) |
| 69 | echo "unknown: $1" | 57 | echo "unknown: $1" |
| 70 | exit 1 | 58 | exit 1 |
| 71 | ;; | 59 | ;; |
| 72 | esac | 60 | esac |
| 73 | shift | 61 | } |
| 74 | done | 62 | parse_boot_args "$@" |
| 75 | 63 | ||
| 76 | OUT_DIR="target/x86_64-unknown-uefi/$PROFILE" | 64 | OUT_DIR="target/x86_64-unknown-uefi/$PROFILE" |
| 77 | KERNEL="$OUT_DIR/rsdos.efi" | 65 | KERNEL="$OUT_DIR/rsdos.efi" |
diff --git a/scripts/lib-boot-args.sh b/scripts/lib-boot-args.sh new file mode 100644 index 0000000..ec97500 --- /dev/null +++ b/scripts/lib-boot-args.sh | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | # | ||
| 3 | # scripts/lib-boot-args.sh — shared CLI parsing for the QEMU boot scripts. | ||
| 4 | # Sourced, not executed. The caller sets default values for GUI/DEBUG/ | ||
| 5 | # MEM/SMP first, then calls `parse_boot_args "$@"`. A caller with extra | ||
| 6 | # flags defines its own `handle_arg()` to intercept them before the | ||
| 7 | # shared cases run (unknown args still fail loudly). | ||
| 8 | set -euo pipefail | ||
| 9 | |||
| 10 | parse_boot_args() { | ||
| 11 | while [ $# -gt 0 ]; do | ||
| 12 | case "$1" in | ||
| 13 | --gui | -g) GUI="-vga std" ;; | ||
| 14 | --debug | -d) DEBUG="-s -S" ;; | ||
| 15 | --mem) | ||
| 16 | shift | ||
| 17 | MEM="$1" | ||
| 18 | ;; | ||
| 19 | --smp) | ||
| 20 | shift | ||
| 21 | SMP="$1" | ||
| 22 | ;; | ||
| 23 | --help | -h) | ||
| 24 | head -20 "$0" | grep "^#" | sed 's/^# //' | ||
| 25 | exit 0 | ||
| 26 | ;; | ||
| 27 | *) handle_arg "$1" ;; | ||
| 28 | esac | ||
| 29 | shift | ||
| 30 | done | ||
| 31 | } | ||
| 32 | |||
| 33 | # Default: no extra flags. A script with more defines its own before | ||
| 34 | # calling parse_boot_args. | ||
| 35 | handle_arg() { | ||
| 36 | echo "unknown: $1" | ||
| 37 | exit 1 | ||
| 38 | } | ||
diff --git a/scripts/test-disk.sh b/scripts/test-disk.sh index 11a9b05..0268fff 100755 --- a/scripts/test-disk.sh +++ b/scripts/test-disk.sh | |||
| @@ -72,7 +72,11 @@ cargo build --package rsdos --target x86_64-unknown-uefi | |||
| 72 | echo "==> 2/6 deploy to ESP + ensure disk image" | 72 | echo "==> 2/6 deploy to ESP + ensure disk image" |
| 73 | mkdir -p "$ESP_DIR/EFI/BOOT" | 73 | mkdir -p "$ESP_DIR/EFI/BOOT" |
| 74 | cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI" | 74 | cp target/x86_64-unknown-uefi/debug/rsdos.efi "$ESP_DIR/EFI/BOOT/BOOTX64.EFI" |
| 75 | "$SCRIPT_DIR/mkdisk.sh" $([ "$FRESH" -eq 1 ] && echo --fresh) "$IMG" | 75 | if [ "$FRESH" -eq 1 ]; then |
| 76 | "$SCRIPT_DIR/mkdisk.sh" --fresh "$IMG" | ||
| 77 | else | ||
| 78 | "$SCRIPT_DIR/mkdisk.sh" "$IMG" | ||
| 79 | fi | ||
| 76 | 80 | ||
| 77 | echo "==> 3/6 boot QEMU (headless)" | 81 | echo "==> 3/6 boot QEMU (headless)" |
| 78 | kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true | 82 | kill "$(cat "$QPID" 2>/dev/null)" 2>/dev/null || true |
