ALT Linux Distributions development
 help / color / mirror / Atom feed
* [devel-distro] grub-efi в инсталяторе
@ 2019-11-01 14:18 Alexey Shabalin
  2019-11-14 19:10 ` Alexey Shabalin
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alexey Shabalin @ 2019-11-01 14:18 UTC (permalink / raw)
  To: Distributions development

Всем привет.
Я для Server-V добавил поддержку grub-efi в инстляторе.
Прошу посмотреть/проверить. Делал только самое необходимое для себя. В
дальнейшем можно наращивать функционал. Например, сейчас нет поддержки
тем для grub, потому что мне не надо было :), мне достаточно
текстового grub.

1) поддержка grub-efi в efiboot mkimage
http://git.altlinux.org/people/shaba/packages/mkimage.git?p=mkimage.git;a=commitdiff;h=932c2e80d41c8ace7bbb5da52a48bab49fde575f

2) добавил фичу grub для генерации кофигов grub из кусочков, по
аналогии с syslinux.
Пока жесткая завязка на местоположение vmlinuz и full.cz в EFI/BOOT
для grub-efi.
Не уверен, что можно использовать для aarch64, это буду смотреть дальше.
http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=7b9d60d6661cad6e6f02b93e646a42bd07645c51

3) использование конфигов для grub наравне с syslinux
http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=23a460dd3de2147cc9a0db5de52234ececb0b5ef

4) переключил server-v с refind на grub-efi
Вместо (+efi use/efi/refind) использую use/efi/grub use/efi/signed
http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=5577800554b2e240146b7cfb039c7a97d13e74d7

5) собираю командой (потому что искать, где это переопределяется, кто
мне помогает и потом определяет эти переменные подругому, тяжело и
муторно)
make ARCH=x86_64 BUILDDIR=~/build-mkimage
APTCONF=~/etc/p9.x86_64-apt.conf DEBUG=1 REPORT=1 IMAGE_PACKTYPE=boot
BOOT_TYPE="isolinux efiboot" EFI_BOOTLOADER=grub-efi server-v.iso

Спасибо за внимание. Буду рад исправлениям.


-- 
Alexey Shabalin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2019-11-01 14:18 [devel-distro] grub-efi в инсталяторе Alexey Shabalin
@ 2019-11-14 19:10 ` Alexey Shabalin
  2019-11-15  9:49   ` Alexey Gladkov
  2019-11-15 14:59 ` Alexey Shabalin
  2020-01-08 19:29 ` Антон Мидюков
  2 siblings, 1 reply; 10+ messages in thread
From: Alexey Shabalin @ 2019-11-14 19:10 UTC (permalink / raw)
  To: Distributions development; +Cc: Alexey Gladkov

пт, 1 нояб. 2019 г. в 17:18, Alexey Shabalin <a.shabalin@gmail.com>:
>
> Всем привет.
> Я для Server-V добавил поддержку grub-efi в инстляторе.
> Прошу посмотреть/проверить. Делал только самое необходимое для себя. В
> дальнейшем можно наращивать функционал. Например, сейчас нет поддержки
> тем для grub, потому что мне не надо было :), мне достаточно
> текстового grub.
>
> 1) поддержка grub-efi в efiboot mkimage
> http://git.altlinux.org/people/shaba/packages/mkimage.git?p=mkimage.git;a=commitdiff;h=932c2e80d41c8ace7bbb5da52a48bab49fde575f

прошу пропустить
[#240813] EPERM mkimage.git=0.2.29-alt1


> 2) добавил фичу grub для генерации кофигов grub из кусочков, по
> аналогии с syslinux.
> Пока жесткая завязка на местоположение vmlinuz и full.cz в EFI/BOOT
> для grub-efi.
> Не уверен, что можно использовать для aarch64, это буду смотреть дальше.
> http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=7b9d60d6661cad6e6f02b93e646a42bd07645c51
>
> 3) использование конфигов для grub наравне с syslinux
> http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=23a460dd3de2147cc9a0db5de52234ececb0b5ef
>
> 4) переключил server-v с refind на grub-efi
> Вместо (+efi use/efi/refind) использую use/efi/grub use/efi/signed
> http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=5577800554b2e240146b7cfb039c7a97d13e74d7
>
> 5) собираю командой (потому что искать, где это переопределяется, кто
> мне помогает и потом определяет эти переменные подругому, тяжело и
> муторно)
> make ARCH=x86_64 BUILDDIR=~/build-mkimage
> APTCONF=~/etc/p9.x86_64-apt.conf DEBUG=1 REPORT=1 IMAGE_PACKTYPE=boot
> BOOT_TYPE="isolinux efiboot" EFI_BOOTLOADER=grub-efi server-v.iso
>
> Спасибо за внимание. Буду рад исправлениям.
>
>
> --
> Alexey Shabalin



-- 
Alexey Shabalin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2019-11-14 19:10 ` Alexey Shabalin
@ 2019-11-15  9:49   ` Alexey Gladkov
  0 siblings, 0 replies; 10+ messages in thread
From: Alexey Gladkov @ 2019-11-15  9:49 UTC (permalink / raw)
  To: shaba; +Cc: Distributions development

On Thu, Nov 14, 2019 at 10:10:22PM +0300, Alexey Shabalin wrote:
> пт, 1 нояб. 2019 г. в 17:18, Alexey Shabalin <a.shabalin@gmail.com>:
> >
> > Всем привет.
> > Я для Server-V добавил поддержку grub-efi в инстляторе.
> > Прошу посмотреть/проверить. Делал только самое необходимое для себя. В
> > дальнейшем можно наращивать функционал. Например, сейчас нет поддержки
> > тем для grub, потому что мне не надо было :), мне достаточно
> > текстового grub.
> >
> > 1) поддержка grub-efi в efiboot mkimage
> > http://git.altlinux.org/people/shaba/packages/mkimage.git?p=mkimage.git;a=commitdiff;h=932c2e80d41c8ace7bbb5da52a48bab49fde575f
> 
> прошу пропустить
> [#240813] EPERM mkimage.git=0.2.29-alt1

Approved.

> > 2) добавил фичу grub для генерации кофигов grub из кусочков, по
> > аналогии с syslinux.
> > Пока жесткая завязка на местоположение vmlinuz и full.cz в EFI/BOOT
> > для grub-efi.
> > Не уверен, что можно использовать для aarch64, это буду смотреть дальше.
> > http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=7b9d60d6661cad6e6f02b93e646a42bd07645c51
> >
> > 3) использование конфигов для grub наравне с syslinux
> > http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=23a460dd3de2147cc9a0db5de52234ececb0b5ef
> >
> > 4) переключил server-v с refind на grub-efi
> > Вместо (+efi use/efi/refind) использую use/efi/grub use/efi/signed
> > http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=5577800554b2e240146b7cfb039c7a97d13e74d7
> >
> > 5) собираю командой (потому что искать, где это переопределяется, кто
> > мне помогает и потом определяет эти переменные подругому, тяжело и
> > муторно)
> > make ARCH=x86_64 BUILDDIR=~/build-mkimage
> > APTCONF=~/etc/p9.x86_64-apt.conf DEBUG=1 REPORT=1 IMAGE_PACKTYPE=boot
> > BOOT_TYPE="isolinux efiboot" EFI_BOOTLOADER=grub-efi server-v.iso
> >
> > Спасибо за внимание. Буду рад исправлениям.

-- 
Rgrds, legion



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2019-11-01 14:18 [devel-distro] grub-efi в инсталяторе Alexey Shabalin
  2019-11-14 19:10 ` Alexey Shabalin
@ 2019-11-15 14:59 ` Alexey Shabalin
  2019-11-18 15:57   ` Michael Shigorin
  2020-01-08 19:29 ` Антон Мидюков
  2 siblings, 1 reply; 10+ messages in thread
From: Alexey Shabalin @ 2019-11-15 14:59 UTC (permalink / raw)
  To: Distributions development

пт, 1 нояб. 2019 г. в 17:18, Alexey Shabalin <a.shabalin@gmail.com>:
>
> 5) собираю командой (потому что искать, где это переопределяется, кто
> мне помогает и потом определяет эти переменные подругому, тяжело и
> муторно)
> make ARCH=x86_64 BUILDDIR=~/build-mkimage
> APTCONF=~/etc/p9.x86_64-apt.conf DEBUG=1 REPORT=1 IMAGE_PACKTYPE=boot
> BOOT_TYPE="isolinux efiboot" EFI_BOOTLOADER=grub-efi server-v.iso

Будьте осторожны, какой-то из указанных параметров поломал гибридность образа.
Записанный образ на флэшку не грузится в EFI, раздел с FAT отсутствует.
Можно собирать без всех этих лишних опций.

-- 
Alexey Shabalin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2019-11-15 14:59 ` Alexey Shabalin
@ 2019-11-18 15:57   ` Michael Shigorin
  0 siblings, 0 replies; 10+ messages in thread
From: Michael Shigorin @ 2019-11-18 15:57 UTC (permalink / raw)
  To: devel-distro

On Fri, Nov 15, 2019 at 05:59:57PM +0300, Alexey Shabalin wrote:
> > BOOT_TYPE="isolinux efiboot" EFI_BOOTLOADER=grub-efi server-v.iso
> Будьте осторожны, какой-то из указанных параметров поломал гибридность образа.

Возможно, двойной BOOT_TYPE.

-- 
 ---- WBR, Michael Shigorin / http://altlinux.org
  ------ http://opennet.ru / http://anna-news.info


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2019-11-01 14:18 [devel-distro] grub-efi в инсталяторе Alexey Shabalin
  2019-11-14 19:10 ` Alexey Shabalin
  2019-11-15 14:59 ` Alexey Shabalin
@ 2020-01-08 19:29 ` Антон Мидюков
  2020-01-09 14:39   ` Антон Мидюков
  2 siblings, 1 reply; 10+ messages in thread
From: Антон Мидюков @ 2020-01-08 19:29 UTC (permalink / raw)
  To: devel-distro

[-- Attachment #1: Type: text/plain, Size: 6091 bytes --]

01.11.2019 21:18, Alexey Shabalin пишет:
> Всем привет.
> Я для Server-V добавил поддержку grub-efi в инстляторе.
> Прошу посмотреть/проверить. Делал только самое необходимое для себя. В
> дальнейшем можно наращивать функционал. Например, сейчас нет поддержки
> тем для grub, потому что мне не надо было :), мне достаточно
> текстового grub.
>
> 1) поддержка grub-efi в efiboot mkimage
> http://git.altlinux.org/people/shaba/packages/mkimage.git?p=mkimage.git;a=commitdiff;h=932c2e80d41c8ace7bbb5da52a48bab49fde575f
>
> 2) добавил фичу grub для генерации кофигов grub из кусочков, по
> аналогии с syslinux.
> Пока жесткая завязка на местоположение vmlinuz и full.cz в EFI/BOOT
> для grub-efi.
> Не уверен, что можно использовать для aarch64, это буду смотреть дальше.
> http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=7b9d60d6661cad6e6f02b93e646a42bd07645c51
>
> 3) использование конфигов для grub наравне с syslinux
> http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=23a460dd3de2147cc9a0db5de52234ececb0b5ef
>
> 4) переключил server-v с refind на grub-efi
> Вместо (+efi use/efi/refind) использую use/efi/grub use/efi/signed
> http://git.altlinux.org/people/shaba/packages/mkimage-profiles.git?p=mkimage-profiles.git;a=commitdiff;h=5577800554b2e240146b7cfb039c7a97d13e74d7
>
> 5) собираю командой (потому что искать, где это переопределяется, кто
> мне помогает и потом определяет эти переменные подругому, тяжело и
> муторно)
> make ARCH=x86_64 BUILDDIR=~/build-mkimage
> APTCONF=~/etc/p9.x86_64-apt.conf DEBUG=1 REPORT=1 IMAGE_PACKTYPE=boot
> BOOT_TYPE="isolinux efiboot" EFI_BOOTLOADER=grub-efi server-v.iso
>
> Спасибо за внимание. Буду рад исправлениям.

Доброго времени суток

За каникулы серьёзно поработал над mkimage и mkimage-profiles.

В задании [#243937] [test-only] EPERM mkimage.git=0.2.30-alt1 сделал 
следующее:

1. в grubaa64boot сделал структуру файлов как в образе собираемом с 
efiboot. Так что прошу обратить пристальное внимание на это.

2. в grubaa64boot убрал генерацию grub.cfg из syslinux.cfg, так как она 
больше не нужна (да и работала некорректно)

3. Добавил новую цель mki-copy-kernel, которую предлагаю вызывать из 
mkimage-profiles вместо mki-copy-$BOOTLOADER.

Мне не нравится, что у нас сейчас mki-copy-$BOOTLOADER вызывается 
дважды: из mkimage-profiles, чтобы скопировать ядро с образом 
пропагатора, и второй раз уже в mkimage-profiles, чтобы установить 
загрузчик. При первом вызове есть ядро, но не готов syslinux.cfg, при 
втором готов syslinux.cfg, но уже нет ядра. Кроме того, это изменение 
упростит процесс перехода на использование в образе нескольких ядер.

4. В mki-copy-efiboot для grub-efi ядро копировать в boot, если его ещё 
там нет. Аналогично для других EFI_BOOTLOADER проверять, есть ли уже 
ядро в EFI/BOOT, и если есть не копировать.

Но основные изменения в mkimage-profiles:

1. Исправил определение default-ного пункта, если не задан (см 0001).

2. Сделал фильтр конфигов по названиям. Например, пункты меню 
специфичные для EFI должны оканчиваться на _efi.cfg (см 0005)

3. Может генерироваться два конфига grub.cfg, для EFI и всех остальных. 
Два сразу могут быть только при использовании grub для legacy (не 
реализован) и grub-efi (см 0005)

4. Исправил $linux_suffix. То условие не работает и генерит при загрузке 
grub ошибки про не найденные команды (см 0008)

5. Интегрировал по аналогии с syslinux генерацию конфигов grub для 
install2 и live (см 0012). Для того, чтобы это никому не помешало, в 
зависимости от выбранных загрузчиков следы grub подчищаются (см 0004 и 0005)

6. Для syslinux тоже сделал такую проверку (см 0015, 0016) Это позволит 
задать загрузчик grub legacy, не убирая отовсюду syslinux.

7 Вызываю copy-kernel вместо copy-$BOOTLOADER (см 0020)

8 Остальное мелочи.

Также я отправил в Сизиф livecd-install, который может восстанавливать 
ядро не только из syslinux/alt0, но и boot:

[#243884] DONE (try 2) livecd-install.git=0.9.12-alt1

Итого, для полного счастья не хватает только выбора языка и графической 
темы.

-- 
С уважением, Антон Мидюков <antohami@altlinux.org>


[-- Attachment #2: 0001-grub-fixed-search-default-in-stage1-scripts.d-01-gru.patch --]
[-- Type: text/x-patch, Size: 1293 bytes --]

>From 844a75faf4943665aafb81402fdf224b06e1f02f Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:34:52 +0700
Subject: [PATCH 01/20] grub: fixed search default in stage1/scripts.d/01-grub

The definition of the default menu item has been fixed.
Grub.cfg does not use label, uses --id.
It is assumed that --id is given last.
---
 features.in/grub/stage1/scripts.d/01-grub | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 620b8dac4b..11890e5381 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -24,10 +24,10 @@ fi
 grep -hv '^#' .in/[0-9][0-9]*.cfg > "$CFG"
 
 # there should be DEFAULT directive there (at least for alterator-netinst)
-if ! grep -i '^default' "$CFG"; then
-	DEFAULT="$(grep -i '^label ' "$CFG" | head -1 | cut -f2 -d' ')"
+if ! grep -i '^default' .in/[0-9][0-9]*.cfg; then
+	DEFAULT="$(grep -i '\-\-id ' .in/[0-9][0-9]*.cfg | head -1 | rev| cut -f2 -d' ' |rev)"
 	if [ -n "$DEFAULT" ]; then
-		echo "default $DEFAULT" >> "$CFG"
+		echo "default=$DEFAULT" >> "$CFG"
 	else
 		echo "error: no DEFAULT or UI directive and cannot guess" >&2
 		exit 1
-- 
2.24.1


[-- Attachment #3: 0002-grub-replace-PATH-to-kernel-and-grub.cfg-to-boot.patch --]
[-- Type: text/x-patch, Size: 9928 bytes --]

>From e5ef8d26042f88e38a09a94fe9bc0e3756940c1b Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Thu, 2 Jan 2020 22:28:16 +0700
Subject: [PATCH 02/20] grub: replace PATH to kernel and grub.cfg to boot/

grub not only for EFI.
---
 features.in/grub/cfg.in/20install2.cfg               | 6 +++---
 features.in/grub/cfg.in/25install-vnc-connect.cfg    | 4 ++--
 features.in/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/85mediacheck.cfg             | 4 ++--
 features.in/grub/generate.mk                         | 2 +-
 features.in/grub/scripts.d/20-propagator-ramdisk     | 4 ++--
 features.in/grub/scripts.d/20-propagator-rescue-hash | 4 ++--
 features.in/grub/stage1/scripts.d/01-grub            | 4 ++--
 13 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg
index 1da6304eb5..fb6d0407b6 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 ALT @relname@' --hotkey 'i' --id 'linux' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+menuentry 'Install @relname@' --hotkey 'i' --id 'linux' {
+  linux$linux_suffix /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@
+  initrd$linux_suffix /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg
index 178e8fccd5..5041350e6f 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 'Install ALT @relname@ (headless with DHCP+VNC client) (edit to set server IP address)' --id 'vncconnect' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
+  initrd$linux_suffix /boot/BOOT/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg
index 53b2b5119b..f6252ba262 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 'Install ALT @relname@ (headless with DHCP+VNC) (password VNCPWD)' --id 'vncpasswd' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
+  initrd$linux_suffix /boot/full.cz
 }
 
diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
index d53a1e506a..079eaae8f5 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 /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
+  initrd$linux_suffix /boot/full.cz
 }
 
 
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
index 55c4b977fe..406ff19486 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 /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
+  initrd$linux_suffix /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg
index c6c0ae53c9..d863ef0c1e 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 /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
+  initrd$linux_suffix /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg
index ec18be28bb..c6365be080 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 /EFI/BOOT/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 /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/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/full.cz
 }
diff --git a/features.in/grub/cfg.in/83rescue_fm.cfg b/features.in/grub/cfg.in/83rescue_fm.cfg
index 71bf21d3b7..fa8bf7adfb 100644
--- a/features.in/grub/cfg.in/83rescue_fm.cfg
+++ b/features.in/grub/cfg.in/83rescue_fm.cfg
@@ -1,4 +1,4 @@
 menuentry 'Forensic mode (leave disks alone)' --id 'rescue_forensic' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 forensic hash=@rescue_hash@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 forensic hash=@rescue_hash@
+  initrd$linux_suffix /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/85mediacheck.cfg b/features.in/grub/cfg.in/85mediacheck.cfg
index 6779dd00d3..3a2fbe4105 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 /EFI/BOOT/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix /boot/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
+  initrd$linux_suffix /boot/full.cz
 }
diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk
index a0b59221a2..f321ce798e 100644
--- a/features.in/grub/generate.mk
+++ b/features.in/grub/generate.mk
@@ -19,7 +19,7 @@ ifndef GRUB_DIRECT
 GRUB_CFG := $(GRUB_CFG) $(SUBPROFILE_DIRS) defaults
 endif
 
-DSTDIR  := $(BUILDDIR)/stage1/files/EFI/BOOT/.in
+DSTDIR  := $(BUILDDIR)/stage1/files/boot/grub/.in
 DSTCFGS := $(DSTDIR)/*.cfg
 
 # we can do GRUB_{CFG,MODULES,FILES}
diff --git a/features.in/grub/scripts.d/20-propagator-ramdisk b/features.in/grub/scripts.d/20-propagator-ramdisk
index c47302a769..a01b8f3127 100755
--- a/features.in/grub/scripts.d/20-propagator-ramdisk
+++ b/features.in/grub/scripts.d/20-propagator-ramdisk
@@ -5,9 +5,9 @@
 
 cd "$WORKDIR"
 
-cfgs="$(find EFI/BOOT -name '*.cfg')"
+cfgs="$(find boot/grub -name '*.cfg')"
 [ -n "$cfgs" ] || {
-	echo "${0##*/}: did not find any config under EFI/BOOT " >&2
+	echo "${0##*/}: did not find any config under boot/grub " >&2
 	exit 1
 }
 
diff --git a/features.in/grub/scripts.d/20-propagator-rescue-hash b/features.in/grub/scripts.d/20-propagator-rescue-hash
index fff0be0ce9..7a13499693 100755
--- a/features.in/grub/scripts.d/20-propagator-rescue-hash
+++ b/features.in/grub/scripts.d/20-propagator-rescue-hash
@@ -5,10 +5,10 @@
 
 cd "$WORKDIR"
 
-grep -qs "@rescue_hash@" EFI/BOOT/*.cfg || exit 0
+grep -qs "@rescue_hash@" boot/grub/*.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," EFI/BOOT/*.cfg
+	sed -i "s,@rescue_hash@,$rescue_hash," boot/grub/*.cfg
 done
diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 11890e5381..2c13a4b893 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -4,8 +4,8 @@
 
 CFG="grub.cfg"
 
-mkdir -p "$WORKDIR/EFI/BOOT"
-cd "$WORKDIR/EFI/BOOT"
+mkdir -p "$WORKDIR/boot/grub"
+cd "$WORKDIR/boot/grub"
 
 # validate just in case (see also stage1 Makefile)
 case "$GLOBAL_BOOTLOADER" in
-- 
2.24.1


[-- Attachment #4: 0003-grub-fix-typo.patch --]
[-- Type: text/x-patch, Size: 1001 bytes --]

>From 77fbdc8d9f2e368c2d5ca95e15971cdd3f544732 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 22:50:57 +0700
Subject: [PATCH 03/20] grub: fix typo

---
 features.in/grub/stage1/scripts.d/01-grub | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 2c13a4b893..4d2a7ac007 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -1,5 +1,5 @@
 #!/bin/sh
-# gather syslinux configuration from snippets;
+# gather grub configuration from snippets;
 # copy modules; see also this feature's generate.mk
 
 CFG="grub.cfg"
@@ -38,4 +38,4 @@ fi
 if [ "$DEBUG" != 2 ]; then rm -r .in/; fi
 
 # NB: there will be final macro expansion based on actual image sizes
-#     done by features.in/syslinux/scripts.d/20-propagator-ramdisk
+#     done by features.in/grub/scripts.d/20-propagator-ramdisk
-- 
2.24.1


[-- Attachment #5: 0004-grub-do-not-create-grub.cfg-if-EFI_BOOTLOADER-is-set.patch --]
[-- Type: text/x-patch, Size: 2351 bytes --]

>From 487a864b4275644c5f8a32a2978ffe8264ae9a71 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:00:50 +0700
Subject: [PATCH 04/20] grub: do not create grub.cfg if EFI_BOOTLOADER is set
 to not equal grub-efi

---
 .../grub/scripts.d/20-propagator-ramdisk      |  2 ++
 .../grub/scripts.d/20-propagator-rescue-hash  |  2 ++
 features.in/grub/stage1/scripts.d/01-grub     | 20 ++++++++++++-------
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/features.in/grub/scripts.d/20-propagator-ramdisk b/features.in/grub/scripts.d/20-propagator-ramdisk
index a01b8f3127..059c60ef76 100755
--- a/features.in/grub/scripts.d/20-propagator-ramdisk
+++ b/features.in/grub/scripts.d/20-propagator-ramdisk
@@ -5,6 +5,8 @@
 
 cd "$WORKDIR"
 
+[ -d boot/grub ] || exit 0
+
 cfgs="$(find boot/grub -name '*.cfg')"
 [ -n "$cfgs" ] || {
 	echo "${0##*/}: did not find any config under boot/grub " >&2
diff --git a/features.in/grub/scripts.d/20-propagator-rescue-hash b/features.in/grub/scripts.d/20-propagator-rescue-hash
index 7a13499693..92c5972a65 100755
--- a/features.in/grub/scripts.d/20-propagator-rescue-hash
+++ b/features.in/grub/scripts.d/20-propagator-rescue-hash
@@ -5,6 +5,8 @@
 
 cd "$WORKDIR"
 
+[ -d boot/grub ] || exit 0
+
 grep -qs "@rescue_hash@" boot/grub/*.cfg || exit 0
 
 find -maxdepth 1 -type f -name rescue \
diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 4d2a7ac007..4c7d5e23ee 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -4,16 +4,22 @@
 
 CFG="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
+	case "$GLOBAL_BOOTLOADER" in
+		ieee1275boot|grubaa64boot|grubx86boot) ;;
+		*) rm -fr "$WORKDIR/boot"
+		   exit 0;;
+	esac
+fi
+
 mkdir -p "$WORKDIR/boot/grub"
 cd "$WORKDIR/boot/grub"
 
-# validate just in case (see also stage1 Makefile)
-case "$GLOBAL_BOOTLOADER" in
-	isolinux|syslinux|ieee1275boot|grubaa64boot|grubx86boot) ;;
-	*) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2;
-	   exit 1;;
-esac
-
 # copy extra files, if any
 GRUB_FILES="$(cat .in/grub.list)"
 if [ -n "${GRUB_FILES% }" ]; then
-- 
2.24.1


[-- Attachment #6: 0005-grub-generate-configs-boot-grub-grub.cfg-and-EFI-BOO.patch --]
[-- Type: text/x-patch, Size: 4179 bytes --]

>From 1ee8d93445a8ed6468d2b00645a268bb4532013c Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Wed, 8 Jan 2020 11:24:17 +0700
Subject: [PATCH 05/20] grub: generate configs boot/grub/grub.cfg and
 EFI/BOOT/grub.cfg if necessary

---
 .../grub/scripts.d/20-propagator-ramdisk      | 10 +++---
 .../grub/scripts.d/20-propagator-rescue-hash  |  8 +++--
 features.in/grub/stage1/scripts.d/01-grub     | 33 +++++++++++++++----
 3 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/features.in/grub/scripts.d/20-propagator-ramdisk b/features.in/grub/scripts.d/20-propagator-ramdisk
index 059c60ef76..04470b6c85 100755
--- a/features.in/grub/scripts.d/20-propagator-ramdisk
+++ b/features.in/grub/scripts.d/20-propagator-ramdisk
@@ -5,13 +5,11 @@
 
 cd "$WORKDIR"
 
-[ -d boot/grub ] || exit 0
+[ -f boot/grub/grub.cfg -o -f EFI/BOOT/grub.cfg ] || exit 0
 
-cfgs="$(find boot/grub -name '*.cfg')"
-[ -n "$cfgs" ] || {
-	echo "${0##*/}: did not find any config under boot/grub " >&2
-	exit 1
-}
+cfgs=
+[ ! -f boot/grub/grub.cfg ] || cfgs+='boot/grub/grub.cfg '
+[ ! -f EFI/BOOT/grub.cfg ] || cfgs+='EFI/BOOT/grub.cfg'
 
 # apply size census while looking for potential squashfs images
 find -maxdepth 1 -type f -size +1M \
diff --git a/features.in/grub/scripts.d/20-propagator-rescue-hash b/features.in/grub/scripts.d/20-propagator-rescue-hash
index 92c5972a65..3ca61591bc 100755
--- a/features.in/grub/scripts.d/20-propagator-rescue-hash
+++ b/features.in/grub/scripts.d/20-propagator-rescue-hash
@@ -5,12 +5,14 @@
 
 cd "$WORKDIR"
 
-[ -d boot/grub ] || exit 0
+[ -f boot/grub/grub.cfg -o -f EFI/BOOT/grub.cfg ] || exit 0
 
-grep -qs "@rescue_hash@" 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'
 
 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," boot/grub/*.cfg
+	sed -i "s,@rescue_hash@,$rescue_hash," $cfgs
 done
diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 4c7d5e23ee..eeb3c49760 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -2,7 +2,8 @@
 # gather grub configuration from snippets;
 # copy modules; see also this feature's generate.mk
 
-CFG="grub.cfg"
+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"
@@ -27,21 +28,41 @@ if [ -n "${GRUB_FILES% }" ]; then
 fi
 
 # number ordering sponsored by shell's pathname expansion
-grep -hv '^#' .in/[0-9][0-9]*.cfg > "$CFG"
+case "$GLOBAL_BOOTLOADER" in
+	grubx86boot)
+		grep -hv '^#' $(find .in/*.cfg -not -name *_efi.cfg) > "$CFG" ;;
+	ieee1275boot)
+		grep -hv '^#' $(find .in/*.cfg -not -name *_efi.cfg -not -name *_x86.cfg) > "$CFG" ;;
+esac
+
+if [ "$GLOBAL_EFI_BOOTLOADER" = "grub-efi" ]; then
+	mkdir -p "$WORKDIR/EFI/BOOT"
+	grep -hv '^#' $(find .in/*.cfg -not -name *_x86.cfg) > "$CFG_EFI"
+fi
 
 # there should be DEFAULT directive there (at least for alterator-netinst)
-if ! grep -i '^default' .in/[0-9][0-9]*.cfg; then
-	DEFAULT="$(grep -i '\-\-id ' .in/[0-9][0-9]*.cfg | head -1 | rev| cut -f2 -d' ' |rev)"
+default_change() {
+local CFG=$1
+if ! grep -i '^default' "$CFG"; then
+	DEFAULT="$(grep -i '\-\-id ' "$CFG" | head -1 | rev| cut -f2 -d' ' |rev)"
 	if [ -n "$DEFAULT" ]; then
 		echo "default=$DEFAULT" >> "$CFG"
 	else
-		echo "error: no DEFAULT or UI directive and cannot guess" >&2
+		echo "error: no DEFAULT or UI directive and cannot guess for $CFG" >&2
 		exit 1
 	fi
 fi
+}
+
+[ ! -f "$CFG" ] || default_change "$CFG"
+[ ! -f "$CFG_EFI" ] || default_change "$CFG_EFI"
 
 # snippets are not going into the actual image
-if [ "$DEBUG" != 2 ]; then rm -r .in/; fi
+if [ "$DEBUG" != 2 ]; then
+	rm -r .in/
+	cd ..
+	[ -f "$CFG" ] || rm -r grub/
+fi
 
 # NB: there will be final macro expansion based on actual image sizes
 #     done by features.in/grub/scripts.d/20-propagator-ramdisk
-- 
2.24.1


[-- Attachment #7: 0006-grub-add-suffix-_efi-for-EFI-configs.patch --]
[-- Type: text/x-patch, Size: 1005 bytes --]

>From 30d4235d95ea359ecd1c8caa5feb18678015ab88 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Wed, 8 Jan 2020 15:29:17 +0700
Subject: [PATCH 06/20] grub: add suffix _efi for EFI configs

---
 features.in/grub/cfg.in/{90memtest.cfg => 90memtest_efi.cfg} | 0
 features.in/grub/cfg.in/{95fwsetup.cfg => 95fwsetup_efi.cfg} | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename features.in/grub/cfg.in/{90memtest.cfg => 90memtest_efi.cfg} (100%)
 rename features.in/grub/cfg.in/{95fwsetup.cfg => 95fwsetup_efi.cfg} (100%)

diff --git a/features.in/grub/cfg.in/90memtest.cfg b/features.in/grub/cfg.in/90memtest_efi.cfg
similarity index 100%
rename from features.in/grub/cfg.in/90memtest.cfg
rename to features.in/grub/cfg.in/90memtest_efi.cfg
diff --git a/features.in/grub/cfg.in/95fwsetup.cfg b/features.in/grub/cfg.in/95fwsetup_efi.cfg
similarity index 100%
rename from features.in/grub/cfg.in/95fwsetup.cfg
rename to features.in/grub/cfg.in/95fwsetup_efi.cfg
-- 
2.24.1


[-- Attachment #8: 0007-grub-fixed-PATH-to-memtest86.efi-in-90memtest-efi.cf.patch --]
[-- Type: text/x-patch, Size: 732 bytes --]

>From 9daadf582c8fec5b1bfbc48fac24a1bfa6c712f5 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:46:48 +0700
Subject: [PATCH 07/20] grub: fixed PATH to memtest86.efi in 90memtest-efi.cfg

---
 features.in/grub/cfg.in/90memtest_efi.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/features.in/grub/cfg.in/90memtest_efi.cfg b/features.in/grub/cfg.in/90memtest_efi.cfg
index f4c2121687..d0d27372d9 100644
--- a/features.in/grub/cfg.in/90memtest_efi.cfg
+++ b/features.in/grub/cfg.in/90memtest_efi.cfg
@@ -1,3 +1,3 @@
 menuentry 'Memory Test' --id 'memtest' {
-  linux$linux_suffix /EFI/BOOT/memtest86.efi
+  linux$linux_suffix /EFI/tools/memtest86.efi
 }
-- 
2.24.1


[-- Attachment #9: 0008-grub-change-linux_suffix.patch --]
[-- Type: text/x-patch, Size: 9307 bytes --]

>From 5a899a2e925793226a6ba1474eb1390c6a04e22c Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Fri, 3 Jan 2020 16:58:15 +0700
Subject: [PATCH 08/20] grub: change @linux_suffix@

---
 features.in/grub/cfg.in/00defaults.cfg            | 11 -----------
 features.in/grub/cfg.in/20install2.cfg            |  4 ++--
 features.in/grub/cfg.in/25install-vnc-connect.cfg |  4 ++--
 features.in/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/85mediacheck.cfg          |  4 ++--
 features.in/grub/cfg.in/90memtest_efi.cfg         |  2 +-
 features.in/grub/stage1/scripts.d/01-grub         | 12 ++++++++++++
 12 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/features.in/grub/cfg.in/00defaults.cfg b/features.in/grub/cfg.in/00defaults.cfg
index 4d469d4817..88b56d9873 100644
--- a/features.in/grub/cfg.in/00defaults.cfg
+++ b/features.in/grub/cfg.in/00defaults.cfg
@@ -4,14 +4,3 @@ insmod minicmd
 insmod normal
 insmod test
 set timeout=@timeout@
-
-if [ $grub_cpu = x86_64 -o $grub_cpu = i386 ]; then
-    if [ $grub_platform = efi ]; then
-        linux_suffix=efi
-    elif [ $grub_platform = pc ]; then
-        linux_suffix=16
-    else
-        linux_suffix=
-else
-    linux_suffix=
-fi
diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg
index fb6d0407b6..0031499e4c 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/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /boot/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@
+  initrd@linux_suffix@ /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg
index 5041350e6f..2c41df10d3 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 'Install ALT @relname@ (headless with DHCP+VNC client) (edit to set server IP address)' --id 'vncconnect' {
-  linux$linux_suffix /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
-  initrd$linux_suffix /boot/BOOT/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
+  initrd@linux_suffix@ /boot/BOOT/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg
index f6252ba262..1b847bd14a 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 'Install ALT @relname@ (headless with DHCP+VNC) (password VNCPWD)' --id 'vncpasswd' {
-  linux$linux_suffix /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
-  initrd$linux_suffix /boot/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
+  initrd@linux_suffix@ /boot/full.cz
 }
 
diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
index 079eaae8f5..d4fd6a8303 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/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /boot/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
+  initrd@linux_suffix@ /boot/full.cz
 }
 
 
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
index 406ff19486..11df0b62ed 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/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /boot/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
+  initrd@linux_suffix@ /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg
index d863ef0c1e..59a266c231 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/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
-  initrd$linux_suffix /boot/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
+  initrd@linux_suffix@ /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg
index c6365be080..2bf7dd628e 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/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/full.cz
+  linux@linux_suffix@ /boot/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/full.cz
 }
diff --git a/features.in/grub/cfg.in/83rescue_fm.cfg b/features.in/grub/cfg.in/83rescue_fm.cfg
index fa8bf7adfb..a374a76311 100644
--- a/features.in/grub/cfg.in/83rescue_fm.cfg
+++ b/features.in/grub/cfg.in/83rescue_fm.cfg
@@ -1,4 +1,4 @@
 menuentry 'Forensic mode (leave disks alone)' --id 'rescue_forensic' {
-  linux$linux_suffix /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 forensic hash=@rescue_hash@
-  initrd$linux_suffix /boot/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 forensic hash=@rescue_hash@
+  initrd@linux_suffix@ /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/85mediacheck.cfg b/features.in/grub/cfg.in/85mediacheck.cfg
index 3a2fbe4105..02c0dfe286 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/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
-  initrd$linux_suffix /boot/full.cz
+  linux@linux_suffix@ /boot/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
+  initrd@linux_suffix@ /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/90memtest_efi.cfg b/features.in/grub/cfg.in/90memtest_efi.cfg
index d0d27372d9..c52d1a6ffc 100644
--- a/features.in/grub/cfg.in/90memtest_efi.cfg
+++ b/features.in/grub/cfg.in/90memtest_efi.cfg
@@ -1,3 +1,3 @@
 menuentry 'Memory Test' --id 'memtest' {
-  linux$linux_suffix /EFI/tools/memtest86.efi
+  linux@linux_suffix@ /EFI/tools/memtest86.efi
 }
diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index eeb3c49760..4cd1825ef9 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -57,6 +57,18 @@ fi
 [ ! -f "$CFG" ] || default_change "$CFG"
 [ ! -f "$CFG_EFI" ] || default_change "$CFG_EFI"
 
+# change @linux_suffix@
+case "$GLOBAL_ARCH" in
+	i586|x86_64)
+		[ ! -f "$CFG" ] || sed -i 's/@linux_suffix@/16/g' "$CFG"
+		[ ! -f "$CFG_EFI" ] || sed -i 's/@linux_suffix@/efi/g' "$CFG_EFI"
+	;;
+	*)
+		[ ! -f "$CFG" ] || sed -i 's/@linux_suffix@//g' "$CFG"
+		[ ! -f "$CFG_EFI" ] || sed -i 's/@linux_suffix@//g' "$CFG_EFI"
+	;;
+esac
+
 # snippets are not going into the actual image
 if [ "$DEBUG" != 2 ]; then
 	rm -r .in/
-- 
2.24.1


[-- Attachment #10: 0009-grub-available-for-i586-x86_64-aarch64-ppc64le.patch --]
[-- Type: text/x-patch, Size: 895 bytes --]

>From 28d65b333f31af531c4c9777eed9d9b53adce8cf Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 21:51:30 +0700
Subject: [PATCH 09/20] grub: available for i586, x86_64, aarch64, ppc64le

---
 features.in/grub/config.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/features.in/grub/config.mk b/features.in/grub/config.mk
index 9f80822fa4..373001f884 100644
--- a/features.in/grub/config.mk
+++ b/features.in/grub/config.mk
@@ -1,9 +1,7 @@
 # default is plain text prompt
 # NB: might be usbflash-ready hybrid iso
 
-# on ppc64le syslinux feature is used only to generate config
-#ifeq (,$(filter-out i586 x86_64 ppc64le aarch64,$(ARCH)))
-ifeq (,$(filter-out i586 x86_64,$(ARCH)))
+ifeq (,$(filter-out i586 x86_64 ppc64le aarch64,$(ARCH)))
 
 use/grub: sub/stage1 $(ISOHYBRID:%=use/isohybrid)
 	@$(call add_feature)
-- 
2.24.1


[-- Attachment #11: 0010-grub-add-84rescue_remote.cfg.patch --]
[-- Type: text/x-patch, Size: 947 bytes --]

>From 703cc8cd1cd6289f5569ec0c9909ed5b939b5854 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:29:45 +0700
Subject: [PATCH 10/20] grub: add 84rescue_remote.cfg

---
 features.in/grub/cfg.in/84rescue_remote.cfg | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 features.in/grub/cfg.in/84rescue_remote.cfg

diff --git a/features.in/grub/cfg.in/84rescue_remote.cfg b/features.in/grub/cfg.in/84rescue_remote.cfg
new file mode 100644
index 0000000000..c9e3304619
--- /dev/null
+++ b/features.in/grub/cfg.in/84rescue_remote.cfg
@@ -0,0 +1,4 @@
+menuentry 'Rescue with remote SSH access (DHCP)' --id 'rescue_remote' {
+  linux@linux_suffix@ /boot/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/full.cz
+}
-- 
2.24.1


[-- Attachment #12: 0011-grub-Added-release-name-to-LiveCD-menu-items.patch --]
[-- Type: text/x-patch, Size: 1568 bytes --]

>From 39af0ff9b87ad51acece91e885bcc7d96a5c8e4b Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:41:23 +0700
Subject: [PATCH 11/20] grub: Added release name to LiveCD menu items

In grub, you cannot set a header with a release name, as in syslinux.
---
 features.in/grub/cfg.in/30live.cfg    | 2 +-
 features.in/grub/cfg.in/32live_rw.cfg | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
index d4fd6a8303..a9e9ab7451 100644
--- a/features.in/grub/cfg.in/30live.cfg
+++ b/features.in/grub/cfg.in/30live.cfg
@@ -1,4 +1,4 @@
-menuentry 'LiveCD (no hard disk needed)' --id 'live' {
+menuentry 'LiveCD @relname@ (no hard disk needed)' --id 'live' {
   linux@linux_suffix@ /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
   initrd@linux_suffix@ /boot/full.cz
 }
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
index 11df0b62ed..cec2da186d 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' {
+menuentry 'LiveCD @relname@ with sessions support' --id 'session' {
   linux@linux_suffix@ /boot/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
   initrd@linux_suffix@ /boot/full.cz
 }
-- 
2.24.1


[-- Attachment #13: 0012-install2-live-add-grub.cfg-support.patch --]
[-- Type: text/x-patch, Size: 2831 bytes --]

>From b348e69a85d8777842a1ca9156d8fae006fd1225 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Fri, 3 Jan 2020 21:11:15 +0700
Subject: [PATCH 12/20] install2, live: add grub.cfg support

---
 features.in/install2/config.mk | 10 +++++-----
 features.in/live/config.mk     |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/features.in/install2/config.mk b/features.in/install2/config.mk
index 4c744dac80..71e6c4171b 100644
--- a/features.in/install2/config.mk
+++ b/features.in/install2/config.mk
@@ -3,7 +3,7 @@
 +installer: use/install2/full; @:
 
 use/install2: use/stage2 sub/stage2@install2 use/metadata \
-	use/cleanup/installer use/install2/autoinstall
+	use/cleanup/installer use/install2/autoinstall use/grub/install2.cfg
 	@$(call add_feature)
 	@$(call try,INSTALLER,altlinux-generic)	# might be replaced later
 	@$(call add,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
@@ -84,12 +84,12 @@ use/install2/vnc:
 	@$(call add,INSTALL2_PACKAGES,x11vnc xterm net-tools)
 
 # this one expects external vncviewer to come
-use/install2/vnc/listen: \
-	use/install2/vnc use/syslinux/install-vnc-listen.cfg; @:
+use/install2/vnc/listen: use/install2/vnc \
+	use/syslinux/install-vnc-listen.cfg use/grub/install-vnc-listen.cfg; @:
 
 # this one connects to a specified vncviewer --listen
-use/install2/vnc/connect: \
-	use/install2/vnc use/syslinux/install-vnc-connect.cfg; @:
+use/install2/vnc/connect: use/install2/vnc \
+	use/syslinux/install-vnc-connect.cfg use/grub/install-vnc-connect.cfg; @:
 
 # add both bootloader items to be *that* explicit ;-)
 use/install2/vnc/full: use/install2/vnc/listen use/install2/vnc/connect; @:
diff --git a/features.in/live/config.mk b/features.in/live/config.mk
index 7644e8591e..1278922ddd 100644
--- a/features.in/live/config.mk
+++ b/features.in/live/config.mk
@@ -12,7 +12,8 @@ _OFF = anacron blk-availability bridge clamd crond dhcpd dmeventd dnsmasq \
 
 # copy stage2 as live
 # NB: starts to preconfigure but doesn't use/cleanup yet
-use/live: use/stage2 sub/rootfs@live sub/stage2@live use/services/lvm2-disable
+use/live: use/stage2 sub/rootfs@live sub/stage2@live \
+	use/services/lvm2-disable use/grub/live.cfg
 	@$(call add_feature)
 	@$(call add,CLEANUP_BASE_PACKAGES,'installer*')
 	@$(call add,DEFAULT_SERVICES_ENABLE,$(_ON))
@@ -28,10 +29,9 @@ use/live/base: use/live/.base use/net use/deflogin/live
 
 # rw slice, see http://www.altlinux.org/make-initrd-propagator and #28289
 ifeq (,$(EFI_BOOTLOADER))
-use/live/rw: use/live use/syslinux
-	@$(call add,SYSLINUX_CFG,live_rw)
+use/live/rw: use/live use/syslinux/live_rw.cfg use/grub/live_rw.cfg; @:
 else
-use/live/rw: use/live; @:
+use/live/rw: use/live use/grub/live_rw.cfg; @:
 endif
 
 # graphical target (not enforcing xorg drivers or blobs)
-- 
2.24.1


[-- Attachment #14: 0013-efi-do-not-call-use-efi-refind-from-use-efi-memtest8.patch --]
[-- Type: text/x-patch, Size: 907 bytes --]

>From c172fccaa68797be25bef53f3034e5f18a0a9afa Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 21:04:02 +0700
Subject: [PATCH 13/20] efi: do not call use/efi/refind from use/efi/memtest86

This is necessary to prevent unintentional assignment of rEFInd
as EFI_BOOTLOADER.
I also want to hope that memtest86.efi can be made to work from
grub-efi in the future.
---
 features.in/efi/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/features.in/efi/config.mk b/features.in/efi/config.mk
index c6fbff4f34..3726cb5162 100644
--- a/features.in/efi/config.mk
+++ b/features.in/efi/config.mk
@@ -48,7 +48,7 @@ use/efi/lilo: use/efi use/bootloader/lilo
 use/efi/refind: use/efi
 	@$(call set,EFI_BOOTLOADER,refind)
 
-use/efi/memtest86: use/efi/refind
+use/efi/memtest86: use/efi
 	@$(call set,EFI_MEMTEST86,efi-memtest86)
 
 else
-- 
2.24.1


[-- Attachment #15: 0014-efi-use-efi-grub-by-default-for-all-arches.patch --]
[-- Type: text/x-patch, Size: 897 bytes --]

>From ae1a96f6530b50882372cda42e31dc09c92eaf28 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Mon, 30 Dec 2019 18:55:32 +0700
Subject: [PATCH 14/20] efi: use/efi/grub by default for all arches

---
 features.in/efi/config.mk | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/features.in/efi/config.mk b/features.in/efi/config.mk
index 3726cb5162..db37b282e4 100644
--- a/features.in/efi/config.mk
+++ b/features.in/efi/config.mk
@@ -10,11 +10,7 @@ use/efi:
 	@$(call add_feature)
 	@$(call set,MKI_VER_MINIMAL,0.2.12)	# it's official now
 	@$(call set,MKI_VER_OPTIMAL,0.2.17)	# for EFI_BOOTARGS
-ifeq (x86_64,$(ARCH))
-	@$(call try,EFI_BOOTLOADER,elilo)	# default one
-else
 	@$(call try,EFI_BOOTLOADER,grub-efi)	# default one
-endif
 	@$(call add,THE_PACKAGES,$$(EFI_BOOTLOADER))
 	@$(call xport,EFI_BOOTLOADER)
 	@$(call add,THE_LISTS,$(EFI_LISTS))
-- 
2.24.1


[-- Attachment #16: 0015-syslinux-do-not-use-syslinux-to-generate-config-on-u.patch --]
[-- Type: text/x-patch, Size: 3849 bytes --]

>From 0d66510f857a745a1ac0ffd4dde372c8b7f4e0de Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 22:10:07 +0700
Subject: [PATCH 15/20] syslinux: do not use syslinux to generate config on
 unsupported arches

These are partial commits reverts:
01ee4075438e9ecfcf1b7bb71b37025f3232c3bf
e42bcdcb3095346a4c653938f7e90fa3c80b292f
5cfc7ede81024fa62039013a09160b8a7da1457d
---
 features.in/syslinux/config.mk                | 20 ++-----------------
 .../syslinux/scripts.d/20-propagator-ramdisk  |  8 +-------
 .../syslinux/stage1/scripts.d/01-syslinux     |  2 +-
 3 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/features.in/syslinux/config.mk b/features.in/syslinux/config.mk
index c355d8a875..7fa8e2198b 100644
--- a/features.in/syslinux/config.mk
+++ b/features.in/syslinux/config.mk
@@ -1,36 +1,26 @@
 # default is plain text prompt
 # NB: might be usbflash-ready hybrid iso
-
-# on ppc64le, aarch64 syslinux feature is used only to generate config
-# (it's converted into grub.cfg later)
-ifeq (,$(filter-out i586 x86_64 ppc64le aarch64,$(ARCH)))
-
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 use/syslinux: sub/stage1 $(ISOHYBRID:%=use/isohybrid)
 	@$(call add_feature)
-ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 	@$(call add,STAGE1_PACKAGES,syslinux)
 	@$(call try,BOOTVGA,normal)
 	@$(call add,SYSLINUX_FILES,/usr/lib/syslinux/pxelinux.0)
-endif
 	@$(call try,META_SYSTEM_ID,SYSLINUX)
 	@$(call set,RELNAME,ALT ($(IMAGE_NAME)))
 	@$(call set,IMAGE_PACKTYPE,boot)
 else
-
 use/syslinux: ; @:
-
 endif
 
-ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 # UI is overwritten
 use/syslinux/ui/%: use/syslinux
 	@$(call set,SYSLINUX_UI,$*)
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 	@if [ "$*" == gfxboot ]; then \
 		$(call add,STAGE1_PACKAGES,gfxboot); \
 		$(call add,STAGE1_BRANDING,bootloader); \
 	fi
-else
-use/syslinux/ui/%: use/syslinux; @:
 endif
 
 # modules and config snippets just add up
@@ -40,11 +30,5 @@ use/syslinux/%.com use/syslinux/%.c32: use/syslinux
 use/syslinux/%.cfg: use/syslinux
 	@$(call add,SYSLINUX_CFG,$*)
 
-ifeq (,$(filter-out ppc64le aarch64,$(ARCH)))
-use/syslinux/localboot.cfg use/syslinux/removable.cfg use/syslinux/lateboot.cfg use/syslinux/sdab.cfg: use/syslinux; @:
-use/syslinux/install-vnc-connect.cfg: use/syslinux/grub-install-vnc-connect.cfg; @:
-use/syslinux/install-vnc-listen.cfg: use/syslinux/grub-install-vnc-listen.cfg; @:
-endif
-
 use/syslinux/timeout/%: use/syslinux
 	@$(call set,SYSLINUX_TIMEOUT,$*)
diff --git a/features.in/syslinux/scripts.d/20-propagator-ramdisk b/features.in/syslinux/scripts.d/20-propagator-ramdisk
index b9d9c6266d..525512a0e5 100755
--- a/features.in/syslinux/scripts.d/20-propagator-ramdisk
+++ b/features.in/syslinux/scripts.d/20-propagator-ramdisk
@@ -5,16 +5,10 @@
 
 cd "$WORKDIR"
 
-cfgs="$(find syslinux boot/grub EFI/BOOT -name '*.cfg')"
-[ -n "$cfgs" ] || {
-	echo "${0##*/}: did not find any config under /syslinux or /boot/grub" >&2
-	exit 1
-}
-
 # 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," syslinux/*.cfg
 done
diff --git a/features.in/syslinux/stage1/scripts.d/01-syslinux b/features.in/syslinux/stage1/scripts.d/01-syslinux
index 693a1f58ca..e9390715aa 100755
--- a/features.in/syslinux/stage1/scripts.d/01-syslinux
+++ b/features.in/syslinux/stage1/scripts.d/01-syslinux
@@ -10,7 +10,7 @@ cd "$WORKDIR/syslinux"
 
 # validate just in case (see also stage1 Makefile)
 case "$GLOBAL_BOOTLOADER" in
-	isolinux|syslinux|ieee1275boot|grubaa64boot) ;;
+	isolinux|syslinux) ;;
 	*) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2;
 	   exit 1;;
 esac
-- 
2.24.1


[-- Attachment #17: 0016-syslinux-fixed-for-using-BOOTLOADER-not-equal-syslin.patch --]
[-- Type: text/x-patch, Size: 3088 bytes --]

>From 994759b4d916f3b29c4b869ba09e07338b4283a8 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Mon, 6 Jan 2020 23:26:52 +0700
Subject: [PATCH 16/20] syslinux: fixed for using BOOTLOADER not equal syslinux

Do not create syslinux.cfg if EFI_BOOTLOADER is set to not equal grub-efi.
---
 features.in/syslinux/scripts.d/20-propagator-ramdisk   |  2 ++
 .../syslinux/scripts.d/20-propagator-rescue-hash       |  2 ++
 features.in/syslinux/stage1/scripts.d/01-syslinux      | 10 +++++-----
 features.in/syslinux/stage1/scripts.d/02-gfxboot       |  6 +++---
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/features.in/syslinux/scripts.d/20-propagator-ramdisk b/features.in/syslinux/scripts.d/20-propagator-ramdisk
index 525512a0e5..f4139321df 100755
--- a/features.in/syslinux/scripts.d/20-propagator-ramdisk
+++ b/features.in/syslinux/scripts.d/20-propagator-ramdisk
@@ -3,6 +3,8 @@
 # when the image sizes are finally known
 # NB: install2_size, live_size, rescue_size get defined here
 
+[ -d "$WORKDIR/syslinux" ] || exit 0
+
 cd "$WORKDIR"
 
 # apply size census while looking for potential squashfs images
diff --git a/features.in/syslinux/scripts.d/20-propagator-rescue-hash b/features.in/syslinux/scripts.d/20-propagator-rescue-hash
index c785b35442..72279a8a73 100755
--- a/features.in/syslinux/scripts.d/20-propagator-rescue-hash
+++ b/features.in/syslinux/scripts.d/20-propagator-rescue-hash
@@ -3,6 +3,8 @@
 # to add rescue image hash, if any
 # (for propagator in forensic mode)
 
+[ -d "$WORKDIR/syslinux" ] || exit 0
+
 cd "$WORKDIR"
 
 grep -qs "@rescue_hash@" syslinux/*.cfg || exit 0
diff --git a/features.in/syslinux/stage1/scripts.d/01-syslinux b/features.in/syslinux/stage1/scripts.d/01-syslinux
index e9390715aa..baec719f02 100755
--- a/features.in/syslinux/stage1/scripts.d/01-syslinux
+++ b/features.in/syslinux/stage1/scripts.d/01-syslinux
@@ -5,16 +5,16 @@
 MODDIR="/usr/lib/syslinux"
 CFG="$GLOBAL_BOOTLOADER.cfg"
 
-mkdir -p "$WORKDIR/syslinux"
-cd "$WORKDIR/syslinux"
-
 # validate just in case (see also stage1 Makefile)
 case "$GLOBAL_BOOTLOADER" in
 	isolinux|syslinux) ;;
-	*) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2;
-	   exit 1;;
+	*) echo "Warning: GLOBAL_BOOTLOADER not supported: \`$GLOBAL_BOOTLOADER'" >&2;
+	   rm -fr "$WORKDIR/syslinux"
+	   exit 0;;
 esac
 
+cd "$WORKDIR/syslinux"
+
 # copy extra files, if any
 SYSLINUX_FILES="$(cat .in/syslinux.list)"
 if [ -n "${SYSLINUX_FILES% }" ]; then
diff --git a/features.in/syslinux/stage1/scripts.d/02-gfxboot b/features.in/syslinux/stage1/scripts.d/02-gfxboot
index 221deb9aa8..9deb6cddd0 100755
--- a/features.in/syslinux/stage1/scripts.d/02-gfxboot
+++ b/features.in/syslinux/stage1/scripts.d/02-gfxboot
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+[ -d "$WORKDIR/syslinux" ] || exit 0
+
 gfxboot_datadir=/usr/share/gfxboot
 
 if [ ! -d "$gfxboot_datadir" ]; then
@@ -15,9 +17,7 @@ if [ ! -f "$bootlogo" ]; then
 	exit 0
 fi
 
-cd "$WORKDIR"
-mkdir -p syslinux
-cd syslinux
+cd "$WORKDIR/syslinux"
 
 # unpack
 cpio -iduV <"$bootlogo"
-- 
2.24.1


[-- Attachment #18: 0020-sub.in-stage1-call-copy-kernel-instead-of-copy-BOOTL.patch --]
[-- Type: text/x-patch, Size: 1035 bytes --]

>From 76d5d98c0e730f8af30670a054843a188a068516 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Tue, 7 Jan 2020 21:48:53 +0700
Subject: [PATCH 20/20] sub.in/stage1: call copy-kernel instead of
 copy-$BOOTLOADER

copy-$BOOTLOADER was called to copy the kernel and propagator image.
---
 sub.in/stage1/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile
index 112c953365..6578bdc25c 100644
--- a/sub.in/stage1/Makefile
+++ b/sub.in/stage1/Makefile
@@ -52,7 +52,7 @@ prepare-modules:
 # scripts prepare bootloader configuration, too
 # NB: we pass tested squashfs options for sub.in/stage2/Makefile to include
 all: | debug prepare-workdir copy-tree run-scripts $(BUILD_PROPAGATOR) \
-	copy-$(BOOTLOADER) $(COPY_SQUASHCFG) pack-image $(GLOBAL_CLEAN_WORKDIR)
+	copy-kernel $(COPY_SQUASHCFG) pack-image $(GLOBAL_CLEAN_WORKDIR)
 	@if [ -s $(OUTDIR)/squashcfg.mk ]; then \
 		cp $(OUTDIR)/squashcfg.mk $(GLOBAL_BUILDDIR)/; \
 	fi
-- 
2.24.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2020-01-08 19:29 ` Антон Мидюков
@ 2020-01-09 14:39   ` Антон Мидюков
  2020-01-12 15:18     ` Антон Мидюков
  0 siblings, 1 reply; 10+ messages in thread
From: Антон Мидюков @ 2020-01-09 14:39 UTC (permalink / raw)
  To: devel-distro

09.01.2020 2:29, Антон Мидюков пишет:
>
> [...]
>
> 4. В mki-copy-efiboot для grub-efi ядро копировать в boot, если его 
> ещё там нет. Аналогично для других EFI_BOOTLOADER проверять, есть ли 
> уже ядро в EFI/BOOT, и если есть не копировать.
>
Копировать ядро в boot, видимо, плохая идея. В qemu грузится, на железе 
же ядро не находит.
> [...]

-- 
С уважением, Антон Мидюков <antohami@altlinux.org>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2020-01-09 14:39   ` Антон Мидюков
@ 2020-01-12 15:18     ` Антон Мидюков
  2020-02-10  2:58       ` Антон Мидюков
  0 siblings, 1 reply; 10+ messages in thread
From: Антон Мидюков @ 2020-01-12 15:18 UTC (permalink / raw)
  To: devel-distro

[-- Attachment #1: Type: text/plain, Size: 1367 bytes --]

09.01.2020 21:39, Антон Мидюков пишет:
> 09.01.2020 2:29, Антон Мидюков пишет:
>>
>> [...]
>>
>> 4. В mki-copy-efiboot для grub-efi ядро копировать в boot, если его 
>> ещё там нет. Аналогично для других EFI_BOOTLOADER проверять, есть ли 
>> уже ядро в EFI/BOOT, и если есть не копировать.
>>
> Копировать ядро в boot, видимо, плохая идея. В qemu грузится, на 
> железе же ядро не находит.
>> [...]
>
В связи с этим переделал задание 243937 (mkimage), всё хорошенько 
перепроверил и исправил очепятки.

Количество правок сократил. Убрал упоминание несуществующего grubx86boot.

Без патча 
0017-sub.in-stage1-call-copy-kernel-instead-of-copy-BOOTL.patch для 
mkimage-profiles будет работать по-старому.

Прошу аппрув для задания 243937 (mkimage).

Во вложении также патчи для mkimage-profiles. 
0000-add-grub-feature.patch -- патч shaba@, от которого я отталкивался.

-- 
С уважением, Антон Мидюков <antohami@altlinux.org>


[-- Attachment #2: 0000-add-grub-feature.patch --]
[-- Type: text/x-patch, Size: 14963 bytes --]

>From 29b94953c301bb59037c0a2c1e851a886fcbb5ab Mon Sep 17 00:00:00 2001
From: Alexey Shabalin <shaba@altlinux.org>
Date: Wed, 30 Oct 2019 20:36:22 +0300
Subject: [PATCH 01/23] add grub feature

---
 features.in/grub/cfg.in/00defaults.cfg        |  17 +++
 features.in/grub/cfg.in/20install2.cfg        |   6 ++
 .../grub/cfg.in/25install-vnc-connect.cfg     |   5 +
 .../grub/cfg.in/25install-vnc-listen.cfg      |   6 ++
 features.in/grub/cfg.in/30live.cfg            |   6 ++
 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/85mediacheck.cfg      |   4 +
 features.in/grub/cfg.in/90memtest.cfg         |   3 +
 features.in/grub/cfg.in/95fwsetup.cfg         |   3 +
 features.in/grub/config.mk                    |  39 +++++++
 features.in/grub/generate.mk                  | 100 ++++++++++++++++++
 .../grub/scripts.d/20-propagator-ramdisk      |  20 ++++
 .../grub/scripts.d/20-propagator-rescue-hash  |  14 +++
 features.in/grub/stage1/scripts.d/01-grub     |  41 +++++++
 17 files changed, 280 insertions(+)
 create mode 100644 features.in/grub/cfg.in/00defaults.cfg
 create mode 100644 features.in/grub/cfg.in/20install2.cfg
 create mode 100644 features.in/grub/cfg.in/25install-vnc-connect.cfg
 create mode 100644 features.in/grub/cfg.in/25install-vnc-listen.cfg
 create mode 100644 features.in/grub/cfg.in/30live.cfg
 create mode 100644 features.in/grub/cfg.in/32live_rw.cfg
 create mode 100644 features.in/grub/cfg.in/80rescue.cfg
 create mode 100644 features.in/grub/cfg.in/82rescue_rw.cfg
 create mode 100644 features.in/grub/cfg.in/83rescue_fm.cfg
 create mode 100644 features.in/grub/cfg.in/85mediacheck.cfg
 create mode 100644 features.in/grub/cfg.in/90memtest.cfg
 create mode 100644 features.in/grub/cfg.in/95fwsetup.cfg
 create mode 100644 features.in/grub/config.mk
 create mode 100644 features.in/grub/generate.mk
 create mode 100755 features.in/grub/scripts.d/20-propagator-ramdisk
 create mode 100755 features.in/grub/scripts.d/20-propagator-rescue-hash
 create mode 100755 features.in/grub/stage1/scripts.d/01-grub

diff --git a/features.in/grub/cfg.in/00defaults.cfg b/features.in/grub/cfg.in/00defaults.cfg
new file mode 100644
index 0000000000..4d469d4817
--- /dev/null
+++ b/features.in/grub/cfg.in/00defaults.cfg
@@ -0,0 +1,17 @@
+insmod echo
+insmod gzio
+insmod minicmd
+insmod normal
+insmod test
+set timeout=@timeout@
+
+if [ $grub_cpu = x86_64 -o $grub_cpu = i386 ]; then
+    if [ $grub_platform = efi ]; then
+        linux_suffix=efi
+    elif [ $grub_platform = pc ]; then
+        linux_suffix=16
+    else
+        linux_suffix=
+else
+    linux_suffix=
+fi
diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg
new file mode 100644
index 0000000000..1da6304eb5
--- /dev/null
+++ b/features.in/grub/cfg.in/20install2.cfg
@@ -0,0 +1,6 @@
+
+default='linux'
+menuentry 'Install ALT @relname@' --hotkey 'i' --id 'linux' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg
new file mode 100644
index 0000000000..178e8fccd5
--- /dev/null
+++ b/features.in/grub/cfg.in/25install-vnc-connect.cfg
@@ -0,0 +1,5 @@
+
+menuentry 'Install ALT @relname@ (headless with DHCP+VNC client) (edit to set server IP address)' --id 'vncconnect' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg
new file mode 100644
index 0000000000..53b2b5119b
--- /dev/null
+++ b/features.in/grub/cfg.in/25install-vnc-listen.cfg
@@ -0,0 +1,6 @@
+
+menuentry 'Install ALT @relname@ (headless with DHCP+VNC) (password VNCPWD)' --id 'vncpasswd' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
+
diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
new file mode 100644
index 0000000000..d53a1e506a
--- /dev/null
+++ b/features.in/grub/cfg.in/30live.cfg
@@ -0,0 +1,6 @@
+menuentry 'LiveCD (no hard disk needed)' --id 'live' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
+
+
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
new file mode 100644
index 0000000000..55c4b977fe
--- /dev/null
+++ b/features.in/grub/cfg.in/32live_rw.cfg
@@ -0,0 +1,4 @@
+menuentry 'LiveCD with sessions support' --id 'session' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg
new file mode 100644
index 0000000000..c6c0ae53c9
--- /dev/null
+++ b/features.in/grub/cfg.in/80rescue.cfg
@@ -0,0 +1,4 @@
+menuentry 'Rescue LiveCD' --id 'rescue' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg
new file mode 100644
index 0000000000..ec18be28bb
--- /dev/null
+++ b/features.in/grub/cfg.in/82rescue_rw.cfg
@@ -0,0 +1,4 @@
+menuentry 'Rescue with sessions support' --id 'rescue_session' {
+  linux$linux_suffix /EFI/BOOT/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 /EFI/BOOT/full.cz
+}
diff --git a/features.in/grub/cfg.in/83rescue_fm.cfg b/features.in/grub/cfg.in/83rescue_fm.cfg
new file mode 100644
index 0000000000..71bf21d3b7
--- /dev/null
+++ b/features.in/grub/cfg.in/83rescue_fm.cfg
@@ -0,0 +1,4 @@
+menuentry 'Forensic mode (leave disks alone)' --id 'rescue_forensic' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 forensic hash=@rescue_hash@
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
diff --git a/features.in/grub/cfg.in/85mediacheck.cfg b/features.in/grub/cfg.in/85mediacheck.cfg
new file mode 100644
index 0000000000..6779dd00d3
--- /dev/null
+++ b/features.in/grub/cfg.in/85mediacheck.cfg
@@ -0,0 +1,4 @@
+menuentry 'Check this media for defects' --id 'mediachk' {
+  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
+  initrd$linux_suffix /EFI/BOOT/full.cz
+}
diff --git a/features.in/grub/cfg.in/90memtest.cfg b/features.in/grub/cfg.in/90memtest.cfg
new file mode 100644
index 0000000000..f4c2121687
--- /dev/null
+++ b/features.in/grub/cfg.in/90memtest.cfg
@@ -0,0 +1,3 @@
+menuentry 'Memory Test' --id 'memtest' {
+  linux$linux_suffix /EFI/BOOT/memtest86.efi
+}
diff --git a/features.in/grub/cfg.in/95fwsetup.cfg b/features.in/grub/cfg.in/95fwsetup.cfg
new file mode 100644
index 0000000000..52404efd28
--- /dev/null
+++ b/features.in/grub/cfg.in/95fwsetup.cfg
@@ -0,0 +1,3 @@
+menuentry 'System setup' --id 'uefi-firmware' {
+        fwsetup
+}
diff --git a/features.in/grub/config.mk b/features.in/grub/config.mk
new file mode 100644
index 0000000000..9f80822fa4
--- /dev/null
+++ b/features.in/grub/config.mk
@@ -0,0 +1,39 @@
+# default is plain text prompt
+# NB: might be usbflash-ready hybrid iso
+
+# on ppc64le syslinux feature is used only to generate config
+#ifeq (,$(filter-out i586 x86_64 ppc64le aarch64,$(ARCH)))
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
+
+use/grub: sub/stage1 $(ISOHYBRID:%=use/isohybrid)
+	@$(call add_feature)
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
+	@$(call add,STAGE1_PACKAGES,grub-efi shim-signed)
+	@$(call try,BOOTVGA,normal)
+endif
+	@$(call set,RELNAME,ALT ($(IMAGE_NAME)))
+	@$(call set,IMAGE_PACKTYPE,boot)
+else
+
+use/grub: ; @:
+
+endif
+
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
+# UI is overwritten
+use/grub/ui/%: use/grub
+	@$(call set,GRUB_UI,$*)
+	@if [ "$*" == gfxboot ]; then \
+		$(call add,STAGE1_PACKAGES,gfxboot); \
+		$(call add,STAGE1_BRANDING,bootloader); \
+	fi
+else
+use/grub/ui/%: use/grub; @:
+endif
+
+use/grub/%.cfg: use/grub
+	@$(call add,GRUB_CFG,$*)
+
+
+use/grub/timeout/%: use/grub
+	@$(call set,GRUB_TIMEOUT,$*)
diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk
new file mode 100644
index 0000000000..a0b59221a2
--- /dev/null
+++ b/features.in/grub/generate.mk
@@ -0,0 +1,100 @@
+ifdef BUILDDIR
+
+# in deciseconds
+DEFAULT_TIMEOUT = 90
+
+# prepare data for grub installation;
+# see also stage1/scripts.d/01-grub
+
+include $(BUILDDIR)/distcfg.mk
+
+ifndef BOOTLOADER
+$(error grub feature enabled but BOOTLOADER undefined)
+endif
+
+ifndef GRUB_DIRECT
+# SUBPROFILES are considered GRUB_CFG too
+# (note these can appear like stage2@live);
+# 01defaults.cfg is included indefinitely
+GRUB_CFG := $(GRUB_CFG) $(SUBPROFILE_DIRS) defaults
+endif
+
+DSTDIR  := $(BUILDDIR)/stage1/files/EFI/BOOT/.in
+DSTCFGS := $(DSTDIR)/*.cfg
+
+# we can do GRUB_{CFG,MODULES,FILES}
+# CFG have only cfg snippet
+cfg = $(wildcard cfg.in/??$(1).cfg)
+
+# NB: list position determined by file numbering (*.cfg sorting)
+#
+# config snippets are copied into generated profile where they can
+# be also tested against grub modules (some can be unavailable);
+# we can't do tests right now since that implies host grub being
+# identical to build system one which might be not the case...
+#
+# have to piggyback parameters as we're running in host system yet,
+# and files involved will appear inside instrumental chroot
+#
+# arguments get evaluated before recipe body execution thus prep
+
+all: debug timeout
+	@### proper text branding should be implemented
+	@echo $(GRUB_FILES) > $(DSTDIR)/grub.list
+	@sed -i \
+		-e 's,@mkimage-profiles@,$(IMAGE_NAME),' \
+		-e 's,@relname@,$(RELNAME),' \
+		$(DSTCFGS)
+
+# integerity check
+timeout: distro
+	@if [ "$(GRUB_TIMEOUT)" -ge 0 ] 2>/dev/null; then \
+		TIMEOUT="$(GRUB_TIMEOUT)"; \
+	else \
+		TIMEOUT="$(DEFAULT_TIMEOUT)"; \
+	fi; \
+	sed -i "s,@timeout@,$$TIMEOUT," $(DSTCFGS)
+
+distro: bootargs
+	@if [ -n "$(META_VOL_SET)" ]; then \
+		DISTRO="$(META_VOL_SET)"; \
+	else \
+		DISTRO="ALT"; \
+	fi; \
+	sed -i "s,@distro@,$$DISTRO," $(DSTCFGS)
+
+# pass over additional parameters, if any
+bootargs: clean
+	@if [ -n "$(STAGE2_BOOTARGS)" ]; then \
+		sed -i "s,@bootargs@,$(STAGE2_BOOTARGS)," $(DSTCFGS); \
+	fi; \
+	sed -i "s,@bootargs@,," $(DSTCFGS)
+	@if [ -n "$(RESCUE_BOOTARGS)" ]; then \
+		sed -i "s,@rescue_bootargs@,$(RESCUE_BOOTARGS)," $(DSTCFGS); \
+	fi; \
+	sed -i "s,@rescue_bootargs@,," $(DSTCFGS)
+	@if [ -n "$(BOOTVGA)" ]; then \
+		sed -i "s,@bootvga@,$(BOOTVGA)," $(DSTCFGS); \
+	fi; \
+	sed -i "s,@bootvga@,,;s,vga= ,," $(DSTCFGS)
+
+clean: copy
+	@if [ "$(GRUB_UI)" = gfxboot ]; then \
+		sed -i "s/\^//;/menu label /d" $(DSTCFGS); \
+	fi
+
+copy: prep
+	@cp -pLt $(DSTDIR) -- $(sort \
+		$(foreach C,$(GRUB_CFG),$(call cfg,$(C))))
+
+prep:
+	@mkdir -p $(DSTDIR)
+
+debug:
+	@if [ -n "$(DEBUG)" ]; then \
+		echo "** BOOTLOADER: $(BOOTLOADER)"; \
+		echo "** GRUB_CFG: $(GRUB_CFG)"; \
+		echo "** GRUB_FILES: $(GRUB_FILES)"; \
+	fi
+
+endif
diff --git a/features.in/grub/scripts.d/20-propagator-ramdisk b/features.in/grub/scripts.d/20-propagator-ramdisk
new file mode 100755
index 0000000000..c47302a769
--- /dev/null
+++ b/features.in/grub/scripts.d/20-propagator-ramdisk
@@ -0,0 +1,20 @@
+#!/bin/sh
+# postprocess isolinux configuration
+# when the image sizes are finally known
+# NB: install2_size, live_size, rescue_size get defined here
+
+cd "$WORKDIR"
+
+cfgs="$(find EFI/BOOT -name '*.cfg')"
+[ -n "$cfgs" ] || {
+	echo "${0##*/}: did not find any config under EFI/BOOT " >&2
+	exit 1
+}
+
+# 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
+done
diff --git a/features.in/grub/scripts.d/20-propagator-rescue-hash b/features.in/grub/scripts.d/20-propagator-rescue-hash
new file mode 100755
index 0000000000..fff0be0ce9
--- /dev/null
+++ b/features.in/grub/scripts.d/20-propagator-rescue-hash
@@ -0,0 +1,14 @@
+#!/bin/sh
+# postprocess isolinux configuration
+# to add rescue image hash, if any
+# (for propagator in forensic mode)
+
+cd "$WORKDIR"
+
+grep -qs "@rescue_hash@" EFI/BOOT/*.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," EFI/BOOT/*.cfg
+done
diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
new file mode 100755
index 0000000000..620b8dac4b
--- /dev/null
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -0,0 +1,41 @@
+#!/bin/sh
+# gather syslinux configuration from snippets;
+# copy modules; see also this feature's generate.mk
+
+CFG="grub.cfg"
+
+mkdir -p "$WORKDIR/EFI/BOOT"
+cd "$WORKDIR/EFI/BOOT"
+
+# validate just in case (see also stage1 Makefile)
+case "$GLOBAL_BOOTLOADER" in
+	isolinux|syslinux|ieee1275boot|grubaa64boot|grubx86boot) ;;
+	*) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2;
+	   exit 1;;
+esac
+
+# copy extra files, if any
+GRUB_FILES="$(cat .in/grub.list)"
+if [ -n "${GRUB_FILES% }" ]; then
+	cp -a $GRUB_FILES .
+fi
+
+# number ordering sponsored by shell's pathname expansion
+grep -hv '^#' .in/[0-9][0-9]*.cfg > "$CFG"
+
+# there should be DEFAULT directive there (at least for alterator-netinst)
+if ! grep -i '^default' "$CFG"; then
+	DEFAULT="$(grep -i '^label ' "$CFG" | head -1 | cut -f2 -d' ')"
+	if [ -n "$DEFAULT" ]; then
+		echo "default $DEFAULT" >> "$CFG"
+	else
+		echo "error: no DEFAULT or UI directive and cannot guess" >&2
+		exit 1
+	fi
+fi
+
+# snippets are not going into the actual image
+if [ "$DEBUG" != 2 ]; then rm -r .in/; fi
+
+# NB: there will be final macro expansion based on actual image sizes
+#     done by features.in/syslinux/scripts.d/20-propagator-ramdisk
-- 
2.24.1


[-- Attachment #3: 0001-grub-fix-typo.patch --]
[-- Type: text/x-patch, Size: 1001 bytes --]

>From d59e532386690265ce4bd1ed5af33562e4e02d7f Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 22:50:57 +0700
Subject: [PATCH 01/22] grub: fix typo

---
 features.in/grub/stage1/scripts.d/01-grub | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 620b8dac4b..d331c0b016 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -1,5 +1,5 @@
 #!/bin/sh
-# gather syslinux configuration from snippets;
+# gather grub configuration from snippets;
 # copy modules; see also this feature's generate.mk
 
 CFG="grub.cfg"
@@ -38,4 +38,4 @@ fi
 if [ "$DEBUG" != 2 ]; then rm -r .in/; fi
 
 # NB: there will be final macro expansion based on actual image sizes
-#     done by features.in/syslinux/scripts.d/20-propagator-ramdisk
+#     done by features.in/grub/scripts.d/20-propagator-ramdisk
-- 
2.24.1


[-- Attachment #4: 0002-grub-fixed-search-default-in-stage1-scripts.d-01-gru.patch --]
[-- Type: text/x-patch, Size: 1293 bytes --]

>From 63c0b2e2da50c7e16cd7b70ed8a8268939ef4e50 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:34:52 +0700
Subject: [PATCH 02/22] grub: fixed search default in stage1/scripts.d/01-grub

The definition of the default menu item has been fixed.
Grub.cfg does not use label, uses --id.
It is assumed that --id is given last.
---
 features.in/grub/stage1/scripts.d/01-grub | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index d331c0b016..9f87292925 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -24,10 +24,10 @@ fi
 grep -hv '^#' .in/[0-9][0-9]*.cfg > "$CFG"
 
 # there should be DEFAULT directive there (at least for alterator-netinst)
-if ! grep -i '^default' "$CFG"; then
-	DEFAULT="$(grep -i '^label ' "$CFG" | head -1 | cut -f2 -d' ')"
+if ! grep -i '^default' .in/[0-9][0-9]*.cfg; then
+	DEFAULT="$(grep -i '\-\-id ' .in/[0-9][0-9]*.cfg | head -1 | rev| cut -f2 -d' ' |rev)"
 	if [ -n "$DEFAULT" ]; then
-		echo "default $DEFAULT" >> "$CFG"
+		echo "default=$DEFAULT" >> "$CFG"
 	else
 		echo "error: no DEFAULT or UI directive and cannot guess" >&2
 		exit 1
-- 
2.24.1


[-- Attachment #5: 0003-grub-generate-grub.cfg-for-grub-efi-ieee1275boot-and.patch --]
[-- Type: text/x-patch, Size: 12481 bytes --]

>From 675ebfb1fc1e7e1368980e160e05f98cbb8e152e Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Thu, 2 Jan 2020 22:28:16 +0700
Subject: [PATCH 03/22] grub: generate grub.cfg for grub-efi, ieee1275boot and
 grub-pc

---
 features.in/grub/cfg.in/20install2.cfg        |  6 +-
 .../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/85mediacheck.cfg      |  4 +-
 features.in/grub/generate.mk                  |  2 +-
 .../grub/scripts.d/20-propagator-ramdisk      | 10 ++--
 .../grub/scripts.d/20-propagator-rescue-hash  |  8 ++-
 features.in/grub/stage1/scripts.d/01-grub     | 60 ++++++++++++++-----
 13 files changed, 77 insertions(+), 41 deletions(-)

diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg
index 1da6304eb5..373cd892fc 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 ALT @relname@' --hotkey 'i' --id 'linux' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+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@
+  initrd$linux_suffix @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg
index 178e8fccd5..77cbee0e5c 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 'Install ALT @relname@ (headless with DHCP+VNC client) (edit to set server IP address)' --id 'vncconnect' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
+  initrd$linux_suffix @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg
index 53b2b5119b..39606a400a 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 'Install ALT @relname@ (headless with DHCP+VNC) (password VNCPWD)' --id 'vncpasswd' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
+  initrd$linux_suffix @boot_path@/full.cz
 }
 
diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
index d53a1e506a..b03b5ade9e 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 /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
+  initrd$linux_suffix @boot_path@/full.cz
 }
 
 
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
index 55c4b977fe..5aec351804 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 /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
+  initrd$linux_suffix @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg
index c6c0ae53c9..230f8c6cb3 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 /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  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
 }
diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg
index ec18be28bb..6266962645 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 /EFI/BOOT/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 /EFI/BOOT/full.cz
+  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
 }
diff --git a/features.in/grub/cfg.in/83rescue_fm.cfg b/features.in/grub/cfg.in/83rescue_fm.cfg
index 71bf21d3b7..e2214b6cc5 100644
--- a/features.in/grub/cfg.in/83rescue_fm.cfg
+++ b/features.in/grub/cfg.in/83rescue_fm.cfg
@@ -1,4 +1,4 @@
 menuentry 'Forensic mode (leave disks alone)' --id 'rescue_forensic' {
-  linux$linux_suffix /EFI/BOOT/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ max_loop=16 forensic hash=@rescue_hash@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  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 forensic hash=@rescue_hash@
+  initrd$linux_suffix @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/85mediacheck.cfg b/features.in/grub/cfg.in/85mediacheck.cfg
index 6779dd00d3..490df685f2 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 /EFI/BOOT/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
-  initrd$linux_suffix /EFI/BOOT/full.cz
+  linux$linux_suffix @boot_path@/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
+  initrd$linux_suffix @boot_path@/full.cz
 }
diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk
index a0b59221a2..f321ce798e 100644
--- a/features.in/grub/generate.mk
+++ b/features.in/grub/generate.mk
@@ -19,7 +19,7 @@ ifndef GRUB_DIRECT
 GRUB_CFG := $(GRUB_CFG) $(SUBPROFILE_DIRS) defaults
 endif
 
-DSTDIR  := $(BUILDDIR)/stage1/files/EFI/BOOT/.in
+DSTDIR  := $(BUILDDIR)/stage1/files/boot/grub/.in
 DSTCFGS := $(DSTDIR)/*.cfg
 
 # we can do GRUB_{CFG,MODULES,FILES}
diff --git a/features.in/grub/scripts.d/20-propagator-ramdisk b/features.in/grub/scripts.d/20-propagator-ramdisk
index c47302a769..04470b6c85 100755
--- a/features.in/grub/scripts.d/20-propagator-ramdisk
+++ b/features.in/grub/scripts.d/20-propagator-ramdisk
@@ -5,11 +5,11 @@
 
 cd "$WORKDIR"
 
-cfgs="$(find EFI/BOOT -name '*.cfg')"
-[ -n "$cfgs" ] || {
-	echo "${0##*/}: did not find any config under EFI/BOOT " >&2
-	exit 1
-}
+[ -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'
 
 # apply size census while looking for potential squashfs images
 find -maxdepth 1 -type f -size +1M \
diff --git a/features.in/grub/scripts.d/20-propagator-rescue-hash b/features.in/grub/scripts.d/20-propagator-rescue-hash
index fff0be0ce9..3ca61591bc 100755
--- a/features.in/grub/scripts.d/20-propagator-rescue-hash
+++ b/features.in/grub/scripts.d/20-propagator-rescue-hash
@@ -5,10 +5,14 @@
 
 cd "$WORKDIR"
 
-grep -qs "@rescue_hash@" EFI/BOOT/*.cfg || exit 0
+[ -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'
 
 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," EFI/BOOT/*.cfg
+	sed -i "s,@rescue_hash@,$rescue_hash," $cfgs
 done
diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 9f87292925..4ea9a02acd 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -2,17 +2,23 @@
 # gather grub configuration from snippets;
 # copy modules; see also this feature's generate.mk
 
-CFG="grub.cfg"
+CFG="$WORKDIR/boot/grub/grub.cfg"
+CFG_EFI="$WORKDIR/EFI/BOOT/grub.cfg"
 
-mkdir -p "$WORKDIR/EFI/BOOT"
-cd "$WORKDIR/EFI/BOOT"
+if [ -n "$GLOBAL_EFI_BOOTLOADER" -a ! "$GLOBAL_EFI_BOOTLOADER" = "grub-efi" ]; then
+	rm -fr "$WORKDIR/boot"
+	exit 0
+fi
 
-# validate just in case (see also stage1 Makefile)
-case "$GLOBAL_BOOTLOADER" in
-	isolinux|syslinux|ieee1275boot|grubaa64boot|grubx86boot) ;;
-	*) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2;
-	   exit 1;;
-esac
+if [ -z "$GLOBAL_EFI_BOOTLOADER" ]; then
+	case "$GLOBAL_BOOTLOADER" in
+		ieee1275boot) ;;
+		*) rm -fr "$WORKDIR/boot"
+		   exit 0;;
+	esac
+fi
+
+cd "$WORKDIR/boot/grub"
 
 # copy extra files, if any
 GRUB_FILES="$(cat .in/grub.list)"
@@ -21,21 +27,47 @@ if [ -n "${GRUB_FILES% }" ]; then
 fi
 
 # number ordering sponsored by shell's pathname expansion
-grep -hv '^#' .in/[0-9][0-9]*.cfg > "$CFG"
+case "$GLOBAL_BOOTLOADER" in
+	ieee1275boot)
+		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) > "$CFG_EFI"
+fi
 
 # there should be DEFAULT directive there (at least for alterator-netinst)
-if ! grep -i '^default' .in/[0-9][0-9]*.cfg; then
-	DEFAULT="$(grep -i '\-\-id ' .in/[0-9][0-9]*.cfg | head -1 | rev| cut -f2 -d' ' |rev)"
+default_change() {
+local CFG=$1
+if ! grep -i '^default' "$CFG"; then
+	DEFAULT="$(grep -i '\-\-id ' "$CFG" | head -1 | rev| cut -f2 -d' ' |rev)"
 	if [ -n "$DEFAULT" ]; then
 		echo "default=$DEFAULT" >> "$CFG"
 	else
-		echo "error: no DEFAULT or UI directive and cannot guess" >&2
+		echo "error: no DEFAULT or UI directive and cannot guess for $CFG" >&2
 		exit 1
 	fi
 fi
+}
+
+if [ -f "$CFG" ]; then
+	default_change "$CFG"
+	sed -i 's,@boot_path@,/boot,g' "$CFG"
+fi
+
+if [ -f "$CFG_EFI" ]; then
+	default_change "$CFG_EFI"
+	sed -i 's,@boot_path@,/EFI/BOOT,g' "$CFG_EFI"
+fi
 
 # snippets are not going into the actual image
-if [ "$DEBUG" != 2 ]; then rm -r .in/; fi
+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
 #     done by features.in/grub/scripts.d/20-propagator-ramdisk
-- 
2.24.1


[-- Attachment #6: 0004-grub-add-suffix-_efi-for-EFI-configs.patch --]
[-- Type: text/x-patch, Size: 1005 bytes --]

>From a9a046c71c5045c770ccfec1ba4f1f8ea93b12db Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Wed, 8 Jan 2020 15:29:17 +0700
Subject: [PATCH 04/22] grub: add suffix _efi for EFI configs

---
 features.in/grub/cfg.in/{90memtest.cfg => 90memtest_efi.cfg} | 0
 features.in/grub/cfg.in/{95fwsetup.cfg => 95fwsetup_efi.cfg} | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename features.in/grub/cfg.in/{90memtest.cfg => 90memtest_efi.cfg} (100%)
 rename features.in/grub/cfg.in/{95fwsetup.cfg => 95fwsetup_efi.cfg} (100%)

diff --git a/features.in/grub/cfg.in/90memtest.cfg b/features.in/grub/cfg.in/90memtest_efi.cfg
similarity index 100%
rename from features.in/grub/cfg.in/90memtest.cfg
rename to features.in/grub/cfg.in/90memtest_efi.cfg
diff --git a/features.in/grub/cfg.in/95fwsetup.cfg b/features.in/grub/cfg.in/95fwsetup_efi.cfg
similarity index 100%
rename from features.in/grub/cfg.in/95fwsetup.cfg
rename to features.in/grub/cfg.in/95fwsetup_efi.cfg
-- 
2.24.1


[-- Attachment #7: 0005-grub-fixed-PATH-to-memtest86.efi-in-90memtest-efi.cf.patch --]
[-- Type: text/x-patch, Size: 732 bytes --]

>From b3e3f2c78c52144a301469da12bb7dac35a55cb5 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:46:48 +0700
Subject: [PATCH 05/22] grub: fixed PATH to memtest86.efi in 90memtest-efi.cfg

---
 features.in/grub/cfg.in/90memtest_efi.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/features.in/grub/cfg.in/90memtest_efi.cfg b/features.in/grub/cfg.in/90memtest_efi.cfg
index f4c2121687..d0d27372d9 100644
--- a/features.in/grub/cfg.in/90memtest_efi.cfg
+++ b/features.in/grub/cfg.in/90memtest_efi.cfg
@@ -1,3 +1,3 @@
 menuentry 'Memory Test' --id 'memtest' {
-  linux$linux_suffix /EFI/BOOT/memtest86.efi
+  linux$linux_suffix /EFI/tools/memtest86.efi
 }
-- 
2.24.1


[-- Attachment #8: 0006-grub-change-linux_suffix.patch --]
[-- Type: text/x-patch, Size: 9497 bytes --]

>From 16c9382d60f5a0448b5c698a4235d6283edb5603 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Fri, 3 Jan 2020 16:58:15 +0700
Subject: [PATCH 06/22] grub: change @linux_suffix@

---
 features.in/grub/cfg.in/00defaults.cfg            | 11 -----------
 features.in/grub/cfg.in/20install2.cfg            |  4 ++--
 features.in/grub/cfg.in/25install-vnc-connect.cfg |  4 ++--
 features.in/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/85mediacheck.cfg          |  4 ++--
 features.in/grub/cfg.in/90memtest_efi.cfg         |  2 +-
 features.in/grub/stage1/scripts.d/01-grub         | 12 ++++++++++++
 12 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/features.in/grub/cfg.in/00defaults.cfg b/features.in/grub/cfg.in/00defaults.cfg
index 4d469d4817..88b56d9873 100644
--- a/features.in/grub/cfg.in/00defaults.cfg
+++ b/features.in/grub/cfg.in/00defaults.cfg
@@ -4,14 +4,3 @@ insmod minicmd
 insmod normal
 insmod test
 set timeout=@timeout@
-
-if [ $grub_cpu = x86_64 -o $grub_cpu = i386 ]; then
-    if [ $grub_platform = efi ]; then
-        linux_suffix=efi
-    elif [ $grub_platform = pc ]; then
-        linux_suffix=16
-    else
-        linux_suffix=
-else
-    linux_suffix=
-fi
diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg
index 373cd892fc..9cf86bbed0 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@
-  initrd$linux_suffix @boot_path@/full.cz
+  linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg
index 77cbee0e5c..8277bd4b03 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 'Install ALT @relname@ (headless with DHCP+VNC client) (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
-  initrd$linux_suffix @boot_path@/full.cz
+  linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncconnect=IP
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg
index 39606a400a..a056a64fca 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 'Install ALT @relname@ (headless with DHCP+VNC) (password VNCPWD)' --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
-  initrd$linux_suffix @boot_path@/full.cz
+  linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
 
diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
index b03b5ade9e..5e4b85ada6 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@
-  initrd$linux_suffix @boot_path@/full.cz
+  linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
 
 
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
index 5aec351804..4bac28aa65 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@
-  initrd$linux_suffix @boot_path@/full.cz
+  linux@linux_suffix@ @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg
index 230f8c6cb3..a9d2575cfb 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 changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg
index 6266962645..753c642bc3 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 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
 }
diff --git a/features.in/grub/cfg.in/83rescue_fm.cfg b/features.in/grub/cfg.in/83rescue_fm.cfg
index e2214b6cc5..2374452dee 100644
--- a/features.in/grub/cfg.in/83rescue_fm.cfg
+++ b/features.in/grub/cfg.in/83rescue_fm.cfg
@@ -1,4 +1,4 @@
 menuentry 'Forensic mode (leave disks alone)' --id 'rescue_forensic' {
-  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 forensic hash=@rescue_hash@
-  initrd$linux_suffix @boot_path@/full.cz
+  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 forensic hash=@rescue_hash@
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/85mediacheck.cfg b/features.in/grub/cfg.in/85mediacheck.cfg
index 490df685f2..918f074dbe 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@
-  initrd$linux_suffix @boot_path@/full.cz
+  linux@linux_suffix@ @boot_path@/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@
+  initrd@linux_suffix@ @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/90memtest_efi.cfg b/features.in/grub/cfg.in/90memtest_efi.cfg
index d0d27372d9..c52d1a6ffc 100644
--- a/features.in/grub/cfg.in/90memtest_efi.cfg
+++ b/features.in/grub/cfg.in/90memtest_efi.cfg
@@ -1,3 +1,3 @@
 menuentry 'Memory Test' --id 'memtest' {
-  linux$linux_suffix /EFI/tools/memtest86.efi
+  linux@linux_suffix@ /EFI/tools/memtest86.efi
 }
diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub
index 4ea9a02acd..e7e82a9bfd 100755
--- a/features.in/grub/stage1/scripts.d/01-grub
+++ b/features.in/grub/stage1/scripts.d/01-grub
@@ -61,6 +61,18 @@ if [ -f "$CFG_EFI" ]; then
 	sed -i 's,@boot_path@,/EFI/BOOT,g' "$CFG_EFI"
 fi
 
+# change @linux_suffix@
+case "$GLOBAL_ARCH" in
+	i586|x86_64)
+		[ ! -f "$CFG" ] || sed -i 's/@linux_suffix@/16/g' "$CFG"
+		[ ! -f "$CFG_EFI" ] || sed -i 's/@linux_suffix@/efi/g' "$CFG_EFI"
+	;;
+	*)
+		[ ! -f "$CFG" ] || sed -i 's/@linux_suffix@//g' "$CFG"
+		[ ! -f "$CFG_EFI" ] || sed -i 's/@linux_suffix@//g' "$CFG_EFI"
+	;;
+esac
+
 # snippets are not going into the actual image
 if [ "$DEBUG" != 2 ]; then
 	rm -r .in/
-- 
2.24.1


[-- Attachment #9: 0007-grub-available-for-i586-x86_64-aarch64-ppc64le.patch --]
[-- Type: text/x-patch, Size: 895 bytes --]

>From b92e30b3a8c79255b92e4c52b5b13bdbf5773d35 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 21:51:30 +0700
Subject: [PATCH 07/22] grub: available for i586, x86_64, aarch64, ppc64le

---
 features.in/grub/config.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/features.in/grub/config.mk b/features.in/grub/config.mk
index 9f80822fa4..373001f884 100644
--- a/features.in/grub/config.mk
+++ b/features.in/grub/config.mk
@@ -1,9 +1,7 @@
 # default is plain text prompt
 # NB: might be usbflash-ready hybrid iso
 
-# on ppc64le syslinux feature is used only to generate config
-#ifeq (,$(filter-out i586 x86_64 ppc64le aarch64,$(ARCH)))
-ifeq (,$(filter-out i586 x86_64,$(ARCH)))
+ifeq (,$(filter-out i586 x86_64 ppc64le aarch64,$(ARCH)))
 
 use/grub: sub/stage1 $(ISOHYBRID:%=use/isohybrid)
 	@$(call add_feature)
-- 
2.24.1


[-- Attachment #10: 0008-grub-add-84rescue_remote.cfg.patch --]
[-- Type: text/x-patch, Size: 959 bytes --]

>From 274aa0982b6995215263127aa6ba6b06aff13e8f Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:29:45 +0700
Subject: [PATCH 08/22] grub: add 84rescue_remote.cfg

---
 features.in/grub/cfg.in/84rescue_remote.cfg | 4 ++++
 1 file changed, 4 insertions(+)
 create mode 100644 features.in/grub/cfg.in/84rescue_remote.cfg

diff --git a/features.in/grub/cfg.in/84rescue_remote.cfg b/features.in/grub/cfg.in/84rescue_remote.cfg
new file mode 100644
index 0000000000..738abd79ad
--- /dev/null
+++ b/features.in/grub/cfg.in/84rescue_remote.cfg
@@ -0,0 +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
+}
-- 
2.24.1


[-- Attachment #11: 0009-grub-Added-release-name-to-LiveCD-menu-items.patch --]
[-- Type: text/x-patch, Size: 1592 bytes --]

>From 3d28f1797cdbe8029f8da939eea91b859bc61998 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 20:41:23 +0700
Subject: [PATCH 09/22] grub: Added release name to LiveCD menu items

In grub, you cannot set a header with a release name, as in syslinux.
---
 features.in/grub/cfg.in/30live.cfg    | 2 +-
 features.in/grub/cfg.in/32live_rw.cfg | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg
index 5e4b85ada6..7986432113 100644
--- a/features.in/grub/cfg.in/30live.cfg
+++ b/features.in/grub/cfg.in/30live.cfg
@@ -1,4 +1,4 @@
-menuentry 'LiveCD (no hard disk needed)' --id 'live' {
+menuentry 'LiveCD @relname@ (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@
   initrd@linux_suffix@ @boot_path@/full.cz
 }
diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg
index 4bac28aa65..4c00dd3d4f 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' {
+menuentry 'LiveCD @relname@ 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@
   initrd@linux_suffix@ @boot_path@/full.cz
 }
-- 
2.24.1


[-- Attachment #12: 0010-install2-live-add-grub.cfg-support.patch --]
[-- Type: text/x-patch, Size: 2831 bytes --]

>From c4aeff917b22f29e3a8397c652fd2b3f3c72d79a Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Fri, 3 Jan 2020 21:11:15 +0700
Subject: [PATCH 10/22] install2, live: add grub.cfg support

---
 features.in/install2/config.mk | 10 +++++-----
 features.in/live/config.mk     |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/features.in/install2/config.mk b/features.in/install2/config.mk
index 4c744dac80..71e6c4171b 100644
--- a/features.in/install2/config.mk
+++ b/features.in/install2/config.mk
@@ -3,7 +3,7 @@
 +installer: use/install2/full; @:
 
 use/install2: use/stage2 sub/stage2@install2 use/metadata \
-	use/cleanup/installer use/install2/autoinstall
+	use/cleanup/installer use/install2/autoinstall use/grub/install2.cfg
 	@$(call add_feature)
 	@$(call try,INSTALLER,altlinux-generic)	# might be replaced later
 	@$(call add,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
@@ -84,12 +84,12 @@ use/install2/vnc:
 	@$(call add,INSTALL2_PACKAGES,x11vnc xterm net-tools)
 
 # this one expects external vncviewer to come
-use/install2/vnc/listen: \
-	use/install2/vnc use/syslinux/install-vnc-listen.cfg; @:
+use/install2/vnc/listen: use/install2/vnc \
+	use/syslinux/install-vnc-listen.cfg use/grub/install-vnc-listen.cfg; @:
 
 # this one connects to a specified vncviewer --listen
-use/install2/vnc/connect: \
-	use/install2/vnc use/syslinux/install-vnc-connect.cfg; @:
+use/install2/vnc/connect: use/install2/vnc \
+	use/syslinux/install-vnc-connect.cfg use/grub/install-vnc-connect.cfg; @:
 
 # add both bootloader items to be *that* explicit ;-)
 use/install2/vnc/full: use/install2/vnc/listen use/install2/vnc/connect; @:
diff --git a/features.in/live/config.mk b/features.in/live/config.mk
index 7644e8591e..1278922ddd 100644
--- a/features.in/live/config.mk
+++ b/features.in/live/config.mk
@@ -12,7 +12,8 @@ _OFF = anacron blk-availability bridge clamd crond dhcpd dmeventd dnsmasq \
 
 # copy stage2 as live
 # NB: starts to preconfigure but doesn't use/cleanup yet
-use/live: use/stage2 sub/rootfs@live sub/stage2@live use/services/lvm2-disable
+use/live: use/stage2 sub/rootfs@live sub/stage2@live \
+	use/services/lvm2-disable use/grub/live.cfg
 	@$(call add_feature)
 	@$(call add,CLEANUP_BASE_PACKAGES,'installer*')
 	@$(call add,DEFAULT_SERVICES_ENABLE,$(_ON))
@@ -28,10 +29,9 @@ use/live/base: use/live/.base use/net use/deflogin/live
 
 # rw slice, see http://www.altlinux.org/make-initrd-propagator and #28289
 ifeq (,$(EFI_BOOTLOADER))
-use/live/rw: use/live use/syslinux
-	@$(call add,SYSLINUX_CFG,live_rw)
+use/live/rw: use/live use/syslinux/live_rw.cfg use/grub/live_rw.cfg; @:
 else
-use/live/rw: use/live; @:
+use/live/rw: use/live use/grub/live_rw.cfg; @:
 endif
 
 # graphical target (not enforcing xorg drivers or blobs)
-- 
2.24.1


[-- Attachment #13: 0011-efi-do-not-call-use-efi-refind-from-use-efi-memtest8.patch --]
[-- Type: text/x-patch, Size: 907 bytes --]

>From 22827511fb488cafa71e86f0074aa714b566295b Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 21:04:02 +0700
Subject: [PATCH 11/22] efi: do not call use/efi/refind from use/efi/memtest86

This is necessary to prevent unintentional assignment of rEFInd
as EFI_BOOTLOADER.
I also want to hope that memtest86.efi can be made to work from
grub-efi in the future.
---
 features.in/efi/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/features.in/efi/config.mk b/features.in/efi/config.mk
index c6fbff4f34..3726cb5162 100644
--- a/features.in/efi/config.mk
+++ b/features.in/efi/config.mk
@@ -48,7 +48,7 @@ use/efi/lilo: use/efi use/bootloader/lilo
 use/efi/refind: use/efi
 	@$(call set,EFI_BOOTLOADER,refind)
 
-use/efi/memtest86: use/efi/refind
+use/efi/memtest86: use/efi
 	@$(call set,EFI_MEMTEST86,efi-memtest86)
 
 else
-- 
2.24.1


[-- Attachment #14: 0012-efi-use-efi-grub-by-default-for-all-arches.patch --]
[-- Type: text/x-patch, Size: 897 bytes --]

>From 4558187d4e2c464e0d15e9a7855d6ba2e77208d8 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Mon, 30 Dec 2019 18:55:32 +0700
Subject: [PATCH 12/22] efi: use/efi/grub by default for all arches

---
 features.in/efi/config.mk | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/features.in/efi/config.mk b/features.in/efi/config.mk
index 3726cb5162..db37b282e4 100644
--- a/features.in/efi/config.mk
+++ b/features.in/efi/config.mk
@@ -10,11 +10,7 @@ use/efi:
 	@$(call add_feature)
 	@$(call set,MKI_VER_MINIMAL,0.2.12)	# it's official now
 	@$(call set,MKI_VER_OPTIMAL,0.2.17)	# for EFI_BOOTARGS
-ifeq (x86_64,$(ARCH))
-	@$(call try,EFI_BOOTLOADER,elilo)	# default one
-else
 	@$(call try,EFI_BOOTLOADER,grub-efi)	# default one
-endif
 	@$(call add,THE_PACKAGES,$$(EFI_BOOTLOADER))
 	@$(call xport,EFI_BOOTLOADER)
 	@$(call add,THE_LISTS,$(EFI_LISTS))
-- 
2.24.1


[-- Attachment #15: 0013-syslinux-do-not-use-syslinux-to-generate-config-on-u.patch --]
[-- Type: text/x-patch, Size: 3849 bytes --]

>From 4b361b25d45fd1688223b3e12f95a227051d3174 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 5 Jan 2020 22:10:07 +0700
Subject: [PATCH 13/22] syslinux: do not use syslinux to generate config on
 unsupported arches

These are partial commits reverts:
01ee4075438e9ecfcf1b7bb71b37025f3232c3bf
e42bcdcb3095346a4c653938f7e90fa3c80b292f
5cfc7ede81024fa62039013a09160b8a7da1457d
---
 features.in/syslinux/config.mk                | 20 ++-----------------
 .../syslinux/scripts.d/20-propagator-ramdisk  |  8 +-------
 .../syslinux/stage1/scripts.d/01-syslinux     |  2 +-
 3 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/features.in/syslinux/config.mk b/features.in/syslinux/config.mk
index c355d8a875..7fa8e2198b 100644
--- a/features.in/syslinux/config.mk
+++ b/features.in/syslinux/config.mk
@@ -1,36 +1,26 @@
 # default is plain text prompt
 # NB: might be usbflash-ready hybrid iso
-
-# on ppc64le, aarch64 syslinux feature is used only to generate config
-# (it's converted into grub.cfg later)
-ifeq (,$(filter-out i586 x86_64 ppc64le aarch64,$(ARCH)))
-
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 use/syslinux: sub/stage1 $(ISOHYBRID:%=use/isohybrid)
 	@$(call add_feature)
-ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 	@$(call add,STAGE1_PACKAGES,syslinux)
 	@$(call try,BOOTVGA,normal)
 	@$(call add,SYSLINUX_FILES,/usr/lib/syslinux/pxelinux.0)
-endif
 	@$(call try,META_SYSTEM_ID,SYSLINUX)
 	@$(call set,RELNAME,ALT ($(IMAGE_NAME)))
 	@$(call set,IMAGE_PACKTYPE,boot)
 else
-
 use/syslinux: ; @:
-
 endif
 
-ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 # UI is overwritten
 use/syslinux/ui/%: use/syslinux
 	@$(call set,SYSLINUX_UI,$*)
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 	@if [ "$*" == gfxboot ]; then \
 		$(call add,STAGE1_PACKAGES,gfxboot); \
 		$(call add,STAGE1_BRANDING,bootloader); \
 	fi
-else
-use/syslinux/ui/%: use/syslinux; @:
 endif
 
 # modules and config snippets just add up
@@ -40,11 +30,5 @@ use/syslinux/%.com use/syslinux/%.c32: use/syslinux
 use/syslinux/%.cfg: use/syslinux
 	@$(call add,SYSLINUX_CFG,$*)
 
-ifeq (,$(filter-out ppc64le aarch64,$(ARCH)))
-use/syslinux/localboot.cfg use/syslinux/removable.cfg use/syslinux/lateboot.cfg use/syslinux/sdab.cfg: use/syslinux; @:
-use/syslinux/install-vnc-connect.cfg: use/syslinux/grub-install-vnc-connect.cfg; @:
-use/syslinux/install-vnc-listen.cfg: use/syslinux/grub-install-vnc-listen.cfg; @:
-endif
-
 use/syslinux/timeout/%: use/syslinux
 	@$(call set,SYSLINUX_TIMEOUT,$*)
diff --git a/features.in/syslinux/scripts.d/20-propagator-ramdisk b/features.in/syslinux/scripts.d/20-propagator-ramdisk
index b9d9c6266d..525512a0e5 100755
--- a/features.in/syslinux/scripts.d/20-propagator-ramdisk
+++ b/features.in/syslinux/scripts.d/20-propagator-ramdisk
@@ -5,16 +5,10 @@
 
 cd "$WORKDIR"
 
-cfgs="$(find syslinux boot/grub EFI/BOOT -name '*.cfg')"
-[ -n "$cfgs" ] || {
-	echo "${0##*/}: did not find any config under /syslinux or /boot/grub" >&2
-	exit 1
-}
-
 # 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," syslinux/*.cfg
 done
diff --git a/features.in/syslinux/stage1/scripts.d/01-syslinux b/features.in/syslinux/stage1/scripts.d/01-syslinux
index 693a1f58ca..e9390715aa 100755
--- a/features.in/syslinux/stage1/scripts.d/01-syslinux
+++ b/features.in/syslinux/stage1/scripts.d/01-syslinux
@@ -10,7 +10,7 @@ cd "$WORKDIR/syslinux"
 
 # validate just in case (see also stage1 Makefile)
 case "$GLOBAL_BOOTLOADER" in
-	isolinux|syslinux|ieee1275boot|grubaa64boot) ;;
+	isolinux|syslinux) ;;
 	*) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2;
 	   exit 1;;
 esac
-- 
2.24.1


[-- Attachment #16: 0014-syslinux-fixed-for-using-BOOTLOADER-not-equal-syslin.patch --]
[-- Type: text/x-patch, Size: 3088 bytes --]

>From c7bbde5adb73bfa018191e8b70ac61dac32081b2 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Mon, 6 Jan 2020 23:26:52 +0700
Subject: [PATCH 14/22] syslinux: fixed for using BOOTLOADER not equal syslinux

Do not create syslinux.cfg if EFI_BOOTLOADER is set to not equal grub-efi.
---
 features.in/syslinux/scripts.d/20-propagator-ramdisk   |  2 ++
 .../syslinux/scripts.d/20-propagator-rescue-hash       |  2 ++
 features.in/syslinux/stage1/scripts.d/01-syslinux      | 10 +++++-----
 features.in/syslinux/stage1/scripts.d/02-gfxboot       |  6 +++---
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/features.in/syslinux/scripts.d/20-propagator-ramdisk b/features.in/syslinux/scripts.d/20-propagator-ramdisk
index 525512a0e5..f4139321df 100755
--- a/features.in/syslinux/scripts.d/20-propagator-ramdisk
+++ b/features.in/syslinux/scripts.d/20-propagator-ramdisk
@@ -3,6 +3,8 @@
 # when the image sizes are finally known
 # NB: install2_size, live_size, rescue_size get defined here
 
+[ -d "$WORKDIR/syslinux" ] || exit 0
+
 cd "$WORKDIR"
 
 # apply size census while looking for potential squashfs images
diff --git a/features.in/syslinux/scripts.d/20-propagator-rescue-hash b/features.in/syslinux/scripts.d/20-propagator-rescue-hash
index c785b35442..72279a8a73 100755
--- a/features.in/syslinux/scripts.d/20-propagator-rescue-hash
+++ b/features.in/syslinux/scripts.d/20-propagator-rescue-hash
@@ -3,6 +3,8 @@
 # to add rescue image hash, if any
 # (for propagator in forensic mode)
 
+[ -d "$WORKDIR/syslinux" ] || exit 0
+
 cd "$WORKDIR"
 
 grep -qs "@rescue_hash@" syslinux/*.cfg || exit 0
diff --git a/features.in/syslinux/stage1/scripts.d/01-syslinux b/features.in/syslinux/stage1/scripts.d/01-syslinux
index e9390715aa..baec719f02 100755
--- a/features.in/syslinux/stage1/scripts.d/01-syslinux
+++ b/features.in/syslinux/stage1/scripts.d/01-syslinux
@@ -5,16 +5,16 @@
 MODDIR="/usr/lib/syslinux"
 CFG="$GLOBAL_BOOTLOADER.cfg"
 
-mkdir -p "$WORKDIR/syslinux"
-cd "$WORKDIR/syslinux"
-
 # validate just in case (see also stage1 Makefile)
 case "$GLOBAL_BOOTLOADER" in
 	isolinux|syslinux) ;;
-	*) echo "error: weird GLOBAL_BOOTLOADER: \`$GLOBAL_BOOTLOADER'" >&2;
-	   exit 1;;
+	*) echo "Warning: GLOBAL_BOOTLOADER not supported: \`$GLOBAL_BOOTLOADER'" >&2;
+	   rm -fr "$WORKDIR/syslinux"
+	   exit 0;;
 esac
 
+cd "$WORKDIR/syslinux"
+
 # copy extra files, if any
 SYSLINUX_FILES="$(cat .in/syslinux.list)"
 if [ -n "${SYSLINUX_FILES% }" ]; then
diff --git a/features.in/syslinux/stage1/scripts.d/02-gfxboot b/features.in/syslinux/stage1/scripts.d/02-gfxboot
index 221deb9aa8..9deb6cddd0 100755
--- a/features.in/syslinux/stage1/scripts.d/02-gfxboot
+++ b/features.in/syslinux/stage1/scripts.d/02-gfxboot
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+[ -d "$WORKDIR/syslinux" ] || exit 0
+
 gfxboot_datadir=/usr/share/gfxboot
 
 if [ ! -d "$gfxboot_datadir" ]; then
@@ -15,9 +17,7 @@ if [ ! -f "$bootlogo" ]; then
 	exit 0
 fi
 
-cd "$WORKDIR"
-mkdir -p syslinux
-cd syslinux
+cd "$WORKDIR/syslinux"
 
 # unpack
 cpio -iduV <"$bootlogo"
-- 
2.24.1


[-- Attachment #17: 0017-sub.in-stage1-call-copy-kernel-instead-of-copy-BOOTL.patch --]
[-- Type: text/x-patch, Size: 1035 bytes --]

>From 27f1f5e8435f9f9c96798a481141280c3ef66268 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Tue, 7 Jan 2020 21:48:53 +0700
Subject: [PATCH 17/22] sub.in/stage1: call copy-kernel instead of
 copy-$BOOTLOADER

copy-$BOOTLOADER was called to copy the kernel and propagator image.
---
 sub.in/stage1/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile
index 112c953365..6578bdc25c 100644
--- a/sub.in/stage1/Makefile
+++ b/sub.in/stage1/Makefile
@@ -52,7 +52,7 @@ prepare-modules:
 # scripts prepare bootloader configuration, too
 # NB: we pass tested squashfs options for sub.in/stage2/Makefile to include
 all: | debug prepare-workdir copy-tree run-scripts $(BUILD_PROPAGATOR) \
-	copy-$(BOOTLOADER) $(COPY_SQUASHCFG) pack-image $(GLOBAL_CLEAN_WORKDIR)
+	copy-kernel $(COPY_SQUASHCFG) pack-image $(GLOBAL_CLEAN_WORKDIR)
 	@if [ -s $(OUTDIR)/squashcfg.mk ]; then \
 		cp $(OUTDIR)/squashcfg.mk $(GLOBAL_BUILDDIR)/; \
 	fi
-- 
2.24.1


[-- Attachment #18: 0018-grub-added-fwsetup_efi.cfg.patch --]
[-- Type: text/x-patch, Size: 884 bytes --]

>From dadd7b9ea737566165c4dd44fd73881b6175fd82 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sat, 11 Jan 2020 01:56:52 +0700
Subject: [PATCH 18/22] grub: added fwsetup_efi.cfg

Added for EFI only (see stage1/scripts.d/01-grub).
---
 features.in/grub/generate.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk
index f321ce798e..8d3870fe90 100644
--- a/features.in/grub/generate.mk
+++ b/features.in/grub/generate.mk
@@ -16,7 +16,7 @@ ifndef GRUB_DIRECT
 # SUBPROFILES are considered GRUB_CFG too
 # (note these can appear like stage2@live);
 # 01defaults.cfg is included indefinitely
-GRUB_CFG := $(GRUB_CFG) $(SUBPROFILE_DIRS) defaults
+GRUB_CFG := $(GRUB_CFG) $(SUBPROFILE_DIRS) defaults fwsetup_efi
 endif
 
 DSTDIR  := $(BUILDDIR)/stage1/files/boot/grub/.in
-- 
2.24.1


[-- Attachment #19: 0019-efi-use-efi-grub-for-EFI_ARHES-only.patch --]
[-- Type: text/x-patch, Size: 752 bytes --]

>From 8184fec1adaa190d4480bc3a8ad45588059a5ea4 Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 12 Jan 2020 00:15:55 +0700
Subject: [PATCH 19/22] efi: use/efi/grub for EFI_ARHES only

---
 features.in/efi/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/features.in/efi/config.mk b/features.in/efi/config.mk
index db37b282e4..271f9b0cbd 100644
--- a/features.in/efi/config.mk
+++ b/features.in/efi/config.mk
@@ -64,7 +64,7 @@ endif
 else
 
 # ignore on an unsupported target arch but make it hybrid at least
-use/efi use/efi/signed use/efi/debug \
+use/efi use/efi/signed use/efi/debug use/efi/grub \
   use/efi/refind use/efi/shell use/efi/memtest86: use/isohybrid; @:
 
 endif
-- 
2.24.1


[-- Attachment #20: 0020-hdt-for-i586-and-x86_64-only.patch --]
[-- Type: text/x-patch, Size: 717 bytes --]

>From 2fae2778c480ed624af3aeb270c222a4e5a01f1a Mon Sep 17 00:00:00 2001
From: Anton Midyukov <antohami@altlinux.org>
Date: Sun, 12 Jan 2020 00:22:06 +0700
Subject: [PATCH 20/22] hdt: for i586 and x86_64 only

---
 features.in/hdt/config.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/features.in/hdt/config.mk b/features.in/hdt/config.mk
index c8ec7baa30..1969eb02d5 100644
--- a/features.in/hdt/config.mk
+++ b/features.in/hdt/config.mk
@@ -1,5 +1,9 @@
 # optimized out use/syslinux due to use/memtest
+ifeq (,$(filter-out i586 x86_64,$(ARCH)))
 use/hdt: use/memtest
 	@$(call add_feature)
 	@$(call add,STAGE1_PACKAGES,pciids)
 	@$(call add,SYSLINUX_MODULES,hdt)
+else
+use/hdt: ; @:
+endif
-- 
2.24.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2020-01-12 15:18     ` Антон Мидюков
@ 2020-02-10  2:58       ` Антон Мидюков
  2020-02-10  9:51         ` Alexey Gladkov
  0 siblings, 1 reply; 10+ messages in thread
From: Антон Мидюков @ 2020-02-10  2:58 UTC (permalink / raw)
  To: devel-distro

12.01.2020 22:18, Антон Мидюков пишет:
> 09.01.2020 21:39, Антон Мидюков пишет:
>> 09.01.2020 2:29, Антон Мидюков пишет:
>>>
>>> [...]
>>>
>>> 4. В mki-copy-efiboot для grub-efi ядро копировать в boot, если его 
>>> ещё там нет. Аналогично для других EFI_BOOTLOADER проверять, есть ли 
>>> уже ядро в EFI/BOOT, и если есть не копировать.
>>>
>> Копировать ядро в boot, видимо, плохая идея. В qemu грузится, на 
>> железе же ядро не находит.
>>> [...]
>>
> В связи с этим переделал задание 243937 (mkimage), всё хорошенько 
> перепроверил и исправил очепятки.
>
> Количество правок сократил. Убрал упоминание несуществующего grubx86boot.
>
> Без патча 
> 0017-sub.in-stage1-call-copy-kernel-instead-of-copy-BOOTL.patch для 
> mkimage-profiles будет работать по-старому.
>
> Прошу аппрув для задания 243937 (mkimage).
Повторяю просьбу. Если что-то сделал неправильно, не молчите, пожалуйста.

-- 
С уважением, Антон Мидюков <antohami@altlinux.org>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [devel-distro] grub-efi в инсталяторе
  2020-02-10  2:58       ` Антон Мидюков
@ 2020-02-10  9:51         ` Alexey Gladkov
  0 siblings, 0 replies; 10+ messages in thread
From: Alexey Gladkov @ 2020-02-10  9:51 UTC (permalink / raw)
  To: Антон
	Мидюков
  Cc: devel-distro

On Mon, Feb 10, 2020 at 09:58:54AM +0700, Антон Мидюков wrote:
> 12.01.2020 22:18, Антон Мидюков пишет:
> > 09.01.2020 21:39, Антон Мидюков пишет:
> > > 09.01.2020 2:29, Антон Мидюков пишет:
> > > > 
> > > > [...]
> > > > 
> > > > 4. В mki-copy-efiboot для grub-efi ядро копировать в boot, если
> > > > его ещё там нет. Аналогично для других EFI_BOOTLOADER проверять,
> > > > есть ли уже ядро в EFI/BOOT, и если есть не копировать.
> > > > 
> > > Копировать ядро в boot, видимо, плохая идея. В qemu грузится, на
> > > железе же ядро не находит.
> > > > [...]
> > > 
> > В связи с этим переделал задание 243937 (mkimage), всё хорошенько
> > перепроверил и исправил очепятки.
> > 
> > Количество правок сократил. Убрал упоминание несуществующего grubx86boot.
> > 
> > Без патча
> > 0017-sub.in-stage1-call-copy-kernel-instead-of-copy-BOOTL.patch для
> > mkimage-profiles будет работать по-старому.
> > 
> > Прошу аппрув для задания 243937 (mkimage).
> Повторяю просьбу. Если что-то сделал неправильно, не молчите, пожалуйста.

Письма про EPERM я игнорирую. Это не pull-request. Они значат лишь то, что
кто-то собирает ваш пакет.

В будущем пожалуйста присылайте нормальный запрос с описанием того, что вы
делаете.

Теперь конкретно по таску 243937.

1f2ab51466760f2c614f33d916d8b7fefa90dd95 ("mki-copy-kernel: initial target for copying kernel")

Описание коммита не поясняет зачем он нужен вообще.  Не вызывать
mki-copy-$BOOTLOADER дважды ? Не вызывайте, если не нужно.  Какую проблему
вы решаете этим коммитом ?

> [ x$EFI_DESTINATION != 'x' ]

Пожалуйста, не пишите так.

В mki-copy-kernel вы анализируете ${BOOTLOADER:-}. Такой переменной нет в
mkimage. Если это новый параметр, то его нужно требовать в скрипте и
описать. Есть параметр BOOT_TYPE. Вы его имели в виду ?

Вы проверяете BOOTLOADER только на значения isolinux, syslinux, pxelinux,
ieee1275boot. Типов загрузчиков в mkimage больше. Если они не должны
обрабатываться, то задокументируйте это.

Также вы вынесли код копирования ядра в отдельный таргет продублировав код
из соответствующих mki-copy-$BOOTLOADER. Это плохое решение. Это приведёт
к рассинхронизации кода в будущем. Также следующий кто будет добавлять
новый вариант загрузчика скорее всего пропустит этот скрипт.

Я не против вынести копирование ядра в отдельный таргет, если это
необходимо. Но мне не нравится, как это реализовано. Если вы хотите это
сделать, то убирайте соответствующий код из mki-copy-*. Например, пусть
они сами вызывают новую утилиту с параметром `mki-copy-kernel $DESTDIR`.

e0501c5fcf9bde41d1cfc88c0941b7282e23bcdb ("mki-copy-grubaa64boot, mki-pack-efionly-isoboot: replaced grub to EFI/BOOT")

Опять же описание коммита не совсем понятно. Вы создаёте EFI/BOOT и
копируете части grub туда потому что директории вне EFI могут быть не
доступны. Когда не доступны ? Вы наверно имели в виду, что для grub во
время загрузки может быть доступен только EFI раздел ? (просто угадываю
сейчас).

> +[ -f "$chroot/.image/$imgdir/EFI/BOOT/grub.cfg" ] ||
> +       message "Warning: /.image/$imgdir/EFI/BOOT/grub.cfg: not found."

Зачем этот варнинг, если внизу есть код, который создаёт этот конфиг ?

> +mkdir $verbose -p EFI/BOOT

Вот тут вы можете написать EFI/BOOT/fonts чтобы не проверять и создавать
эту директорию ниже.

-- 
Rgrds, legion



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-02-10  9:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 14:18 [devel-distro] grub-efi в инсталяторе Alexey Shabalin
2019-11-14 19:10 ` Alexey Shabalin
2019-11-15  9:49   ` Alexey Gladkov
2019-11-15 14:59 ` Alexey Shabalin
2019-11-18 15:57   ` Michael Shigorin
2020-01-08 19:29 ` Антон Мидюков
2020-01-09 14:39   ` Антон Мидюков
2020-01-12 15:18     ` Антон Мидюков
2020-02-10  2:58       ` Антон Мидюков
2020-02-10  9:51         ` Alexey Gladkov

ALT Linux Distributions development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-distro/0 devel-distro/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-distro devel-distro/ http://lore.altlinux.org/devel-distro \
		devel-distro@lists.altlinux.org devel-distro@lists.altlinux.ru devel-distro@lists.altlinux.com
	public-inbox-index devel-distro

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-distro


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git