Class: Yast::BootArchClass

Inherits:
Module
  • Object
show all
Defined in:
src/modules/BootArch.rb

Instance Method Summary (collapse)

Instance Method Details

- (String) DefaultKernelParams(resume)

Get parameters for the default kernel

Parameters:

  • resume (String)

    string device to resume from (or empty not to set it)

Returns:

  • (String)

    parameters for default kernel



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'src/modules/BootArch.rb', line 38

def DefaultKernelParams(resume)
  features = ProductFeatures.GetStringFeature(
    "globals",
    "additional_kernel_parameters"
  )
  kernel_cmdline = Kernel.GetCmdLine

  if Arch.i386 || Arch.x86_64
    ret = kernel_cmdline != "" ? Ops.add(kernel_cmdline, " ") : ""
    if resume != ""
      ret = Ops.add(ret, Builtins.sformat("resume=%1 ", resume))
    end
    ret = Ops.add(Ops.add(ret, features), " ") if features != ""
    if Builtins.regexpmatch(ret, "^(.* )?splash=[[:lower:]]+( .*)?$")
      ret = Builtins.regexpsub(
        ret,
        "^((.* ))?splash=[[:lower:]]+(( .*)?)$",
        "\\1 \\3"
      )
    end
    ret = Ops.add(ret, "splash=silent quiet showopts")
    return ret
  elsif Arch.s390
    file_desc = Convert.convert(
      SCR.Execute(path(".target.bash_output"), "echo $TERM"),
      :from => "any",
      :to   => "map <string, any>"
    )
    env_term = Ops.get_string(file_desc, "stdout", "")
    termparm = "hvc_iucv=8 TERM=dumb"
    if env_term == "linux\n"
      termparm = "TERM=linux console=ttyS0 console=ttyS1"
    end
    parameters = Builtins.sformat("%1 %2", features, termparm)
    if resume != ""
      parameters = Ops.add(
        parameters,
        Builtins.sformat(" resume=%1", resume)
      )
    end
    return parameters
  else
    Builtins.y2warning("Default kernel parameters not defined")
    return kernel_cmdline
  end
end

- (String) FailsafeKernelParams

Get parameters for the failsafe kernel

Returns:

  • (String)

    parameters for failsafe kernel



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'src/modules/BootArch.rb', line 87

def FailsafeKernelParams
  ret = ""
  if Arch.i386
    ret = "showopts apm=off noresume nosmp maxcpus=0 edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset"
  elsif Arch.x86_64
    ret = "showopts apm=off noresume edd=off powersaved=off nohz=off highres=off processor.max_cstate=1 nomodeset"
  elsif Arch.s390
    ret = Ops.add(DefaultKernelParams(""), " noresume")
  else
    Builtins.y2warning("Parameters for Failsafe boot option not defined")
  end
  if Stage.initial
    ret = Ops.add(ret, " NOPCMCIA") if Linuxrc.InstallInf("NOPCMCIA") == "1"
  else
    saved_params = Convert.convert(
      SCR.Read(path(".target.ycp"), "/var/lib/YaST2/bootloader.ycp"),
      :from => "any",
      :to   => "map <string, any>"
    )
    ret = Ops.add(
      Ops.add(ret, " "),
      Ops.get_string(saved_params, "additional_failsafe_params", "")
    )
  end


  #B#352020 kokso: - Graphical failsafe mode
  #ret = ret + " 3";
  ret = Ops.add(ret, " x11failsafe")
  #B#352020 end
  ret
end

- (Object) main



24
25
26
27
28
29
30
31
32
33
# File 'src/modules/BootArch.rb', line 24

def main

  textdomain "bootloader"

  Yast.import "Arch"
  Yast.import "Kernel"
  Yast.import "Linuxrc"
  Yast.import "ProductFeatures"
  Yast.import "Stage"
end

- (Object) ResumeAvailable

Is Suspend to Disk available?

Returns:

  • true if STD is available



128
129
130
# File 'src/modules/BootArch.rb', line 128

def ResumeAvailable
  Arch.i386 || Arch.x86_64 || Arch.s390
end

- (String) StrArch

Return architecture as string

Returns:

  • (String)

    type of architecture e.g. “i386”



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'src/modules/BootArch.rb', line 135

def StrArch
  ret = Arch.architecture
  if ret == "ppc" || ret == "ppc64"
    if Arch.board_iseries
      ret = "iseries"
    elsif Arch.board_prep
      ret = "prep"
    elsif Arch.board_chrp
      ret = "chrp"
    elsif Arch.board_mac_new
      ret = "pmac"
    elsif Arch.board_mac_old
      ret = "pmac"
    else
      ret = "unknown"
    end
  end

  Builtins.y2milestone("Type of architecture: %1", ret)
  ret
end

- (Object) VgaAvailable

Is VGA parameter setting available

Returns:

  • true if vga= can be set



122
123
124
# File 'src/modules/BootArch.rb', line 122

def VgaAvailable
  Arch.i386 || Arch.x86_64
end