From 1963a0a6d7398a426d0701f90a5bc796e32899ae Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 31 Jul 2026 02:55:10 +0200 Subject: feat(rsboot): initial commit — UEFI bootloader extracted from RNG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pad_for_optiplex.py | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 pad_for_optiplex.py (limited to 'pad_for_optiplex.py') diff --git a/pad_for_optiplex.py b/pad_for_optiplex.py new file mode 100644 index 0000000..2d48552 --- /dev/null +++ b/pad_for_optiplex.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python3 +"""pad_for_optiplex.py — pad a UEFI bootloader PE for Optiplex 7010 + +The Optiplex 7010 AMI Aptio firmware rejects PEs smaller than ~160KB +("no bootable devices"). This pads the PE to match systemd-boot's size +and sets SizeOfImage accordingly. +""" + +import struct, sys, os + +def pad(path): + try: + with open(path, 'rb') as f: + d = bytearray(f.read()) + except IOError as e: + print(f" ERROR: cannot read {path}: {e}") + return False + + po = struct.unpack('= target: + print(f" Already >= {target} bytes ({len(d)}), nothing to do") + return True + + # Compute SizeOfImage: round current SizeOfImage to match file growth + cur_si = struct.unpack('") + sys.exit(1) + if not pad(sys.argv[1]): + sys.exit(1) -- cgit v1.2.3