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
84
85
86
87
88
89
90
91
92
93
94
95
# 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.ia64
    ret = kernel_cmdline != "" ? Ops.add(kernel_cmdline, " ") : ""
    ret = Ops.add(Ops.add(ret, features), " ") if features != ""
    ret = Ops.add(ret, "splash=silent quiet")

    # FIXME: this does not belong here, it cannot be tracked or maintained
    # and is undocumented
    # on SGI Altix change kernel default hash tables sizes
    if SCR.Read(path(".target.stat"), "/proc/sgi_sn") != {}
      ret = Ops.add(ret, " thash_entries=2097152")
    end
    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



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File '../../src/modules/BootArch.rb', line 99

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.ia64
    ret = "nohalt noresume powersaved=off"
  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



142
143
144
# File '../../src/modules/BootArch.rb', line 142

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

- (String) StrArch

Return architecture as string

Returns:

  • (String)

    type of architecture e.g. “i386”



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File '../../src/modules/BootArch.rb', line 149

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



136
137
138
# File '../../src/modules/BootArch.rb', line 136

def VgaAvailable
  Arch.i386 || Arch.x86_64 || Arch.ia64
end