grub: Use common grub.cfg for grub-pc and grub-efi
This commit is contained in:
parent
aa12c024f9
commit
dfa67141d8
@ -4,6 +4,7 @@ insmod minicmd
|
||||
insmod normal
|
||||
insmod test
|
||||
set timeout=@timeout@
|
||||
if [ "$grub_platform" = "efi" ]; then set EFI_BOOTARGS='@efi_bootargs@'; fi
|
||||
if [ "$grub_platform" = "efi" -a "$grub_cpu" = "x86_64" ]; then
|
||||
set linux_suffix='efi'
|
||||
fi
|
||||
|
@ -3,7 +3,7 @@ default='linux'
|
||||
|
||||
menuentry $"Install "'@distro@' --hotkey 'i' --id 'linux' {
|
||||
echo $"Loading Linux vmlinuz$KFLAVOUR ..."
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ @efi_bootargs@ lang=$lang
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ $EFI_BOOTARGS lang=$lang
|
||||
echo $"Loading initial ramdisk ..."
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
menuentry $"VNC install "'@distro@'$" (edit to set server IP address)" --id 'vncconnect' {
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ @efi_bootargs@ headless no_alt_virt_keyboard vncconnect=IP lang=$lang
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ $EFI_BOOTARGS headless no_alt_virt_keyboard vncconnect=IP lang=$lang
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
menuentry $"VNC install "'@distro@'$" (edit to set password and connect here)" --id 'vncpasswd' {
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ @efi_bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD lang=$lang
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ $EFI_BOOTARGS headless no_alt_virt_keyboard vncpassword=VNCPWD lang=$lang
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
menuentry $"LiveCD (no hard disk needed)" --id 'live' {
|
||||
echo $"Loading Linux vmlinuz$KFLAVOUR ..."
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ @efi_bootargs@ lang=$lang
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ $EFI_BOOTARGS lang=$lang
|
||||
echo $"Loading initial ramdisk ..."
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
menuentry $"LiveCD with sessions support" --id 'session' {
|
||||
echo $"Loading Linux vmlinuz$KFLAVOUR ..."
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@ @efi_bootargs@ lang=$lang
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@ $EFI_BOOTARGS lang=$lang
|
||||
echo $"Loading initial ramdisk ..."
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
menuentry $"Rescue LiveCD" --id 'rescue' {
|
||||
echo $"Loading Linux vmlinuz$KFLAVOUR ..."
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ @efi_bootargs@
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ $EFI_BOOTARGS
|
||||
echo $"Loading initial ramdisk ..."
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
menuentry $"Rescue with sessions support" --id 'rescue_session' {
|
||||
echo $"Loading Linux vmlinuz$KFLAVOUR ..."
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom,label:ALT* ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ @efi_bootargs@ live_rw
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom,label:ALT* ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ $EFI_BOOTARGS live_rw
|
||||
echo $"Loading initial ramdisk ..."
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
menuentry $"Forensic mode (leave disks alone)" --id 'rescue_forensic' {
|
||||
echo $"Loading Linux vmlinuz$KFLAVOUR ..."
|
||||
linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ @efi_bootargs@ max_loop=16 forensic hash=@rescue_hash@
|
||||
linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ $EFI_BOOTARGS max_loop=16 forensic hash=@rescue_hash@
|
||||
echo $"Loading initial ramdisk ..."
|
||||
initrd$linux_suffix @boot_path@/full.cz
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
menuentry $"Rescue with remote SSH access (DHCP)" --id 'rescue_remote' {
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ @efi_bootargs@ max_loop=16 ip=dhcp port=22 rootpw=AUTO hash=@rescue_hash@
|
||||
linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ $EFI_BOOTARGS max_loop=16 ip=dhcp port=22 rootpw=AUTO hash=@rescue_hash@
|
||||
echo $"Loading initial ramdisk ..."
|
||||
initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
menuentry $"Check this media for defects" --id 'mediachk' {
|
||||
linux$linux_suffix @boot_path@/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@ @efi_bootargs@
|
||||
linux$linux_suffix @boot_path@/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@ $EFI_BOOTARGS
|
||||
initrd$linux_suffix @boot_path@/full.cz
|
||||
}
|
||||
|
5
features.in/grub/cfg.in/91shell_efi.cfg
Normal file
5
features.in/grub/cfg.in/91shell_efi.cfg
Normal file
@ -0,0 +1,5 @@
|
||||
if [ "$grub_platform" = "efi" ]; then
|
||||
menuentry $"Memory Test" --id 'memtest' {
|
||||
chainloader /EFI/tools/efi-shell.efi
|
||||
}
|
||||
fi
|
@ -16,6 +16,7 @@ use/grub/ui/%: use/grub
|
||||
@$(call set,GRUB_UI,$*)
|
||||
@if [ "$*" == gfxboot ]; then \
|
||||
$(call add,STAGE1_BRANDING,bootloader); \
|
||||
$(call add,STAGE1_PACKAGES,grub-common); \
|
||||
fi
|
||||
|
||||
use/grub/%.cfg: use/grub
|
||||
|
@ -73,12 +73,12 @@ distro: bootargs
|
||||
# pass over additional parameters, if any
|
||||
bootargs: clean
|
||||
@if [ -n "$(EFI_BOOTARGS)" ]; then \
|
||||
echo "$(EFI_BOOTARGS)" > $(DSTDIR)/EFI_BOOTARGS; \
|
||||
fi
|
||||
sed -i "s,@efi_bootargs@,$(EFI_BOOTARGS)," $(DSTCFGS); \
|
||||
fi; \
|
||||
sed -i "s,@efi_bootargs@,," $(DSTCFGS)
|
||||
@if [ -n "$(STAGE2_BOOTARGS)" ]; then \
|
||||
sed -i "s,$(STAGE2_BOOTARGS),," $(DSTCFGS); \
|
||||
sed -i "s,@bootargs@,$(STAGE2_BOOTARGS)," $(DSTCFGS); \
|
||||
[ -f $(DSTDIR)/EFI_BOOTARGS ] && \
|
||||
sed -i "s/$(STAGE2_BOOTARGS)//" $(DSTDIR)/EFI_BOOTARGS; \
|
||||
fi; \
|
||||
sed -i "s,@bootargs@,," $(DSTCFGS)
|
||||
@if [ -n "$(RESCUE_BOOTARGS)" ]; then \
|
||||
|
@ -1,20 +1,17 @@
|
||||
#!/bin/sh
|
||||
# postprocess isolinux configuration
|
||||
# postprocess grub configuration
|
||||
# when the image sizes are finally known
|
||||
# NB: install2_size, live_size, rescue_size get defined here
|
||||
|
||||
cd "$WORKDIR"
|
||||
cfg='boot/grub/grub.cfg'
|
||||
|
||||
[ -f boot/grub/grub.cfg -o -f EFI/BOOT/grub.cfg ] || exit 0
|
||||
|
||||
cfgs=
|
||||
[ ! -f boot/grub/grub.cfg ] || cfgs+='boot/grub/grub.cfg '
|
||||
[ ! -f EFI/BOOT/grub.cfg ] || cfgs+='EFI/BOOT/grub.cfg'
|
||||
[ -f "$cfg" ] || exit 0
|
||||
|
||||
# apply size census while looking for potential squashfs images
|
||||
find -maxdepth 1 -type f -size +1M \
|
||||
| sed 's,^\./,,' \
|
||||
| while read image; do
|
||||
size="$[ $(stat -c%s "$image") / 1024 + 1 ]"
|
||||
sed -i "s,@${image}_size@,$size," $cfgs
|
||||
sed -i "s,@${image}_size@,$size," $cfg
|
||||
done
|
||||
|
@ -1,18 +1,15 @@
|
||||
#!/bin/sh
|
||||
# postprocess isolinux configuration
|
||||
# postprocess grub configuration
|
||||
# to add rescue image hash, if any
|
||||
# (for propagator in forensic mode)
|
||||
|
||||
cd "$WORKDIR"
|
||||
cfg='boot/grub/grub.cfg'
|
||||
|
||||
[ -f boot/grub/grub.cfg -o -f EFI/BOOT/grub.cfg ] || exit 0
|
||||
|
||||
cfgs=
|
||||
[ ! -f boot/grub/grub.cfg ] || cfgs+='boot/grub/grub.cfg '
|
||||
[ ! -f EFI/BOOT/grub.cfg ] || cfgs+='EFI/BOOT/grub.cfg'
|
||||
[ -f "$cfg" ] || exit 0
|
||||
|
||||
find -maxdepth 1 -type f -name rescue \
|
||||
| while read image; do
|
||||
rescue_hash="$(sha256sum -b "$image" | cut -f1 -d' ')"
|
||||
sed -i "s,@rescue_hash@,$rescue_hash," $cfgs
|
||||
sed -i "s,@rescue_hash@,$rescue_hash," $cfg
|
||||
done
|
||||
|
@ -3,16 +3,8 @@
|
||||
# copy modules; see also this feature's generate.mk
|
||||
|
||||
CFG="$WORKDIR/boot/grub/grub.cfg"
|
||||
CFG_EFI="$WORKDIR/EFI/BOOT/grub.cfg"
|
||||
|
||||
|
||||
|
||||
if [ -n "$GLOBAL_EFI_BOOTLOADER" -a ! "$GLOBAL_EFI_BOOTLOADER" = "grub-efi" ]; then
|
||||
rm -fr "$WORKDIR/boot"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$GLOBAL_EFI_BOOTLOADER" ]; then
|
||||
if [ "$GLOBAL_EFI_BOOTLOADER" != 'grub-efi' ]; then
|
||||
case "$GLOBAL_BOOTLOADER" in
|
||||
ieee1275boot|grubpcboot) ;;
|
||||
*) rm -fr "$WORKDIR/boot"
|
||||
@ -29,17 +21,7 @@ if [ -n "${GRUB_FILES% }" ]; then
|
||||
fi
|
||||
|
||||
# number ordering sponsored by shell's pathname expansion
|
||||
case "$GLOBAL_BOOTLOADER" in
|
||||
ieee1275boot)
|
||||
grep -hv '^#' $(find .in/*.cfg -not -name *_efi.cfg -not -name *_bios.cfg) > "$CFG" ;;
|
||||
grubpcboot)
|
||||
grep -hv '^#' $(find .in/*.cfg -not -name *_efi.cfg) > "$CFG" ;;
|
||||
esac
|
||||
|
||||
if [ "$GLOBAL_EFI_BOOTLOADER" = "grub-efi" ]; then
|
||||
mkdir -p "$WORKDIR/EFI/BOOT"
|
||||
grep -hv '^#' $(find .in/*.cfg -not -name *_bios.cfg) > "$CFG_EFI"
|
||||
fi
|
||||
grep -hv '^#' $(find .in/*.cfg) > "$CFG"
|
||||
|
||||
# there should be DEFAULT directive there (at least for alterator-netinst)
|
||||
default_change() {
|
||||
@ -65,30 +47,20 @@ if ! grep -i '^default' "$CFG"; then
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f "$CFG" ]; then
|
||||
default_change "$CFG"
|
||||
sed -i 's,@boot_path@,/boot,g' "$CFG"
|
||||
sed -i 's,@efi_bootargs@,,g' "$CFG"
|
||||
fi
|
||||
default_change "$CFG"
|
||||
|
||||
if [ -f .in/EFI_BOOTARGS ]; then
|
||||
EFI_BOOTARGS=$(cat .in/EFI_BOOTARGS)
|
||||
fi
|
||||
case "$GLOBAL_BOOTLOADER" in
|
||||
ieee1275boot|grubpcboot)
|
||||
BOOT_PATH=/boot;;
|
||||
*)
|
||||
BOOT_PATH=/EFI/BOOT;;
|
||||
esac
|
||||
|
||||
if [ -f "$CFG_EFI" ]; then
|
||||
default_change "$CFG_EFI"
|
||||
sed -i 's,@boot_path@,/EFI/BOOT,g' "$CFG_EFI"
|
||||
[ -n "$EFI_BOOTARGS" ] &&
|
||||
sed -i "s,@efi_bootargs@,$EFI_BOOTARGS,g" "$CFG_EFI"
|
||||
sed -i "s, @efi_bootargs@,,g" "$CFG_EFI"
|
||||
fi
|
||||
sed -i "s,@boot_path@,$BOOT_PATH,g" "$CFG"
|
||||
|
||||
# snippets are not going into the actual image
|
||||
if [ "$DEBUG" != 2 ]; then
|
||||
rm -r .in/
|
||||
cd $WORKDIR
|
||||
[ -f "$CFG" ] || rm -r boot/grub
|
||||
[ ! $(ls -A boot/ | wc -l) -eq 0 ] || rm -r boot/
|
||||
fi
|
||||
|
||||
# NB: there will be final macro expansion based on actual image sizes
|
||||
|
Loading…
Reference in New Issue
Block a user