diff options
Diffstat (limited to 'efi/fetch_ref.sh')
| -rw-r--r-- | efi/fetch_ref.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/efi/fetch_ref.sh b/efi/fetch_ref.sh new file mode 100644 index 0000000..67b726b --- /dev/null +++ b/efi/fetch_ref.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Тянет из 9legacy референсный EFI-загрузчик (nboot/efi) и достаёт из него +# pe64.s (PE32+ обёртка), efi.h и mem.h. Это НЕ наш код — это Plan9/9legacy, +# поэтому качаем, а не храним в репе. Наш код — hello.c/efi_build.sh/mkesp.py. +set -e +cd "$(dirname "$0")" +echo ">> качаю 9legacy nboot.diff ..." +python3 -c "import urllib.request; urllib.request.urlretrieve('http://9legacy.org/9legacy/patch/nboot.diff','nboot.diff')" +python3 - <<'PY' +import re +d=open('nboot.diff').read().splitlines() +want={'pe64.s','efi.h','mem.h'}; cur=None; buf=[]; out={} +for l in d: + m=re.match(r'^\+\+\+ .*/nboot/efi/(\S+)', l) + if m: + if cur: out[cur]='\n'.join(buf) + cur=m.group(1) if m.group(1) in want else None; buf=[]; continue + if cur is not None: + if l.startswith('--- '): out[cur]='\n'.join(buf); cur=None; continue + if l.startswith('+'): buf.append(l[1:]) +if cur: out[cur]='\n'.join(buf) +for k,v in sorted(out.items()): open(k,'w').write(v); print(' извлёк', k, f'({len(v.splitlines())} строк)') +PY +echo ">> готово: pe64.s efi.h mem.h (референс 9legacy)" |
