Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:michael-chang:grub:2.12
grub2
grub2-s390x-set-hostonly.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File grub2-s390x-set-hostonly.patch of Package grub2
From 2a86e5f9e3abb622d2e16ee5f05b1ba2df1f756d Mon Sep 17 00:00:00 2001 From: Gary Lin <glin@suse.com> Date: Tue, 6 Aug 2024 14:46:17 +0800 Subject: [PATCH] zipl2grub.pl.in: add the switch for hostonly/no-hostonly Since the kiwi build environment could be very different from the real system environment, it may cause some problem to build the zipl initrd with '--hostonly' since some critical files could be omitted accidentally. To avoid the potential issues, this commit introduces a variable, SUSE_S390_DRACUT_HOSTONLY, as the switch to use hostonly or no-hostonly for the zipl initrd. By default, it's detected automatically by tracing the root partition to the root block device. If the root block device is a loop device, then it's likely to be a build environment, and then '--no-hostonly' will be used to create the zipl initrd. Signed-off-by: Gary Lin <glin@suse.com> --- util/s390x/zipl2grub.pl.in | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/util/s390x/zipl2grub.pl.in b/util/s390x/zipl2grub.pl.in index f4f997100..46b902209 100644 --- a/util/s390x/zipl2grub.pl.in +++ b/util/s390x/zipl2grub.pl.in @@ -15,6 +15,7 @@ my $zipldir = ""; my $running = ""; my $refresh = 1; # needs to default to "on" until most bugs are shaken out! my $force = 0; +my $hostonly = 1; my $verbose = 0; my $debug = 0; my $miss = 0; @@ -114,8 +115,13 @@ sub BootCopy($$$$) { } sub MkInitrd($$$) { my( $initrd, $dir, $version) = @_; - my @C = ( "dracut", "--hostonly", "--force"); + my @C = ( "dracut", "--force"); my $uuid; + if ($hostonly) { + push @C, "--hostonly"; + } else { + push @C, "--no-hostonly"; + } push @C, "--quiet" unless ($verbose > 1); if ( exists( $fsdev{"/boot"}) ) { chomp( $uuid = qx{grub2-probe --target=fs_uuid /boot}); @@ -368,6 +374,24 @@ foreach ("GRUB_EMU_CONMODE", "GRUB_CONMODE") { $C{$_} = "conmode=" . $C{$_}; } +if ( !exists( $C{SUSE_S390_DRACUT_HOSTONLY}) || $C{SUSE_S390_DRACUT_HOSTONLY} eq "auto" ) { + # Auto-detection mode + # + # Check if the root block device of the root partition is a loop device. + # If yes, it is the image building system, e.g. kiwi. Then, set 'hostonly' to 0. + my ( $dev, $lsblk ); + + chomp( $dev = qx{grub2-probe -t device /}); + if ($dev) { + chomp( $lsblk = qx{lsblk -snrp -o NAME $dev}); + $hostonly = 0 if ( $lsblk =~ m{\/loop} ); + } +} elsif ( $C{SUSE_S390_DRACUT_HOSTONLY} =~ m{^(no|false|0)$} ) { + $hostonly = 0; +} else { + $hostonly = 1; +} + if ( $debug && $verbose > 2 ) { foreach ( sort( keys( %C)) ) { printf( "%s=\"%s\"\n", $_, $C{$_}); -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor