fix installer
This commit is contained in:
parent
7b5df8d41b
commit
b8fd538073
1 changed files with 22 additions and 4 deletions
|
|
@ -184,21 +184,39 @@ MUSL_LOADER="$TOOLS_LIB/ld-musl-x86_64.so.1"
|
|||
GRUB_MKIMAGE="$STAGE/tools/grub-mkimage"
|
||||
GRUB_BIOS_SETUP="$STAGE/tools/grub-bios-setup"
|
||||
GRUB_EDITENV="$STAGE/tools/grub-editenv"
|
||||
GRUB_MODDIR="$STAGE/tools/grub/i386-pc"
|
||||
GRUB_MODDIR_SRC="$STAGE/tools/grub/i386-pc"
|
||||
GRUB_EMBED_CFG="$STAGE/tools/embed.cfg"
|
||||
GRUB_MODULES_FILE="$STAGE/tools/grub-modules.txt"
|
||||
for f in "$MUSL_LOADER" "$GRUB_MKIMAGE" "$GRUB_BIOS_SETUP" "$GRUB_EDITENV" "$GRUB_EMBED_CFG" "$GRUB_MODULES_FILE"; do
|
||||
[ -f "$f" ] || die "bundled installer tool $f missing from release tarball (rebuild with a current build-image.sh)"
|
||||
done
|
||||
[ -d "$GRUB_MODDIR" ] || die "bundled GRUB i386-pc module dir missing from release tarball"
|
||||
[ -d "$GRUB_MODDIR_SRC" ] || die "bundled GRUB i386-pc module dir missing from release tarball"
|
||||
chmod +x "$MUSL_LOADER" "$GRUB_MKIMAGE" "$GRUB_BIOS_SETUP" "$GRUB_EDITENV"
|
||||
|
||||
run_tool() {
|
||||
"$MUSL_LOADER" --library-path "$TOOLS_LIB" "$@"
|
||||
}
|
||||
|
||||
# grub-bios-setup insists on resolving --directory (and --core-image,
|
||||
# which it always joins onto --directory itself, even when given as an
|
||||
# absolute path -- see the core.img naming below) down to a real
|
||||
# underlying block device, to work out how to embed core.img -- staging
|
||||
# them under $STAGE (tmpfs, /tmp) fails with "failed to get canonical
|
||||
# path of `tmpfs'" since tmpfs has no backing block device. Installing
|
||||
# the module dir onto the just-formatted, really-mounted ALPINEDATA
|
||||
# partition first (the same location grub.cfg's own $prefix points at,
|
||||
# so this also happens to match a normal grub-install layout) sidesteps
|
||||
# that entirely.
|
||||
GRUB_MODDIR="$DATA_MNT/boot/grub/i386-pc"
|
||||
mkdir -p "$GRUB_MODDIR"
|
||||
cp -a "$GRUB_MODDIR_SRC/." "$GRUB_MODDIR/"
|
||||
|
||||
log "building GRUB BIOS core image (prefix on the data partition's /boot/grub)"
|
||||
CORE_IMG="$STAGE/core.img"
|
||||
# core.img has to actually live inside $GRUB_MODDIR, not just be
|
||||
# referenced by absolute path -- grub-bios-setup joins --directory and
|
||||
# --core-image itself regardless.
|
||||
CORE_IMG_NAME="core.img"
|
||||
CORE_IMG="$GRUB_MODDIR/$CORE_IMG_NAME"
|
||||
GRUB_MODULES=$(cat "$GRUB_MODULES_FILE")
|
||||
# shellcheck disable=SC2086
|
||||
run_tool "$GRUB_MKIMAGE" \
|
||||
|
|
@ -212,7 +230,7 @@ run_tool "$GRUB_MKIMAGE" \
|
|||
log "installing GRUB to the MBR + post-MBR gap (BIOS boot)"
|
||||
run_tool "$GRUB_BIOS_SETUP" \
|
||||
--directory="$GRUB_MODDIR" \
|
||||
--core-image="$CORE_IMG" \
|
||||
--core-image="$CORE_IMG_NAME" \
|
||||
--skip-fs-probe \
|
||||
"$DEVICE"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue