From 91bd7a7ff1ce09eb7e70f87a493a7029b65d494b Mon Sep 17 00:00:00 2001 From: bigbiff Date: Sun, 3 Jan 2021 17:33:01 -0500 Subject: [PATCH] adb: get adb working and cleanup pixelflinger - update recovery init.rc - add libdl bootstrap - cleanup libpixelflinger import - logd and adbd permissive for now --- Android.bp | 11 ++ Android.mk | 9 +- etc/init.rc | 9 +- etc/init.recovery.logd.rc | 2 +- etc/init.recovery.service22.rc | 3 - gui/Android.bp | 164 +++++++++++------------ libpixelflinger/Android.bp | 229 ++++++++++++++++++--------------- prebuilt/Android.mk | 3 +- sepolicy/twrp.te | 2 + 9 files changed, 232 insertions(+), 200 deletions(-) diff --git a/Android.bp b/Android.bp index 250ef9d0..a31ec867 100755 --- a/Android.bp +++ b/Android.bp @@ -85,6 +85,17 @@ cc_library_shared { "libhidl-gen-utils", "librecovery_utils", "libc++fs" + ], + required: [ + "init_recovery.rc", + "libdl_android.bootstrap", ] } +prebuilt_etc { + name: "init_recovery.rc", + filename: "init.rc", + src: "etc/init.rc", + sub_dir: "init/hw", + recovery: true, +} diff --git a/Android.mk b/Android.mk index f81d023d..6fff19bf 100755 --- a/Android.mk +++ b/Android.mk @@ -109,7 +109,6 @@ LOCAL_C_INCLUDES += \ system/core/adb \ system/core/libsparse \ external/zlib \ - system/core/libpixelflinger/include \ system/core/libziparchive/include \ external/freetype/include \ external/boringssl/include \ @@ -121,12 +120,13 @@ LOCAL_C_INCLUDES += \ $(LOCAL_PATH)/fuse_sideload/include \ $(LOCAL_PATH)/install/include \ $(LOCAL_PATH)/twrpinstall/include \ - $(LOCAL_PATH)/recovery_utils/include + $(LOCAL_PATH)/recovery_utils/include \ + $(LOCAL_PATH)/libpixelflinger/include LOCAL_STATIC_LIBRARIES += libguitwrp LOCAL_SHARED_LIBRARIES += libz libc libcutils libstdc++ libtar libblkid libminuitwrp libmtdutils libtwadbbu LOCAL_SHARED_LIBRARIES += libbootloader_message libcrecovery libtwrpdigest libc++ libaosprecovery libcrypto libbase -LOCAL_SHARED_LIBRARIES += libziparchive libselinux +LOCAL_SHARED_LIBRARIES += libziparchive libselinux libdl_android.bootstrap ifneq ($(wildcard system/core/libsparse/Android.mk),) LOCAL_SHARED_LIBRARIES += libsparse @@ -402,7 +402,8 @@ TWRP_REQUIRED_MODULES += \ plat_hwservice_contexts \ vendor_hwservice_contexts \ minadbd \ - twrpbu + twrpbu \ + adbd_system_api_recovery ifneq ($(TW_INCLUDE_CRYPTO),) TWRP_REQUIRED_MODULES += \ diff --git a/etc/init.rc b/etc/init.rc index e63c74c6..ae184527 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -19,6 +19,8 @@ on early-init start ueventd + setprop sys.usb.configfs 0 + on init export PATH /sbin:/system/bin export LD_LIBRARY_PATH /system/lib64 @@ -73,9 +75,6 @@ on late-init trigger early-boot trigger boot -on property:sys.powerctl=* - powerctl ${sys.powerctl} - service ueventd /system/bin/ueventd critical seclabel u:r:ueventd:s0 @@ -91,6 +90,10 @@ on property:ro.debuggable=1 #start adbd setprop service.adb.root 1 +# Always start adbd on userdebug and eng builds +on fs && property:ro.debuggable=1 + setprop sys.usb.config adb + service fastbootd /system/bin/fastbootd disabled group system diff --git a/etc/init.recovery.logd.rc b/etc/init.recovery.logd.rc index 29db6be8..ed413911 100644 --- a/etc/init.recovery.logd.rc +++ b/etc/init.recovery.logd.rc @@ -1,4 +1,4 @@ -on late-init +on init start logd service logd /system/bin/logd diff --git a/etc/init.recovery.service22.rc b/etc/init.recovery.service22.rc index 410efff9..7ba997a7 100755 --- a/etc/init.recovery.service22.rc +++ b/etc/init.recovery.service22.rc @@ -4,6 +4,3 @@ on boot service recovery /system/bin/recovery socket recovery stream 422 system system seclabel u:r:recovery:s0 - -on early-init - write /sys/fs/selinux/enforce 0 diff --git a/gui/Android.bp b/gui/Android.bp index 94d429bc..aa2bbc41 100644 --- a/gui/Android.bp +++ b/gui/Android.bp @@ -1,83 +1,83 @@ -bootstrap_go_package { - name: "soong-libguitwrp_defaults", - pkgPath: "bootable/recovery/gui", - deps: [ - "soong", - "soong-android", - "soong-cc" - ], - srcs: [ - "libguitwrp_defaults.go" - ], - pluginFor: ["soong_build"] -} - -libguitwrp_defaults { - name: "libguitwrp_defaults" -} - -cc_library_static { - name: "libguitwrp", - defaults: ["libguitwrp_defaults"], - cflags: [ - "-fno-strict-aliasing", - "-Wno-implicit-fallthrough", - "-D_USE_SYSTEM_ZIPARCHIVE" - ], - include_dirs: [ - "bootable/recovery/crypto/scrypt/lib/util", - "bootable/recovery/otautil/include", - "bootable/recovery/install/include", - "system/core/libziparchive/include", - "bootable/recovery/recovery_ui/include", - "bootable/recovery/fuse_sideload/include", - "bootable/recovery/twrpinstall", - "bootable/recovery/twrpinstall/include", - "bionic", - "system/core/base/include", - "system/core/include", - "system/core/libpixelflinger/include", - "external/freetype/include" - - ], - srcs: [ - "gui.cpp", - "resources.cpp", - "pages.cpp", - "text.cpp", - "image.cpp", - "action.cpp", - "console.cpp", - "fill.cpp", - "button.cpp", - "checkbox.cpp", - "fileselector.cpp", - "progressbar.cpp", - "animation.cpp", - "object.cpp", - "slider.cpp", - "slidervalue.cpp", - "listbox.cpp", - "keyboard.cpp", - "input.cpp", - "blanktimer.cpp", - "partitionlist.cpp", - "mousecursor.cpp", - "scrolllist.cpp", - "patternpassword.cpp", - "textbox.cpp", - "terminal.cpp", - "twmsg.cpp" - ], - shared_libs: [ - "libminuitwrp", - "libc", - "libstdc++", - "libaosprecovery", - "libselinux", - "libziparchive" - ], - static_libs: [ - "libotautil" - ] +bootstrap_go_package { + name: "soong-libguitwrp_defaults", + pkgPath: "bootable/recovery/gui", + deps: [ + "soong", + "soong-android", + "soong-cc" + ], + srcs: [ + "libguitwrp_defaults.go" + ], + pluginFor: ["soong_build"] +} + +libguitwrp_defaults { + name: "libguitwrp_defaults" +} + +cc_library_static { + name: "libguitwrp", + defaults: ["libguitwrp_defaults"], + cflags: [ + "-fno-strict-aliasing", + "-Wno-implicit-fallthrough", + "-D_USE_SYSTEM_ZIPARCHIVE" + ], + include_dirs: [ + "bootable/recovery/crypto/scrypt/lib/util", + "bootable/recovery/otautil/include", + "bootable/recovery/install/include", + "system/core/libziparchive/include", + "bootable/recovery/recovery_ui/include", + "bootable/recovery/fuse_sideload/include", + "bootable/recovery/twrpinstall", + "bootable/recovery/twrpinstall/include", + "bootable/recovery/libpixelflinger/include", + "bionic", + "system/core/base/include", + "system/core/include", + "external/freetype/include" + + ], + srcs: [ + "gui.cpp", + "resources.cpp", + "pages.cpp", + "text.cpp", + "image.cpp", + "action.cpp", + "console.cpp", + "fill.cpp", + "button.cpp", + "checkbox.cpp", + "fileselector.cpp", + "progressbar.cpp", + "animation.cpp", + "object.cpp", + "slider.cpp", + "slidervalue.cpp", + "listbox.cpp", + "keyboard.cpp", + "input.cpp", + "blanktimer.cpp", + "partitionlist.cpp", + "mousecursor.cpp", + "scrolllist.cpp", + "patternpassword.cpp", + "textbox.cpp", + "terminal.cpp", + "twmsg.cpp" + ], + shared_libs: [ + "libminuitwrp", + "libc", + "libstdc++", + "libaosprecovery", + "libselinux", + "libziparchive" + ], + static_libs: [ + "libotautil" + ] } \ No newline at end of file diff --git a/libpixelflinger/Android.bp b/libpixelflinger/Android.bp index 57213941..8a4489c3 100644 --- a/libpixelflinger/Android.bp +++ b/libpixelflinger/Android.bp @@ -1,105 +1,124 @@ -//bootstrap_go_package { -// name: "soong-libpixelflingertwrp_defaults", -// pkgPath: "bootable/recovery/libpixelflinger", -// deps: [ -// "soong", -// "soong-android", -// "soong-cc" -// ], -// srcs: [ -// "libpixelflingertwrp_defaults.go" -// ], -// pluginFor: ["soong_build"] -//} - -//libpixelflingertwrp_defaults { -// name: "libpixelflingertwrp_defaults" -//} - -cc_defaults { - name: "libpixelflingertwrp_defaults", - - cflags: [ - "-fstrict-aliasing", - "-fomit-frame-pointer", - "-Wall", - "-Werror", - "-Wno-unused-function", - ], - export_include_dirs: ["include"], - header_libs: ["libbase_headers"], - shared_libs: [ - "libcutils", - "liblog", - "libutils", - ], - - arch: { - arm: { - neon: { - cflags: ["-D__ARM_HAVE_NEON"], - }, - }, - }, -} - -cc_library_static { - name: "libpixelflinger_twrp", - defaults: ["libpixelflingertwrp_defaults"], - - srcs: [ - "codeflinger/ARMAssemblerInterface.cpp", - "codeflinger/ARMAssemblerProxy.cpp", - "codeflinger/CodeCache.cpp", - "codeflinger/GGLAssembler.cpp", - "codeflinger/load_store.cpp", - "codeflinger/blending.cpp", - "codeflinger/texturing.cpp", - "format.cpp", - "clear.cpp", - "raster.cpp", - "buffer.cpp", - ], - whole_static_libs: ["libpixelflinger-arm"], - - arch: { - arm: { - srcs: [ - "codeflinger/ARMAssembler.cpp", - "codeflinger/disassem.c", - "col32cb16blend.S", - "t32cb16blend.S", - ], - - neon: { - srcs: ["col32cb16blend_neon.S"], - }, - }, - arm64: { - srcs: [ - "codeflinger/Arm64Assembler.cpp", - "codeflinger/Arm64Disassembler.cpp", - "arch-arm64/col32cb16blend.S", - "arch-arm64/t32cb16blend.S", - ], - }, - mips: { - mips32r6: { - srcs: [ - "codeflinger/MIPSAssembler.cpp", - "codeflinger/mips_disassem.c", - "arch-mips/t32cb16blend.S", - ], - }, - }, - mips64: { - srcs: [ - "codeflinger/MIPSAssembler.cpp", - "codeflinger/MIPS64Assembler.cpp", - "codeflinger/mips64_disassem.c", - "arch-mips64/col32cb16blend.S", - "arch-mips64/t32cb16blend.S", - ], - }, - }, -} +//bootstrap_go_package { +// name: "soong-libpixelflingertwrp_defaults", +// pkgPath: "bootable/recovery/libpixelflinger", +// deps: [ +// "soong", +// "soong-android", +// "soong-cc" +// ], +// srcs: [ +// "libpixelflingertwrp_defaults.go" +// ], +// pluginFor: ["soong_build"] +//} + +//libpixelflingertwrp_defaults { +// name: "libpixelflingertwrp_defaults" +//} + +cc_defaults { + name: "libpixelflingertwrp_defaults", + + cflags: [ + "-fstrict-aliasing", + "-fomit-frame-pointer", + "-Wall", + "-Werror", + "-Wno-unused-function", + ], + export_include_dirs: ["include"], + header_libs: ["libbase_headers"], + shared_libs: [ + "libcutils", + "liblog", + "libutils", + ], + + arch: { + arm: { + neon: { + cflags: ["-D__ARM_HAVE_NEON"], + }, + }, + }, +} + +cc_library_static { + name: "libpixelflingertwrp-arm", + defaults: ["libpixelflingertwrp_defaults"], + + srcs: [ + "fixed.cpp", + "picker.cpp", + "pixelflinger.cpp", + "trap.cpp", + "scanline.cpp", + ], + + arch: { + arm: { + instruction_set: "arm", + }, + }, +} + +cc_library_static { + name: "libpixelflinger_twrp", + defaults: ["libpixelflingertwrp_defaults"], + + srcs: [ + "codeflinger/ARMAssemblerInterface.cpp", + "codeflinger/ARMAssemblerProxy.cpp", + "codeflinger/CodeCache.cpp", + "codeflinger/GGLAssembler.cpp", + "codeflinger/load_store.cpp", + "codeflinger/blending.cpp", + "codeflinger/texturing.cpp", + "format.cpp", + "clear.cpp", + "raster.cpp", + "buffer.cpp", + ], + whole_static_libs: ["libpixelflingertwrp-arm"], + + arch: { + arm: { + srcs: [ + "codeflinger/ARMAssembler.cpp", + "codeflinger/disassem.c", + "col32cb16blend.S", + "t32cb16blend.S", + ], + + neon: { + srcs: ["col32cb16blend_neon.S"], + }, + }, + arm64: { + srcs: [ + "codeflinger/Arm64Assembler.cpp", + "codeflinger/Arm64Disassembler.cpp", + "arch-arm64/col32cb16blend.S", + "arch-arm64/t32cb16blend.S", + ], + }, + mips: { + mips32r6: { + srcs: [ + "codeflinger/MIPSAssembler.cpp", + "codeflinger/mips_disassem.c", + "arch-mips/t32cb16blend.S", + ], + }, + }, + mips64: { + srcs: [ + "codeflinger/MIPSAssembler.cpp", + "codeflinger/MIPS64Assembler.cpp", + "codeflinger/mips64_disassem.c", + "arch-mips64/col32cb16blend.S", + "arch-mips64/t32cb16blend.S", + ], + }, + }, +} diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk index 2928dfdd..c2c24bf2 100755 --- a/prebuilt/Android.mk +++ b/prebuilt/Android.mk @@ -36,7 +36,6 @@ ifneq ($(wildcard external/one-true-awk/Android.bp),) RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/awk endif -RECOVERY_BINARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/adbd RECOVERY_BINARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/bin/fastbootd RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/e2fsck RECOVERY_BINARY_SOURCE_FILES += $(TARGET_OUT_EXECUTABLES)/e2fsdroid @@ -69,7 +68,7 @@ RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libasy RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libbinderthreadstate.so RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_RECOVERY_ROOT_OUT)/system/lib64/libmdnssd.so RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libinit.so -RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libdl_android.so +RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/bootstrap/libdl_android.so RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-lite.so RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libbinder.so RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libchrome.so diff --git a/sepolicy/twrp.te b/sepolicy/twrp.te index 44ceaf89..c27571ad 100755 --- a/sepolicy/twrp.te +++ b/sepolicy/twrp.te @@ -1,4 +1,6 @@ recovery_only(` permissive recovery; permissive init; + permissive logd; + permissive adbd; ')