[PATCH 4/4] grub: Added submenu for kernel flavour change

Anton Midyukov antohami at altlinux.org
Wed Mar 4 10:26:38 MSK 2020


---
 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/84rescue_remote.cfg   |  4 ++--
 features.in/grub/cfg.in/90kernel.cfg          | 19 +++++++++++++++++++
 features.in/grub/generate.mk                  |  7 +++++++
 10 files changed, 42 insertions(+), 16 deletions(-)
 create mode 100644 features.in/grub/cfg.in/90kernel.cfg

diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg
index b88f44ae01..f6e3995550 100644
--- a/features.in/grub/cfg.in/20install2.cfg
+++ b/features.in/grub/cfg.in/20install2.cfg
@@ -1,6 +1,6 @@
 
 default='linux'
 menuentry 'Install @relname@' --hotkey 'i' --id 'linux' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ lang=$language
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ lang=$language
+  initrd ÎÁ linux_suffix@ @boot_path@/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 7a1ce36d25..805435cb20 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 @relname@ (edit to set server IP address)' --id 'vncconnect' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP lang=$language
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP lang=$language
+  initrd ÎÁ linux_suffix@ @boot_path@/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 90a285fdda..0aef0dc4d0 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 @relname@ (<E>, set password and connect here)' --id 'vncpasswd' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD lang=$language
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD lang=$language
+  initrd ÎÁ linux_suffix@ @boot_path@/full$KFLAVOUR.cz
 }
 
diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
index be62b59a79..f750dd0780 100644
--- a/features.in/grub/cfg.in/30live.cfg
+++ b/features.in/grub/cfg.in/30live.cfg
@@ -1,6 +1,6 @@
 menuentry 'LiveCD (no hard disk needed)' --id 'live' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ lang=$language
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ lang=$language
+  initrd ÎÁ linux_suffix@ @boot_path@/full$KFLAVOUR.cz
 }
 
 
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
index 240b6a4e12..b487f9417a 100644
--- a/features.in/grub/cfg.in/32live_rw.cfg
+++ b/features.in/grub/cfg.in/32live_rw.cfg
@@ -1,4 +1,4 @@
 menuentry 'LiveCD with sessions support' --id 'session' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@ lang=$language
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  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@ lang=$language
+  initrd ÎÁ linux_suffix@ @boot_path@/full$KFLAVOUR.cz
 }
diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg
index a9d2575cfb..e06a63afe2 100644
--- a/features.in/grub/cfg.in/80rescue.cfg
+++ b/features.in/grub/cfg.in/80rescue.cfg
@@ -1,4 +1,4 @@
 menuentry 'Rescue LiveCD' --id 'rescue' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
+  initrd ÎÁ linux_suffix@ @boot_path@/full$KFLAVOUR.cz
 }
diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg
index 753c642bc3..45dcb0007a 100644
--- a/features.in/grub/cfg.in/82rescue_rw.cfg
+++ b/features.in/grub/cfg.in/82rescue_rw.cfg
@@ -1,4 +1,4 @@
 menuentry 'Rescue with sessions support' --id 'rescue_session' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom,label:ALT* ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ live_rw
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  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@ live_rw
+  initrd ÎÁ linux_suffix@ @boot_path@/full$KFLAVOUR.cz
 }
diff --git a/features.in/grub/cfg.in/84rescue_remote.cfg b/features.in/grub/cfg.in/84rescue_remote.cfg
index 738abd79ad..0b483f95c0 100644
--- a/features.in/grub/cfg.in/84rescue_remote.cfg
+++ b/features.in/grub/cfg.in/84rescue_remote.cfg
@@ -1,4 +1,4 @@
 menuentry 'Rescue with remote SSH access (DHCP)' --id 'rescue_remote' {
-  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 ip=dhcp port=22 rootpw=AUTO hash=@rescue_hash@
-  initrd ÎÁ linux_suffix@ @boot_path@/full.cz
+  linux ÎÁ linux_suffix@ @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 ip=dhcp port=22 rootpw=AUTO hash=@rescue_hash@
+  initrd ÎÁ linux_suffix@ @boot_path@/full$KFLAVOUR.cz
 }
diff --git a/features.in/grub/cfg.in/90kernel.cfg b/features.in/grub/cfg.in/90kernel.cfg
new file mode 100644
index 0000000000..2c355f3cbc
--- /dev/null
+++ b/features.in/grub/cfg.in/90kernel.cfg
@@ -0,0 +1,19 @@
+submenu "Change Kernel Flavour" {
+	insmod regexp
+	regexp -s 1:kflavours -s 2:kflavourstr '(.*) (.*)' "@KFLAVOUR@"
+	menuentry "${kflavourstr}" {
+		KFLAVOUR=
+		export KFLAVOUR
+		configfile ${prefix}/grub.cfg
+	}
+	for kflavourstr in ${kflavours}; do
+		menuentry "${kflavourstr}" {
+			KFLAVOUR="-$1"
+			export KFLAVOUR
+			configfile ${prefix}/grub.cfg
+		}
+	done
+	menuentry "Return to the Main menu" {
+		configfile ${prefix}/grub.cfg
+	}
+}
diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk
index f6bdd586e2..a5a7dd087a 100644
--- a/features.in/grub/generate.mk
+++ b/features.in/grub/generate.mk
@@ -23,6 +23,10 @@ ifdef LOCALE
 GRUB_CFG := $(GRUB_CFG) lang
 endif
 
+ifneq ($(words $(KFLAVOURS)),1)
+GRUB_CFG := $(GRUB_CFG) kernel
+endif
+
 DSTDIR  := $(BUILDDIR)/stage1/files/boot/grub/.in
 DSTCFGS := $(DSTDIR)/*.cfg
 
@@ -87,6 +91,9 @@ bootargs: clean
 		sed -i "s, lang=.language,,g" $(DSTCFGS); \
 	fi; \
 	sed -i "/language=@LOCALE@/d" $(DSTCFGS)
+	@if [ $$(echo $(KFLAVOURS) | wc -w) -gt 1 ]; then \
+		sed -i "s, ÎÁ KFLAVOUR@,$(KFLAVOURS),g" $(DSTCFGS); \
+	fi
 
 clean: copy
 	@if [ "$(GRUB_UI)" = gfxboot ]; then \
-- 
2.24.1


--------------06E346EE013123DEE309E4A9--


More information about the devel-distro mailing list