Mageia Bugzilla – Attachment 11418 Details for
Bug 25924
Mageia-7.1-Live-Xfce-i586.iso hangs on some BIOS computers when booting from USB stick
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Python3 program to fix Mageia-7.1 hybrid ISO MBR
mageia-iso-fix.py (text/plain), 1.01 KB, created by
Ihar Areshchankau
on 2019-12-22 15:37:04 CET
(
hide
)
Description:
Python3 program to fix Mageia-7.1 hybrid ISO MBR
Filename:
MIME Type:
Creator:
Ihar Areshchankau
Created:
2019-12-22 15:37:04 CET
Size:
1.01 KB
patch
obsolete
>#mageia-iso-fix.py >import sys, os >if len (sys.argv) != 2: > print (" Mageia hybrid ISO image MBR patching utility.") > print (" Usage:") > print ("python3 mageia-iso-fix.py Mageia-...-i586.iso") >else: > IsoFileName = sys.argv[1] > FirstPartTypeOffset = 450 > MbrSignatureOffset = 510 > if not os.path.isfile (IsoFileName): > print ("Error:", IsoFileName, "isn't a file name.") > else: > f = open (IsoFileName, "r+b") > sector = bytearray (f.read (512)) > if sector[MbrSignatureOffset] != 0x55 or sector[MbrSignatureOffset + 1] != 0xAA: > print ("Error:", IsoFileName, "doesn't have MBR.") > elif sector[FirstPartTypeOffset] == 0: > print (IsoFileName, "doesn't need to be patched.") > else: > print ("Patching", IsoFileName, " MBR:") > print ("First partition code is:", hex (sector[FirstPartTypeOffset])) > sector[FirstPartTypeOffset] = 0 > print ("First partition code changed to:", hex (sector[FirstPartTypeOffset])) > f.seek (0) > f.write (sector) > print (IsoFileName, "is patched now.") > f.close ()
#mageia-iso-fix.py import sys, os if len (sys.argv) != 2: print (" Mageia hybrid ISO image MBR patching utility.") print (" Usage:") print ("python3 mageia-iso-fix.py Mageia-...-i586.iso") else: IsoFileName = sys.argv[1] FirstPartTypeOffset = 450 MbrSignatureOffset = 510 if not os.path.isfile (IsoFileName): print ("Error:", IsoFileName, "isn't a file name.") else: f = open (IsoFileName, "r+b") sector = bytearray (f.read (512)) if sector[MbrSignatureOffset] != 0x55 or sector[MbrSignatureOffset + 1] != 0xAA: print ("Error:", IsoFileName, "doesn't have MBR.") elif sector[FirstPartTypeOffset] == 0: print (IsoFileName, "doesn't need to be patched.") else: print ("Patching", IsoFileName, " MBR:") print ("First partition code is:", hex (sector[FirstPartTypeOffset])) sector[FirstPartTypeOffset] = 0 print ("First partition code changed to:", hex (sector[FirstPartTypeOffset])) f.seek (0) f.write (sector) print (IsoFileName, "is patched now.") f.close ()
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 25924
:
11418
|
11424
|
11425
|
11436