kiwi-el8/kiwi/bootloader/template/systemd_boot.py
Marcus Schäfer 872678ea14
Don't use kernel-install
kernel-install does a lot more then making the kernel available
to the ESP. It calls dracut, it creates loader entries and all
that is unexpected and also breaks the boot because the way
dracut is called in the image build case where host != target
leads to broken results. This commit refactors the systemd-boot
support in kiwi to prevent the use of kernel-install
2023-11-08 12:47:32 +01:00

69 lines
1.9 KiB
Python

# Copyright (c) 2022 Marcus Schäfer. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# kiwi is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with kiwi. If not, see <http://www.gnu.org/licenses/>
#
from string import Template
from textwrap import dedent
class BootLoaderTemplateSystemdBoot:
"""
**systemd-boot configuraton file templates**
"""
def __init__(self):
self.cr = '\n'
self.loader = dedent('''
# kiwi generated loader config file
default main.conf
console-mode max
editor no
''').strip() + self.cr
self.timeout = dedent('''
timeout ${boot_timeout}
''').strip() + self.cr
self.entry = dedent('''
title ${title}
options ${boot_options}
linux ${kernel_file}
initrd ${initrd_file}
''').strip() + self.cr
def get_loader_template(self) -> Template:
"""
Bootloader main configuration template
:return: instance of :class:`Template`
:rtype: Template
"""
template_data = self.loader
template_data += self.timeout
return Template(template_data)
def get_entry_template(self) -> Template:
"""
Bootloader entry configuration template
:return: instance of :class:`Template`
:rtype: Template
"""
template_data = self.entry
return Template(template_data)