-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathamdfwflashinst.py
595 lines (540 loc) · 20.9 KB
/
amdfwflashinst.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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
96
97
98
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
#!/usr/bin/env python3
#
# Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
#
# Author: Srinivasan Subramanian (srinivasan.subramanian@amd.com)
#
# Download and install the amdfwflash utility
# V0.8: destdir fix
# V0.7: tar saved ifwi after rollback, update
# V0.6: removed code duplication for apt update cmd
# V0.5: sbin
# V0.4: fix list
# V0.3: exit on amdgpu driver
# V0.2: fix ubuntu
# V0.1: Initial version 10.26.2022
#
from urllib import request
from urllib.request import urlretrieve
import re
import subprocess
import sys
import argparse
import os
import shlex
import datetime
# Set ROCm Release Package Distribution repo baseURL below
fwupdatorurl = { "1.0" :
{ "sles" : "https://repo.radeon.com/fwupdator/amdfwflash/.1.0/rpm",
"centos8" : "https://repo.radeon.com/fwupdator/amdfwflash/.1.0/rpm",
"rhel8" : "https://repo.radeon.com/fwupdator/amdfwflash/.1.0/rpm",
"centos9" : "https://repo.radeon.com/fwupdator/amdfwflash/.1.0/rpm",
"rhel9" : "https://repo.radeon.com/fwupdator/amdfwflash/.1.0/rpm",
"ubuntu" : "https://repo.radeon.com/fwupdator/amdfwflash/.1.0/deb",
"centos" : "https://repo.radeon.com/fwupdator/amdfwflash/.1.0/rpm"
}
}
# Commands
RM_F_CMD = "/bin/rm -f "
RPM_CMD = "/usr/bin/rpm"
YUM_CMD = "/usr/bin/yum"
DPKG_CMD = "/usr/bin/dpkg"
DPKGDEB_CMD = "/usr/bin/dpkg-deb"
APTGET_CMD = "/usr/bin/apt-get"
APT_CMD = "/usr/bin/apt"
APTKEY_CMD = "/usr/bin/apt-key"
WGET_CMD = "/usr/bin/wget"
ZYPPER_CMD = "/usr/bin/zypper"
ECHO_CMD = "/bin/echo"
TEE_CMD = "/usr/bin/tee"
LSMOD_CMD = "/sbin/lsmod"
GREP_CMD = "/bin/grep"
AMDFWFLASH_CMD = "/opt/amdfwflash/sbin/amdfwflash"
SED_CMD = "/bin/sed"
TAR_CMD = "/bin/tar"
# Package type suffixes
PKGTYPE_RPM = "rpm"
PKGTYPE_DEB = "deb"
# Supported OS types
CENTOS_TYPE = "centos" # Version 7
CENTOS8_TYPE = "centos8"
CENTOS9_TYPE = "centos9"
UBUNTU_TYPE = "ubuntu"
DEBIAN_TYPE = "debian"
SLES_TYPE = "sles"
RHEL_TYPE = "rhel" # Version 7
RHEL8_TYPE = "rhel8"
RHEL9_TYPE = "rhel9"
CENTOS_VERSION8_TYPESTRING = 'VERSION="8'
CENTOS_VERSION9_TYPESTRING = 'VERSION="9'
RHEL_VERSION8_TYPESTRING = 'VERSION="8'
RHEL_VERSION9_TYPESTRING = 'VERSION="9'
BIONIC_TYPE = "bionic"
FOCAL_TYPE = "focal"
JAMMY_TYPE = "jammy"
# OS release info
ETC_OS_RELEASE = "/etc/os-release"
# Download destination dir: default current director
DOWNLOAD_DESTDIR = "./"
#
# Is amdgpu driver loaded?
#
def is_amdgpu_driver_loaded():
check_cmd = LSMOD_CMD
grep_cmd = GREP_CMD + " amdgpu "
try:
ps1 = subprocess.Popen(shlex.split(check_cmd), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(shlex.split(grep_cmd), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
if ps2.returncode == 0:
return True
else:
return False
except subprocess.CalledProcessError as err:
return False
#
# Is iomem=relaxed set?
#
def is_iomem_relaxed_set():
check_cmd = "cat /proc/cmdline"
grep_cmd = GREP_CMD + " iomem=relax "
try:
ps1 = subprocess.Popen(shlex.split(check_cmd), stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(shlex.split(grep_cmd), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
if ps2.returncode == 0:
return True
else:
return False
except subprocess.CalledProcessError as err:
return False
# Remove iomem=relaxed parameter
def remove_iomem_relaxed_param():
update_grub_cmd = "sed -i 's/ iomem=relaxed//' /etc/default/grub"
try:
ps1 = subprocess.Popen(shlex.split(update_grub_cmd), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
return False
grub2_mkconfig_cmd = "grub2-mkconfig -o /boot/grub2/grub.cfg"
try:
ps1 = subprocess.Popen(shlex.split(grub2_mkconfig_cmd), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
return False
return True
# update ifwi
def update_ifwi():
update_cmd = AMDFWFLASH_CMD + " --update-ifwi"
try:
ps1 = subprocess.Popen(shlex.split(update_cmd), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
return False
return True
# rollback ifwi
def rollback_ifwi():
rollback_cmd = AMDFWFLASH_CMD + " --rollback-ifwi"
try:
ps1 = subprocess.Popen(shlex.split(rollback_cmd), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
return False
return True
# list devices
def list_devices():
listdev_cmd = AMDFWFLASH_CMD + " --list-devices"
try:
ps1 = subprocess.Popen(shlex.split(listdev_cmd), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
return False
return True
# tar saved ifwi
def tar_saved_ifwi(args):
# use timestamp to create unique tar filename
tar_cmd = (TAR_CMD + " -cvf " + args.destdir[0] + "/" + "saved_ifwi"
+ datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + ".tar "
+ "/tmp/amdfwflash/ifwi/backup ")
print("Archiving save IFWI image: ")
print(tar_cmd)
try:
ps1 = subprocess.Popen(shlex.split(tar_cmd), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
return False
return True
# Setup/remove repo
def setup_sles_zypp_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# Set up rocm repo for chosen rev to install
# use rev specific rocm repo
zypprepo = "[amdfwflash" + args.revstring[0] + "]\nenabled=1\nautorefresh=0\nbaseurl=" + fetchurl + "\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://repo.radeon.com/fwupdator/amdfw.gpg.key"
echocmd = ECHO_CMD + " -e '" + zypprepo + "' "
repofilename = "/etc/zypp/repos.d/amdfwflash" + args.revstring[0] + ".repo "
teecmd = TEE_CMD + " " + repofilename + " "
try:
ps1 = subprocess.Popen(shlex.split(echocmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(teecmd.split(), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# apt update repo
zypprefresh = ZYPPER_CMD + " refresh "
try:
ps1 = subprocess.Popen(zypprefresh.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_centos_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# Set up rocm repo for chosen rev to install
# use rev specific rocm repo
yumrepo = "[amdfwflash" + args.revstring[0] +"]\nname=amdfwflash\nbaseurl=" + fetchurl + "\nenabled=1\ngpgcheck=1\ngpgkey=https://repo.radeon.com/fwupdator/amdfw.gpg.key"
echocmd = ECHO_CMD + " -e '" + yumrepo + "' "
repofilename = "/etc/yum.repos.d/amdfwflash" + args.revstring[0] + ".repo"
teecmd = TEE_CMD + " " + repofilename + " "
try:
ps1 = subprocess.Popen(shlex.split(echocmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(teecmd.split(), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# clean repo
yumupdate = YUM_CMD + " clean all "
try:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_centos9_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
setup_centos_repo(args, fetchurl)
def setup_centos8_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
setup_centos_repo(args, fetchurl)
def remove_centos_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# remove rocm repo for chosen rev to install
# use rev specific rocm repo
repofilename = "/etc/yum.repos.d/amdfwflash" + args.revstring[0] + ".repo"
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# clean repo
yumupdate = YUM_CMD + " clean all "
try:
ps1 = subprocess.Popen(yumupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def remove_sles_zypp_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# remove rocm repo for chosen rev to install
# use rev specific rocm repo
repofilename = "/etc/zypp/repos.d/amdfwflash" + args.revstring[0] + ".repo "
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# clean repo
zyppclean = ZYPPER_CMD + " clean "
try:
ps1 = subprocess.Popen(zyppclean.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def setup_debian_repo(args, fetchurl, ubuntutype):
global rocklist
if args.repourl:
pass
else:
# Set up rocm repo for chosen rev to install
wgetkey = WGET_CMD + " -q -O - http://repo.radeon.com/fwupdator/amdfw.gpg.key "
aptkeycmd = APTKEY_CMD + " add -"
try:
ps1 = subprocess.Popen(wgetkey.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(aptkeycmd.split(), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# use rev specific rocm repo
debrepo = "deb [arch=amd64] " + fetchurl + " " + ubuntutype + " main "
echocmd = ECHO_CMD + " '" + debrepo + "' "
repofilename = "/etc/apt/sources.list.d/amdfwflash" + args.revstring[0] + ".list "
teecmd = TEE_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(shlex.split(echocmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ps2 = subprocess.Popen(teecmd.split(), stdin=ps1.stdout, stdout=subprocess.PIPE)
ps1.stdout.close()
out = ps2.communicate()[0]
print(out.decode('utf-8'))
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# apt update repo
aptupdate = APT_CMD + " clean"
try:
ps1 = subprocess.Popen(aptupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# apt update repo
aptupdate = APT_CMD + " update"
try:
ps1 = subprocess.Popen(aptupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
def remove_debian_repo(args, fetchurl):
global rocklist
if args.repourl:
pass
# use rev specific rocm repo
else:
# remove rocm repo for chosen rev to install
# use rev specific rocm repo
repofilename = "/etc/apt/sources.list.d/amdfwflash" + args.revstring[0] + ".list "
rmrepocmd = RM_F_CMD + " " + repofilename
try:
ps1 = subprocess.Popen(rmrepocmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
# clean repo
# apt update repo
aptupdate = APT_CMD + " clean"
try:
ps1 = subprocess.Popen(aptupdate.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
#
# --rev REV is the ROCm version number string
# --destdir DESTDIR directory to download rpm for installation
#
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=('[V1.0]amdfwflashinst.py: utility to '
' download and install amdfwflash IFWI Updator package for specified rev'
' (requires sudo privilege) '),
prefix_chars='-')
parser.add_argument('--rev', nargs=1, dest='revstring', default='rpm',
help=('specifies release version '
' Example: sudo python3 ./amdfwflashint.py --rev 1.0 for amdfwflash 1.0'
)
)
parser.add_argument('--destdir', nargs=1, dest='destdir', default='.',
help=('specify directory where to save old IFWI '
' after update. Default: current directory '
' --destdir /tmp to use /tmp directory')
)
parser.add_argument('--update', dest='updateifwi', action='store_true',
help=('update the ifwi after the packages are installed'
' to the new version ')
)
parser.add_argument('--rollback', dest='rollbackifwi', action='store_true',
help=('rollback the ifwi after the packages are installed'
' to the GA version ')
)
parser.add_argument('--list', dest='listonly', action='store_true',
help=('just list the packages that will be installed'
' -- do not download or install ')
)
parser.add_argument('--repourl', nargs=1, dest='repourl', default=None,
help=('specify repo URL to use from where to download packages'
' as in http://repo.radeon.com/fwupdator/{apt, yum, zyp, centos8}/<REV> '
' Example: --repourl http://compute-artifactory/build/xyz')
)
parser.add_argument('--baseurl', nargs=1, dest='baseurl', default=None,
help=('specify early access repo URL to use from where to download packages'
' as in http://repo.radeon.com/fwupdator/{apt, yum, zyp, centos8}/.. '
' Example: --baseurl http://repo.radeon.com/fwupdator/private/bionic/')
)
args = parser.parse_args();
# Determine installed OS type
ostype = None
with open(ETC_OS_RELEASE, 'r') as f:
for line in f:
if CENTOS_TYPE.lower() in line.lower():
ostype = CENTOS_TYPE
break
if DEBIAN_TYPE.lower() in line.lower():
ostype = UBUNTU_TYPE
break
if JAMMY_TYPE.lower() in line.lower():
ostype = UBUNTU_TYPE
ubuntutype = JAMMY_TYPE
break
if FOCAL_TYPE.lower() in line.lower():
ostype = UBUNTU_TYPE
ubuntutype = FOCAL_TYPE
break
if BIONIC_TYPE.lower() in line.lower():
ostype = UBUNTU_TYPE
ubuntutype = BIONIC_TYPE
break
if SLES_TYPE.lower() in line.lower():
ostype = SLES_TYPE
break
if RHEL_TYPE.lower() in line.lower():
ostype = CENTOS_TYPE
break
# Detect CentOS8/RHEL8 to set the correct ROCm repo
if ostype is CENTOS_TYPE:
with open(ETC_OS_RELEASE, 'r') as f:
for line in f:
if CENTOS_VERSION8_TYPESTRING.lower() in line.lower():
ostype = CENTOS8_TYPE
break
if RHEL_VERSION8_TYPESTRING.lower() in line.lower():
ostype = CENTOS8_TYPE
break
if CENTOS_VERSION9_TYPESTRING.lower() in line.lower():
ostype = RHEL9_TYPE
break
if RHEL_VERSION9_TYPESTRING.lower() in line.lower():
ostype = RHEL9_TYPE
break
if ostype is None:
print("Exiting: Unknown installed OS type")
parser.print_help()
sys.exit(1)
# Log version and date of run
print("Running V0.8 amdfwflashinst.py utility for OS: " + ostype + " on: " + str(datetime.datetime.now()))
if is_amdgpu_driver_loaded():
print("amdgpu driver is LOADED. Please blacklist amdgpu and try again")
sys.exit(0)
else:
print("amdgpu driver is NOT LOADED")
#
# Set pkgtype to use based on ostype
#
pkgtype = None
pkgtype = {
RHEL9_TYPE : PKGTYPE_RPM,
RHEL8_TYPE : PKGTYPE_RPM,
CENTOS8_TYPE : PKGTYPE_RPM,
CENTOS_TYPE : PKGTYPE_RPM,
UBUNTU_TYPE : PKGTYPE_DEB,
SLES_TYPE : PKGTYPE_RPM
}[ostype]
#
# Get the list of package names from repo using --rev option
#
if args.repourl:
fwbaseurl = args.repourl[0]
elif args.baseurl:
fwbaseurl = args.baseurl[0]
else:
if args.revstring[0] in fwupdatorurl:
fwbaseurl = fwupdatorurl[args.revstring[0]][ostype]
else:
print("Exiting: No AMDFWFLASH package for specified rev: ", args.revstring[0])
sys.exit(1)
#
# Based on os type, set the package install command and options
#
cmd = {
RHEL9_TYPE : YUM_CMD + " install --assumeyes amdfwflash ",
RHEL8_TYPE : YUM_CMD + " install --assumeyes amdfwflash ",
CENTOS8_TYPE : YUM_CMD + " install --assumeyes amdfwflash",
CENTOS_TYPE : YUM_CMD + " install --assumeyes amdfwflash",
UBUNTU_TYPE : APTGET_CMD + " -y install amdfwflash",
SLES_TYPE : ZYPPER_CMD + " install amdfwflash "
}[ostype]
# for Ubuntu/Debian
if ostype is UBUNTU_TYPE:
setup_debian_repo(args, fwbaseurl, "ubuntu")
elif ostype is CENTOS_TYPE:
setup_centos_repo(args, fwbaseurl)
elif ostype is CENTOS8_TYPE:
setup_centos8_repo(args, fwbaseurl)
elif ostype is RHEL9_TYPE:
setup_centos9_repo(args, fwbaseurl)
else:
if is_iomem_relaxed_set() is True:
print("Detected: iomem=relaxed boot paramter set.")
setup_sles_zypp_repo(args, fwbaseurl)
else:
print("SLES15 requires iomem=relaxed boot parameter set.")
print("NOTE: Please refer to the AMDFWFLASH User Guide.")
sys.exit(0)
try:
ps1 = subprocess.Popen(cmd.split(), bufsize=0).communicate()[0]
except subprocess.CalledProcessError as err:
for line in str.splitlines(err.output.decode('utf-8')):
print(line)
print(" Unexpected error encountered! Did you forget sudo?")
#
# If --list specified, print the package list and exit
#
if args.listonly is True:
print("List device\n")
list_devices()
sys.exit(0)
if args.updateifwi is True:
print("Update IFWI")
update_ifwi()
tar_saved_ifwi(args)
elif args.rollbackifwi is True:
print("Rollback IFWI")
rollback_ifwi()
tar_saved_ifwi(args)
if ostype is CENTOS_TYPE or ostype is CENTOS8_TYPE or ostype is RHEL9_TYPE:
remove_centos_repo(args, fwbaseurl)
elif ostype is UBUNTU_TYPE:
remove_debian_repo(args, fwbaseurl)
else:
remove_sles_zypp_repo(args, fwbaseurl)
remove_iomem_relaxed_param()
sys.exit(0)