Class: Yast::BootArchClass

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

Constant Summary collapse

S390_WHITELIST =

list of regexp to match kernel params that should be added from installation to running kernel on s390 (bsc#1086665)

[
  /net\.ifnames=\S*/,
  /fips=\S*/,
  /mitigations=\S*/,
  /rd\.zdev=\S*/,
  /zfcp\.allow_lun_scan=\S*/
].freeze

Instance Method Summary collapse

Instance Method Details

#DefaultKernelParams(resume) ⇒ String

Note:

for possible arguments for kernel see man kernel-command-line

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



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
# File 'src/modules/BootArch.rb', line 52

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

  if Arch.i386 || Arch.x86_64 || Arch.aarch64 || Arch.arm || Arch.ppc || Arch.riscv64
    ret = kernel_cmdline
    ret << " resume=#{resume}" unless resume.empty?
    ret << " #{features}" unless features.empty?
    ret << propose_cpu_mitigations
    ret << " quiet"
    ret
  elsif Arch.s390
    termparm = if ENV.fetch("TERM", nil) == "linux"
      "TERM=linux console=ttyS0 console=ttyS1"
    else
      "hvc_iucv=8 TERM=dumb"
    end
    parameters = +"#{features} #{termparm}"
    # pick selected params from installation command line
    S390_WHITELIST.each do |pattern|
      parameters << " #{Regexp.last_match(0)}" if kernel_cmdline =~ pattern
    end

    parameters << propose_cpu_mitigations
    parameters << " resume=#{resume}" unless resume.empty?
    parameters
  else
    log.warn "Default kernel parameters not defined"
    kernel_cmdline + propose_cpu_mitigations
  end
end

#mainObject



28
29
30
31
32
33
34
35
36
# File 'src/modules/BootArch.rb', line 28

def main
  textdomain "bootloader"

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

#propose_cpu_mitigationsObject



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'src/modules/BootArch.rb', line 87

def propose_cpu_mitigations
  linuxrc_value = Yast::Linuxrc.value_for("mitigations")
  log.info "linuxrc mitigations #{linuxrc_value.inspect}"
  return "" unless linuxrc_value.nil? # linuxrc already has mitigations

  product_value = ProductFeatures.GetStringFeature("globals", "cpu_mitigations")
  log.info "cpu mitigations in product: #{product_value.inspect}"

  mitigations = if product_value.empty?
    ::Bootloader::CpuMitigations::DEFAULT
  else
    ::Bootloader::CpuMitigations.from_string(product_value)
  end
  # no value for manual mitigations
  mitigations.kernel_value ? " mitigations=#{mitigations.kernel_value}" : ""
end