mirror of
https://github.com/bylaws/libadrenotools
synced 2024-11-21 14:29:15 -07:00
Make blob patcher respect android driver layout
This commit is contained in:
parent
812ae09b9e
commit
db24bb4750
1 changed files with 20 additions and 17 deletions
|
@ -15,25 +15,26 @@ def patch_lib_base(in_dir, out_dir, libs, in_name, out_name):
|
||||||
def patch_lib(in_dir, out_dir, libs, name):
|
def patch_lib(in_dir, out_dir, libs, name):
|
||||||
patch_lib_base(in_dir, out_dir, libs, "lib" + name + ".so", "not" + name + ".so")
|
patch_lib_base(in_dir, out_dir, libs, "lib" + name + ".so", "not" + name + ".so")
|
||||||
|
|
||||||
def patch_references(lib_dir, out_dir, vulkan_libname, vulkan_newname, stub_mapper):
|
def patch_references(lib_dir, out_dir, vulkan_libname, vulkan_newname, shim_mapper):
|
||||||
try:
|
try:
|
||||||
os.mkdir(out_dir)
|
os.mkdir(out_dir)
|
||||||
|
os.mkdir(out_dir + "/hw")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
replacement_list = [("libgsl.so", "notgsl.so"), ("libllvm-glnext.so", "notllvm-glnext.so"), ("libdmabufheap.so", "notdmabufheap.so"), ("libadreno_utils.so", "notadreno_utils.so"), ("libllvm-qgl.so", "notllvm-qgl.so")]
|
replacement_list = [("libgsl.so", "notgsl.so"), ("libllvm-glnext.so", "notllvm-glnext.so"), ("libdmabufheap.so", "notdmabufheap.so"), ("libadreno_utils.so", "notadreno_utils.so"), ("libllvm-qgl.so", "notllvm-qgl.so")]
|
||||||
|
|
||||||
if (stub_mapper == 2):
|
if (shim_mapper < 2):
|
||||||
replacement_list += [("vendor.qti.hardware.display.mapper@2.0.so", "vendor.qti.hardware.display.mapperstub.so"),
|
replacement_list += [("vendor.qti.hardware.display.mapper@2.0.so", "vendor.qti.hardware.display.mappershim.so"),
|
||||||
("android.hardware.graphics.mapper@2.0.so", "android.hardware.graphics.mapperstub.so"),
|
("android.hardware.graphics.mapper@2.0.so", "android.hardware.graphics.mappershim.so"),
|
||||||
("vendor.qti.hardware.display.mapperextensions@1.0.so", "vendor.qti.hardware.display.mapperextensionsstub.so"),
|
("vendor.qti.hardware.display.mapperextensions@1.0.so", "vendor.qti.hardware.display.mapperextensionsshim.so"),
|
||||||
("vendor.qti.hardware.display.mapperextensions@1.1.so", "vendor.qti.hardware.display.mapperextensionsstub.so")]
|
("vendor.qti.hardware.display.mapperextensions@1.1.so", "vendor.qti.hardware.display.mapperextensionsshim.so")]
|
||||||
if (stub_mapper <= 3):
|
if (shim_mapper < 3):
|
||||||
replacement_list += [("vendor.qti.hardware.display.mapper@3.0.so", "vendor.qti.hardware.display.mapperstub.so"),
|
replacement_list += [("vendor.qti.hardware.display.mapper@3.0.so", "vendor.qti.hardware.display.mappershim.so"),
|
||||||
("android.hardware.graphics.mapper@3.0.so", "android.hardware.graphics.mapperstub.so")]
|
("android.hardware.graphics.mapper@3.0.so", "android.hardware.graphics.mappershim.so")]
|
||||||
if (stub_mapper <= 4):
|
if (shim_mapper < 4):
|
||||||
replacement_list += [("vendor.qti.hardware.display.mapper@4.0.so", "vendor.qti.hardware.display.mapperstub.so"),
|
replacement_list += [("vendor.qti.hardware.display.mapper@4.0.so", "vendor.qti.hardware.display.mappershim.so"),
|
||||||
("android.hardware.graphics.mapper@4.0.so", "android.hardware.graphics.mapperstub.so")]
|
("android.hardware.graphics.mapper@4.0.so", "android.hardware.graphics.mappershim.so")]
|
||||||
|
|
||||||
for lib in ["gsl", "llvm-glnext", "dmabufheap", "adreno_utils", "llvm-qgl"]:
|
for lib in ["gsl", "llvm-glnext", "dmabufheap", "adreno_utils", "llvm-qgl"]:
|
||||||
try:
|
try:
|
||||||
|
@ -41,24 +42,26 @@ def patch_references(lib_dir, out_dir, vulkan_libname, vulkan_newname, stub_mapp
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
patch_lib_base(lib_dir + "/hw/", out_dir, replacement_list, vulkan_libname, vulkan_newname)
|
patch_lib_base(lib_dir + "/hw/", out_dir + "/hw/", replacement_list, vulkan_libname, vulkan_newname)
|
||||||
|
|
||||||
if (len(sys.argv)!= 6):
|
if (len(sys.argv)!= 6):
|
||||||
print("<extracted rom in> <pkg out> <vk soname> <vk soname new> <mapper ver to patch up to>")
|
print("<in> <out> <vk soname> <vk soname new> <device mapper ver>")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
root_path = sys.argv[1]
|
root_path = sys.argv[1]
|
||||||
out_path = sys.argv[2]
|
out_path = sys.argv[2]
|
||||||
vulkan_libname = sys.argv[3]
|
vulkan_libname = sys.argv[3]
|
||||||
vulkan_newname = sys.argv[4]
|
vulkan_newname = sys.argv[4]
|
||||||
stub_mapper = int(sys.argv[5])
|
shim_mapper = int(sys.argv[5])
|
||||||
vendor_path = root_path + "/vendor/"
|
vendor_path = root_path + "/vendor/"
|
||||||
|
|
||||||
if (len(vulkan_newname) != len(vulkan_libname)):
|
if (len(vulkan_newname) != len(vulkan_libname)):
|
||||||
print("New vk soname must be equal to old one")
|
print("Errror")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
for libdir in ["/lib64/", "/lib/"]:
|
for libdir in ["/lib64/", "/lib/"]:
|
||||||
patch_references(vendor_path + libdir, out_path + libdir, vulkan_libname, vulkan_newname, stub_mapper)
|
patch_references(vendor_path + libdir, out_path + libdir, vulkan_libname, vulkan_newname, shim_mapper)
|
||||||
print("done!")
|
print("done!")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue