shared library can't be copied into OTATOOLS

441 views
Skip to first unread message

임정민

unread,
May 4, 2020, 11:49:15 AM5/4/20
to Android Building
Hi I found there are no shared library in ota packages.

I expect there are some modules and shared libraries.
but only existing were modules like lpunpack.
I hope there are shared libraries such as libbase.so.
but It's not working.

I think get-all-shared-libs-deps is related with copying shared libraries into ota_package. but It's not working
please check it for me

thanks

!!!!!!!!!!
/build/make/core/Makefile
!!!!!!!!!

-----------------------------------
INTERNAL_OTATOOLS_MODULES := \
  aapt2 \
  add_img_to_target_files \
  append2simg \
  avbtool \
  blk_alloc_to_base_fs \
  boot_signer \
  brillo_update_payload \
  brotli \
  bsdiff \
  build_image \
  build_super_image \
  build_verity_metadata \
  build_verity_tree \
  care_map_generator \
  check_ota_package_signature \
  check_target_files_signatures \
  check_target_files_vintf \
  checkvintf \
  delta_generator \
  e2fsck \
  e2fsdroid \
  fc_sort \
  fec \
  fs_config \
  generate_verity_key \
  img2simg \
  img_from_target_files \
  imgdiff \
  libconscrypt_openjdk_jni \
  lpmake \
  lpunpack \
  make_f2fs \
  merge_target_files \
  minigzip \
  mk_combined_img \
  mkbootfs \
  mkbootimg \
  mke2fs \
  mke2fs.conf \
  mkf2fsuserimg.sh \
  mksquashfs \
  mksquashfsimage.sh \
  mkuserimg_mke2fs \
  ota_from_target_files \
  sefcontext_compile \
  sgdisk \
  shflags \
  sign_apex \
  sign_target_files_apks \
  signapk \
  simg2img \
  sload_f2fs \
  tune2fs \
  unpack_bootimg \
  update_host_simulator \
  validate_target_files \
  verity_signer \
  verity_verifier \
  zipalign \

# Additional tools to unpack and repack the apex file.
INTERNAL_OTATOOLS_MODULES += \
  apexer \
  deapexer \
  debugfs_static \
  merge_zips \
  resize2fs \
  soong_zip \

ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
INTERNAL_OTATOOLS_MODULES += \
  futility \
  vboot_signer
endif

INTERNAL_OTATOOLS_FILES := \
  $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES)))

.PHONY: otatools
otatools: $(INTERNAL_OTATOOLS_FILES)

# For each module, recursively resolve its host shared library dependencies. Then we have a full
# list of modules whose installed files need to be packed.

INTERNAL_OTATOOLS_MODULES_WITH_DEPS := \
  $(sort $(INTERNAL_OTATOOLS_MODULES) \
      $(foreach m,$(INTERNAL_OTATOOLS_MODULES),$(call get-all-shared-libs-deps,$(m))))

INTERNAL_OTATOOLS_PACKAGE_FILES := \
  $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES_WITH_DEPS)))

INTERNAL_OTATOOLS_PACKAGE_FILES += \
  $(sort $(shell find build/make/target/product/security -type f -name "*.x509.pem" -o \
      -name "*.pk8" -o -name verity_key))

ifneq (,$(wildcard device))
INTERNAL_OTATOOLS_PACKAGE_FILES += \
  $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
      -name "*.pem" -o -name "oem*.prop" -o -name "*.avbpubkey"))
endif
ifneq (,$(wildcard external/avb))
INTERNAL_OTATOOLS_PACKAGE_FILES += \
  $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
      -name "atx_metadata.bin"))
endif
ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
INTERNAL_OTATOOLS_PACKAGE_FILES += \
  $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
endif

INTERNAL_OTATOOLS_RELEASETOOLS := \
  $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o \
      \( -type f -o -type l \) -print))

BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
$(BUILT_OTATOOLS_PACKAGE): PRIVATE_ZIP_ROOT := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_PACKAGE_FILES := $(INTERNAL_OTATOOLS_PACKAGE_FILES)
$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_RELEASETOOLS := $(INTERNAL_OTATOOLS_RELEASETOOLS)
$(BUILT_OTATOOLS_PACKAGE): $(INTERNAL_OTATOOLS_PACKAGE_FILES) $(INTERNAL_OTATOOLS_RELEASETOOLS)
$(BUILT_OTATOOLS_PACKAGE): $(SOONG_ZIP) $(ZIP2ZIP)
@echo "Package OTA tools: $@"
rm -rf $@ $(PRIVATE_ZIP_ROOT)
mkdir -p $(dir $@)
$(call copy-files-with-structure,$(PRIVATE_OTATOOLS_PACKAGE_FILES),$(HOST_OUT)/,$(PRIVATE_ZIP_ROOT))
$(call copy-files-with-structure,$(PRIVATE_OTATOOLS_RELEASETOOLS),build/make/tools/,$(PRIVATE_ZIP_ROOT))
cp $(SOONG_ZIP) $(ZIP2ZIP) $(MERGE_ZIPS) $(PRIVATE_ZIP_ROOT)/bin/
$(SOONG_ZIP) -o $@ -C $(PRIVATE_ZIP_ROOT) -D $(PRIVATE_ZIP_ROOT)

.PHONY: otatools-package
otatools-package: $(BUILT_OTATOOLS_PACKAGE)
-----------------------------------

Dan Willemsen

unread,
May 4, 2020, 1:21:09 PM5/4/20
to Android Building
What version of AOSP are you using? The current aosp/master builds of otatools.zip definitely have lib64/libbase.so: https://ci.android.com/builds/submitted/6459548/aosp_cf_x86_phone-userdebug/latest

And printing out INTERNAL_OTATOOLS_MODULES_WITH_DEPS, it's getting libbase added from get-all-shared-libs-deps.

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/bbec4cba-a5ca-4cc4-9dd4-37d0bc4c83b9%40googlegroups.com.

임정민

unread,
May 6, 2020, 7:27:47 PM5/6/20
to Android Building
I'm checking R OS 
And I made something wrong the question.
I need OTATOOLS have shared library
until Q OS there is lines like
------------------------------------------
2504# Shared libraries.
2505OTATOOLS += \
2506 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
2507 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
------------------------------------------

but It's removed at R OS how could I insert shared library into OTA/tools

2020년 5월 5일 화요일 오전 12시 49분 15초 UTC+9, 임정민 님의 말:

Dan Willemsen

unread,
May 6, 2020, 7:32:34 PM5/6/20
to Android Building
Just adding "libc++" (etc) to that list would trigger the shared library to be installed, but in general (just like PRODUCT_PACKAGES), you shouldn't need to refer to shared libraries because they should be included as a byproduct of being used by one of the binaries in that list (unless they're used via `dlopen`).

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.

임정민

unread,
May 6, 2020, 7:58:17 PM5/6/20
to Android Building
Thanks for quick response.
Why I'm doing this. We use lpunpack including OTA/tools.
but when I'm running lpunpack there is error cause there are no shared library like libc++

You mean I should check all of this and added it into OTA/tools one by one?


2020년 5월 5일 화요일 오전 12시 49분 15초 UTC+9, 임정민 님의 말:
Hi I found there are no shared library in ota packages.

Dan Willemsen

unread,
May 6, 2020, 8:07:41 PM5/6/20
to Android Building
No, libc++.so is already included in the otatools zip file that I linked earlier (missing that file would cause issues in our infrastructure using otatools as well). I've confirmed it's there in our internal R trees as well. If it's not showing up in your builds, are you sure you don't have a local change to the build system causing this problem?

$ zipinfo otatools.zip | less
Archive:  otatools.zip
Zip file size: 361711518 bytes, number of entries: 257
-rwx------  2.0 unx 68541840 bl defN 08-Jan-01 00:00 bin/aapt2
-rwx------  2.0 unx 31833568 bl defN 08-Jan-01 00:00 bin/add_img_to_target_files
...
-rwx------  2.0 unx   558272 bl defN 08-Jan-01 00:00 bin/lpmake
-rwx------  2.0 unx   519040 bl defN 08-Jan-01 00:00 bin/lpunpack
...
-rw----     2.0 fat  1720976 bl defN 08-Jan-01 00:00 framework/boot_signer.jar
-rw----     2.0 fat  2715758 bl defN 08-Jan-01 00:00 framework/signapk.jar
-rw----     2.0 fat  1716209 bl defN 08-Jan-01 00:00 framework/verity_signer.jar
-rwx------  2.0 unx  4114648 bl defN 08-Jan-01 00:00 lib64/libbase.so
-rwx------  2.0 unx  1501888 bl defN 08-Jan-01 00:00 lib64/libbrillo-stream.so
-rwx------  2.0 unx  2690344 bl defN 08-Jan-01 00:00 lib64/libbrillo.so
-rwx------  2.0 unx  6454680 bl defN 08-Jan-01 00:00 lib64/libc++.so
-rwx------  2.0 unx 20883064 bl defN 08-Jan-01 00:00 lib64/libchrome.so
-rwx------  2.0 unx 13054768 bl defN 08-Jan-01 00:00 lib64/libconscrypt_openjdk_jni.so
-rwx------  2.0 unx  6968648 bl defN 08-Jan-01 00:00 lib64/libcrypto-host.so
-rwx------  2.0 unx    16736 bl defN 08-Jan-01 00:00 lib64/libcrypto_utils.so
-rwx------  2.0 unx   199776 bl defN 08-Jan-01 00:00 lib64/libcutils.so
...

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.

임정민

unread,
May 7, 2020, 3:41:20 AM5/7/20
to Android Building
I haven't been checking otatools.zip yet
but I'm pretty sure otatools.zip has lib already
What I want is shared library should be located in OTA/tools
When I checked the code, copy files only $(INTERNAL_OTATOOLS_FILES)
with this script "$(hide) cp $(INTERNAL_OTATOOLS_FILES) $(zip_root)/OTA/tools/"
before R, shared library located in OTA/tools/ cause INTERNAL_OTATOOLS_FILES has shared library also.
but in R, INTERNAL_OTATOOLS_FILES doesn't have shared library
4872 $(hide) cp $(INTERNAL_OTATOOLS_FILES) $(zip_root)/OTA/tools/


2020년 5월 5일 화요일 오전 12시 49분 15초 UTC+9, 임정민 님의 말:
Hi I found there are no shared library in ota packages.

Dan Willemsen

unread,
May 7, 2020, 4:08:08 AM5/7/20
to Android Building
Ah, yes, the (internal, unstable) INTERNAL_OTATOOLS_FILES variable has changed meaning. Your local change to copy the files into OTA/tools wouldn't be able to use that variable anymore.

I think you'd need the contents of INTERNAL_OTATOOLS_PACKAGE_FILES before the rest of the keys/etc get added to it, so maybe save it away in your own variable directly after this line:

INTERNAL_OTATOOLS_PACKAGE_FILES := \
$(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES_WITH_DEPS)))

- Dan

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.

임정민

unread,
May 7, 2020, 8:04:01 PM5/7/20
to Android Building
Thx that's what I wanted.
And I tried this but It returns build failed like below
----------------------------------------------
[ 99% 161945/161958] Packaging Proguard obfuscation dictionary files.
[ 99% 161946/161958] Dist: out/dist/x-proguard-dict-ver.zip
[ 99% 161947/161958] Package target files: out/target/product/x/obj/PACKAGING/target_files_intermediates/x-target_files-ver.zip
FAILED: out/target/product/x/obj/PACKAGING/target_files_intermediates/x-target_files-ver.zip
cp: out/target/product/x/obj/PACKAGING/target_files_intermediates/x-target_files-ver/OTA/tools//boot_signer: Permission denied
cp: out/target/product/x/obj/PACKAGING/target_files_intermediates/x-target_files-ver/OTA/tools//brillo_update_payload: Permission denied
cp: out/target/product/x/obj/PACKAGING/target_files_intermediates/x-target_files-ver/OTA/tools//mke2fs.conf: Permission denied
----------------------------------------------

I think some of the files doesn't have permission about copy.
do you have any idea?
What I modified was
  from $(hide) cp $(INTERNAL_OTATOOLS_FILES) $(zip_root)/OTA/tools/
  to           $(hide) cp $(INTERNAL_OTATOOLS_FILES) $(INTERNAL_OTATOOLS_PACKAGE_FILES) $(zip_root)/OTA/tools/
So above errors happen.
So I'm trying to changed it
  to           $(hide) cp $(INTERNAL_OTATOOLS_FILES) $(INTERNAL_OTATOOLS_PACKAGE_FILES) $(zip_root)/OTA/tools/ || true

But I'm not sure It's right way or not. 
As of now It works cause which files what I want were copied. but if those files will be blocked later about copy operation.
Is there anyway to detour cp permission error like change permissions?



2020년 5월 7일 목요일 오후 5시 8분 8초 UTC+9, Dan Willemsen 님의 말:
Ah, yes, the (internal, unstable) INTERNAL_OTATOOLS_FILES variable has changed meaning. Your local change to copy the files into OTA/tools wouldn't be able to use that variable anymore.

I think you'd need the contents of INTERNAL_OTATOOLS_PACKAGE_FILES before the rest of the keys/etc get added to it, so maybe save it away in your own variable directly after this line:

INTERNAL_OTATOOLS_PACKAGE_FILES := \
$(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES_WITH_DEPS)))

- Dan


For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-...@googlegroups.com.

mohmod godo

unread,
May 15, 2020, 12:27:34 PM5/15/20
to android-...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages