Add build, deploy and test sources
This commit is contained in:
1 parent
aeae61245d
commit
6035f75ea8
11 files changed
+360
No files matched your search
@@ -0,0 +1,29 @@
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][int]$Disk,
|
||||
[Parameter(Mandatory=$true)][string]$File
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$data = [IO.File]::ReadAllBytes($File)
|
||||
if ($data.Length -lt 513) { throw "Bad GRUB2 MBR image: $File" }
|
||||
|
||||
$path = "\\.\PhysicalDrive$Disk"
|
||||
$fs = [IO.File]::Open($path, [IO.FileMode]::Open, [IO.FileAccess]::ReadWrite, [IO.FileShare]::ReadWrite)
|
||||
try {
|
||||
$mbr = New-Object byte[] 512
|
||||
$fs.Read($mbr, 0, 512) | Out-Null
|
||||
|
||||
# boot code 0..439; partition table/disk signature 440..511 остаются от целевого диска
|
||||
[Array]::Copy($data, 0, $mbr, 0, 440)
|
||||
$fs.Position = 0
|
||||
$fs.Write($mbr, 0, 512)
|
||||
|
||||
# core.img (уже с Reed-Solomon, как в рабочем MBR) — сразу после MBR
|
||||
$fs.Position = 512
|
||||
$fs.Write($data, 512, $data.Length - 512)
|
||||
$fs.Flush()
|
||||
}
|
||||
finally {
|
||||
$fs.Close()
|
||||
}
|
||||
Reference in new issue
Block a user