|
| 1 | +From 27bd04925748a66866011a68eb0e26f23cedbcfa Mon Sep 17 00:00:00 2001 |
| 2 | +From: Riccardo Pittau < [email protected]> |
| 3 | +Date: Tue, 29 Oct 2024 09:05:05 +0100 |
| 4 | +Subject: [PATCH] Use linux instead of linuxefi in grub config |
| 5 | + |
| 6 | +The EFI handover protocol has been deprecated since a while |
| 7 | +and recently moved to be optional and enabled by default [1]. |
| 8 | +As a consequence, the linuxefi and initrdefi binaries that |
| 9 | +were specifically compiled to use that option, are |
| 10 | +also deprecated and they have been removed in most of |
| 11 | +the recent linux distributions in favor of the generic |
| 12 | +linux and initrd that are now compatible with UEFI boot. |
| 13 | +This patch changes linuxefi to linux and initrdefi to |
| 14 | +initrd in all the grub templates, using the generic |
| 15 | +entries for all the platform architectures. |
| 16 | + |
| 17 | +[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc3fdda2876e58a7e83e558ab51853cf106afb6a |
| 18 | + |
| 19 | +Closes-Bug: #2081305 |
| 20 | +Change-Id: Ie5b2265d7afc8b71fabfca6ca6687e0e34ce3b5b |
| 21 | +--- |
| 22 | + |
| 23 | +diff --git a/ironic/common/grub_conf.template b/ironic/common/grub_conf.template |
| 24 | +index 2a979d2..480c6e8 100644 |
| 25 | +--- a/ironic/common/grub_conf.template |
| 26 | ++++ b/ironic/common/grub_conf.template |
| 27 | +@@ -3,6 +3,6 @@ |
| 28 | + set hidden_timeout_quiet=false |
| 29 | + |
| 30 | + menuentry "boot_partition" { |
| 31 | +-linuxefi {{ linux }} {{ kernel_params }} -- |
| 32 | +-initrdefi {{ initrd }} |
| 33 | ++linux {{ linux }} {{ kernel_params }} -- |
| 34 | ++initrd {{ initrd }} |
| 35 | + } |
| 36 | +diff --git a/ironic/common/pxe_utils.py b/ironic/common/pxe_utils.py |
| 37 | +index 1726d73..9896a5b 100644 |
| 38 | +--- a/ironic/common/pxe_utils.py |
| 39 | ++++ b/ironic/common/pxe_utils.py |
| 40 | +@@ -351,11 +351,9 @@ |
| 41 | + pxe_config_root_tag = '(( ROOT ))' |
| 42 | + pxe_config_disk_ident = '(( DISK_IDENTIFIER ))' |
| 43 | + |
| 44 | +- # Determine the appropriate commands based on the CPU architecture |
| 45 | +- arch = task.node.properties.get('cpu_arch', 'x86_64') |
| 46 | + commands = { |
| 47 | +- 'linux_cmd': 'linuxefi' if arch != 'aarch64' else 'linux', |
| 48 | +- 'initrd_cmd': 'initrdefi' if arch != 'aarch64' else 'initrd' |
| 49 | ++ 'linux_cmd': 'linux', |
| 50 | ++ 'initrd_cmd': 'initrd' |
| 51 | + } |
| 52 | + pxe_options.update(commands) |
| 53 | + else: |
| 54 | +diff --git a/ironic/drivers/modules/pxe_grub_config.template b/ironic/drivers/modules/pxe_grub_config.template |
| 55 | +index 93a0869..59686fe 100644 |
| 56 | +--- a/ironic/drivers/modules/pxe_grub_config.template |
| 57 | ++++ b/ironic/drivers/modules/pxe_grub_config.template |
| 58 | +@@ -3,20 +3,20 @@ |
| 59 | + set hidden_timeout_quiet=false |
| 60 | + |
| 61 | + menuentry "deploy" { |
| 62 | +- {{ pxe_options.linux_cmd|default('linuxefi', true) }} {{ pxe_options.deployment_aki_path }} selinux=0 troubleshoot=0 text {{ pxe_options.pxe_append_params|default("", true) }} boot_server={{pxe_options.tftp_server}} |
| 63 | +- {{ pxe_options.initrd_cmd|default('initrdefi', true) }} {{ pxe_options.deployment_ari_path }} |
| 64 | ++ {{ pxe_options.linux_cmd|default('linux', true) }} {{ pxe_options.deployment_aki_path }} selinux=0 troubleshoot=0 text {{ pxe_options.pxe_append_params|default("", true) }} boot_server={{pxe_options.tftp_server}} |
| 65 | ++ {{ pxe_options.initrd_cmd|default('initrd', true) }} {{ pxe_options.deployment_ari_path }} |
| 66 | + } |
| 67 | + |
| 68 | + menuentry "boot_ramdisk" { |
| 69 | +- {{ pxe_options.linux_cmd|default('linuxefi', true) }} {{ pxe_options.aki_path }} root=/dev/ram0 text {{ pxe_options.pxe_append_params|default("", true) }} {{ pxe_options.ramdisk_opts|default('', true) }} |
| 70 | +- {{ pxe_options.initrd_cmd|default('initrdefi', true) }} {{ pxe_options.ari_path }} |
| 71 | ++ {{ pxe_options.linux_cmd|default('linux', true) }} {{ pxe_options.aki_path }} root=/dev/ram0 text {{ pxe_options.pxe_append_params|default("", true) }} {{ pxe_options.ramdisk_opts|default('', true) }} |
| 72 | ++ {{ pxe_options.initrd_cmd|default('initrd', true) }} {{ pxe_options.ari_path }} |
| 73 | + } |
| 74 | + |
| 75 | + menuentry "boot_whole_disk" { |
| 76 | +- {{ pxe_options.linux_cmd|default('linuxefi', true) }} chain.c32 mbr:{{ DISK_IDENTIFIER }} |
| 77 | ++ {{ pxe_options.linux_cmd|default('linux', true) }} chain.c32 mbr:{{ DISK_IDENTIFIER }} |
| 78 | + } |
| 79 | + |
| 80 | + menuentry "boot_anaconda" { |
| 81 | +- {{ pxe_options.linux_cmd|default('linuxefi', true) }} {{ pxe_options.aki_path }} text {{ pxe_options.pxe_append_params|default("", true) }} inst.ks={{ pxe_options.ks_cfg_url }} {% if pxe_options.repo_url %}inst.repo={{ pxe_options.repo_url }}{% else %}inst.stage2={{ pxe_options.stage2_url }}{% endif %} |
| 82 | +- {{ pxe_options.initrd_cmd|default('initrdefi', true) }} {{ pxe_options.ari_path }} |
| 83 | ++ {{ pxe_options.linux_cmd|default('linux', true) }} {{ pxe_options.aki_path }} text {{ pxe_options.pxe_append_params|default("", true) }} inst.ks={{ pxe_options.ks_cfg_url }} {% if pxe_options.repo_url %}inst.repo={{ pxe_options.repo_url }}{% else %}inst.stage2={{ pxe_options.stage2_url }}{% endif %} |
| 84 | ++ {{ pxe_options.initrd_cmd|default('initrd', true) }} {{ pxe_options.ari_path }} |
| 85 | + } |
| 86 | +diff --git a/ironic/tests/unit/common/test_images.py b/ironic/tests/unit/common/test_images.py |
| 87 | +index 99b1652..102c927 100644 |
| 88 | +--- a/ironic/tests/unit/common/test_images.py |
| 89 | ++++ b/ironic/tests/unit/common/test_images.py |
| 90 | +@@ -654,8 +654,8 @@ |
| 91 | + "set hidden_timeout_quiet=false\n" |
| 92 | + "\n" |
| 93 | + "menuentry \"boot_partition\" {\n" |
| 94 | +- "linuxefi /vmlinuz key1=value1 key2 --\n" |
| 95 | +- "initrdefi /initrd\n" |
| 96 | ++ "linux /vmlinuz key1=value1 key2 --\n" |
| 97 | ++ "initrd /initrd\n" |
| 98 | + "}") |
| 99 | + |
| 100 | + cfg = images._generate_cfg(kernel_params, |
| 101 | +diff --git a/ironic/tests/unit/common/test_pxe_utils.py b/ironic/tests/unit/common/test_pxe_utils.py |
| 102 | +index 50cfb5e..d31ee21 100644 |
| 103 | +--- a/ironic/tests/unit/common/test_pxe_utils.py |
| 104 | ++++ b/ironic/tests/unit/common/test_pxe_utils.py |
| 105 | +@@ -166,23 +166,7 @@ |
| 106 | + |
| 107 | + self.assertEqual(str(expected_template), rendered_template) |
| 108 | + |
| 109 | +- def test_pxe_config_x86_64(self): |
| 110 | +- self.node.properties['cpu_arch'] = 'x86_64' |
| 111 | +- self.node.save() |
| 112 | +- |
| 113 | +- rendered_template = utils.render_template( |
| 114 | +- CONF.pxe.uefi_pxe_config_template, |
| 115 | +- {'pxe_options': self.pxe_options, |
| 116 | +- 'ROOT': '{{ ROOT }}', |
| 117 | +- 'DISK_IDENTIFIER': '{{ DISK_IDENTIFIER }}'}) |
| 118 | +- |
| 119 | +- self.assertIn('linuxefi', rendered_template) |
| 120 | +- self.assertIn('initrdefi', rendered_template) |
| 121 | +- |
| 122 | +- def test_pxe_config_aarch64(self): |
| 123 | +- self.node.properties['cpu_arch'] = 'aarch64' |
| 124 | +- self.node.save() |
| 125 | +- |
| 126 | ++ def test_pxe_config(self): |
| 127 | + rendered_template = utils.render_template( |
| 128 | + CONF.pxe.uefi_pxe_config_template, |
| 129 | + {'pxe_options': self.pxe_options, |
| 130 | +diff --git a/ironic/tests/unit/drivers/modules/test_deploy_utils.py b/ironic/tests/unit/drivers/modules/test_deploy_utils.py |
| 131 | +index cb9ec1b..171bdca 100644 |
| 132 | +--- a/ironic/tests/unit/drivers/modules/test_deploy_utils.py |
| 133 | ++++ b/ironic/tests/unit/drivers/modules/test_deploy_utils.py |
| 134 | +@@ -159,12 +159,12 @@ |
| 135 | + set hidden_timeout_quiet=false |
| 136 | + |
| 137 | + menuentry "deploy" { |
| 138 | +- linuxefi deploy_kernel "ro text" |
| 139 | +- initrdefi deploy_ramdisk |
| 140 | ++ linux deploy_kernel "ro text" |
| 141 | ++ initrd deploy_ramdisk |
| 142 | + } |
| 143 | + |
| 144 | + menuentry "boot_whole_disk" { |
| 145 | +- linuxefi chain.c32 mbr:(( DISK_IDENTIFIER )) |
| 146 | ++ linux chain.c32 mbr:(( DISK_IDENTIFIER )) |
| 147 | + } |
| 148 | + """ |
| 149 | + |
| 150 | +@@ -174,12 +174,12 @@ |
| 151 | + set hidden_timeout_quiet=false |
| 152 | + |
| 153 | + menuentry "deploy" { |
| 154 | +- linuxefi deploy_kernel "ro text" |
| 155 | +- initrdefi deploy_ramdisk |
| 156 | ++ linux deploy_kernel "ro text" |
| 157 | ++ initrd deploy_ramdisk |
| 158 | + } |
| 159 | + |
| 160 | + menuentry "boot_whole_disk" { |
| 161 | +- linuxefi chain.c32 mbr:0x12345678 |
| 162 | ++ linux chain.c32 mbr:0x12345678 |
| 163 | + } |
| 164 | + """ |
| 165 | + |
| 166 | +diff --git a/ironic/tests/unit/drivers/pxe_grub_config.template b/ironic/tests/unit/drivers/pxe_grub_config.template |
| 167 | +index 95716cb..6caa0dd 100644 |
| 168 | +--- a/ironic/tests/unit/drivers/pxe_grub_config.template |
| 169 | ++++ b/ironic/tests/unit/drivers/pxe_grub_config.template |
| 170 | +@@ -3,20 +3,20 @@ |
| 171 | + set hidden_timeout_quiet=false |
| 172 | + |
| 173 | + menuentry "deploy" { |
| 174 | +- linuxefi /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/deploy_kernel selinux=0 troubleshoot=0 text test_param boot_server=192.0.2.1 |
| 175 | +- initrdefi /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/deploy_ramdisk |
| 176 | ++ linux /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/deploy_kernel selinux=0 troubleshoot=0 text test_param boot_server=192.0.2.1 |
| 177 | ++ initrd /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/deploy_ramdisk |
| 178 | + } |
| 179 | + |
| 180 | + menuentry "boot_ramdisk" { |
| 181 | +- linuxefi /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/kernel root=/dev/ram0 text test_param ramdisk_param |
| 182 | +- initrdefi /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/ramdisk |
| 183 | ++ linux /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/kernel root=/dev/ram0 text test_param ramdisk_param |
| 184 | ++ initrd /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/ramdisk |
| 185 | + } |
| 186 | + |
| 187 | + menuentry "boot_whole_disk" { |
| 188 | +- linuxefi chain.c32 mbr:(( DISK_IDENTIFIER )) |
| 189 | ++ linux chain.c32 mbr:(( DISK_IDENTIFIER )) |
| 190 | + } |
| 191 | + |
| 192 | + menuentry "boot_anaconda" { |
| 193 | +- linuxefi /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/kernel text test_param inst.ks=http://fake/ks.cfg inst.stage2=http://fake/stage2 |
| 194 | +- initrdefi /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/ramdisk |
| 195 | ++ linux /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/kernel text test_param inst.ks=http://fake/ks.cfg inst.stage2=http://fake/stage2 |
| 196 | ++ initrd /tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/ramdisk |
| 197 | + } |
0 commit comments