Files
oxmc af29205167 recovery: unblock Soong analysis on android-16
The recovery_toolkit/recovery_ui merge broke ninja generation for the
whole tree (everything runs at analysis time, even for modules nothing
builds). Fixes, in the order the errors surfaced:

- BoardConfigSoong.mk: export TW_THEME=landscape_hdpi via the
  twrpVarsPlugin soong config namespace (RPi 4/5 are 1080p HDMI);
  libguitwrp's theme selection hard-exits analysis when unset
- soong/copy.go: re-anchor runtime.Caller path derivation — the
  'bootable' anchor never matches at vendor/pawlet/recovery_ui and the
  slice paniced; recovery dir is now derived relative to this file
- scrypt sources.bp + libpixelflinger: hoist arch.arm.neon.* contents
  into plain arm blocks — the neon variant was removed in android-16
  Soong (NEON is mandatory on armv7-a+)
- recovery_ui/Android.bp: port twrp_defaults verbatim from
  android_vendor_twrp (android-14.1, build/soong) — it never lived in
  bootable/recovery; pure soong_config machinery, contributes no flags
  until twrpGlobalVars vars are set
- gui/Android.bp: drop libaosprecovery from libguitwrp's shared_libs —
  the module doesn't exist (TWRP's forked install/*.cpp was never
  ported) and an undefined dep is analysis-fatal; compile is unaffected
  (static lib), the gap moves to link time and is documented
- recovery_ui/Android.bp: librecovery_ui_pawlet_twrp shared -> static
  (librecovery_ui_ext absorbs TARGET_RECOVERY_UI_LIB via
  whole_static_libs) and libpixelflinger_twrp moved to static_libs
- scrypt Android.bp + libminuitwrp_defaults.go: rewrite leftover
  bootable/recovery/* self-referential paths to the new
  vendor/pawlet locations

Requires the libminadbd_headers visibility patch in the patches repo.
m nothing now completes for pawlet_rpi4-bp4a-userdebug.
2026-07-15 02:35:09 -07:00

254 lines
8.2 KiB
Plaintext

// Copyright (C) 2026 oxmc / PawletOS
// SPDX-License-Identifier: Apache-2.0
//
// This is the module TARGET_RECOVERY_UI_LIB (set in BoardConfig.mk) should
// point at. Stock bootable/recovery's librecovery_ui_ext wraps whatever
// TARGET_RECOVERY_UI_LIB names via whole_static_libs — see
// bootable/recovery/Android.bp's librecovery_ui_ext definition (unmodified,
// still stock). recovery_main.cpp dlopen()s librecovery_ui_ext.so and
// dlsym()s make_device() out of it at runtime; nothing here requires
// forking bootable/recovery itself.
//
// KNOWN GAP: upstream libguitwrp links libaosprecovery — TWRP's
// repackaging of its FORKED bootable/recovery install/*.cpp (adb_install,
// install, wipe_data, ...), built via the libaosprecovery_defaults.go Go
// plugin. Those forked sources were never ported (this port keeps
// bootable/recovery stock), so the dep was dropped from gui/Android.bp to
// keep Soong analysis green (an undefined module reference fails the whole
// tree). Compiling is unaffected; linking THIS module will fail with
// undefined symbols (apply_from_adb & co.) until the forked install code
// is ported into recovery_toolkit. See NOTES-ota-recovery-ab.md.
//
// NOT BUILD-TESTED. pawlet_recovery_ui.cpp/.h and make_device.cpp are new
// code written against stock RecoveryUI/ScreenRecoveryUI's documented
// virtual-method contract (verified by reading recovery_ui/include headers),
// not copied from any reference device tree — TWRP's own bootable/recovery
// fork never ships one, confirmed. Expect iteration once this actually
// compiles.
package {
default_applicable_licenses: ["vendor_pawlet_recovery_ui_license"],
}
// gui/, minuitwrp/, and libpixelflinger/ underneath are TWRP's own GPL-3.0
// source (see gui/gui.h's header), separate from the Apache-2.0 glue code
// in device/. Two license modules, applied per-subtree.
license {
name: "vendor_pawlet_recovery_ui_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-Apache-2.0",
],
}
// twrp_defaults — ported verbatim from TWRP's vendor tree
// (android_vendor_twrp android-14.1, build/soong/Android.bp), which is where
// gui/ and minuitwrp/ get it from upstream; it never lived in
// bootable/recovery. Pure soong_config machinery, no Go plugin. Maps
// optional TW_* device config vars (twrpGlobalVars namespace) to cflags;
// with no vars exported it contributes nothing, which is currently the case
// for the RPi targets. Set vars from make with e.g.:
// $(call add_soong_config_namespace,twrpGlobalVars)
// $(call soong_config_set,twrpGlobalVars,tw_brightness_path,/sys/...)
soong_config_module_type {
name: "twrp",
module_type: "cc_defaults",
config_namespace: "twrpGlobalVars",
value_variables: [
"tw_delay_touch_init_ms",
"tw_ozip_decrypt_key",
"tw_x_offset",
"tw_y_offset",
"tw_w_offset",
"tw_h_offset",
"tw_framerate",
"target_recovery_overscan_percent",
"tw_input_blacklist",
"tw_support_input_aidl_haptics_fqname",
"tw_brightness_path",
"tw_max_brightness",
],
bool_variables: [
"tw_event_logging",
"tw_no_screen_blank",
"tw_no_screen_timeout",
"tw_oem_build",
"tw_round_screen",
"tw_support_input_1_2_haptics",
"tw_target_uses_qcom_bsp",
"tw_include_jpeg",
"recovery_touchscreen_swap_xy",
"recovery_touchscreen_flip_x",
"recovery_touchscreen_flip_y",
"recovery_graphics_force_use_linelength",
"recovery_graphics_force_single_buffer",
"twrp_event_logging",
"tw_screen_blank_on_boot",
"tw_fbiopan",
"tw_ignore_major_axis_0",
"tw_ignore_mt_position_0",
"tw_haptics_tspdrv",
"tw_exclude_nano",
"tw_support_input_aidl_haptics",
"tw_support_input_aidl_haptics_fix_off",
"tw_use_samsung_haptics",
],
properties: ["cflags"],
}
twrp {
name: "twrp_defaults",
soong_config_variables: {
tw_delay_touch_init_ms: {
cflags: ["-DTW_DELAY_TOUCH_INIT_MS=%s"],
},
tw_event_logging: {
cflags: ["-D_EVENT_LOGGING"],
},
tw_ozip_decrypt_key: {
cflags: ["-DTW_OZIP_DECRYPT_KEY=\"%s\""],
},
tw_no_screen_blank: {
cflags: ["-DTW_NO_SCREEN_BLANK"],
},
tw_no_screen_timeout: {
cflags: ["-DTW_NO_SCREEN_TIMEOUT"],
},
tw_oem_build: {
cflags: ["-DTW_OEM_BUILD"],
},
tw_x_offset: {
cflags: ["-DTW_X_OFFSET=%s"],
},
tw_y_offset: {
cflags: ["-DTW_Y_OFFSET=%s"],
},
tw_w_offset: {
cflags: ["-DTW_W_OFFSET=%s"],
},
tw_h_offset: {
cflags: ["-DTW_H_OFFSET=%s"],
},
tw_framerate: {
cflags: ["-DTW_FRAMERATE=%s"],
},
tw_round_screen: {
cflags: ["-DTW_ROUND_SCREEN"],
},
tw_support_input_1_2_haptics: {
cflags: ["-DUSE_QTI_HAPTICS"],
},
tw_target_uses_qcom_bsp: {
cflags: ["-DMSM_BSP"],
},
tw_include_jpeg: {
cflags: ["-DTW_INCLUDE_JPEG"],
},
recovery_touchscreen_swap_xy: {
cflags: ["-DRECOVERY_TOUCHSCREEN_SWAP_XY"],
},
recovery_touchscreen_flip_x: {
cflags: ["-DRECOVERY_TOUCHSCREEN_FLIP_X"],
},
recovery_touchscreen_flip_y: {
cflags: ["-DRECOVERY_TOUCHSCREEN_FLIP_Y"],
},
recovery_graphics_force_use_linelength: {
cflags: ["-DRECOVERY_GRAPHICS_FORCE_USE_LINELENGTH"],
},
recovery_graphics_force_single_buffer: {
cflags: ["-DRECOVERY_GRAPHICS_FORCE_SINGLE_BUFFER"],
},
twrp_event_logging: {
cflags: ["-DTWRP_EVENT_LOGGING"],
},
target_recovery_overscan_percent: {
cflags: ["-DOVERSCAN_PERCENT=%s"],
},
tw_screen_blank_on_boot: {
cflags: ["-DTW_SCREEN_BLANK_ON_BOOT"],
},
tw_fbiopan: {
cflags: ["-DTW_FBIOPAN"],
},
tw_ignore_major_axis_0: {
cflags: ["-DTW_IGNORE_MAJOR_AXIS_0"],
},
tw_ignore_mt_position_0: {
cflags: ["-DTW_IGNORE_MT_POSITION_0"],
},
tw_input_blacklist: {
cflags: ["-DTW_INPUT_BLACKLIST=\"%s\""],
},
tw_haptics_tspdrv: {
cflags: ["-DTW_HAPTICS_TSPDRV"],
},
tw_exclude_nano: {
cflags: ["-DTW_EXCLUDE_NANO"],
},
tw_support_input_aidl_haptics: {
cflags: ["-DUSE_QTI_AIDL_HAPTICS"],
},
tw_support_input_aidl_haptics_fqname: {
cflags: ["-DUSE_QTI_AIDL_HAPTICS_FQNAME=\"%s\""],
},
tw_support_input_aidl_haptics_fix_off: {
cflags: ["-DUSE_QTI_AIDL_HAPTICS_FIX_OFF"],
},
tw_use_samsung_haptics: {
cflags: ["-DUSE_SAMSUNG_HAPTICS"],
},
tw_brightness_path: {
cflags: ["-DTW_BRIGHTNESS_PATH=\"%s\""],
},
tw_max_brightness: {
cflags: ["-DTW_MAX_BRIGHTNESS=%s"],
},
},
}
// Static, not shared: stock librecovery_ui_ext absorbs TARGET_RECOVERY_UI_LIB
// via whole_static_libs (bootable/recovery/Android.bp), so this module must
// provide a static variant or the whole-tree analysis fails.
cc_library_static {
name: "librecovery_ui_pawlet_twrp",
recovery: true,
srcs: [
"device/make_device.cpp",
"device/pawlet_recovery_ui.cpp",
"data.cpp",
],
local_include_dirs: [
"device",
".",
],
include_dirs: [
"bootable/recovery/recovery_ui/include",
"bootable/recovery/otautil/include",
"vendor/pawlet/recovery_ui/gui/include",
],
static_libs: [
"librecovery_ui",
"libguitwrp",
"libotautil",
// static library — must not sit in shared_libs (no shared variant)
"libpixelflinger_twrp",
],
shared_libs: [
"libminuitwrp",
"libbase",
"liblog",
],
cflags: [
"-Wall",
"-Wno-unused-parameter",
],
}