Skip to content

Commit

Permalink
sunfish: Set up proprietary files extraction & build vendor image
Browse files Browse the repository at this point in the history
* Blobs that can be built from source code are built from source, except
  librmnetctl.
* The proprietary files lists are generated by comparing stock partition
  contents with AOSP generated partitions.
* Various lib and folder symlinks need to be created.

Co-authored-by: Bruno Martins <[email protected]>
Co-authored-by: Chirayu Desai <[email protected]>
Co-authored-by: Christopher N. Hesse <[email protected]>
Co-authored-by: Dan Pasanen <[email protected]>
Co-authored-by: Eamon Powell <[email protected]>
Co-authored-by: Josh Chasky <[email protected]>
Co-authored-by: "Josh Fox (XlxFoXxlX)" <[email protected]>
Co-authored-by: Michael Bestas <[email protected]>
Co-authored-by: Nolen Johnson <[email protected]>
Co-authored-by: Rashed Abdel-Tawab <[email protected]>
Co-authored-by: razorloves <[email protected]>
Change-Id: I17f79b417a8f0d022bec9c6b5f37d03b842d43e1
  • Loading branch information
12 people committed Sep 6, 2022
1 parent e8768e2 commit 59ec265
Show file tree
Hide file tree
Showing 11 changed files with 3,707 additions and 4 deletions.
96 changes: 96 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,100 @@ $(eval $(call declare-1p-copy-files,device/google/sunfish,audio_policy_configura
ifeq ($(USES_DEVICE_GOOGLE_SUNFISH),true)
subdir_makefiles=$(call first-makefiles-under,$(LOCAL_PATH))
$(foreach mk,$(subdir_makefiles),$(info including $(mk) ...)$(eval include $(mk)))

RFS_MSM_ADSP_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/adsp/
$(RFS_MSM_ADSP_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM ADSP folder structure: $@"
@rm -rf $@/*
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/tombstones/rfs/lpass $@/ramdumps
$(hide) ln -sf /mnt/vendor/persist/rfs/msm/adsp $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware

RFS_MSM_CDSP_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/cdsp/
$(RFS_MSM_CDSP_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM CDSP folder structure: $@"
@rm -rf $@/*
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/tombstones/rfs/cdsp $@/ramdumps
$(hide) ln -sf /mnt/vendor/persist/rfs/msm/cdsp $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware

RFS_MSM_MPSS_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/mpss/
$(RFS_MSM_MPSS_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM MPSS folder structure: $@"
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/wifidump $@/ramdumps
$(hide) ln -sf /data/vendor/rfs/mpss $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware

RFS_MSM_SLPI_SYMLINKS := $(TARGET_OUT_VENDOR)/rfs/msm/slpi/
$(RFS_MSM_SLPI_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "Creating RFS MSM SLPI folder structure: $@"
@rm -rf $@/*
@mkdir -p $(dir $@)/readonly/vendor
$(hide) ln -sf /data/vendor/tombstones/rfs/slpi $@/ramdumps
$(hide) ln -sf /mnt/vendor/persist/rfs/msm/slpi $@/readwrite
$(hide) ln -sf /mnt/vendor/persist/rfs/shared $@/shared
$(hide) ln -sf /mnt/vendor/persist/hlos_rfs/shared $@/hlos
$(hide) ln -sf /vendor/firmware_mnt $@/readonly/firmware
$(hide) ln -sf /vendor/firmware $@/readonly/vendor/firmware

EGL_LIBS := libEGL_adreno.so libGLESv2_adreno.so libq3dtools_adreno.so
EGL_32_SYMLINKS := $(addprefix $(TARGET_OUT_VENDOR)/lib/,$(notdir $(EGL_LIBS)))
$(EGL_32_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "EGL 32 lib link: $@"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf egl/$(notdir $@) $@

EGL_64_SYMLINKS := $(addprefix $(TARGET_OUT_VENDOR)/lib64/,$(notdir $(EGL_LIBS)))
$(EGL_64_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "EGL lib link: $@"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf egl/$(notdir $@) $@

CNE_LIBS := libvndfwk_detect_jni.qti.so
CNE_SYMLINKS := $(addprefix $(TARGET_OUT_VENDOR)/app/CneApp/lib/arm64/,$(notdir $(CNE_LIBS)))
$(CNE_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "CneApp lib link: $@"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf /vendor/lib64/$(notdir $@) $@

IMS_LIBS := libimscamera_jni.so libimsmedia_jni.so
IMS_SYMLINKS := $(addprefix $(TARGET_OUT_SYSTEM_EXT)/priv-app/ims/lib/arm64/,$(notdir $(IMS_LIBS)))
$(IMS_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "IMS lib link: $@"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf /system_ext/lib64/$(notdir $@) $@

SECUREUI_LIBS := libsecureuisvc_jni.so
SECUREUI_SYMLINKS := $(addprefix $(TARGET_OUT_SYSTEM_EXT)/app/com.qualcomm.qti.services.secureui/lib/arm64/,$(notdir $(SECUREUI_LIBS)))
$(SECUREUI_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "SecureUI lib link: $@"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf /system_ext/lib64/$(notdir $@) $@

DM_LIBS := libdmengine.so libdmjavaplugin.so
DM_SYMLINKS := $(addprefix $(TARGET_OUT_PRODUCT)/priv-app/DMService/lib/arm/,$(notdir $(DM_LIBS)))
$(DM_SYMLINKS): $(LOCAL_INSTALLED_MODULE)
@echo "DMService lib link: $@"
@mkdir -p $(dir $@)
@rm -rf $@
$(hide) ln -sf /product/lib/$(notdir $@) $@

ALL_DEFAULT_INSTALLED_MODULES += $(RFS_MSM_ADSP_SYMLINKS) $(RFS_MSM_CDSP_SYMLINKS) $(RFS_MSM_MPSS_SYMLINKS) $(RFS_MSM_SLPI_SYMLINKS) $(EGL_32_SYMLINKS) $(EGL_64_SYMLINKS) $(CNE_SYMLINKS) $(IMS_SYMLINKS) $(SECUREUI_SYMLINKS) $(DM_SYMLINKS)
endif
9 changes: 9 additions & 0 deletions BoardConfigLineage.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
# SPDX-License-Identifier: Apache-2.0
#

BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true

# Kernel
BOARD_KERNEL_IMAGE_NAME := Image.lz4
TARGET_COMPILE_WITH_MSM_KERNEL := true
TARGET_KERNEL_CONFIG := sunfish_defconfig
TARGET_KERNEL_SOURCE := kernel/google/msm-4.14
TARGET_NEEDS_DTBOIMAGE := true

# Partitions
AB_OTA_PARTITIONS += \
vendor
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4

# Verified Boot
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3

include vendor/google/sunfish/BoardConfigVendor.mk
152 changes: 152 additions & 0 deletions device-lineage.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,155 @@ PRODUCT_COPY_FILES += \
PRODUCT_PACKAGES += \
PresencePolling \
RcsService

# Build necessary packages for system_ext

# Display
PRODUCT_PACKAGES += \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]

# Build necessary packages for vendor

# Bluetooth
PRODUCT_PACKAGES += \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]

# CHRE
PRODUCT_PACKAGES += \
chre

# Codec2
PRODUCT_PACKAGES += \
[email protected] \
libavservices_minijail.vendor \
[email protected] \
libcodec2_vndk.vendor \
libmedia_ecoservice.vendor \
[email protected]

# Confirmation UI
PRODUCT_PACKAGES += \
[email protected]:64 \
libteeui_hal_support.vendor:64

# Display
PRODUCT_PACKAGES += \
libdisplayconfig.qti \
[email protected] \
[email protected] \
[email protected]

# GPS
PRODUCT_PACKAGES += \
flp.conf

# HIDL
PRODUCT_PACKAGES += \
libhwbinder.vendor

# Identity credential
PRODUCT_PACKAGES += \
android.hardware.identity-support-lib.vendor:64 \
android.hardware.identity_credential.xml

# Json
PRODUCT_PACKAGES += \
libjson

# Nos
PRODUCT_PACKAGES += \
libnos:64 \
libnosprotos:64 \
libnos_client_citadel:64 \
libnos_datagram:64 \
libnos_datagram_citadel:64 \
libnos_transport:64 \
nos_app_avb:64 \
nos_app_identity:64 \
nos_app_keymaster:64 \
nos_app_weaver:64

# Protobuf
PRODUCT_PACKAGES += \
libprotobuf-cpp-full-vendorcompat

# Sensor listener
PRODUCT_PACKAGES += \
lib_sensor_listener

# Tinycompress
PRODUCT_PACKAGES += \
libtinycompress

# VNDK FWK detect
PRODUCT_PACKAGES += \
libqti_vndfwk_detect.vendor \
libvndfwk_detect_jni.qti.vendor

# Wi-Fi
PRODUCT_PACKAGES += \
libwifi-hal:64 \
libwifi-hal-qcom

# Misc interfaces
PRODUCT_PACKAGES += \
[email protected] \
[email protected]:64 \
[email protected] \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected] \
android.hardware.input.common-V1-ndk.vendor:64 \
android.hardware.input.processor-V1-ndk.vendor:64 \
[email protected] \
[email protected] \
[email protected] \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
android.hardware.power-V1-ndk.vendor \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64 \
[email protected]:64

# Properties
TARGET_VENDOR_PROP := $(LOCAL_PATH)/vendor.prop
4 changes: 0 additions & 4 deletions device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ $(call inherit-product, $(LOCAL_PATH)/utils.mk)
# Installs gsi keys into ramdisk, to boot a developer GSI with verified boot.
$(call inherit-product, $(SRC_TARGET_DIR)/product/developer_gsi_keys.mk)

ifeq ($(wildcard vendor/google_devices/sunfish/proprietary/device-vendor-sunfish.mk),)
BUILD_WITHOUT_VENDOR := true
endif

PRODUCT_CHARACTERISTICS := nosdcard
PRODUCT_SHIPPING_API_LEVEL := 29

Expand Down
62 changes: 62 additions & 0 deletions extract-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2021 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#

set -e

DEVICE=sunfish
VENDOR=google

# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi

ANDROID_ROOT="${MY_DIR}/../../.."

HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"

# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true

KANG=
SECTION=

while [ "${#}" -gt 0 ]; do
case "${1}" in
-n | --no-cleanup )
CLEAN_VENDOR=false
;;
-k | --kang )
KANG="--kang"
;;
-s | --section )
SECTION="${2}"; shift
CLEAN_VENDOR=false
;;
* )
SRC="${1}"
;;
esac
shift
done

if [ -z "${SRC}" ]; then
SRC="adb"
fi

# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"

extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}"

"${MY_DIR}/setup-makefiles.sh"
2 changes: 2 additions & 0 deletions lineage_sunfish.mk
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ PRODUCT_BUILD_PROP_OVERRIDES += \
PRIVATE_BUILD_DESC="sunfish-user 13 TP1A.220624.014 8819323 release-keys"

BUILD_FINGERPRINT := google/sunfish/sunfish:13/TP1A.220624.014/8819323:user/release-keys

$(call inherit-product, vendor/google/sunfish/sunfish-vendor.mk)
Loading

0 comments on commit 59ec265

Please sign in to comment.