#!/usr/bin/env python3 import argparse,hashlib,json,os,struct,subprocess from pathlib import Path p=argparse.ArgumentParser();p.add_argument('--zig',default='zig');a=p.parse_args() r=Path(__file__).resolve().parent;os.chdir(r) sources=['app','app_io','ownership','format','runtime','sha256','checks','port','compat','vendor/unlock_610','vendor/prep_610','vendor/layout_610','vendor/vbios_610','vendor/gfw_eval'] out=Path('USB/EFI/BOOT/BOOTX64.EFI');out.parent.mkdir(parents=True,exist_ok=True) cmd=[a.zig,'cc','-target','x86_64-uefi','-std=c11','-ffreestanding','-fno-builtin','-fno-stack-protector','-mno-red-zone','-fshort-wchar','-Os','-g0','-Wall','-Wextra','-Werror','-Wno-unused-parameter','-D__KERNEL__','-DGU_UEFI_PORT','-DGU_TARGET_PCI_ID=0x270410deU','-Iunlock/compat','-Ideps/edk2/MdePkg/Include','-Ideps/edk2/MdePkg/Include/X64','-nostdlib']+['unlock/'+x+'.c' for x in sources]+['-o',str(out)] subprocess.run(cmd,check=True) b=out.read_bytes();u16=lambda o:struct.unpack_from('0 for i in [1,12,13]:assert b[opt+112+i*8:opt+120+i*8]==b'\0'*8 entry=u32(opt+16);sections=opt+u16(pe+20) assert any(u32(t+12)<=entry