52 lines
1.6 KiB
Bash
Executable File
52 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
# build-iso.sh — assemble a Keru OS ISO from the built rootfs and kernel
|
|
#
|
|
# From-scratch approach (no archiso): we lay out the classic isohybrid
|
|
# structure manually, squash the rootfs, and generate the ISO with xorriso +
|
|
# isolinux/syslinux (or syslinux's isohybrid). This is the LFS/Debian-live
|
|
# style path.
|
|
#
|
|
# Requires on the build host: xorriso, squashfs-tools, syslinux/isolinux.
|
|
|
|
set -eu
|
|
. "$(dirname "$0")/common.sh"
|
|
|
|
ROOT="${ROOT:-/tmp/keru/root}" # target rootfs (from make.conf)
|
|
ISO_OUT="${ISO_OUT:-$KERU_ROOT/iso/keru-$(date +%Y%m%d).iso}"
|
|
WORK="$KERU_ROOT/iso/work"
|
|
ISOIMG="$WORK/isolinux"
|
|
|
|
info "building Keru ISO -> $ISO_OUT"
|
|
[ -d "$ROOT" ] || die "rootfs not found at $ROOT (run build-root.sh first)"
|
|
|
|
have xorriso || die "xorriso not installed"
|
|
have mksquashfs || die "squashfs-tools not installed"
|
|
|
|
rm -rf "$WORK"; mkdir -p "$ISOIMG"
|
|
info "generating isolinux config"
|
|
cp /usr/lib/syslinux/bios/isolinux.bin "$ISOIMG/" || true
|
|
cp /usr/lib/syslinux/bios/ldlinux.c32 "$ISOIMG/" || true
|
|
cat > "$ISOIMG/isolinux.cfg" <<'EOF'
|
|
UI vesamenu.c32
|
|
DEFAULT keru
|
|
LABEL keru
|
|
LINUX /boot/vmlinuz-keru
|
|
INITRD /boot/initramfs-keru.img
|
|
APPEND root=live:LABEL=KERU_LIVE toram quiet
|
|
EOF
|
|
|
|
info "packing rootfs into squashfs"
|
|
mksquashfs "$ROOT" "$WORK/keru.sfs" -noappend -comp xz
|
|
|
|
info "writing ISO (isohybrid)"
|
|
xorriso -as mkisofs \
|
|
-o "$ISO_OUT" \
|
|
-V KERU_LIVE \
|
|
-b isolinux/isolinux.bin \
|
|
-c isolinux/boot.cat \
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
|
-isohybrid-mbr /usr/lib/syslinux/bios/isohdpfx.bin \
|
|
"$WORK"
|
|
|
|
info "done: $ISO_OUT"
|