mirror of
https://github.com/elseif/MikroTikPatch
synced 2026-07-17 10:39:40 +00:00
Update patch.py
Signed-off-by: elseif <elseif@live.cn>
This commit is contained in:
parent
dedfe06698
commit
a5db54eca5
13
patch.py
13
patch.py
@ -281,11 +281,22 @@ def patch_kernel(data:bytes,key_dict):
|
|||||||
else:
|
else:
|
||||||
raise Exception('unknown kernel format')
|
raise Exception('unknown kernel format')
|
||||||
|
|
||||||
|
def patch_loader(loader_file):
|
||||||
|
try:
|
||||||
|
from loader import patch_loader
|
||||||
|
if 'ARCH' in os.environ and os.environ['ARCH'] == '-arm64':
|
||||||
|
arch = 'arm64'
|
||||||
|
else:
|
||||||
|
arch = 'x86'
|
||||||
|
patch_loader(loader_file,loader_file,arch)
|
||||||
|
except ImportError:
|
||||||
|
print("loader module not found. cannot run patch_loader.py")
|
||||||
|
|
||||||
def patch_squashfs(path,key_dict):
|
def patch_squashfs(path,key_dict):
|
||||||
for root, dirs, files in os.walk(path):
|
for root, dirs, files in os.walk(path):
|
||||||
for file in files:
|
for file in files:
|
||||||
if file =='loader':
|
if file =='loader':
|
||||||
continue
|
patch_loader(loader_file)
|
||||||
file = os.path.join(root,file)
|
file = os.path.join(root,file)
|
||||||
if os.path.isfile(file):
|
if os.path.isfile(file):
|
||||||
data = open(file,'rb').read()
|
data = open(file,'rb').read()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user