Skip to content

Commit

Permalink
Base tree done
Browse files Browse the repository at this point in the history
  • Loading branch information
ChonDoit committed Feb 2, 2024
0 parents commit afb8282
Show file tree
Hide file tree
Showing 106 changed files with 12,382 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LOCAL_PATH := $(call my-dir)

ifeq ($(TARGET_DEVICE),devon)
include $(call all-makefiles-under,$(LOCAL_PATH))
endif
7 changes: 7 additions & 0 deletions AndroidProducts.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PRODUCT_MAKEFILES := $(LOCAL_DIR)/twrp_devon.mk

COMMON_LUNCH_CHOICES := \
twrp_devon-user \
twrp_devon-userdebug \
twrp_devon-eng

108 changes: 108 additions & 0 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Platform
TARGET_BOARD_PLATFORM := bengal
BOARD_USES_QCOM_HARDWARE := true

# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := $(PRODUCT_DEVICE)

# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_VARIANT := cortex-a73
TARGET_CPU_VARIANT_RUNTIME := cortex-a73

TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv8-a
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a53
TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a53

# A/B flags
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS += system system_ext product vbmeta_system vendor
BOARD_USES_RECOVERY_AS_BOOT := true
ENABLE_VIRTUAL_AB := true
TARGET_NO_RECOVERY := true
TARGET_COPY_OUT_VENDOR := vendor

# Kernel
BOARD_BOOT_HEADER_VERSION := 3
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
BOARD_BOOTIMAGE_PARTITION_SIZE := 100663296
BOARD_AVB_ENABLE := true
TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/kernel

# Broken stuffs
ALLOW_MISSING_DEPENDENCIES := true
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true
BUILD_BROKEN_MISSING_REQUIRED_MODULES := true

#######################
# Decryption support
#######################

# TWRP - Crypto
TW_INCLUDE_CRYPTO := true
TW_INCLUDE_CRYPTO_FBE := true
TW_INCLUDE_FBE_METADATA_DECRYPT := true
BOARD_USES_QCOM_FBE_DECRYPTION := true
PLATFORM_VERSION := 99.87.36
PLATFORM_VERSION_LAST_STABLE := $(PLATFORM_VERSION)

PLATFORM_SECURITY_PATCH := 2127-12-31
VENDOR_SECURITY_PATCH := $(PLATFORM_SECURITY_PATCH)
BOOT_SECURITY_PATCH := $(PLATFORM_SECURITY_PATCH)

OF_DEFAULT_KEYMASTER_VERSION := 4.1
TW_FORCE_KEYMASTER_VER := true

BOARD_USES_METADATA_PARTITION := true
BOARD_ROOT_EXTRA_FOLDERS := metadata

TARGET_RECOVERY_DEVICE_MODULES += libion
RECOVERY_LIBRARY_SOURCE_FILES += $(TARGET_OUT_SHARED_LIBRARIES)/libion.so

###############################
# TWRP specific build flags
###############################

TW_THEME := portrait_hdpi
RECOVERY_SDCARD_ON_DATA := true
TWRP_INCLUDE_LOGCAT := true

TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_RECOVERY_QCOM_RTC_FIX := true
TARGET_USE_CUSTOM_LUN_FILE_PATH := /config/usb_gadget/g1/functions/mass_storage.0/lun.%d/file
TARGET_USES_LOGD := true
TARGET_USES_MKE2FS := true
TARGET_USERIMAGES_USE_F2FS := true

TW_EXCLUDE_DEFAULT_USB_INIT := true
TW_EXCLUDE_TWRPAPP := true
TW_EXTRA_LANGUAGES := true
TW_FRAMERATE := 90
TW_INCLUDE_FASTBOOTD := true
TW_INCLUDE_LIBRESETPROP := true
TW_INCLUDE_NTFS_3G := true
TW_INCLUDE_PYTHON := true
TW_INCLUDE_REPACKTOOLS := true
TW_INCLUDE_RESETPROP := true
TW_NO_SCREEN_BLANK := true
TW_SCREEN_BLANK_ON_BOOT := true
TW_USE_TOOLBOX := true

# Brightness
TW_BRIGHTNESS_PATH := "/sys/class/backlight/panel0-backlight/brightness"
TW_DEFAULT_BRIGHTNESS := 500
TW_MAX_BRIGHTNESS := 2047

# Battery
TW_CUSTOM_BATTERY_PATH := "/sys/class/power_supply/battery"
TW_BATTERY_SYSFS_WAIT_SECONDS := 5

# Kernel module loading for touch, battery etc
TW_LOAD_VENDOR_MODULES := $(shell echo \"$(shell ls $(DEVICE_PATH)/recovery/root/vendor/lib/modules/1.1)\")
TW_LOAD_VENDOR_BOOT_MODULES := true

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Unofficial OrangeFox Device Tree for Motorola G32 (devon)

### Working

- All

### Not implemented (Lazyness)

- Flashlight
20 changes: 20 additions & 0 deletions bootctrl/1.1/impl/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cc_library_shared {
name: "[email protected]",
stem: "[email protected]",
defaults: [
"hidl_defaults",
],
relative_install_path: "hw",
vendor: true,
recovery_available: true,
srcs: ["BootControl.cpp"],
shared_libs: [
"liblog",
"libhidlbase",
"libhardware",
"libutils",
"[email protected]",
"[email protected]",
"libboot_control_qti",
],
}
132 changes: 132 additions & 0 deletions bootctrl/1.1/impl/BootControl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#define LOG_TAG "[email protected]"

#include <memory>

#include <log/log.h>

#include "BootControl.h"

namespace android {
namespace hardware {
namespace boot {
namespace V1_1 {
namespace implementation {

using ::android::hardware::boot::V1_0::CommandResult;

bool BootControl::Init() {
return bootcontrol_init();
}

Return<uint32_t> BootControl::getNumberSlots() {
return get_number_slots();
}

Return<uint32_t> BootControl::getCurrentSlot() {
return get_current_slot();
}

Return<void> BootControl::markBootSuccessful(markBootSuccessful_cb _hidl_cb) {
int ret = mark_boot_successful();
struct CommandResult cr;
cr.success = (ret == 0);
cr.errMsg = strerror(-ret);
_hidl_cb(cr);
return Void();
}

Return<void> BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) {
int ret = set_active_boot_slot(slot);
struct CommandResult cr;
cr.success = (ret == 0);
cr.errMsg = strerror(-ret);
_hidl_cb(cr);
return Void();
}

Return<void> BootControl::setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) {
int ret = set_slot_as_unbootable(slot);
struct CommandResult cr;
cr.success = (ret == 0);
cr.errMsg = strerror(-ret);
_hidl_cb(cr);
return Void();
}

Return<BoolResult> BootControl::isSlotBootable(uint32_t slot) {
int32_t ret = is_slot_bootable(slot);
if (ret < 0) {
return BoolResult::INVALID_SLOT;
}
return ret ? BoolResult::TRUE : BoolResult::FALSE;
}

Return<BoolResult> BootControl::isSlotMarkedSuccessful(uint32_t slot) {
int32_t ret = is_slot_marked_successful(slot);
if (ret < 0) {
return BoolResult::INVALID_SLOT;
}
return ret ? BoolResult::TRUE : BoolResult::FALSE;
}

Return<void> BootControl::getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) {
hidl_string ans;
const char* suffix = get_suffix(slot);
if (suffix) {
ans = suffix;
}
_hidl_cb(ans);
return Void();
}

Return<bool> BootControl::setSnapshotMergeStatus(MergeStatus status) {
return set_snapshot_merge_status(status);
}

Return<MergeStatus> BootControl::getSnapshotMergeStatus() {
return get_snapshot_merge_status();
}

IBootControl* HIDL_FETCH_IBootControl(const char* /* hal */) {
auto module = std::make_unique<BootControl>();
if (!module->Init()) {
ALOGE("Could not initialize BootControl module");
return nullptr;
}
return module.release();
}

} // namespace implementation
} // namespace V1_1
} // namespace boot
} // namespace hardware
} // namespace android
75 changes: 75 additions & 0 deletions bootctrl/1.1/impl/BootControl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#pragma once

#include <android/hardware/boot/1.1/IBootControl.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <libboot_control_qti.h>

namespace android {
namespace hardware {
namespace boot {
namespace V1_1 {
namespace implementation {

using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::boot::V1_0::BoolResult;
using ::android::hardware::boot::V1_1::IBootControl;
using ::android::hardware::boot::V1_1::MergeStatus;

class BootControl : public IBootControl {
public:
bool Init();

// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
Return<uint32_t> getNumberSlots() override;
Return<uint32_t> getCurrentSlot() override;
Return<void> markBootSuccessful(markBootSuccessful_cb _hidl_cb) override;
Return<void> setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override;
Return<void> setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) override;
Return<BoolResult> isSlotBootable(uint32_t slot) override;
Return<BoolResult> isSlotMarkedSuccessful(uint32_t slot) override;
Return<void> getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override;

// Methods from ::android::hardware::boot::V1_1::IBootControl follow.
Return<bool> setSnapshotMergeStatus(MergeStatus status) override;
Return<MergeStatus> getSnapshotMergeStatus() override;

};

extern "C" IBootControl* HIDL_FETCH_IBootControl(const char* name);

} // namespace implementation
} // namespace V1_1
} // namespace boot
} // namespace hardware
} // namespace android
27 changes: 27 additions & 0 deletions bootctrl/1.1/libboot_control_qti/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cc_library {
name: "libboot_control_qti",
vendor: true,
recovery_available: true,
shared_libs: [
"[email protected]",
"librecovery_updater.devon",
"libbase",
"libcutils",
"liblog",
"libz",
],
static_libs: [
"libboot_control",
"libbootloader_message_vendor",
"libfstab",
],
owner: "qti",
cflags: [
"-Wall",
"-Werror",
],
srcs: [
"libboot_control_qti.cpp",
],
export_include_dirs: ["."],
}
Loading

0 comments on commit afb8282

Please sign in to comment.