From 2ced3fab48030a3c59ee4830f0eaab6732d2457c Mon Sep 17 00:00:00 2001 From: handyohos Date: Sat, 14 May 2022 16:41:35 +0800 Subject: [PATCH] feat: Add 64bit support for modulemgr. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1)install from lib64 for arm64 platform Signed-off-by: handyohos Change-Id: I7420b15591b180bf4b09c563d0d6751cdc321c90 --- interfaces/innerkits/BUILD.gn | 4 ++++ interfaces/innerkits/modulemgr/modulemgr.c | 9 +++++++-- services/BUILD.gn | 4 ++++ test/unittest/BUILD.gn | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index 13e0238b..3caa62f5 100755 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -170,6 +170,10 @@ if (defined(ohos_lite)) { "_GNU_SOURCE", "INIT_FILE", ] + if (target_cpu == "arm64") { + defines += [ "SUPPORT_64BIT" ] + } + include_dirs = [ "./include", "//third_party/bounds_checking_function/include", diff --git a/interfaces/innerkits/modulemgr/modulemgr.c b/interfaces/innerkits/modulemgr/modulemgr.c index 8697eb54..84e2cfb8 100755 --- a/interfaces/innerkits/modulemgr/modulemgr.c +++ b/interfaces/innerkits/modulemgr/modulemgr.c @@ -27,6 +27,11 @@ #include "modulemgr.h" #define MODULE_SUFFIX_D ".z.so" +#ifdef SUPPORT_64BIT +#define MODULE_LIB_NAME "lib64" +#else +#define MODULE_LIB_NAME "lib" +#endif struct tagMODULE_MGR { ListNode modules; @@ -114,7 +119,7 @@ static void *moduleInstall(MODULE_ITEM *module, int argc, const char *argv[]) if (module->moduleMgr->name[0] == '/') { snprintf_s(path, sizeof(path), sizeof(path) - 1, "%s/%s" MODULE_SUFFIX_D, module->moduleMgr->name, module->name); } else { - snprintf_s(path, sizeof(path), sizeof(path) - 1, "/system/lib/%s/%s" MODULE_SUFFIX_D, module->moduleMgr->name, module->name); + snprintf_s(path, sizeof(path), sizeof(path) - 1, "/system/" MODULE_LIB_NAME "/%s/%s" MODULE_SUFFIX_D, module->moduleMgr->name, module->name); } currentInstallArgs = &(module->moduleMgr->installArgs); @@ -236,7 +241,7 @@ MODULE_MGR *ModuleMgrScan(const char *modulePath) if (modulePath[0] == '/') { snprintf_s(path, sizeof(path), sizeof(path) - 1, "%s", modulePath); } else { - snprintf_s(path, sizeof(path), sizeof(path) - 1, "/system/lib/%s", modulePath); + snprintf_s(path, sizeof(path), sizeof(path) - 1, "/system/" MODULE_LIB_NAME "/%s", modulePath); } scanModules(moduleMgr, path); diff --git a/services/BUILD.gn b/services/BUILD.gn index 16d42030..061676d4 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -237,6 +237,10 @@ if (defined(ohos_lite)) { ] } + if (target_cpu == "arm64") { + defines += [ "SUPPORT_64BIT" ] + } + if (!enable_ramdisk) { defines += [ "DISABLE_INIT_TWO_STAGES" ] } diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index e3e7cabb..b8821193 100755 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -212,6 +212,10 @@ ohos_unittest("init_ut") { ] defines += [ "_GNU_SOURCE" ] + if (target_cpu == "arm64") { + defines += [ "SUPPORT_64BIT" ] + } + external_deps = [ "hiviewdfx_hilog_native:libhilog", "init:libinit_module_engine", -- GitLab