Fix ARM64 ISO: mkfs.fat PATH wrapper to guarantee EFI FAT headroom
Replace the fragile Python regex patch (which failed to match the actual awk variable name in mkarchiso) with a mkfs.fat wrapper script placed earlier in PATH. The wrapper intercepts every -C (create) invocation and adds +128 MiB (131072 KiB) to the size argument, ensuring the ~50 MB ARM64 kernel Image + FAT filesystem overhead fits regardless of which exact size formula the installed mkarchiso version uses. Also adds a grep of mkarchiso's size lines to stdout so the formula is visible in build logs for future debugging. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
bdfc6008fc
commit
e56412ecdd
1 file changed
+26
-25
@@ -657,9 +657,9 @@ echo "=== /usr/lib/modules/ ==="
|
|||||||
ls /usr/lib/modules/ 2>&1 || echo "(empty)"
|
ls /usr/lib/modules/ 2>&1 || echo "(empty)"
|
||||||
echo "=== end diagnostics ==="
|
echo "=== end diagnostics ==="
|
||||||
|
|
||||||
# ALARM aarch64 sometimes installs the kernel as /boot/Image (uncompressed EFI
|
# ALARM aarch64 may install the kernel as /boot/Image (uncompressed EFI
|
||||||
# stub) rather than /boot/vmlinuz-linux-aarch64. Archiso's vmlinuz glob and
|
# stub) rather than /boot/vmlinuz-linux-aarch64. Archiso's vmlinuz-* glob
|
||||||
# systemd-boot both expect the vmlinuz-* naming — create a symlink when needed.
|
# and systemd-boot both expect the vmlinuz-* naming — create a symlink.
|
||||||
if [[ ! -f /boot/vmlinuz-linux-aarch64 ]]; then
|
if [[ ! -f /boot/vmlinuz-linux-aarch64 ]]; then
|
||||||
if [[ -f /boot/Image ]]; then
|
if [[ -f /boot/Image ]]; then
|
||||||
ln -sf Image /boot/vmlinuz-linux-aarch64
|
ln -sf Image /boot/vmlinuz-linux-aarch64
|
||||||
@@ -729,28 +729,29 @@ echo "OrionOS ARM64 customization complete."
|
|||||||
CUSTOMIZE
|
CUSTOMIZE
|
||||||
chmod 755 "$PROFILE/airootfs/root/customize_airootfs.sh"
|
chmod 755 "$PROFILE/airootfs/root/customize_airootfs.sh"
|
||||||
|
|
||||||
# ── 13. Patch mkarchiso EFI FAT image size ───────────────────────────
|
# ── 13. Fix EFI FAT image size for the large ARM64 kernel ────────────
|
||||||
# The ARM64 kernel (Image) is ~50 MB. mkarchiso's default size formula is
|
# mkarchiso calculates EFI FAT image size as roughly (kernel+initramfs MiB)+N
|
||||||
# int(total_bytes/1024/1024)+2 MiB, which leaves no room for FAT overhead
|
# but the ARM64 kernel Image is ~50 MB and FAT filesystem overhead pushes
|
||||||
# and causes "Disk full". Bump the buffer to +128 MiB.
|
# the total over the calculated limit → "Disk full".
|
||||||
python3 - <<'PYEOF'
|
#
|
||||||
import re, sys
|
# Strategy: put a mkfs.fat wrapper earlier in PATH that transparently adds
|
||||||
with open('/usr/bin/mkarchiso') as f:
|
# +128 MiB to every -C (create) call. This works regardless of which exact
|
||||||
txt = f.read()
|
# formula the installed mkarchiso version uses.
|
||||||
orig = txt
|
cat > /usr/local/bin/mkfs.fat <<'MKFAT'
|
||||||
# Match: int($1 / 1024 / 1024) + N (with any spacing or small N)
|
#!/usr/bin/bash
|
||||||
txt = re.sub(
|
args=("$@")
|
||||||
r'int\(\$1\s*/\s*1024\s*/\s*1024\s*\)\s*\+\s*\d+',
|
# When creating (-C) the EFI FAT image, add 128 MiB to the requested size
|
||||||
r'int($1 / 1024 / 1024) + 128',
|
if [[ " ${args[*]} " == *" -C "* ]] && [[ "${args[-1]}" =~ ^[0-9]+$ ]]; then
|
||||||
txt
|
args[-1]=$(( ${args[-1]} + 131072 )) # +128 MiB in KiB blocks
|
||||||
)
|
fi
|
||||||
if txt == orig:
|
exec /usr/bin/mkfs.fat "${args[@]}"
|
||||||
print('mkarchiso: FAT size pattern not found — build may fail with Disk full', file=sys.stderr)
|
MKFAT
|
||||||
else:
|
chmod +x /usr/local/bin/mkfs.fat
|
||||||
with open('/usr/bin/mkarchiso', 'w') as f:
|
export PATH="/usr/local/bin:$PATH"
|
||||||
f.write(txt)
|
echo ">>> mkfs.fat wrapper active — EFI FAT creation gets +128 MiB headroom"
|
||||||
print('mkarchiso: patched EFI FAT size buffer to +128 MiB')
|
echo ">>> mkarchiso EFI size lines (for reference):"
|
||||||
PYEOF
|
grep -n "1024.*1024\|fat.*size\|efi.*size\|img_size" /usr/bin/mkarchiso 2>/dev/null \
|
||||||
|
| grep -iv "^[0-9]*:#\|comment" | head -8 || true
|
||||||
|
|
||||||
# ── 14. Build the ISO ─────────────────────────────────────────────────
|
# ── 14. Build the ISO ─────────────────────────────────────────────────
|
||||||
echo ">>> Building ARM64 ISO (this takes 5-15 minutes)..."
|
echo ">>> Building ARM64 ISO (this takes 5-15 minutes)..."
|
||||||
|
|||||||
Reference in new issue
Block a user