Skip to content

Commit 70997b4

Browse files
committed
extract_utils: fix rules for QDSP6 blobs
* Disable ELF check. It won't work and will break the build. * Infer the bits from file path. QDSP6 blobs are observe in vendor/lib64, so the assumption of QDSP6 being placed in lib no longer holds. Change-Id: Ic8344f40d2e0f366752c8ddeb6962f5d20c4a0f5
1 parent a5549b0 commit 70997b4

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

extract_utils/bp_builder.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
MACHINE_TARGET_MAP = {
1616
EM.ARM: 'android_arm',
17-
EM.QDSP6: 'android_arm',
1817
EM.AARCH64: 'android_arm64',
1918
EM.X86: 'android_x86',
2019
EM.X86_64: 'android_x86_64',
@@ -219,7 +218,10 @@ def target(self, f: File, machine: EM, deps: Optional[List[str]]):
219218
target = self.o.setdefault('target', {})
220219

221220
rel_path = self.__file_rel_sub_path(f.dst)
222-
arch = MACHINE_TARGET_MAP[machine]
221+
if machine == EM.QDSP6:
222+
arch = 'android_arm64' if f.inferred_bits == 64 else 'android_arm'
223+
else:
224+
arch = MACHINE_TARGET_MAP[machine]
223225
target[arch] = {'srcs': [rel_path]}
224226

225227
if deps:

extract_utils/file.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,15 @@ def privileged(self):
293293
def skip_preprocessed_apk_checks(self):
294294
return self.args.get(FileArgs.SKIPAPKCHECKS)
295295

296+
@property
297+
def inferred_bits(self):
298+
if self.contains_path_parts(LIB_PARTS):
299+
return 32
300+
elif self.contains_path_parts(LIB64_PARTS):
301+
return 64
302+
else:
303+
raise ValueError(f'Cannot infer bits from file path: {self.src}')
304+
296305

297306
T = TypeVar('T')
298307

extract_utils/makefiles.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
get_file_machine_bits_libs,
1717
remove_libs_so_ending,
1818
)
19+
from extract_utils.elf_parser import EM
1920
from extract_utils.file import (
2021
CommonFileTree,
2122
File,
@@ -204,6 +205,11 @@ def write_elfs_package(
204205
if is_bin and (machine is None or bits is None):
205206
return write_sh_package(files[0], builder, any_extension=True)
206207

208+
if machine == EM.QDSP6:
209+
libs = None
210+
enable_check_elf = False
211+
bits = f.inferred_bits
212+
207213
deps = remove_libs_so_ending(libs)
208214
deps = run_libs_fixup(ctx.lib_fixups, deps, file.partition)
209215
machines.append(machine)

0 commit comments

Comments
 (0)