Add build, deploy and test sources
This commit is contained in:
1 parent
b962581812
commit
3d1a08f230
259 files changed
+15273
No files matched your search
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cd /tmp
|
||||
rm -rf mt86p
|
||||
git clone --depth 1 https://github.com/memtest86plus/memtest86plus.git mt86p >/tmp/mt86p_clone.log 2>&1 || { tail -5 /tmp/mt86p_clone.log; exit 1; }
|
||||
cd mt86p
|
||||
echo "=== version/tag:"
|
||||
git describe --tags 2>/dev/null || true
|
||||
grep -rn 'VERSION' app/version.h 2>/dev/null | head -3 || true
|
||||
echo "=== build docs:"
|
||||
sed -n '/[Bb]uild/,+25p' README.md | head -60
|
||||
echo "=== make targets hinted:"
|
||||
grep -nE '^[a-z0-9_]+:' Makefile 2>/dev/null | head -20
|
||||
ls
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
K=/path/to/pf/Ventoy/keys
|
||||
BK=/path/to/pf/Ventoy/backup/xorboot-uefi/sign/EFI/Paravis/Boot/super/x64.efi
|
||||
rm -rf /tmp/rs; mkdir -p /tmp/rs
|
||||
python3 /path/to/pf/Ventoy/add-sbat.py "$BK" /tmp/rs/stage.efi
|
||||
sbsign --key "$K/ventoy.key" --cert "$K/ventoy.crt" --output /tmp/rs/out.efi /tmp/rs/stage.efi >/dev/null
|
||||
sbverify --cert "$K/ventoy.crt" /tmp/rs/out.efi
|
||||
cp -f /tmp/rs/out.efi /mnt/f/efi/Paravis/Boot/super/x64.efi
|
||||
ls -l /mnt/f/efi/Paravis/Boot/super/x64.efi
|
||||
@@ -0,0 +1,35 @@
|
||||
# Restore all XorBoot UEFI files to their pre-change (original, unsigned) state.
|
||||
$bk = 'C:\PF\Ventoy\backup\xorboot-uefi'
|
||||
$sgn = Join-Path $bk 'sign'
|
||||
$dstRoot = 'F:\'
|
||||
|
||||
function Restore-One([string]$src, [string]$dst) {
|
||||
if (!(Test-Path $src)) { " MISSING BACKUP: $src"; return }
|
||||
Copy-Item $src $dst -Force
|
||||
$h1 = (Get-FileHash $src -Algorithm SHA256).Hash
|
||||
$h2 = (Get-FileHash $dst -Algorithm SHA256).Hash
|
||||
$ok = if ($h1 -eq $h2) { 'ok' } else { 'HASH MISMATCH' }
|
||||
" {0,-56} {1,9} {2}" -f $dst.Replace('F:\',''), (Get-Item $dst).Length, $ok
|
||||
}
|
||||
|
||||
"=== main loaders"
|
||||
Restore-One (Join-Path $bk 'bootx64.efi.orig') 'F:\EFI\Boot\bootx64.efi'
|
||||
Restore-One (Join-Path $bk 'bootia32.efi.orig') 'F:\EFI\Boot\bootia32.efi'
|
||||
|
||||
"=== remove files we added"
|
||||
foreach ($f in 'F:\EFI\Boot\fbx64.efi', 'F:\EFI\Boot\mmx64.efi') {
|
||||
if (Test-Path $f) { Remove-Item $f -Force; " removed: $f" } else { " already absent: $f" }
|
||||
}
|
||||
|
||||
"=== sub-loaders"
|
||||
Get-ChildItem $sgn -Recurse -File -Filter '*.efi' | ForEach-Object {
|
||||
$rel = $_.FullName.Substring($sgn.Length + 1)
|
||||
Restore-One $_.FullName (Join-Path $dstRoot $rel)
|
||||
}
|
||||
|
||||
"=== result: signature state of all EFI under F:\efi"
|
||||
Get-ChildItem 'F:\efi' -Recurse -File -Filter '*.efi' | Sort-Object FullName | ForEach-Object {
|
||||
$s = Get-AuthenticodeSignature $_.FullName
|
||||
$subj = if ($s.SignerCertificate) { ($s.SignerCertificate.Subject -replace '^CN=([^,]+).*', '$1') } else { '-' }
|
||||
" {0,-52} {1,9} {2,-12} {3}" -f $_.FullName.Replace('F:\', ''), $_.Length, $s.Status, $subj
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
python3 - <<'EOF'
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
|
||||
imgs = {
|
||||
'legacy-normal': '/path/to/pf/PSD/main/main1.bmp',
|
||||
'legacy-high': '/path/to/pf/PSD/main/main2.bmp',
|
||||
'x64-normal': '/path/to/pf/PSD/UEFI/x64/main/main1.bmp',
|
||||
'x64-high': '/path/to/pf/PSD/UEFI/x64/main/main2.bmp',
|
||||
'x86-normal': '/path/to/pf/PSD/UEFI/x86/main/main1.bmp',
|
||||
'x86-high': '/path/to/pf/PSD/UEFI/x86/main/main2.bmp',
|
||||
}
|
||||
# y-полосы строк (из PSD bbox): A = Grub2/GFM, B = Kaspersky
|
||||
bands = {
|
||||
'legacy-normal': (424, 444, 481, 501),
|
||||
'legacy-high': (424, 444, 481, 501),
|
||||
'x64-normal': (356, 376, 416, 436),
|
||||
'x64-high': (356, 376, 416, 436),
|
||||
'x86-normal': (424, 444, 481, 501),
|
||||
'x86-high': (424, 444, 481, 501),
|
||||
}
|
||||
for name, path in imgs.items():
|
||||
im = Image.open(path).convert('RGB')
|
||||
a = np.array(im)
|
||||
yA0, yA1, yB0, yB1 = bands[name]
|
||||
print('==', name, im.size)
|
||||
for tag, (y0, y1) in (('A', (yA0, yA1)), ('B', (yB0, yB1))):
|
||||
band = a[y0-4:y1+4, 40:470]
|
||||
# фон: самый частый цвет
|
||||
cols, counts = np.unique(band.reshape(-1,3), axis=0, return_counts=True)
|
||||
bg = cols[counts.argmax()]
|
||||
# текст: пиксели, максимально отличающиеся от фона
|
||||
diff = np.abs(band.astype(int) - bg.astype(int)).sum(axis=2)
|
||||
ink = band[diff > 120]
|
||||
if len(ink):
|
||||
tc = np.median(ink, axis=0).astype(int)
|
||||
else:
|
||||
tc = None
|
||||
print(f' {tag}: bg={tuple(int(x) for x in bg)} ink={tuple(int(x) for x in tc) if tc is not None else None} '
|
||||
f'unique_bg_ratio={counts.max()/counts.sum():.3f}')
|
||||
EOF
|
||||
@@ -0,0 +1,118 @@
|
||||
#!/bin/bash
|
||||
python3 - <<'EOF'
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import numpy as np, os, shutil
|
||||
|
||||
FONT = '/path/to/pf/PSD/fonts/Montserrat-VF.ttf'
|
||||
OUT = '/path/to/pf/KRD/images'
|
||||
os.makedirs(OUT, exist_ok=True)
|
||||
|
||||
items = [
|
||||
# name, src, yA (grub2 строка), yB (kaspersky строка)
|
||||
('legacy-1', '/path/to/pf/PSD/main/main1.bmp', 424, 481),
|
||||
('legacy-2', '/path/to/pf/PSD/main/main2.bmp', 424, 481),
|
||||
('x64-1', '/path/to/pf/PSD/UEFI/x64/main/main1.bmp', 356, 416),
|
||||
('x64-2', '/path/to/pf/PSD/UEFI/x64/main/main2.bmp', 356, 416),
|
||||
('x86-1', '/path/to/pf/PSD/UEFI/x86/main/main1.bmp', 424, 481),
|
||||
('x86-2', '/path/to/pf/PSD/UEFI/x86/main/main2.bmp', 424, 481),
|
||||
]
|
||||
|
||||
OLD_A = 'Grub2 FileManager (ISO образы)'
|
||||
NEW_A = 'Ventoy (ISO образы)'
|
||||
OLD_B = 'Kaspersky Rescue Disk 18'
|
||||
NEW_B = 'Kaspersky Rescue Disk 24'
|
||||
|
||||
def font(size=20, wght=550):
|
||||
f = ImageFont.truetype(FONT, size)
|
||||
f.set_variation_by_axes([wght])
|
||||
return f
|
||||
|
||||
def render_mask(text, size=20, wght=550, pad=40):
|
||||
f = font(size, wght)
|
||||
img = Image.new('L', (1000, 120), 0)
|
||||
ImageDraw.Draw(img).text((pad, 30), text, font=f, fill=255)
|
||||
m = np.array(img) > 127
|
||||
ys, xs = np.where(m)
|
||||
return m[ys.min():ys.max()+1, xs.min():xs.max()+1], xs.min()-pad, ys.min()-30 # обрезанный mask + смещение
|
||||
|
||||
def analyze(a, y, h=30):
|
||||
band = a[y-8:y+22, 30:500]
|
||||
cols, counts = np.unique(band.reshape(-1, 3), axis=0, return_counts=True)
|
||||
bg = cols[counts.argmax()]
|
||||
diff = np.abs(band.astype(int) - bg.astype(int)).sum(axis=2)
|
||||
ink_mask = diff > 120
|
||||
ink = band[ink_mask]
|
||||
tc = tuple(int(v) for v in np.median(ink, axis=0)) if len(ink) else (0, 0, 0)
|
||||
return tuple(int(v) for v in bg), tc, ink_mask, band
|
||||
|
||||
def text_region(ink_mask, x_off=30):
|
||||
# колонки с чернилами
|
||||
colsum = ink_mask.sum(axis=0)
|
||||
cols = np.where(colsum > 0)[0]
|
||||
if len(cols) == 0: return None
|
||||
# группируем в "кластеры" по разрывам > 15 px
|
||||
groups = []
|
||||
start = cols[0]; prev = cols[0]
|
||||
for c in cols[1:]:
|
||||
if c - prev > 15:
|
||||
groups.append((start, prev)); start = c
|
||||
prev = c
|
||||
groups.append((start, prev))
|
||||
# последняя группа - хоткей (короткая), если её ширина < 45 и групп > 1
|
||||
text_groups = groups
|
||||
if len(groups) > 1 and (groups[-1][1] - groups[-1][0]) < 45:
|
||||
text_groups = groups[:-1]
|
||||
x0 = text_groups[0][0]; x1 = text_groups[-1][1]
|
||||
rows = np.where(ink_mask[:, x0:x1+1].sum(axis=1) > 0)[0]
|
||||
return (x0+x_off, rows.min()+y-8, x1+x_off, rows.max()+y-8), groups
|
||||
|
||||
def iou_align(A, B, rng=10):
|
||||
ha, wa = A.shape; hb, wb = B.shape; best = (-1, 0, 0)
|
||||
for dy in range(-rng, rng+1):
|
||||
for dx in range(-rng, rng+1):
|
||||
y0 = max(0, dy); x0 = max(0, dx)
|
||||
y1 = min(ha, hb+dy); x1 = min(wa, wb+dx)
|
||||
if y1 <= y0 or x1 <= x0: continue
|
||||
s1 = A[y0:y1, x0:x1]; s2 = B[y0-dy:y1-dy, x0-dx:x1-dx]
|
||||
u = np.logical_or(s1, s2).sum()
|
||||
if not u: continue
|
||||
s = np.logical_and(s1, s2).sum()/u
|
||||
if s > best[0]: best = (s, dx, dy)
|
||||
return best
|
||||
|
||||
for name, src, yA, yB in items:
|
||||
a = np.array(Image.open(src).convert('RGB'))
|
||||
img = Image.open(src).convert('RGB')
|
||||
draw = ImageDraw.Draw(img)
|
||||
print('==', name)
|
||||
|
||||
for tag, y, old, new in (('A', yA, OLD_A, NEW_A), ('B', yB, OLD_B, NEW_B)):
|
||||
bg, tc, ink_mask, band = analyze(a, y)
|
||||
reg, groups = text_region(ink_mask)
|
||||
if reg is None:
|
||||
print(' ', tag, 'текст не найден'); continue
|
||||
x0, y0, x1, y1 = reg
|
||||
print(f' {tag}: bg={bg} ink={tc} text_bbox=({x0},{y0},{x1},{y1}) groups={groups}')
|
||||
|
||||
# совмещаем отрисовку старого текста с картинкой
|
||||
rend, rx, ry = render_mask(old)
|
||||
sub = a[y0-2:y1+3, x0-2:x1+3]
|
||||
d = np.abs(sub.astype(int) - np.array(bg).astype(int)).sum(axis=2) > 120
|
||||
s, dx, dy = iou_align(d, rend)
|
||||
print(f' align IoU={s:.3f} dx={dx} dy={dy}')
|
||||
|
||||
# точка, куда рисовать текст: (x0-2+dx - rx, y0-2+dy - ry)
|
||||
px = x0 - 2 + dx - rx
|
||||
py = y0 - 2 + dy - ry
|
||||
|
||||
# стираем область текста
|
||||
draw.rectangle([x0-3, y0-4, x1+3, y1+3], fill=bg)
|
||||
# рисуем новый текст
|
||||
draw.text((px, py), new, font=font(), fill=tc)
|
||||
print(f' draw "{new}" at ({px},{py})')
|
||||
|
||||
a2 = np.array(img)
|
||||
# проверка: чернила в области B
|
||||
Image.fromarray(a2).save(f'{OUT}/{name}.png')
|
||||
print(' ->', f'{OUT}/{name}.png')
|
||||
EOF
|
||||
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
python3 - <<'EOF'
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import numpy as np, os
|
||||
|
||||
FONT = '/path/to/pf/PSD/fonts/Montserrat-VF.ttf'
|
||||
OUT = '/path/to/pf/KRD/images'
|
||||
os.makedirs(OUT, exist_ok=True)
|
||||
|
||||
DARK = np.array([41, 53, 84])
|
||||
YELL = np.array([234, 224, 115])
|
||||
PAGE = np.array([233, 233, 233])
|
||||
|
||||
items = [
|
||||
('legacy-2', '/path/to/pf/PSD/main/main2.bmp', 424, 481),
|
||||
('x64-2', '/path/to/pf/PSD/UEFI/x64/main/main2.bmp', 356, 416),
|
||||
('x86-2', '/path/to/pf/PSD/UEFI/x86/main/main2.bmp', 424, 481),
|
||||
]
|
||||
OLD_A = 'Grub2 FileManager (ISO образы)'
|
||||
NEW_A = 'Ventoy (ISO образы)'
|
||||
OLD_B = 'Kaspersky Rescue Disk 18'
|
||||
NEW_B = 'Kaspersky Rescue Disk 24'
|
||||
|
||||
def font(size=20, wght=550):
|
||||
f = ImageFont.truetype(FONT, size)
|
||||
f.set_variation_by_axes([wght])
|
||||
return f
|
||||
|
||||
def render(text, color, size=20, wght=550, pad=60):
|
||||
f = font(size, wght)
|
||||
w, h = 1100, 140
|
||||
img = Image.new('RGB', (w, h), tuple(PAGE))
|
||||
ImageDraw.Draw(img).text((pad, 40), text, font=f, fill=tuple(int(v) for v in color))
|
||||
a = np.array(img).astype(int)
|
||||
m = np.abs(a - PAGE).sum(axis=2) > 100
|
||||
ys, xs = np.where(m)
|
||||
return m[ys.min():ys.max()+1, xs.min():xs.max()+1], xs.min()-pad, ys.min()-40
|
||||
|
||||
def iou_align(A, B, rng=12):
|
||||
ha, wa = A.shape; hb, wb = B.shape; best = (-1, 0, 0)
|
||||
for dy in range(-rng, rng+1):
|
||||
for dx in range(-rng, rng+1):
|
||||
y0 = max(0, dy); x0 = max(0, dx)
|
||||
y1 = min(ha, hb+dy); x1 = min(wa, wb+dx)
|
||||
if y1 <= y0 or x1 <= x0: continue
|
||||
s1 = A[y0:y1, x0:x1]; s2 = B[y0-dy:y1-dy, x0-dx:x1-dx]
|
||||
u = np.logical_or(s1, s2).sum()
|
||||
if not u: continue
|
||||
s = np.logical_and(s1, s2).sum()/u
|
||||
if s > best[0]: best = (s, dx, dy)
|
||||
return best
|
||||
|
||||
for name, src, yA, yB in items:
|
||||
base = Image.open(src).convert('RGB')
|
||||
arr0 = np.array(base).astype(int)
|
||||
img = base.copy()
|
||||
draw = ImageDraw.Draw(img)
|
||||
print('==', name)
|
||||
|
||||
for tag, y, old, new in (('A', yA, OLD_A, NEW_A), ('B', yB, OLD_B, NEW_B)):
|
||||
band = arr0[y-10:y+24, 20:1010]
|
||||
# цвет полосы: сэмпл в середине строки
|
||||
bar = arr0[y+2, 250]
|
||||
# сколько пикселей рядом с тёмным/жёлтым в полосе
|
||||
d_dark = np.abs(band - DARK).sum(axis=2) < 150
|
||||
d_yell = np.abs(band - YELL).sum(axis=2) < 150
|
||||
if d_yell.sum() > 50 and np.abs(bar - YELL).sum() > 100:
|
||||
text_color, bar_color = YELL, bar
|
||||
elif d_dark.sum() > 50 and np.abs(bar - DARK).sum() > 100:
|
||||
text_color, bar_color = DARK, bar
|
||||
else:
|
||||
# текст того цвета, которого больше и который не совпадает с полосой
|
||||
text_color = YELL if d_yell.sum() > d_dark.sum() else DARK
|
||||
bar_color = bar
|
||||
m = np.abs(band - text_color).sum(axis=2) < 150
|
||||
ys, xs = np.where(m)
|
||||
if len(xs) == 0:
|
||||
print(' ', tag, 'текст не найден'); continue
|
||||
x0, x1 = xs.min()+20, xs.max()+20
|
||||
y0, y1 = ys.min()+y-10, ys.max()+y-10
|
||||
print(f' {tag}: bar={tuple(int(v) for v in bar_color)} text={tuple(int(v) for v in text_color)} bbox=({x0},{y0},{x1},{y1})')
|
||||
|
||||
rend, rx, ry = render(old, text_color)
|
||||
sub = np.abs(arr0[y0-2:y1+3, x0-2:x1+3] - text_color).sum(axis=2) < 150
|
||||
s, dx, dy = iou_align(sub, rend)
|
||||
print(f' align IoU={s:.3f} dx={dx} dy={dy}')
|
||||
px = x0 - 2 + dx - rx
|
||||
py = y0 - 2 + dy - ry
|
||||
|
||||
draw.rectangle([x0-3, y0-4, x1+3, y1+3], fill=tuple(int(v) for v in bar_color))
|
||||
draw.text((px, py), new, font=font(), fill=tuple(int(v) for v in text_color))
|
||||
print(f' draw "{new}" at ({px},{py})')
|
||||
|
||||
img.save(f'{OUT}/{name}.png')
|
||||
print(' ->', f'{OUT}/{name}.png')
|
||||
EOF
|
||||
@@ -0,0 +1,104 @@
|
||||
#!/bin/bash
|
||||
python3 - <<'EOF'
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import numpy as np, os
|
||||
|
||||
FONT = '/path/to/pf/PSD/fonts/Montserrat-VF.ttf'
|
||||
OUT = '/path/to/pf/KRD/images'
|
||||
os.makedirs(OUT, exist_ok=True)
|
||||
|
||||
DARK = np.array([41, 53, 84]); YELL = np.array([234, 224, 115]); PAGE = np.array([233, 233, 233])
|
||||
TOL = 55
|
||||
|
||||
items = [
|
||||
('legacy-1', '/path/to/pf/PSD/main/main1.bmp', 424, 481),
|
||||
('legacy-2', '/path/to/pf/PSD/main/main2.bmp', 424, 481),
|
||||
('x64-1', '/path/to/pf/PSD/UEFI/x64/main/main1.bmp', 356, 416),
|
||||
('x64-2', '/path/to/pf/PSD/UEFI/x64/main/main2.bmp', 356, 416),
|
||||
('x86-1', '/path/to/pf/PSD/UEFI/x86/main/main1.bmp', 424, 481),
|
||||
('x86-2', '/path/to/pf/PSD/UEFI/x86/main/main2.bmp', 424, 481),
|
||||
]
|
||||
OLD_A, NEW_A = 'Grub2 FileManager (ISO образы)', 'Ventoy (ISO образы)'
|
||||
OLD_B, NEW_B = 'Kaspersky Rescue Disk 18', 'Kaspersky Rescue Disk 24'
|
||||
|
||||
def font(size=20, wght=550):
|
||||
f = ImageFont.truetype(FONT, size); f.set_variation_by_axes([wght]); return f
|
||||
|
||||
def render(text, color, size=20, wght=550, pad=60):
|
||||
img = Image.new('RGB', (1100, 140), tuple(PAGE))
|
||||
ImageDraw.Draw(img).text((pad, 40), text, font=font(size, wght), fill=tuple(int(v) for v in color))
|
||||
a = np.array(img).astype(int)
|
||||
m = np.sqrt(((a - PAGE) ** 2).sum(axis=2)) > TOL
|
||||
ys, xs = np.where(m)
|
||||
return m[ys.min():ys.max()+1, xs.min():xs.max()+1], xs.min()-pad, ys.min()-40
|
||||
|
||||
def iou_align(A, B, rng=12):
|
||||
ha, wa = A.shape; hb, wb = B.shape; best = (-1, 0, 0)
|
||||
for dy in range(-rng, rng+1):
|
||||
for dx in range(-rng, rng+1):
|
||||
y0 = max(0, dy); x0 = max(0, dx)
|
||||
y1 = min(ha, hb+dy); x1 = min(wa, wb+dx)
|
||||
if y1 <= y0 or x1 <= x0: continue
|
||||
s1 = A[y0:y1, x0:x1]; s2 = B[y0-dy:y1-dy, x0-dx:x1-dx]
|
||||
u = np.logical_or(s1, s2).sum()
|
||||
if not u: continue
|
||||
s = np.logical_and(s1, s2).sum()/u
|
||||
if s > best[0]: best = (s, dx, dy)
|
||||
return best
|
||||
|
||||
for name, src, yA, yB in items:
|
||||
base = Image.open(src).convert('RGB')
|
||||
arr0 = np.array(base).astype(int)
|
||||
img = base.copy(); draw = ImageDraw.Draw(img)
|
||||
print('==', name)
|
||||
for tag, y, old, new in (('A', yA, OLD_A, NEW_A), ('B', yB, OLD_B, NEW_B)):
|
||||
bar = arr0[y+2, 250]
|
||||
band = arr0[y-10:y+24, 20:470] # только зона текста (справа графика)
|
||||
cnt = {}
|
||||
for nm, col in (('dark', DARK), ('yellow', YELL)):
|
||||
cnt[nm] = int((np.sqrt(((band - col) ** 2).sum(axis=2)) < TOL).sum())
|
||||
# выбираем цвет текста: тот, что не совпадает с полосой и его достаточно
|
||||
if np.sqrt(((bar - YELL) ** 2).sum()) < TOL and cnt['dark'] > 30:
|
||||
text_color, bar_color = DARK, bar
|
||||
elif np.sqrt(((bar - DARK) ** 2).sum()) < TOL and cnt['yellow'] > 30:
|
||||
text_color, bar_color = YELL, bar
|
||||
else:
|
||||
text_color = YELL if cnt['yellow'] >= cnt['dark'] else DARK
|
||||
bar_color = PAGE if cnt['yellow'] < 30 and cnt['dark'] < 30 else bar
|
||||
m = np.sqrt(((band - text_color) ** 2).sum(axis=2)) < TOL
|
||||
ys, xs = np.where(m)
|
||||
if len(xs) == 0:
|
||||
print(' ', tag, 'текст не найден'); continue
|
||||
# колонки с чернилами, группируем по разрывам; последняя короткая группа = хоткей
|
||||
colsum = m.sum(axis=0)
|
||||
cols = np.where(colsum >= 2)[0]
|
||||
groups = []
|
||||
if len(cols):
|
||||
s = cols[0]; prev = cols[0]
|
||||
for c in cols[1:]:
|
||||
if c - prev > 12:
|
||||
groups.append((s, prev)); s = c
|
||||
prev = c
|
||||
groups.append((s, prev))
|
||||
if len(groups) > 1 and (groups[-1][1] - groups[-1][0]) < 60:
|
||||
groups = groups[:-1]
|
||||
if not groups:
|
||||
print(' ', tag, 'текст не найден'); continue
|
||||
gx0, gx1 = groups[0][0], groups[-1][1]
|
||||
x0, x1 = gx0+20, gx1+20
|
||||
rowsub = m[:, gx0:gx1+1]
|
||||
rowsum = rowsub.sum(axis=1); rows = np.where(rowsum >= 2)[0]
|
||||
y0, y1 = rows.min()+y-10, rows.max()+y-10
|
||||
print(f' {tag}: bar={tuple(int(v) for v in bar_color)} text={tuple(int(v) for v in text_color)} bbox=({x0},{y0},{x1},{y1})')
|
||||
|
||||
rend, rx, ry = render(old, text_color)
|
||||
sub = np.sqrt(((arr0[y0-2:y1+3, x0-2:x1+3] - text_color) ** 2).sum(axis=2)) < TOL
|
||||
s, dx, dy = iou_align(sub, rend)
|
||||
px = x0 - 2 + dx - rx; py = y0 - 2 + dy - ry
|
||||
print(f' align IoU={s:.3f} dx={dx} dy={dy} -> draw at ({px},{py})')
|
||||
|
||||
draw.rectangle([x0-3, y0-4, x1+3, y1+3], fill=tuple(int(v) for v in bar_color))
|
||||
draw.text((px, py), new, font=font(), fill=tuple(int(v) for v in text_color))
|
||||
img.save(f'{OUT}/{name}.png')
|
||||
print(' ->', f'{OUT}/{name}.png')
|
||||
EOF
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Проверка UEFI Xorboot: какие файлы меню он использует.
|
||||
set -e
|
||||
IMG=/root/xoruefi.img
|
||||
rm -f "$IMG"; truncate -s 256M "$IMG"
|
||||
mkfs.vfat -F 32 -n XORTEST "$IMG" >/dev/null 2>&1
|
||||
mkdir -p /mnt/xortest; mount -o loop "$IMG" /mnt/xortest
|
||||
mkdir -p /mnt/xortest/EFI/BOOT
|
||||
cp -f /mnt/f/efi/Paravis/Boot/xor/UEFI/bootx64.efi /mnt/xortest/EFI/BOOT/BOOTX64.EFI
|
||||
mkdir -p /mnt/xortest/efi/Paravis/Boot
|
||||
cp -r /mnt/f/efi/Paravis/Boot/xor /mnt/xortest/efi/Paravis/Boot/
|
||||
sync
|
||||
echo "=== в образе:"; find /mnt/xortest/efi/Paravis/Boot/xor -maxdepth 2 | head -20
|
||||
umount /mnt/xortest
|
||||
|
||||
rm -f /tmp/qx1.ppm /tmp/qxmon.sock
|
||||
qemu-system-x86_64 -m 1024 -machine q35 \
|
||||
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \
|
||||
-drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS_4M.fd \
|
||||
-drive file="$IMG",format=raw,if=ide \
|
||||
-device qemu-xhci -device usb-tablet -display none -vga std \
|
||||
-monitor unix:/tmp/qxmon.sock,server,nowait -daemonize
|
||||
sleep 12
|
||||
python3 - <<'EOF'
|
||||
import socket, time
|
||||
s=socket.socket(socket.AF_UNIX); s.connect('/tmp/qxmon.sock'); time.sleep(0.3)
|
||||
s.recv(65536); s.sendall(b'screendump /tmp/qx1.ppm\n'); time.sleep(1.5)
|
||||
try: s.recv(65536)
|
||||
except Exception: pass
|
||||
s.sendall(b'quit\n')
|
||||
EOF
|
||||
sleep 2
|
||||
pkill -f 'qemu-system-x86_64.*xoruefi.img' 2>/dev/null || true
|
||||
ls -l /tmp/qx1.ppm 2>/dev/null
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# UEFI Xorboot на образе с таблицей разделов (как флешка).
|
||||
set -e
|
||||
IMG=/root/xoruefi.img
|
||||
rm -f "$IMG"; truncate -s 300M "$IMG"
|
||||
# MBR + один раздел с 1 МиБ
|
||||
printf 'label: dos\nstart=1MiB, type=0c, bootable\n' | sfdisk "$IMG" >/dev/null 2>&1 || {
|
||||
parted -s "$IMG" mklabel msdos
|
||||
parted -s "$IMG" mkpart primary fat32 1MiB 100%
|
||||
parted -s "$IMG" set 1 boot on
|
||||
}
|
||||
LOOP=$(losetup -f --show -P "$IMG")
|
||||
sleep 1
|
||||
mkfs.vfat -F 32 -n XORTEST "${LOOP}p1" >/dev/null 2>&1
|
||||
mkdir -p /mnt/xortest; mount "${LOOP}p1" /mnt/xortest
|
||||
mkdir -p /mnt/xortest/EFI/BOOT
|
||||
cp -f /mnt/f/efi/Paravis/Boot/xor/UEFI/bootx64.efi /mnt/xortest/EFI/BOOT/BOOTX64.EFI
|
||||
mkdir -p /mnt/xortest/efi/Paravis/Boot
|
||||
cp -r /mnt/f/efi/Paravis/Boot/xor /mnt/xortest/efi/Paravis/Boot/
|
||||
sync
|
||||
umount /mnt/xortest
|
||||
losetup -d "$LOOP"
|
||||
|
||||
rm -f /tmp/qx2.ppm /tmp/qxmon2.sock
|
||||
qemu-system-x86_64 -m 1024 -machine q35 \
|
||||
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \
|
||||
-drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS_4M.fd \
|
||||
-drive file="$IMG",format=raw,if=ide \
|
||||
-device qemu-xhci -device usb-tablet -display none -vga std \
|
||||
-monitor unix:/tmp/qxmon2.sock,server,nowait -daemonize
|
||||
sleep 12
|
||||
python3 - <<'EOF'
|
||||
import socket, time
|
||||
s=socket.socket(socket.AF_UNIX); s.connect('/tmp/qxmon2.sock'); time.sleep(0.3)
|
||||
s.recv(65536); s.sendall(b'screendump /tmp/qx2.ppm\n'); time.sleep(1.5)
|
||||
try: s.recv(65536)
|
||||
except Exception: pass
|
||||
s.sendall(b'quit\n')
|
||||
EOF
|
||||
sleep 2
|
||||
pkill -f 'qemu-system-x86_64.*xoruefi.img' 2>/dev/null || true
|
||||
ls -l /tmp/qx2.ppm
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
# UEFI Xorboot: какие имена BMP он ищет (x64.xor + 1x64/2x64).
|
||||
set -e
|
||||
IMG=/root/xuefi2.img
|
||||
rm -f "$IMG"; truncate -s 400M "$IMG"
|
||||
printf 'label: dos\nstart=1MiB, type=0c, bootable\n' | sfdisk "$IMG" >/dev/null 2>&1
|
||||
LOOP=$(losetup -f --show -P "$IMG"); sleep 1
|
||||
mkfs.vfat -F 32 -n XORTEST "${LOOP}p1" >/dev/null 2>&1
|
||||
mkdir -p /mnt/xt2; mount "${LOOP}p1" /mnt/xt2
|
||||
|
||||
mkdir -p /mnt/xt2/EFI/BOOT
|
||||
cp -f /mnt/f/efi/Paravis/Boot/xor/UEFI/bootx64.efi /mnt/xt2/EFI/BOOT/BOOTX64.EFI
|
||||
cp -f /mnt/f/efi/Boot/x64.xor /mnt/xt2/EFI/BOOT/x64.xor
|
||||
cp -f /mnt/f/efi/Boot/1x64.bmp /mnt/xt2/EFI/BOOT/1x64.bmp
|
||||
cp -f /mnt/f/efi/Boot/2x64.bmp /mnt/xt2/EFI/BOOT/2x64.bmp
|
||||
# ещё копии под именами из конфига — но НЕ кладём, чтобы понять, какие он ищет
|
||||
sync
|
||||
echo "=== в EFI/BOOT:"; ls -l /mnt/xt2/EFI/BOOT
|
||||
umount /mnt/xt2; losetup -d "$LOOP"
|
||||
|
||||
rm -f /tmp/qx3.ppm /tmp/qm3.sock
|
||||
qemu-system-x86_64 -m 1024 -machine q35 \
|
||||
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE_4M.fd \
|
||||
-drive if=pflash,format=raw,file=/usr/share/OVMF/OVMF_VARS_4M.fd \
|
||||
-drive file="$IMG",format=raw,if=ide \
|
||||
-device qemu-xhci -device usb-tablet -display none -vga std \
|
||||
-monitor unix:/tmp/qm3.sock,server,nowait -daemonize
|
||||
sleep 12
|
||||
python3 - <<'EOF'
|
||||
import socket, time
|
||||
s=socket.socket(socket.AF_UNIX); s.connect('/tmp/qm3.sock'); time.sleep(0.3)
|
||||
s.recv(65536); s.sendall(b'screendump /tmp/qx3.ppm\n'); time.sleep(1.5)
|
||||
try: s.recv(65536)
|
||||
except Exception: pass
|
||||
s.sendall(b'quit\n')
|
||||
EOF
|
||||
sleep 2
|
||||
pkill -f 'qemu-system-x86_64.*xuefi2.img' 2>/dev/null || true
|
||||
ls -l /tmp/qx3.ppm
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
python3 - <<'EOF'
|
||||
from PIL import Image
|
||||
import numpy as np
|
||||
|
||||
pairs = [
|
||||
('legacy-1', '/mnt/f/efi/Paravis/Boot/xor/Main1.bmp', '/path/to/pf/KRD/images/legacy-1.png'),
|
||||
('legacy-2', '/mnt/f/efi/Paravis/Boot/xor/Main2.bmp', '/path/to/pf/KRD/images/legacy-2.png'),
|
||||
('x64-1', '/mnt/f/efi/Boot/1x64.bmp', '/path/to/pf/KRD/images/x64-1.png'),
|
||||
('x64-2', '/mnt/f/efi/Boot/2x64.bmp', '/path/to/pf/KRD/images/x64-2.png'),
|
||||
('x86-1', '/mnt/f/efi/Boot/1x86.bmp', '/path/to/pf/KRD/images/x86-1.png'),
|
||||
('x86-2', '/mnt/f/efi/Boot/2x86.bmp', '/path/to/pf/KRD/images/x86-2.png'),
|
||||
]
|
||||
for name, bmp, png in pairs:
|
||||
a = np.array(Image.open(bmp).convert('RGB'))
|
||||
b = np.array(Image.open(png).convert('RGB'))
|
||||
same = a.shape == b.shape and np.array_equal(a, b)
|
||||
diff = None if a.shape != b.shape else int(np.abs(a.astype(int)-b.astype(int)).max())
|
||||
print(f' {name:9s} bmp={a.shape} png={b.shape} equal={same} maxdiff={diff}')
|
||||
if not same:
|
||||
Image.fromarray(a).save(f'/path/to/pf/KRD/check-{name}.png')
|
||||
EOF
|
||||
@@ -0,0 +1,84 @@
|
||||
#!/bin/bash
|
||||
# Только ia32-картинки: "Kaspersky Rescue Disk 18" + "Ventoy (ISO образы)".
|
||||
python3 - <<'EOF'
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import numpy as np, os
|
||||
|
||||
FONT = '/path/to/pf/PSD/fonts/Montserrat-VF.ttf'
|
||||
OUT = '/path/to/pf/KRD/images'
|
||||
DARK = np.array([41, 53, 84]); YELL = np.array([234, 224, 115]); PAGE = np.array([233, 233, 233])
|
||||
TOL = 55
|
||||
items = [
|
||||
('x86-1', '/path/to/pf/PSD/UEFI/x86/main/main1.bmp', 424, 481),
|
||||
('x86-2', '/path/to/pf/PSD/UEFI/x86/main/main2.bmp', 424, 481),
|
||||
]
|
||||
OLD_A, NEW_A = 'Grub2 FileManager (ISO образы)', 'Ventoy (ISO образы)'
|
||||
OLD_B, NEW_B = 'Kaspersky Rescue Disk 18', 'Kaspersky Rescue Disk 18' # 18 как есть
|
||||
|
||||
def font(size=20, wght=550):
|
||||
f = ImageFont.truetype(FONT, size); f.set_variation_by_axes([wght]); return f
|
||||
|
||||
def render(text, color, size=20, wght=550, pad=60):
|
||||
img = Image.new('RGB', (1100, 140), tuple(PAGE))
|
||||
ImageDraw.Draw(img).text((pad, 40), text, font=font(size, wght), fill=tuple(int(v) for v in color))
|
||||
a = np.array(img).astype(int)
|
||||
m = np.sqrt(((a - PAGE) ** 2).sum(axis=2)) > TOL
|
||||
ys, xs = np.where(m)
|
||||
return m[ys.min():ys.max()+1, xs.min():xs.max()+1], xs.min()-pad, ys.min()-40
|
||||
|
||||
def iou_align(A, B, rng=12):
|
||||
ha, wa = A.shape; hb, wb = B.shape; best = (-1, 0, 0)
|
||||
for dy in range(-rng, rng+1):
|
||||
for dx in range(-rng, rng+1):
|
||||
y0 = max(0, dy); x0 = max(0, dx)
|
||||
y1 = min(ha, hb+dy); x1 = min(wa, wb+dx)
|
||||
if y1 <= y0 or x1 <= x0: continue
|
||||
s1 = A[y0:y1, x0:x1]; s2 = B[y0-dy:y1-dy, x0-dx:x1-dx]
|
||||
u = np.logical_or(s1, s2).sum()
|
||||
if not u: continue
|
||||
s = np.logical_and(s1, s2).sum()/u
|
||||
if s > best[0]: best = (s, dx, dy)
|
||||
return best
|
||||
|
||||
for name, src, yA, yB in items:
|
||||
base = Image.open(src).convert('RGB')
|
||||
arr0 = np.array(base).astype(int)
|
||||
img = base.copy(); draw = ImageDraw.Draw(img)
|
||||
for tag, y, old, new in (('A', yA, OLD_A, NEW_A), ('B', yB, OLD_B, NEW_B)):
|
||||
bar = arr0[y+2, 250]
|
||||
band = arr0[y-10:y+24, 20:470]
|
||||
cnt = {}
|
||||
for nm, col in (('dark', DARK), ('yellow', YELL)):
|
||||
cnt[nm] = int((np.sqrt(((band - col) ** 2).sum(axis=2)) < TOL).sum())
|
||||
if np.sqrt(((bar - YELL) ** 2).sum()) < TOL and cnt['dark'] > 30:
|
||||
text_color, bar_color = DARK, bar
|
||||
elif np.sqrt(((bar - DARK) ** 2).sum()) < TOL and cnt['yellow'] > 30:
|
||||
text_color, bar_color = YELL, bar
|
||||
else:
|
||||
text_color = YELL if cnt['yellow'] >= cnt['dark'] else DARK
|
||||
bar_color = PAGE if cnt['yellow'] < 30 and cnt['dark'] < 30 else bar
|
||||
m = np.sqrt(((band - text_color) ** 2).sum(axis=2)) < TOL
|
||||
colsum = m.sum(axis=0); cols = np.where(colsum >= 2)[0]
|
||||
groups = []
|
||||
if len(cols):
|
||||
s = cols[0]; prev = cols[0]
|
||||
for c in cols[1:]:
|
||||
if c - prev > 12: groups.append((s, prev)); s = c
|
||||
prev = c
|
||||
groups.append((s, prev))
|
||||
if len(groups) > 1 and (groups[-1][1] - groups[-1][0]) < 60: groups = groups[:-1]
|
||||
if not groups: continue
|
||||
gx0, gx1 = groups[0][0], groups[-1][1]
|
||||
x0, x1 = gx0+20, gx1+20
|
||||
rowsum = m[:, gx0:gx1+1].sum(axis=1); rows = np.where(rowsum >= 2)[0]
|
||||
y0, y1 = rows.min()+y-10, rows.max()+y-10
|
||||
rend, rx, ry = render(old, text_color)
|
||||
sub = np.sqrt(((arr0[y0-2:y1+3, x0-2:x1+3] - text_color) ** 2).sum(axis=2)) < TOL
|
||||
s, dx, dy = iou_align(sub, rend)
|
||||
px = x0 - 2 + dx - rx; py = y0 - 2 + dy - ry
|
||||
draw.rectangle([x0-3, y0-4, x1+3, y1+3], fill=tuple(int(v) for v in bar_color))
|
||||
draw.text((px, py), new, font=font(), fill=tuple(int(v) for v in text_color))
|
||||
print(f' {name} {tag}: "{new}" at ({px},{py}) IoU={s:.3f}')
|
||||
img.save(f'{OUT}/{name}.png')
|
||||
print(' ->', f'{OUT}/{name}.png')
|
||||
EOF
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
IMG=/root/xor32.img
|
||||
LOOP=$(losetup -f --show -P "$IMG"); sleep 1
|
||||
mount "${LOOP}p1" /mnt/x32p1
|
||||
cp -f /path/to/pf/KRD/images/krd32dbg.efi /mnt/x32p1/efi/Paravis/Boot/loaders/xb32/krd.efi
|
||||
sync
|
||||
umount /mnt/x32p1; losetup -d "$LOOP"
|
||||
bash /path/to/pf/Ventoy/xor32-run.sh 7 30 dbg
|
||||
python3 - <<'EOF'
|
||||
import zlib, struct
|
||||
def ppm2png(src, dst):
|
||||
d = open(src, 'rb').read(); parts=[]; i=0
|
||||
while len(parts) < 4:
|
||||
while d[i:i+1].isspace(): i += 1
|
||||
j = i
|
||||
while not d[j:j+1].isspace(): j += 1
|
||||
parts.append(d[i:j]); i = j
|
||||
i += 1
|
||||
w=int(parts[1]); h=int(parts[2]); px=d[i:i+w*h*3]
|
||||
raw=b''.join(b'\x00'+px[y*w*3:(y+1)*w*3] for y in range(h))
|
||||
def ch(t,dd):
|
||||
c=t+dd
|
||||
return struct.pack('>I',len(dd))+c+struct.pack('>I',zlib.crc32(c)&0xffffffff)
|
||||
png=b'\x89PNG\r\n\x1a\n'+ch(b'IHDR',struct.pack('>IIBBBBB',w,h,8,2,0,0,0))+ch(b'IDAT',zlib.compress(raw,9))+ch(b'IEND',b'')
|
||||
open(dst,'wb').write(png); print(dst,w,h)
|
||||
ppm2png('/tmp/x32-dbg.ppm','/path/to/pf/KRD/xor32-dbg.png')
|
||||
EOF
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# Запуск ia32 Xorboot и выбор пункта N (по умолчанию 6 = Ventoy).
|
||||
set -e
|
||||
IMG=/root/xor32.img
|
||||
N=${1:-6}
|
||||
WAIT=${2:-25}
|
||||
TAG=${3:-v}
|
||||
|
||||
rm -f /tmp/x32-$TAG.ppm /tmp/xm32-$TAG.sock
|
||||
qemu-system-i386 -m 1024 -machine q35 \
|
||||
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF32_CODE_4M.fd \
|
||||
-drive if=pflash,format=raw,file=/root/OVMF32_VARS.fd \
|
||||
-drive file="$IMG",format=raw,if=ide \
|
||||
-device qemu-xhci -device usb-tablet -display none -vga std \
|
||||
-monitor unix:/tmp/xm32-$TAG.sock,server,nowait -daemonize
|
||||
|
||||
python3 - "$N" "$WAIT" "$TAG" <<'EOF'
|
||||
import socket, time, sys
|
||||
N = int(sys.argv[1]); WAIT = int(sys.argv[2]); TAG = sys.argv[3]
|
||||
sock = f'/tmp/xm32-{TAG}.sock'
|
||||
def mon(cmd, pause=0.25):
|
||||
s = socket.socket(socket.AF_UNIX); s.connect(sock); time.sleep(0.2)
|
||||
s.recv(65536); s.sendall((cmd+'\n').encode()); time.sleep(pause)
|
||||
try: s.recv(65536)
|
||||
except Exception: pass
|
||||
s.close()
|
||||
time.sleep(12)
|
||||
# текущий пункт — 2-й; шагаем вниз до N
|
||||
for _ in range(N-2):
|
||||
mon('sendkey down')
|
||||
time.sleep(0.5)
|
||||
mon('sendkey ret')
|
||||
time.sleep(WAIT)
|
||||
mon(f'screendump /tmp/x32-{TAG}.ppm')
|
||||
time.sleep(1)
|
||||
mon('quit')
|
||||
EOF
|
||||
sleep 2
|
||||
pkill -f "qemu-system-i386.*xor32.img" 2>/dev/null || true
|
||||
ls -l /tmp/x32-$TAG.ppm
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
# Тестовый образ для ia32 Xorboot: p1 = меню+KRD, p2 = Ventoy EFI.
|
||||
set -e
|
||||
IMG=/root/xor32.img
|
||||
rm -f "$IMG"; truncate -s 1200M "$IMG"
|
||||
printf 'label: dos\nstart=1MiB, size=1024MiB, type=0c, bootable\nstart=1025MiB, type=0e\n' | sfdisk "$IMG" >/dev/null 2>&1
|
||||
LOOP=$(losetup -f --show -P "$IMG"); sleep 1
|
||||
mkfs.vfat -F 32 -n PARAVIS "${LOOP}p1" >/dev/null 2>&1
|
||||
mkfs.vfat -F 16 -n VTOYEFI "${LOOP}p2" >/dev/null 2>&1
|
||||
|
||||
mkdir -p /mnt/x32p1 /mnt/x32p2
|
||||
mount "${LOOP}p1" /mnt/x32p1
|
||||
mount "${LOOP}p2" /mnt/x32p2
|
||||
|
||||
# --- p1: загрузчик xorboot ia32 + конфиг + картинки + переходники + KRD
|
||||
mkdir -p /mnt/x32p1/EFI/BOOT /mnt/x32p1/efi/Boot
|
||||
cp -f /mnt/f/efi/Paravis/Boot/xor/UEFI/bootia32.efi /mnt/x32p1/EFI/BOOT/BOOTIA32.EFI
|
||||
cp -f /path/to/pf/KRD/images/xor/x86.xor /mnt/x32p1/efi/Boot/x86.xor
|
||||
cp -f /mnt/f/efi/Boot/1x86.bmp /mnt/x32p1/efi/Boot/1x86.bmp
|
||||
cp -f /mnt/f/efi/Boot/2x86.bmp /mnt/x32p1/efi/Boot/2x86.bmp
|
||||
mkdir -p /mnt/x32p1/efi/Paravis/Boot/loaders/xb32
|
||||
cp -f /path/to/pf/KRD/images/ventoy32.efi /mnt/x32p1/efi/Paravis/Boot/loaders/xb32/ventoy.efi
|
||||
cp -f /path/to/pf/KRD/images/krd32.efi /mnt/x32p1/efi/Paravis/Boot/loaders/xb32/krd.efi
|
||||
mkdir -p /mnt/x32p1/efi/Paravis/KRD/live
|
||||
cp -f /mnt/f/efi/Paravis/KRD/live/vmlinuz /mnt/x32p1/efi/Paravis/KRD/live/
|
||||
cp -f /mnt/f/efi/Paravis/KRD/live/initrd.img /mnt/x32p1/efi/Paravis/KRD/live/
|
||||
|
||||
# --- p2: Ventoy EFI (как G:)
|
||||
mkdir -p /mnt/x32p2/EFI/BOOT /mnt/x32p2/grub /mnt/x32p2/ventoy
|
||||
cp -f /mnt/g/EFI/BOOT/grubia32.efi /mnt/x32p2/EFI/BOOT/
|
||||
cp -r /mnt/g/grub/i386-efi /mnt/x32p2/grub/
|
||||
cp -f /mnt/g/ventoy/ventoy.cpio /mnt/g/ventoy/ventoy.cpio.orig /mnt/g/ventoy/vtoyjump32.exe /mnt/x32p2/ventoy/ 2>/dev/null || true
|
||||
|
||||
sync
|
||||
du -sh /mnt/x32p1 /mnt/x32p2
|
||||
umount /mnt/x32p1 /mnt/x32p2; losetup -d "$LOOP"
|
||||
|
||||
rm -f /tmp/x32-*.ppm /tmp/xm32.sock
|
||||
qemu-system-i386 -m 1024 -machine q35 \
|
||||
-drive if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF32_CODE_4M.fd \
|
||||
-drive if=pflash,format=raw,file=/root/OVMF32_VARS.fd \
|
||||
-drive file="$IMG",format=raw,if=ide \
|
||||
-device qemu-xhci -device usb-tablet -display none -vga std \
|
||||
-monitor unix:/tmp/xm32.sock,server,nowait -daemonize
|
||||
sleep 14
|
||||
python3 - <<'EOF'
|
||||
import socket, time
|
||||
s=socket.socket(socket.AF_UNIX); s.connect('/tmp/xm32.sock'); time.sleep(0.3)
|
||||
s.recv(65536); s.sendall(b'screendump /tmp/x32-0.ppm\n'); time.sleep(1.5)
|
||||
try: s.recv(65536)
|
||||
except Exception: pass
|
||||
s.sendall(b'quit\n')
|
||||
EOF
|
||||
sleep 2
|
||||
pkill -f 'qemu-system-i386.*xor32.img' 2>/dev/null || true
|
||||
ls -l /tmp/x32-0.ppm
|
||||
Reference in new issue
Block a user