Files

29 lines
1.0 KiB
Bash

#!/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