Files
Deshab-OS/ISO/run_qemu.bat
T
xyou efa626ed17 feat: Phase 1 网络端到端打通 + FirstInit/Login/DevMode 完善
- 用户态共享网络协议栈 CODE/tools/net_stack.h(eth/ARP/IPv4/ICMP/UDP-DNS/TCP static inline,轮询模型)
- shell 内建 ping/curl/run 命令;ping.elf/curl.elf 对齐 net_stack.h 真实协议栈
- shell dev_mode 串口镜像(g_serial_mirror)便于自动化验证
- DSK 启动流程:firstInit.txt 双行格式(firstInit + dev_mode),dev_mode=1 触发 shell 自动回归测试
- FirstInit 完成→持久化 USER.CONF + 翻转 firstInit 0->1(保留 dev_mode)
- firstInit=1 时 DSK 加载 login.elf 进行用户选择 + 密码校验后再进 desktop
- 新增 CODE/login/ 登录应用、CODE/DKM/dkm_shared.h、Logo.png
- ahci/e1000/virtio_net/fat32/console_fb 驱动更新;utsm serial/block/dsk_loader 调整
- build.ps1 打包 ping.elf/curl.elf 进 SATA FAT32 根目录
- 移除 CODE/tools/bash(与 shell.elf 重复)
2026-07-26 21:07:36 +08:00

76 lines
2.7 KiB
Batchfile

@echo off
setlocal
set "SCRIPT_DIR=%~dp0"
set "IMG=%SCRIPT_DIR%deshab.img"
set "SATA_IMG=%SCRIPT_DIR%..\.build_tmp\sata_fat32_dsk.img"
if not exist "%IMG%" (
echo [qemu] Image not found: %IMG%
echo [qemu] Run ..\build.bat first.
exit /b 1
)
set "QEMU="
for %%Q in (qemu-system-x86_64.exe qemu-system-x86_64) do (
for /f "delims=" %%P in ('where %%Q 2^>nul') do (
if not defined QEMU set "QEMU=%%P"
)
)
if not defined QEMU if exist "C:\Program Files\qemu\qemu-system-x86_64.exe" set "QEMU=C:\Program Files\qemu\qemu-system-x86_64.exe"
if not defined QEMU if exist "C:\Program Files (x86)\qemu\qemu-system-x86_64.exe" set "QEMU=C:\Program Files (x86)\qemu\qemu-system-x86_64.exe"
if not defined QEMU if exist "C:\msys64\mingw64\bin\qemu-system-x86_64.exe" set "QEMU=C:\msys64\mingw64\bin\qemu-system-x86_64.exe"
if not defined QEMU if exist "C:\msys64\ucrt64\bin\qemu-system-x86_64.exe" set "QEMU=C:\msys64\ucrt64\bin\qemu-system-x86_64.exe"
if not defined QEMU (
echo [qemu] qemu-system-x86_64 was not found.
echo [qemu] Install QEMU or add it to PATH.
exit /b 1
)
set "OVMF="
if exist "C:\Program Files\qemu\share\edk2-x86_64-code.fd" set "OVMF=C:\Program Files\qemu\share\edk2-x86_64-code.fd"
if not defined OVMF if exist "C:\Program Files\qemu\share\OVMF_CODE.fd" set "OVMF=C:\Program Files\qemu\share\OVMF_CODE.fd"
if not defined OVMF if exist "C:\msys64\mingw64\share\edk2\ovmf\OVMF_CODE.fd" set "OVMF=C:\msys64\mingw64\share\edk2\ovmf\OVMF_CODE.fd"
if not defined OVMF if exist "C:\msys64\ucrt64\share\edk2\ovmf\OVMF_CODE.fd" set "OVMF=C:\msys64\ucrt64\share\edk2\ovmf\OVMF_CODE.fd"
if not defined OVMF (
echo [qemu] UEFI firmware was not found.
echo [qemu] Expected edk2-x86_64-code.fd or OVMF_CODE.fd under QEMU install directory.
exit /b 1
)
echo [qemu] Using: %QEMU%
echo [qemu] UEFI: %OVMF%
echo [qemu] Image: %IMG%
if exist "%SATA_IMG%" (
echo [qemu] SATA: %SATA_IMG%
"%QEMU%" ^
-machine q35 ^
-m 512M ^
-cpu max ^
-serial stdio ^
-drive if=pflash,format=raw,readonly=on,file="%OVMF%" ^
-drive format=raw,file="%IMG%",if=virtio ^
-drive id=sata0,format=raw,file="%SATA_IMG%",if=none ^
-device ide-hd,drive=sata0,bus=ide.0 ^
-netdev user,id=net0 ^
-device e1000,netdev=net0,mac=52:54:00:12:34:56 ^
-boot menu=on
) else (
echo [qemu] SATA image not found, booting without block device
"%QEMU%" ^
-machine q35 ^
-m 512M ^
-cpu max ^
-serial stdio ^
-drive if=pflash,format=raw,readonly=on,file="%OVMF%" ^
-drive format=raw,file="%IMG%",if=virtio ^
-netdev user,id=net0 ^
-device e1000,netdev=net0 ^
-boot menu=on
)
endlocal