1 Star 0 Fork 98

余诗/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
grub2-s390x-12-zipl-setup-usrmerge.patch 2.86 KB
一键复制 编辑 原始数据 按行查看 历史
zhangqiumiao 提交于 2024-03-04 03:17 . update to 2.12
---
util/s390x/zipl2grub.pl.in | 41 ++++++++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 13 deletions(-)
Index: grub-2.06/util/s390x/zipl2grub.pl.in
===================================================================
--- grub-2.06.orig/util/s390x/zipl2grub.pl.in
+++ grub-2.06/util/s390x/zipl2grub.pl.in
@@ -101,20 +101,22 @@ sub ManagePrev($$$){
}
return $ret;
}
-sub BootCopy($$$) {
- my( $file, $dir, $tgt) = @_;
+sub BootCopy($$$$) {
+ my( $src, $file, $dir, $tgt) = @_;
my $curr = "$dir/$tgt";
- Info(4, "Copy /boot/$file $dir $tgt\n");
+ $src = "/boot/$src" unless ( -r $src );
+ Info(4, "Copy $src $dir $tgt\n");
if ( $tgt eq "image" && ManagePrev( $file, $dir, $tgt)) {
ManagePrev( $file, $dir, "initrd")
}
- cp( "/boot/$file", "$dir/$file");
+ cp( $src, "$dir/$file");
ln( $file, $curr);
}
sub MkInitrd($$$) {
my( $initrd, $dir, $version) = @_;
my @C = ( "dracut", "--hostonly", "--force");
my $uuid;
+ push @C, "--quiet" unless ($verbose > 1);
if ( exists( $fsdev{"/boot"}) ) {
chomp( $uuid = qx{grub2-probe --target=fs_uuid /boot});
my ($dev, $type) = ($fsdev{"/boot"}, $fstype{"/boot"});
@@ -429,18 +431,31 @@ if ( ! -r $Image ) {
}
Panic( 1, "$C: kernel '$Image' not readable!?\n") unless (-r $Image);
-if ( -l $Image ) {
- $Image = readlink( $Image);
-}
-my ($image, $version) = ($Image =~ m{^(?:/boot/)?([^-]+-(.+))$});
-if ( !defined($image) || !defined($version) || ! -r "/boot/$image" ) {
- Panic( 1, "$C: weird $Image. This should never happen!\n");
+my ($image, $version) = ($Image, undef);
+while ( !defined( $version) ) {
+ my ($i, $vr, $f) = ($image =~ m{^(?:/boot/)?([^-/]+)-([^/]+)-([^-/]+)$});
+ Info( 4, "image='$image': ");
+ if ( defined($i) && defined($vr) && defined( $f) && -r "/boot/$i-$vr-$f" ) {
+ Info( 4, "matches pattern ('$vr'-'$f')\n");
+ $version = "$vr-$f";
+ last;
+ }
+ if ( -l $image ) {
+ Info( 4, "readlink...\n");
+ $image = readlink( $image);
+ next;
+ }
+ Info( 4, "last resort: get_kernel_version from original '$Image'...\n");
+ chomp( $version = qx{get_kernel_version $Image});
+ Panic( 1, "$C: failed to get kernel version for '$Image'!\n")
+ unless ( defined( $version) && $version );
}
my $initrd = "initrd-$version";
+$image = "image-$version";
if ( ! -r $ziplimage || ! -r $ziplinitrd || $refresh ) {
- BootCopy( $image, $zipldir, "image");
- BootCopy( $initrd, $zipldir, "initrd")
+ BootCopy( $Image, $image, $zipldir, "image");
+ BootCopy( $initrd, $initrd, $zipldir, "initrd")
if (-r "/boot/$initrd" && ! exists( $fsdev{"/boot"}));
}
if ( $refresh || ChkInitrd( $zipldir, "initrd") <= 0 ) {
@@ -463,7 +478,7 @@ if ( ! $debug ) {
}
# now: go for it!
-my @C = ( "/sbin/zipl", (($verbose) ? "-Vnc" : "-nc"), "$ziplconf" );
+my @C = ( "/sbin/zipl", (($verbose > 1) ? "-Vnc" : "-nc"), "$ziplconf" );
System( @C);
exit( $miss);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yushi-Icy/grub2.git
[email protected]:yushi-Icy/grub2.git
yushi-Icy
grub2
grub2
master

搜索帮助