Files
Deshab-OS/CODE/tools/pe-tools/build.ps1
T
LinehuandCursor 8554a82677 feat(panic): FUCK [panic] mode=strict|fallback + realtest image variant
- UTSM panic_full returns in fallback mode (logs [PANIC:FALLBACK] + code + hit
  count); panic_halt keeps always-halt sites (CPU exception, VMM-E11 LA57,
  VMM-E15 DSK jump, UTSM-E42 test hook). Call sites given safe continuations.
- Mode passed to DSK/FirstInit/login/desktop via DSK_BOOT_FLAG_PANIC_FALLBACK;
  DKM kernel_api.panic / kern.log.panic return to driver; ext4 fatal aborts the
  op via setjmp/longjmp and DSK falls back to FAT32 ESP.
- build.ps1/Makefile: dev=strict, release=fallback, new realtest (release
  options + strict); default -Variant all; serialized iso packing under -j.
- Fix '*/' inside comments (dkm.h, kernel_api.h, bus.c) that broke the build.
- Includes pending work: dkm_bus service bus, mt7920/wlan drivers, desktop
  files/startmenu/prank, pe-tools, diskinfo, docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 23:57:19 +08:00

61 lines
2.0 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# build.ps1 — 编译 Deshab PE 系统工具(mingw-w64 g++)
#
# GUI 工具 → SYSTEM/program/*.exe(开始菜单 STARTMENU.CNF 启动,窗口嵌入桌面)
# CLI 工具 → SYSTEM/bin/*.exe(CMD 里敲名字运行,输出走串口)
#
# 编译模式与 CODE/tools/pe-samples/hello64.c 相同:
# -nostartfiles -Wl,--entry,main -Wl,--image-base,0x140000000
# (无 CRT 启动;只准调 pe_shim 表内的 Win32 面)
#
# 用法: powershell -File build.ps1 [-Gxx <g++路径>]
param([string]$GxxPath = "")
$ErrorActionPreference = "Stop"
$Root = (Resolve-Path "$PSScriptRoot\..\..\..").Path
$ProgDir = Join-Path $Root "SYSTEM\program"
$BinDir = Join-Path $Root "SYSTEM\bin"
# 定位 g++:参数 > PATH > msys2 默认位置
$gxx = $null
if ($GxxPath -and (Test-Path $GxxPath)) {
$gxx = $GxxPath
} elseif (Get-Command g++ -ErrorAction SilentlyContinue) {
$gxx = (Get-Command g++).Source
} elseif (Test-Path "C:\msys64\mingw64\bin\g++.exe") {
$gxx = "C:\msys64\mingw64\bin\g++.exe"
} else {
throw "g++ not found (install msys2 mingw-w64 or pass -GxxPath)"
}
Write-Host "[pe-tools] g++ = $gxx"
$Flags = @(
"-O2", "-Wall", "-std=c++17",
"-nostartfiles",
"-Wl,--entry,main",
"-Wl,--image-base,0x140000000"
)
# GUI 工具(user32 消息循环 + gdi32 DIB/BitBlt)
$GuiTools = @("sysinfo", "clock", "paint", "notes")
# CLI 工具(putchar/puts/ExitProcess)
$CliTools = @("pciscan", "portio")
foreach ($t in $GuiTools) {
$src = Join-Path $PSScriptRoot "$t.cpp"
$out = Join-Path $ProgDir "$t.exe"
& $gxx @Flags $src -o $out -lgdi32 -luser32
if ($LASTEXITCODE -ne 0) { throw "build failed: $t" }
Write-Host "[pe-tools] GUI $t -> SYSTEM\program\$t.exe"
}
foreach ($t in $CliTools) {
$src = Join-Path $PSScriptRoot "$t.cpp"
$out = Join-Path $BinDir "$t.exe"
& $gxx @Flags $src -o $out
if ($LASTEXITCODE -ne 0) { throw "build failed: $t" }
Write-Host "[pe-tools] CLI $t -> SYSTEM\bin\$t.exe"
}
Write-Host "[pe-tools] done. (imports must stay within pe_shim table; verify with objdump -p)"