Commit Graph

151 Commits

Author SHA1 Message Date
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
60659a2dde
Ensure grub.cfg is copied in EFI/BOOT folder
This commit fixes the live images in efi mode. Grub configuration file
is copied to the correct location in <boot_dir>/EFI/BOOT.

Fixes bsc#1155815
2019-11-06 12:58:49 +01:00
Javier Martinez Canillas
9d8ce7eedb
Enable BLS configuration if is supported
Fedora now uses a BLS configuration by default, but this is not supported
by all distributions. So check if is supported by the grub2-mkconfig tool
and only enable the option if that's the case.

Fixes: #1248
2019-10-25 18:05:02 +02:00
Marcus Schäfer
531c0db1a1
Skip isolinux ui setup on serial terminal config
If the attribute bootloader_console="serial" is set, the
expectation that there is no graphics hardware available is
valid. Thus the isolinux setup should not contain any ui
configuration instructions because that leads to run the
graphics initialization which blocks the system if not
present. Please note the bootloader_console allows for
multiple console configuration. In mixed setup the ui
configuration still applies. This Fixes #1153
2019-10-24 11:35:48 +02:00
Marcus Schäfer
bdb7123fa1
Refactor use of logging facility
Use getLogger method instead of a global log object
Also use caplog fixture to capture log messages in
unit tests. This Fixes #1244
2019-10-23 17:54:27 +02:00
Marcus Schäfer
0c1d8b9de7
Fixed grub mkconfig call for read-only root
In case of an overlay root system via overlayroot="true" all parts
of the rootfs are read-only by squashfs except for the extra boot
partition. However tools like grub's mkconfig creates temporary
files at call time and therefore /tmp needs to be writable during
the call time of the tools. Related to Issue #1194
2019-10-17 15:49:39 +02:00
Marcus Schäfer
203fdf8a78
Merge pull request #1241 from OSInside/fix_method_header
Fixed method header of write_meta_data
2019-10-17 15:13:12 +02:00
Marcus Schäfer
d877eb90c6
Fixed method header of write_meta_data
Interface class and implementation class has to use the
same header definitions.
2019-10-17 13:04:18 +02:00
Marcus Schäfer
5d5c7c62ec
Lookup grub mkconfig tool
In the same way as we need to lookup the name for the mkimage
tool we also have to lookup the name of the config tool.
That's because distributions do not handle that consistently
2019-10-17 12:15:04 +02:00
Marcus Schäfer
17e8b9b46f
Fixed EFI path creation
Only copy files to the EFI path on prior creation of that path
2019-10-17 11:45:59 +02:00
Marcus Schäfer
0fd47319ed
Fixed fallback copy of grub config file
For ISO images that are EFI bootable as well as for EFI
secure boot configurations that are not based on shim-install
kiwi provides a fallback code that copies the grub config file
to the efi/efi-vendor boot path. This fallback code was broken
because of the recent change to let grub2 mkconfig create the
config file. The call of grub2 mkconfig happens at a later
stage which required an adaption of the fallback mechanism.
This is related to Issue #1194
2019-10-17 11:05:25 +02:00
Marcus Schäfer
736b27a470
Fixed use of config_file before assignment 2019-10-17 08:14:50 +02:00
Marcus Schäfer
21a573756e
Delete unused template data
With the move to grub2 mkconfig some static template data
became obsolete. This commit removes the unused data
2019-10-16 12:10:32 +02:00
Marcus Schäfer
162d5c9a41
Use grub2-mkconfig for writing grub config
Instead of creating a template based grub config file, use
grub2-mkconfig to create the config file during the build
process. This commit changes from config template to grub2
tooling for the disk based image types vmx and oem
This Fixes #1194
2019-10-16 12:10:32 +02:00
Marcus Schäfer
1843b9d0d0
Flexible use of linuxefi module
Not all distributions provides the grub linuxefi module anymore.
This means a static list for building an efi grub image if needed
is no longer appropriate. This patch changes the module handling
at the following places

1. Use linuxefi for building custom efi modules only if present
   on the host system

2. Use linuxefi related grub2-mkconfig variables only if the
   host grub2-mkconfig implementation supports it

3. Prevent building custom efi image on Fedora by extending
   the search path for the distro provided efi image and also
   adapt the spec file accordingly
2019-10-09 17:04:23 +02:00
Dan Čermák
b015b91679
Stop inheriting from object
This is no longer required in Python3
2019-08-22 15:43:27 +02:00
Marcus Schäfer
c80c2c9bc1
Add required cryptomount coding for EFI boot
For non EFI boot grub2-install has code which gets activated
through the GRUB_ENABLE_CRYPTODISK setting. However for the
EFI boot case no installation of boot code is needed and
therefore the grub earlyboot script has to run cryptomount
2019-08-19 18:28:46 +02:00
Marcus Schäfer
f030880cc6
Extended LUKS encryption support
We supported luks encrypted images with the exception of the
boot partition because grub was not able to read from an
encrypted device at that time. Since some time grub is able
to read from an encrypted partition and this commit add
support for it. With this patch luks encrypted images will
no longer create an extra boot partition and the entire
system will be encrypted. The opening of the luks container
happens on the grub level only once. Customers can still
specify to use an unencrypted extra boot partition with the
bootpartition="true" flag. In this case the opening of the
luks containers happens on the systemd level as before.
This is related to Issue #1162
2019-08-19 16:10:09 +02:00
Stefan Seyfried
e0212272f5 remove '-z' option from rsync local copy calls
rsync's "compress" option just does not make any sense when rsync is
used to copy files locally, it only increases CPU usage and slows down
the process ;-)
2019-08-15 09:52:27 +02:00
Marcus Schäfer
af29f5b430
Fixed zipl bootloader setup
targetgeometry not allowed for targettype SCSI
2019-08-01 16:34:50 +02:00
Marcus Schäfer
21d48c74c6
Allow multiple values for grub terminal setup
With regards to the grub documentation from
https://www.gnu.org/software/grub/manual/grub/grub.html#terminal_005finput
multiple terminal consoles can be active. This patch allows
to specify terminal collection between serial, console and gfxterm
This Fixes #1123
2019-07-23 11:25:59 +02:00
Marcus Schäfer
cfd8ba7732
Fixed setup of bootloader files
The BootLoaderConfig class interface writes several files
e.g etc/sysconfig/bootloader, boot/grub2/grub.cfg and more.
Depending on the image type some of those files belongs
into the root directory and some belongs into the boot
directory. For standard images both locations points to
the same master root entry point. However for special
types like live systems the root tree and the boot tree
are different targets. For example live root filesystems
are a squashfs compressed image file whereas the plain
booting information lives outside. Because of that this
patch introduces a refactoring of the BootLoaderConfig
class to allow to distinguish between root_dir and
boot_dir paths. In addition the live image builder makes
use of the new concept and thus Fixes #1112
2019-07-15 10:35:54 +02:00
Marcus Schäfer
15488ff635
Update Boot From Hard Disk method
Instead of searching for an efi binary to boot, use the exit method
that exits from grub and let the firmware choose the next entry
in the device list
2019-07-03 18:39:46 +02:00
Marcus Schäfer
2485e9b005
Consolidate syslinux file names and search paths
Handle those file names and search path in the Defaults space
and only once in the code
2019-07-02 11:59:37 +02:00
Marcus Schäfer
5b7f49d888
Update secure boot fallback code
With the concept of shim being an option and not mandatory
also the fallback code has to adapt and treat the absence
of shim.efi as not fatal. In this situation we expect the
found grub.efi binary to be correctly signed which we can
only assume but not prove
2019-07-02 11:56:02 +02:00
Marcus Schäfer
dab7b8732a
Refactor ISO boot, use grub in EFI mode
Before this commit isolinux was used to boot an ISO and
thus forms a hard requirement. isolinux however only
exists for the x86 platform. This limitation did not
allow to create ISO images for other platforms. With this
commit a refactoring of the ISO boot setup is introduced.

* isolinux is only used if the bios firmware is requested
  and the platform matches the x86 architecture. A runtime
  check will check for this condition and exits early if
  not applicable

* in case of the EFI firmware we already used grub in
  EFI mode but still had isolinux in place for the legacy/CSM
  boot. That part is now also replaced by a platform specific
  grub eltorito image and grub's boot_hybrid.img for hybrid
  boot. On platforms that do not provide those modules the
  support for it will be skipped

With this change in place it's possible to control the ISO
boot layout through the firmware setup and all platform
specific modules are handled as such. Therefore we also
deleted the syslinux requirement. This Fixes #1092
2019-07-02 11:56:02 +02:00
Marcus Schäfer
efeb727710
Fixed zipl bootloader setup
On zipl we manually move the kernel and initrd file to the
zipl boot path because symlinks can't be read. That move
operation used the wrong filenames and was broken since
baseCreateCommonKernelFile is only used in the legacy
custom kiwi boot images but not in the dracut case.
2019-07-01 10:51:19 +02:00
Marcus Schäfer
f9aafe7f35
Fix location of grub unicode font
This is a follow up patch for #f5bac4495d34. The change of the
location of the font file was not applied if an iso target, live
or install image is being built. This patch completes the change
and Fixes bsc#1124885
2019-02-13 18:34:40 +01:00
Marcus Schäfer
9f0946e1f8
Fixed grub theme lookup
If the theme was not found at the expected place an exception
was thrown. However the alternative lookup code in /boot was
not reached with that exception. This commit fixes this
2019-01-29 12:26:09 +01:00
Marcus Schäfer
0985e21117
Support alternative EFI and grub modules paths
In SUSE products EFI binaries are historically located in
/usr/lib*/efi. In a recent move to package grub2 as noarch
fate#326960, a collision between x86_64 and aarch64 has been
identified, as both place platform-specific files in the same
spot. To rectify this, a new location was devised:
/usr/share/efi/$(uname -m). At the same time /usr/lib/grub2 will
move to /usr/share/grub2. This Fixes #924
2019-01-28 16:27:48 +01:00
Marcus Schäfer
f5bac4495d
Fixed location of grub unicode font file
grub2 is expecting the unicode font below the fonts
directory in the /boot/grub*/ depending on how the
distribution installs grub2. This Fixes bsc#1119416
2019-01-24 17:07:54 +01:00
Marcus Schäfer
0af8028387
Allow to switch off install image boot timeout
This commit adds a new attribute called:

    <type ... install_continue_on_timeout="true|false"/>

It allows to setup the boot timeout for install images
build with KIWI. If not set or set to 'true' the configured
boottimeout or its default applies to the install image
as it was before. If set to 'false' there will be no
timeout in the install image bootloader setup and the boot
only continues on manual intervention.
2019-01-17 10:09:40 +01:00
Marcus Schäfer
dd3009bd40
Add alternative search path for syslinux binaries
On debian/ubuntu systems /usr/lib/ISOLINUX is a valid
search path for syslinux binaries like isolinux.bin.
This Fixes #839
2018-10-11 15:48:34 +02:00
David Cassany
f28aced0e0
Make volume id customizable for installation ISOs
This commit makes volid attribute also available for OEM images.
The installation media makes use of the volid value. Only posix
safe names are allowed, up to 32 characters.

Fixes #811
2018-09-26 11:57:01 +02:00
Marcus Schäfer
7514969510
Fixup validation of boottimeout attribute
If boottimeout is set to zero it is evaluated as "not set"
and the default applies. However it's a fairly well approach
to set a zero second boot timeout. This Fixes #789
2018-07-30 08:44:12 +02:00
Marcus Schäfer
afcbe93826
Fixed some code smells
* Use of unused variables, and dangerous defaults
* Update of design patterns on pylint and landscape
2018-07-11 10:31:04 +02:00
Marcus Schäfer
23aaaea512
Simplify configfile loading
prefix and root variables are correctly set, thus calling
the "normal" command has the same effect than the explicit
call for "configfile"
2018-06-20 11:56:21 +02:00
Marcus Schäfer
dc06f9a720
Prevent building custom efi image
If the distribution provides a prebuilt efi image kiwi
should use it instead of building its own image.
2018-06-19 13:21:30 +02:00
Marcus Schäfer
1d5b35498c
Avoid module loading in grub config template
This patch is two fold. First part replaces the import of
dedicated video modules in the grub image by the all_video
module. Second part avoids runtime module insertion which
requires access to the boot filesystem which is not
guaranteed on sophisticated rootfs structures like btrfs
plus readonly snapshots and what not. Thus we make sure
all boot code is embedded into the grub image(s) and no
extra loading of modules at runtime will be needed.
This Fixes bsc#1096937
2018-06-13 11:08:09 +02:00
Marcus Schäfer
28c6f82e84
Fixup LOADER_LOCATION in sysconfig/bootloader
By default we always set LOADER_LOCATION=mbr which is wrong
if EFI is in use. This patch updates the value to be correct.
It also seems that this variable is only consumed by the
yast2 bootloader module from past days. Thus we consider
it obsolete and on the to be droped list in future releases.
This Fixes #746
2018-05-29 10:26:03 +02:00
Marcus Schäfer
384392360e
Fix setup of LOADER_TYPE in sysconfig/bootloader
LOADER_TYPE value for the grub2 bootloader depends on
the use of EFI. This Fixes bsc#1094883
2018-05-28 17:46:49 +02:00
Marcus Schäfer
75b1e2d6c7
Fixed docstring :rtype: values
In Python the string type name is str not string
2018-04-18 10:33:15 +02:00
Marcus Schäfer
f8c73e2ca3
Cleanup api doc strings
This cleans up and fixes the api documentation for
the public interface of the projects boot source code
files and Fixes #700
2018-04-17 17:56:13 +02:00
Marcus Schäfer
8c916dec91
Update etc/default/grub setup
kiwi writes optional grub boot parameters to the GRUB_CMDLINE_LINUX
variable in default/grub. This information is then picked up by
grub2-mkconfig and written to grub.cfg However there is also another
variable named GRUB_CMDLINE_LINUX_DEFAULT which according to the
documentation should be used preferably. While it does not seem to
matter for grub it matters for yast. Thus this patch changes the
configuration variable and fixes bsc#1084117
2018-04-04 12:08:39 +02:00
Marcus Schäfer
19a84e54ec
Fixed btrfs search path in earlyboot script
If kiwi generates its own efi image for the boot process
it does not setup the btrfs relative path setup in the
earlyboot script embedded into the generated efi image.
This has a bad impact on the file search because the
btrfs setup done in kiwi puts root below the @ volume
which we then need to specify of the relative lookup
is not activated. Fixes bsc#1082155
2018-03-06 16:43:35 +01:00
Marcus Schäfer
4e6374bc5e
Merge pull request #629 from agraf/linuxefi-non-x86
Do not emit linuxefi/initrdefi on non-x86 platforms
2018-02-16 14:52:08 +01:00
Alexander Graf
9ee21e6163 Do not emit linuxefi/initrdefi on non-x86 platforms
Grub wants to have linuxefi/initrdefi commands to execute Linux via the UEFI
calling convention on x86. However, all other platforms simply use the normal
linux/initrd commands, because there grub assumes that an EFI grub wants to
run an EFI payload.

Reflect this architecture difference in the generated grub configuration.

Signed-off-by: Alexander Graf <agraf@suse.de>
2018-02-16 11:24:43 +01:00
Marcus Schäfer
4c901d506d Fixup grub2 theme setup
The presence of a background file was mandatory for kiwi to
use the theme. But the background information is optional
2018-02-15 15:03:45 +01:00
Marcus Schäfer
0a50b72da3
Create compatible boot options
The boot option root=install:CDLABEL= is mandatory for install
images which uses the dracut initrd system. But for the custom
kiwi oemboot descriptions this is causing a problem when detecting
the install device. Thus the above boot option is only applied
for the initrd system which actually makes use of it
2018-02-13 13:00:36 +01:00
Marcus Schäfer
d582dc90bd Implementation of dracut kiwi-dump module
Provide the capabilities of the oem install code as
dracut module. The implementation covers the result
of the installiso="true" configuration. Installation
from remote sources still needs to be done and will
follow in an extra pull request. This addresses
Issue #576
2018-01-16 16:24:58 +01:00