From d9dca6cb1a3cd2cb18d5f37863cba550f418888a Mon Sep 17 00:00:00 2001 From: Anton Midyukov Date: Sun, 21 Mar 2021 19:09:42 +0700 Subject: [PATCH] doc, grub, stage1, stage2: Add support multiple kernels for grub only At the moment, the ability to select the kernel with which to boot is implemented only for grub (grub-pc, grub-efi, ieee1275boot). note that renamed STAGE1_KFLAVOUR to STAGE1_KFLAVOURS, as multiple kernels can now be added. --- doc/assumptions.txt | 5 ++-- doc/pkglists.txt | 6 ++-- features.in/grub/cfg.in/20install2.cfg | 4 +-- .../grub/cfg.in/25install-vnc-connect.cfg | 4 +-- .../grub/cfg.in/25install-vnc-listen.cfg | 4 +-- features.in/grub/cfg.in/30live.cfg | 4 +-- features.in/grub/cfg.in/32live_rw.cfg | 4 +-- features.in/grub/cfg.in/80rescue.cfg | 4 +-- features.in/grub/cfg.in/82rescue_rw.cfg | 4 +-- features.in/grub/cfg.in/83rescue_fm.cfg | 4 +-- features.in/grub/cfg.in/84rescue_remote.cfg | 4 +-- features.in/grub/cfg.in/85mediacheck.cfg | 4 +-- features.in/grub/generate.mk | 3 -- features.in/grub/stage1/scripts.d/01-grub | 23 +++++++++------ .../stage1/scripts.d/90-build-propagator | 29 +++++++++---------- .../stage2/stage1/scripts.d/95-copy-kernel | 15 +++++----- sub.in/stage1/Makefile | 25 +++++++++++----- sub.in/stage1/README | 11 +++---- sub.in/stage2/Makefile | 23 +++++++++++---- 19 files changed, 101 insertions(+), 79 deletions(-) diff --git a/doc/assumptions.txt b/doc/assumptions.txt index 9ec74b68..22d833c2 100644 --- a/doc/assumptions.txt +++ b/doc/assumptions.txt @@ -32,9 +32,8 @@ NB: пути приводятся от верхнего уровня; проек * features.in/kernel/stage1/scripts.d/80-make-initrd * features.in/stage2/stage1/scripts.d/03-test-kernel * sub.in/stage1/Makefile -** ожидают, что в stage1 попадёт строго одно ядро сообразно - явному указанию в STAGE1_KFLAVOUR (либо последнее указанное - в KFLAVOURS) +** если используется загрузчик отличный от grub, то в stage1 попадёт + последнее ядро, указанное в STAGE1_KFLAVOURS или KFLAVOURS ** если добавить какой-либо kernel-image в STAGE1_PACKAGES*, результат может быть неожиданным ** обратите внимание: bin/tar2fs умеет несколько ядер diff --git a/doc/pkglists.txt b/doc/pkglists.txt index 4b3c0ed3..530dd40d 100644 --- a/doc/pkglists.txt +++ b/doc/pkglists.txt @@ -18,7 +18,8 @@ ** SYSTEM_PACKAGES, STAGE2_PACKAGES ** STAGE1_KMODULES, STAGE1_KMODULES_REGEXP, STAGE2_KMODULES, STAGE2_KMODULES_REGEXP -*** STAGE1_KFLAVOUR или последний из KFLAVOURS +*** STAGE1_KFLAVOURS или KFLAVOURS для grub, для других загрузчиков + последний из STAGE1_KFLAVOURS или KFLAVOURS * install2: компактная "живая" система, содержащая только инсталятор ** см. stage2 @@ -47,4 +48,5 @@ ** STAGE1_PACKAGES, SYSTEM_PACKAGES ** STAGE1_PACKAGES_REGEXP ** STAGE1_KMODULES_REGEXP -*** STAGE1_KFLAVOUR или последний из KFLAVOURS +*** STAGE1_KFLAVOURS или KFLAVOURS для grub, для других загрузчиков + последний из STAGE1_KFLAVOURS или KFLAVOURS diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg index c863e863..c7077abf 100644 --- a/features.in/grub/cfg.in/20install2.cfg +++ b/features.in/grub/cfg.in/20install2.cfg @@ -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/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 + initrd$linux_suffix /boot/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg index 256b5836..06fc2336 100644 --- a/features.in/grub/cfg.in/25install-vnc-connect.cfg +++ b/features.in/grub/cfg.in/25install-vnc-connect.cfg @@ -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 - initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz + linux$linux_suffix /boot/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/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg index 27c4fa06..dd99b84b 100644 --- a/features.in/grub/cfg.in/25install-vnc-listen.cfg +++ b/features.in/grub/cfg.in/25install-vnc-listen.cfg @@ -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 - initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz + linux$linux_suffix /boot/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/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg index 905b896d..c5b10668 100644 --- a/features.in/grub/cfg.in/30live.cfg +++ b/features.in/grub/cfg.in/30live.cfg @@ -1,8 +1,8 @@ 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/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 + initrd$linux_suffix /boot/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg index 45fb0617..53f2342e 100644 --- a/features.in/grub/cfg.in/32live_rw.cfg +++ b/features.in/grub/cfg.in/32live_rw.cfg @@ -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/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 + initrd$linux_suffix /boot/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg index 95810e55..2a7d744d 100644 --- a/features.in/grub/cfg.in/80rescue.cfg +++ b/features.in/grub/cfg.in/80rescue.cfg @@ -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/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 + initrd$linux_suffix /boot/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg index b8c3fc53..ea8467c7 100644 --- a/features.in/grub/cfg.in/82rescue_rw.cfg +++ b/features.in/grub/cfg.in/82rescue_rw.cfg @@ -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/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 + initrd$linux_suffix /boot/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/83rescue_fm.cfg b/features.in/grub/cfg.in/83rescue_fm.cfg index 224d50f3..2866e3ab 100644 --- a/features.in/grub/cfg.in/83rescue_fm.cfg +++ b/features.in/grub/cfg.in/83rescue_fm.cfg @@ -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/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 + initrd$linux_suffix /boot/full.cz } diff --git a/features.in/grub/cfg.in/84rescue_remote.cfg b/features.in/grub/cfg.in/84rescue_remote.cfg index 21bf00d2..404aab63 100644 --- a/features.in/grub/cfg.in/84rescue_remote.cfg +++ b/features.in/grub/cfg.in/84rescue_remote.cfg @@ -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/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 + initrd$linux_suffix /boot/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/85mediacheck.cfg b/features.in/grub/cfg.in/85mediacheck.cfg index 11d8ea4e..d492ef2a 100644 --- a/features.in/grub/cfg.in/85mediacheck.cfg +++ b/features.in/grub/cfg.in/85mediacheck.cfg @@ -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 - initrd$linux_suffix @boot_path@/full.cz + linux$linux_suffix /boot/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@ $EFI_BOOTARGS + initrd$linux_suffix /boot/full.cz } diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk index 42984279..e1a686b6 100644 --- a/features.in/grub/generate.mk +++ b/features.in/grub/generate.mk @@ -99,9 +99,6 @@ bootargs: clean sed -i "s, lang=.lang,,g" $(DSTCFGS); \ fi; \ sed -i "/lang=@LOCALE@/d" $(DSTCFGS) - @if [ $$(echo $(KFLAVOURS) | wc -w) -gt 1 ]; then \ - sed -i "s,@KFLAVOUR@,$(KFLAVOURS),g" $(DSTCFGS); \ - fi GRUBTHEME=$(GRUBTHEME); \ [ -n "$$GRUBTHEME" ] || GRUBTHEME=$$(cut -d "-" -f2 <<< $(BRANDING)); \ sed -i "s,@grubtheme@,$$GRUBTHEME,g" $(DSTCFGS) diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub index f27140ea..f4a365bf 100755 --- a/features.in/grub/stage1/scripts.d/01-grub +++ b/features.in/grub/stage1/scripts.d/01-grub @@ -49,20 +49,25 @@ fi default_change "$CFG" -case "$GLOBAL_BOOTLOADER" in - ieee1275boot|grubpcboot) - BOOT_PATH=/boot;; - *) - BOOT_PATH=/EFI/BOOT;; -esac - -sed -i "s,@boot_path@,$BOOT_PATH,g" "$CFG" - # snippets are not going into the actual image if [ "$DEBUG" != 2 ]; then rm -r .in/ fi +# change kernels version for multiple kernels only +if [ $(echo "$GLOBAL_KFLAVOURS" | wc -w) -gt 1 ]; then + kver= + echo $GLOBAL_KFLAVOURS + for KFLAVOUR in $GLOBAL_KFLAVOURS; do + kver+=" $(rpm -qa 'kernel-image*' \ + --qf '%{version}-%{name}-%{release}\n' \ + | grep "$KFLAVOUR" \ + | sed 's/kernel-image-//')" + done + + sed -i "s,@KFLAVOUR@,$kver,g" $CFG +fi + # copy grub theme mkdir -p themes GRUBTHEME="$(grep -m1 '/theme.txt;' "$CFG" |rev | cut -f2 -d '/' |rev)" diff --git a/features.in/stage2/stage1/scripts.d/90-build-propagator b/features.in/stage2/stage1/scripts.d/90-build-propagator index 8a39a599..7e278aca 100755 --- a/features.in/stage2/stage1/scripts.d/90-build-propagator +++ b/features.in/stage2/stage1/scripts.d/90-build-propagator @@ -11,23 +11,20 @@ case "`arch`" in ;; esac -if [ -L /boot/$kname ]; then - kimage="$(readlink -mv /boot/$kname)" -else - kimage="$(find /boot -type f -name "$kname-*" -print -quit)" -fi -kver="${kimage#/boot/$kname-}" +kimage="$(find /boot -type f -name "$kname-*")" -mkmodpack -p /.in/modules -o /tmp/modules -k "$kver" +rm -f /boot/full*.cz -rm -f /boot/full.cz +for kver in $kimage; do + kver="${kver#/boot/$kname-}" + mkmodpack -p /.in/modules -o /tmp/modules-"$kver" -k "$kver" + cat "$libdir/propagator/initfs" /tmp/modules-"$kver" > /boot/full-"$kver".cz -[ ! -f /tmp/modules ] || - cat "$libdir/propagator/initfs" /tmp/modules > /boot/full.cz + sed \ + -e "s,@LIBDIR@,$libdir," \ + -e "s,@TMPDIR@,/tmp,g" \ + < "$WORKDIR/initfs" | + gencpio - | + gzip -c >> /boot/full-"$kver".cz -sed \ - -e "s,@LIBDIR@,$libdir," \ - -e "s,@TMPDIR@,/tmp,g" \ - < "$WORKDIR/initfs" | - gencpio - | - gzip -c >> /boot/full.cz +done diff --git a/features.in/stage2/stage1/scripts.d/95-copy-kernel b/features.in/stage2/stage1/scripts.d/95-copy-kernel index 9d033ec3..75460413 100755 --- a/features.in/stage2/stage1/scripts.d/95-copy-kernel +++ b/features.in/stage2/stage1/scripts.d/95-copy-kernel @@ -14,15 +14,16 @@ esac if [ -L "/boot/$kname" ]; then kimage="$(readlink -ev /boot/$kname)" -else - kimage="$(find /boot -type f -name "$kname-*" -print -quit)" + kverdef="${kimage#/boot/$kname-}" fi -if [ -n "$kimage" ]; then - cp -af "$kimage" boot/$kname - [ ! -f /boot/full.cz ] || - cp -af /boot/full.cz boot/full.cz -fi +kimage="$(find /boot -type f -name "$kname-*")" +propagator="$(find /boot -type f -name 'full-*.cz')" + +cp $verbose -af $kimage boot/ +mv boot/$kname-$kverdef boot/$kname +cp $verbose -af $propagator boot/ +mv boot/full-$kverdef.cz boot/full.cz # config is generated in mkimage case "$GLOBAL_EFI_BOOTLOADER" in diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile index 4e5b01ed..bd5e418f 100644 --- a/sub.in/stage1/Makefile +++ b/sub.in/stage1/Makefile @@ -19,16 +19,25 @@ COPY_TREE = ./files include $(MKIMAGE_PREFIX)/targets.mk # here we try and come up with the installer kernel/modules, if any; -# only a single kernel might be needed (STAGE1_KFLAVOUR sets explicitly); -# kernel image copied from instrumental chroot into .work/syslinux/alt0/ - -STAGE1_KFLAVOUR ?= $(lastword $(KFLAVOURS)) +# only for grub allowed multiple kernels, for other a single kernel +# might be needed (STAGE1_KFLAVOURS sets explicitly); +# kernel image copied from instrumental chroot into .work/boot/ +ifeq (grubpcboot,$(BOOTLOADER)) +STAGE1_KFLAVOURS ?= $(KFLAVOURS) +endif +ifeq (grub-efi,$(EFI_BOOTLOADER)) +STAGE1_KFLAVOURS ?= $(KFLAVOURS) +endif +ifeq (ieee1275boot,$(BOOTLOADER)) +STAGE1_KFLAVOURS ?= $(KFLAVOURS) +endif +STAGE1_KFLAVOURS ?= $(lastword $(KFLAVOURS)) # propagator needed iff stage1 kernel installed (not for e.g. syslinux.iso) -ifneq "$(STAGE1_KFLAVOUR)" "" -GLOBAL_STAGE1_KFLAVOUR := $(STAGE1_KFLAVOUR) +ifneq "$(STAGE1_KFLAVOURS)" "" +GLOBAL_STAGE1_KFLAVOURS := $(STAGE1_KFLAVOURS) CHROOT_PACKAGES_REGEXP := $(call kpackages, \ - $(STAGE1_KFLAVOUR),$(STAGE1_KMODULES),$(STAGE1_KMODULES_REGEXP)) + $(STAGE1_KFLAVOURS),$(STAGE1_KMODULES),$(STAGE1_KMODULES_REGEXP)) ifneq "$(findstring stage2,$(SUBPROFILES))" "" ### assumes stage2 ~ propagator LIST_MODULES = .work/chroot/.in/modules PREPARE_MODULES = prepare-modules @@ -45,7 +54,7 @@ GLOBAL_SQUASHFS := $(SQUASHFS) prepare-modules: @echo $(foreach V,$(STAGE1_MODLISTS),$(wildcard modules.d/??-$(V))) \ - | xargs -r -- cat >> $(PROPAGATOR_MAR_MODULES) + | xargs -r -- cat >> $(LIST_MODULES) # scripts prepare bootloader configuration, too # NB: we pass tested squashfs options for sub.in/stage2/Makefile to include diff --git a/sub.in/stage1/README b/sub.in/stage1/README index 6a2fcf70..8923731a 100644 --- a/sub.in/stage1/README +++ b/sub.in/stage1/README @@ -8,11 +8,12 @@ следует крайне бережно относиться к объёму этой стадии. Обратите внимание: если не указать явно требуемый вариант -ядра посредством STAGE1_KFLAVOUR, будет взят последний -из перечисленных в KFLAVOURS; если не указать явно регэкс, -описывающий требуемые в инсталяторе kernel-modules-*, -посредством STAGE1_KMODULES_REGEXP -- будут доступны модули -из kernel-image (упаковываются в syslinux/alt0/full.cz). +ядер посредством STAGE1_KFLAVOURS, то будет взят из KFLAVOURS; +если используется загрузчик отличный от grub, то будет взят +последний указанный в STAGE1_KFLAVOURS или KFLAVOURS; +если не указать явно регэкс, описывающий требуемые в инсталяторе +kernel-modules-*, посредством STAGE1_KMODULES_REGEXP -- будут +доступны модули из kernel-image (упаковываются в boot/full*.cz). Сам список модулей, попадающих в full.cz, определяется в файле modules (наиболее базовые!) и дополняется указанным diff --git a/sub.in/stage2/Makefile b/sub.in/stage2/Makefile index 28587359..aff28417 100644 --- a/sub.in/stage2/Makefile +++ b/sub.in/stage2/Makefile @@ -25,18 +25,29 @@ include stage2cfg.mk # requisite stuff IMAGE_PACKAGES += $(SYSTEM_PACKAGES) $(STAGE2_PACKAGES) -# here we also try and come up with the stage1 kernel/modules, if any; -# no kernel flavour specified will result in no modules for stage1 vmlinuz -STAGE1_KFLAVOUR ?= $(lastword $(KFLAVOURS)) +# here we try and come up with the installer kernel/modules, if any; +# only for grub allowed multiple kernels, for other a single kernel +# might be needed (STAGE1_KFLAVOURS sets explicitly); +# kernel image copied from instrumental chroot into .work/boot/ +ifeq (grubpcboot,$(BOOTLOADER)) +STAGE1_KFLAVOURS ?= $(KFLAVOURS) +endif +ifeq (grub-efi,$(EFI_BOOTLOADER)) +STAGE1_KFLAVOURS ?= $(KFLAVOURS) +endif +ifeq (ieee1275boot,$(BOOTLOADER)) +STAGE1_KFLAVOURS ?= $(KFLAVOURS) +endif +STAGE1_KFLAVOURS ?= $(lastword $(KFLAVOURS)) -ifeq (,$(STAGE1_KFLAVOUR)) -$(error STAGE1_KFLAVOUR is utterly empty; cannot guess either) +ifeq (,$(STAGE1_KFLAVOURS)) +$(error STAGE1_KFLAVOURS is utterly empty; cannot guess either) endif # need kernel modules only (which require corresponding kernel-image); # these go into work chroot; NB: no vmlinuz there (unless live-install) IMAGE_PACKAGES_REGEXP += $(call kpackages, \ - $(STAGE1_KFLAVOUR), \ + $(STAGE1_KFLAVOURS), \ $(STAGE1_KMODULES) $(STAGE1_KMODULES_REGEXP) \ $(STAGE2_KMODULES) $(STAGE2_KMODULES_REGEXP))