Commit Graph

20 Commits

Author SHA1 Message Date
Marcus Schäfer
583f3385df
Add support for BLS zipl
Add support for <bootloader name="zipl" .../> to support BLS
based zipl configuration. This Fixes #2481
2024-03-10 11:28:21 +01:00
Alexandre Detiste
fb69627ad3
Use unittest.mock from core python everywhere
mock was an independent module that has been merged into the Python standard library.
2024-02-18 22:15:30 +01:00
Marcus Schäfer
8aa517eb77
Remove destructor from BootLoaderInstallGrub2
With MountManager as context manager the BootLoaderInstallGrub2
class doesn't need a destructor anymore. This is related
to Issue #2412
2024-02-06 10:28:18 +01:00
Marcus Schäfer
dd110f63a4
Make sure btrfs root volume is used when needed
With the possibility to switch off setting the default volume
an issue at other parts in the kiwi code which mounted the
btrfs based system were uncovered. Without any default volume
set it's required to transport the root volume if different
from / and pass the respective subvol= option to the mount.
This commit fixes it at the places where kiwi trusted btrfs
to have a correct default volume set
2023-07-27 16:18:48 +02:00
Marcus Schäfer
7ac14458af Refactor the luks_device class data transport
Also add missing unit tests
2023-07-05 12:30:38 +02:00
Robert Schweikert
ef35bef97b
Support new bootloadersettings section
Allow to specify an optional <bootloadersettings> element
inside of the <bootloader> section. The information is used to
specify custom arguments for the tools called in a bootloader
setup procedure, e.g shim-install, grub-install or grub-mkconfig.
kiwi does not judge on the given parameters and if the provided
data is effectively used depends on the individual bootloader
implementation. In this commit the data will be effectively
handled if bootloader="grub2" is configured. More precisely
the custom additions to support SUSE's TPM model with grub2
can be configured as follows:

<bootloadersettings>
    <shimoption name="--suse-enable-tpm"/>
    <installoption name="--suse-enable-tpm"/>
    <configoption name="--set-trusted-boot"/>
</bootloadersettings>

This Fixes #2224
2023-02-22 23:27:19 +01:00
Marcus Schäfer
fe478de901
Added API for BLS and systemd-boot support
Bootloaders implementing the Boot Loader Spec (BLS) are not
directly compatible with the original Bootloader Class design
in kiwi. Because of that an interface class which translates
the original API into calls following BLS was added. This allows
us to keep the implementations in the Builder classes and the
public BootLoader interface untouched. In addition to the BLS
API an implementation to support the systemd-boot loader is
part of this commit too.

An example type definition to use systemd-boot with an EFI
disk image type looks like the following:

    <type image="oem" filesystem="xfs" firmware="efi" bootloader="systemd_boot" efipartsize="200"/>

The implementation uses bootctl and kernel-install tools
provided from systemd and expects a proper integration
of systemd-boot by the distribution maintainers

This Fixes #1935
2022-11-12 17:39:22 +01:00
gmoro
0aa69bdfc3 Fix mocking of grub2-install (fix #2124)
/bin/true was being used from the host machine instead of
the chroot
2022-11-09 15:36:01 +00:00
Marcus Schäfer
9c9250ebc4
Support nose and xunit style tests
The modifications in this commit allows the unit tests
to run on both, pytest 6.x (nose test layout) and the new
pytest 7.x (xunit test layout). This Fixes #2072 in a
much nicer way. Thanks much to @smarlowucf
2022-02-26 20:26:18 +01:00
Marcus Schäfer
ce9b1ccc08
Added option to set the image target architecture
The option --target-arch allows to set the architecture
used to build the image. By default this is the host
architecture. Please note, if the specified architecture
name does not match the host architecture and is therefore
requesting a cross architecture image build, it's important
to understand that for this process to work a preparatory
step to support the image architecture and binary format
on the building host is required and is not considered a
responsibility of kiwi. There will be a followup effort
on providing a plugin for kiwi which should be used to
manage the needed binfmt settings for cross arch image
builds
2021-04-14 12:53:28 +02:00
Andreas Schwab
1c7e5866cd Add support for riscv64 2021-03-29 15:44:08 +02:00
David Cassany
c840474e3a
Refactor grub2 installation
This commit refactors grub2 installation method to split it in two
parts. Former grub2.install method was meant to run the grub2-install
tool, however, in addition it was also running the secure boot
installation shim-install. The install method in KIWI is skipped for
those architectures and firmware combinations for which bios support
doesn't exist. This was leading to skip the secure boot installation.

The current approach strips the secure boot installation logic from the
grub2.install method, so skipping the install method does not
automatically result in skipping the secure boot installation.

Fixes bsc#1182211
2021-03-03 15:19:43 +01:00
Marcus Schäfer
a5425fe575
Add support for s390 CDL DASD disks
On s390 and in CDL mode (4k DASD) the call of grub2-install
does not work because grub2-install is not able to identify
a 4k fdasd partitioned loop device as a grub supported device
and fails. As grub2-install is only used to invoke
grub2-zipl-setup and has no other job to do we can
circumvent this problem by directly calling grub2-zipl-setup
instead. Also delete LDL mode support, IBM no longer supports
this
2020-10-27 11:06:14 +01:00
Marcus Schäfer
836633c7b2
Fix/Refactor s390 support
This changes the s390 support on several stages:

1) On s390 the boot process is based on zipl which boots into an
   initrd from which a userspace grub process is started to support
   the grub capabilities. The implementation of this concept is
   provided via the grub2-s390x-emu package. Once installed the
   setup of the bootloader is done via the grub2-mkconfig and
   grub2-install commands and therefore from a caller perspective
   the same as with any other grub2 setup process. For kiwi this
   means no extra zipl bootloader target code is needed. Therefore
   this commit deletes the zipl setup from kiwi and puts on
   the standard grub2 process. This Fixes bsc#1170863

2) To support different targettypes the grub2-s390x-emu provided
   zipl template must be adapted. Parts of the former zipl bootloader
   setup therefore now applies to an update of the zipl2grub
   template file

3) Support for CDL/LDL DASD targets has been disabled in the schema
   When testing 4k devices and a respective zipl2grub template
   setup for CDL/LDL targettype it has turned out that grub2-install
   is not able to run on such a device. My assumption is that
   the device code in grub2-install does not work for 4k devices
   with an fdasd created partition table. As this needs further
   investigations and most probably adaptions on the grub toolchain
   for s390, we disabled the setup of these modes for now.
   emulated DASD (FBA) and SCSI targets stays supported.
2020-09-30 17:14:30 +02:00
David Cassany
2abcce803b
Refactor BootLoaderInstall
This commit refactors BootLoaderInstall class to make it a proper
factory class. In addition type hints are added for the constructor
method.

Related to #1498
2020-09-28 09:37:05 +02:00
Marcus Schäfer
6b2c4f88bb
Don't keep copy of grub2-install in the system
To prevent shim-install from calling grub2-install in uefi mode
kiwi temporary replaces the tool by a noop. This acts as a
workaround for an issue in shim-install. However the workaround
left a file copy of grub2-install in the system which should
not happen. This commit Fixes bsc#1173226 and Fixes #1490
2020-07-15 14:38:47 +02:00
Marcus Schäfer
e566153138
Fixed bootloader install
Mount EFI partition in any case not only for the shim target
2020-03-20 17:53:28 +01:00
David Cassany
1466a6c69a
Make use of Path.which including root_dir parameter
This commit refactors the use of Path.which in several parts of the
code. Since dd4d2ed78 the Path utility is capable to run Path.which
on certain chroot env, thus no need to adapt the PATH environment
variable.

Fixes #1281
2020-01-22 16:12:08 +01:00
Marcus Schäfer
726eeacee5
Fixed zipl bootloader setup for s390 images
The preparation to call zipl and the call itself were wrong.
For whatever reason the kernel image the initrd are moved
to another location prior to calling zipl. That move broke
the system because no kernel/initrd existed at the expected
place anymore. In addition the zipl call itself was issued
from a the wrong directory. Also no config file was written
as an after effect of the refactoring in Issue #1194. This
Fixes #1173 and bsc#1156694
2019-11-14 12:01:06 +01:00
David Cassany
4b3a105026
Re-structure unit tests folders
This commit relocates unit tests to a folder structure that matches
the source code structure.

Fixes #1128
2019-10-21 14:00:05 +02:00