starkernel: item 4.3.1 -- framebuffer orientation test, found and fixed a real color-swap bug
Adds fb_draw_orientation_test() (framebuffer.c/.h): fills the four raster corners RED/GREEN/BLUE/YELLOW via fb_fill_rect. Wired into kernel_main.c calling fb_init() directly -- console_fb_init()/vt100_init() removed from the boot path, since vt100.c/console.c are superseded by the Console drawing-fabric redesign (FABRIC.md ss27) and should not be exercised even incidentally. The diagnostic caught a real, pre-existing bug on its first run: framebuffer.c's pack_pixel() had its FB_PIXEL_RGBX32/FB_PIXEL_BGRX32 branches swapped relative to UEFI GOP's own byte-order naming convention, producing a clean R<->B channel swap (G unaffected). Spatial placement was already correct -- no flip/rotation. Fixed by swapping pack_pixel's two return bodies to match framebuffer.h's already-correct doc comments; kernel_main.c's GOP-format switch needed no change. Also item 4.3.2 -- QEMU screenshot capability. scripts/qemu_screenshot.sh already existed (monitor socket + socat + HMP screendump), just unwired and unused this session. Redirected its PNG output to a new top-level fb/ directory (tracked in git, not logs/, not a gitignored temp dir) and added a python3+PIL fallback for PPM->PNG conversion since imagemagick isn't installed here. Left as a standalone script for now, not wired into a Makefile target. FABRIC.md items 4.3.1 and 4.3.2 marked done with acceptance evidence.
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
# Makefile target which already built the ISO during the serial acceptance run).
|
||||
#
|
||||
# Outputs:
|
||||
# <BUILD_DIR>/screenshot.ppm — raw PPM from QEMU screendump
|
||||
# <LOG_DIR>/qemu-screenshot-YYYYMMDD-HHMMSS.{log,png} — serial log + PNG
|
||||
# <BUILD_DIR>/screenshot.ppm — raw PPM from QEMU screendump
|
||||
# <LOG_DIR>/qemu-screenshot-YYYYMMDD-HHMMSS.log — serial log
|
||||
# fb/qemu-screenshot-YYYYMMDD-HHMMSS.png — PNG (tracked in git, not build/)
|
||||
#
|
||||
# Requires: qemu-system-x86_64, socat, xorriso, mtools, ovmf, imagemagick
|
||||
|
||||
@@ -61,14 +62,15 @@ fi
|
||||
# --------------------------------------------------------------------------
|
||||
# Setup paths
|
||||
# --------------------------------------------------------------------------
|
||||
mkdir -p "${LOG_DIR}" "${BUILD_DIR}"
|
||||
FB_DIR="fb"
|
||||
mkdir -p "${LOG_DIR}" "${BUILD_DIR}" "${FB_DIR}"
|
||||
|
||||
TS=$(date +%Y%m%d-%H%M%S)
|
||||
SERIAL_LOG="${LOG_DIR}/qemu-screenshot-${TS}.log"
|
||||
VARS_COPY="${BUILD_DIR}/OVMF_VARS_screenshot.fd"
|
||||
MONITOR_SOCK="${BUILD_DIR}/qemu-monitor-${TS}.sock"
|
||||
PPM_OUT="${BUILD_DIR}/screenshot.ppm"
|
||||
PNG_LOG="${LOG_DIR}/qemu-screenshot-${TS}.png" # committed artifact
|
||||
PNG_LOG="${FB_DIR}/qemu-screenshot-${TS}.png" # committed artifact
|
||||
QEMU_PID_FILE="${BUILD_DIR}/qemu-screenshot.pid"
|
||||
|
||||
cp "${OVMF_VARS_RO}" "${VARS_COPY}"
|
||||
@@ -144,9 +146,14 @@ if [ -f "${PPM_OUT}" ]; then
|
||||
convert "${PPM_OUT}" "${PNG_LOG}"
|
||||
rm -f "${PPM_OUT}"
|
||||
echo " PNG : ${PNG_LOG}"
|
||||
elif command -v python3 >/dev/null 2>&1 && python3 -c "import PIL" >/dev/null 2>&1; then
|
||||
python3 -c "from PIL import Image; Image.open('${PPM_OUT}').save('${PNG_LOG}')"
|
||||
rm -f "${PPM_OUT}"
|
||||
echo " PNG : ${PNG_LOG} (via python3/PIL)"
|
||||
else
|
||||
echo " WARN: imagemagick 'convert' not found — PPM only (install imagemagick)"
|
||||
PNG_LOG="${PPM_OUT}"
|
||||
echo " WARN: no PPM->PNG converter found (imagemagick 'convert' or python3+PIL) — PPM only"
|
||||
PNG_LOG="${FB_DIR}/$(basename "${PNG_LOG}" .png).ppm"
|
||||
mv "${PPM_OUT}" "${PNG_LOG}"
|
||||
fi
|
||||
echo ""
|
||||
echo "=== Screendump complete ==="
|
||||
|
||||
Reference in New Issue
Block a user