feat: Linux ABI P0-P6, BMIDE DMA, ImageSee, 4KiB page pool and Explorer hardening

This commit is contained in:
TermiNexus committed 2026-10-29 00:42:21 +08:00
1 parent ebd43ef9da
commit 6f856992da
41 files changed
+8697 -2471

No files matched your search

+79
View File
@@ -88,3 +88,82 @@ Write-Host "Unmounting disk image..."
imdisk -D -m $MOUNT_LETTER
Write-Host "Disk image created: $DISK_IMG" -ForegroundColor Green
# ==========================================================
# Refresh the VMware disk next to the .vmx
# ==========================================================
# Vmware/ViperOS.vmdk is a monolithicFlat descriptor; the data lives in
# ViperOS-flat.vmdk. Both are regenerated from disk.img so "Open VM" always
# sees the image that was just packed. The .vmx already points at
# ide0:0.fileName = "ViperOS.vmdk"; it uses EFI firmware for bootx64.efi.
$VMWARE_DIR = Join-Path $PROJECT_DIR "Vmware"
$VMWARE_VMDK = Join-Path $VMWARE_DIR "ViperOS.vmdk"
$VMWARE_FLAT = Join-Path $VMWARE_DIR "ViperOS-flat.vmdk"
$VMWARE_VMX = Join-Path $VMWARE_DIR "Viper OS.vmx"
if (Test-Path $VMWARE_DIR) {
Write-Host "=== Updating VMware disk ===" -ForegroundColor Cyan
$vmRunning = Get-Process -Name "vmware-vmx" -ErrorAction SilentlyContinue
if ($vmRunning) {
Write-Host "Warning: a VMware VM is running; close it and re-run to refresh the VMDK." -ForegroundColor Yellow
} else {
# A leftover .lck from a crash keeps VMware from opening the VM.
$vmLock = "$VMWARE_VMX.lck"
if (Test-Path $vmLock) {
Write-Host "Removing stale VMware lock: $vmLock" -ForegroundColor Yellow
Remove-Item -Recurse -Force $vmLock -ErrorAction SilentlyContinue
}
$size = (Get-Item $DISK_IMG).Length
$sectors = [int64]($size / 512)
$cyl = [int64][math]::Floor($sectors / (16 * 63))
# Keep the existing CID/UUID so VMware treats it as the same disk.
$cid = "fffffffe"
$uuid = "60 00 C2 96 88 c0 09 6d-c8 30 f7 71 57 ce 47 0d"
$longid = "6af48e7def7fae6bfa57a4affffffffe"
if (Test-Path $VMWARE_VMDK) {
foreach ($l in (Get-Content $VMWARE_VMDK -ErrorAction SilentlyContinue)) {
if ($l -match '^CID=([0-9a-fA-F]+)') { $cid = $Matches[1] }
if ($l -match '^ddb\.uuid\s*=\s*"(.+)"') { $uuid = $Matches[1] }
if ($l -match '^ddb\.longContentID\s*=\s*"(.+)"') { $longid = $Matches[1] }
}
}
$descriptor = @"
# Disk DescriptorFile
version=1
encoding="GBK"
CID=$cid
parentCID=ffffffff
createType="monolithicFlat"
# Extent description
RW $sectors FLAT "ViperOS-flat.vmdk" 0
# The Disk Data Base
#DDB
ddb.adapterType = "ide"
ddb.geometry.cylinders = "$cyl"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"
ddb.longContentID = "$longid"
ddb.uuid = "$uuid"
ddb.virtualHWVersion = "21"
"@
try {
if (Test-Path $VMWARE_FLAT) { Remove-Item -Force $VMWARE_FLAT }
Copy-Item -Force $DISK_IMG $VMWARE_FLAT
Set-Content -Path $VMWARE_VMDK -Value $descriptor -Encoding ASCII
if (-not (Select-String -Path $VMWARE_VMX -Pattern 'ide0:0\.fileName\s*=\s*"ViperOS\.vmdk"' -Quiet)) {
Write-Host "Note: $VMWARE_VMX does not reference ViperOS.vmdk; check ide0:0.fileName." -ForegroundColor Yellow
}
Write-Host "VMDK updated: $VMWARE_VMDK ($sectors sectors, $([math]::Round($size / 1MB)) MiB)" -ForegroundColor Green
} catch {
Write-Host "Warning: failed to refresh the VMware disk: $($_.Exception.Message)" -ForegroundColor Yellow
}
}
} else {
Write-Host "Note: Vmware directory not found; skipping VMDK update." -ForegroundColor DarkGray
}