Skip to content

Commit

Permalink
RMX1831: Initial TWRP device tree
Browse files Browse the repository at this point in the history
Made with SebaUbuntu's TWRP device tree generator
Arch: arm64
Manufacturer: realme
Model: Realme RMX1831
Script version: 1.2.3
Signed-off-by: Sebastiano Barezzi <[email protected]>
  • Loading branch information
SebaUbuntu committed Feb 17, 2021
0 parents commit 30b17a8
Show file tree
Hide file tree
Showing 15 changed files with 556 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (C) 2020 The Android Open Source Project
# Copyright (C) 2020 The TWRP Open Source Project
# Copyright (C) 2020 SebaUbuntu's TWRP device tree generator
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH := $(call my-dir)

ifeq ($(TARGET_DEVICE), RMX1831)
include $(call all-subdir-makefiles,$(LOCAL_PATH))
endif
20 changes: 20 additions & 0 deletions AndroidProducts.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (C) 2020 The Android Open Source Project
# Copyright (C) 2020 The TWRP Open Source Project
# Copyright (C) 2020 SebaUbuntu's TWRP device tree generator
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/omni_RMX1831.mk
80 changes: 80 additions & 0 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#
# Copyright (C) 2020 The Android Open Source Project
# Copyright (C) 2020 The TWRP Open Source Project
# Copyright (C) 2020 SebaUbuntu's TWRP device tree generator
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

DEVICE_PATH := device/realme/RMX1831

# For building with minimal manifest
ALLOW_MISSING_DEPENDENCIES := true

# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := generic

TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := generic
TARGET_BOARD_SUFFIX := _64
TARGET_USES_64_BIT_BINDER := true

# Assert
TARGET_OTA_ASSERT_DEVICE := RMX1831

# File systems
BOARD_HAS_LARGE_FILESYSTEM := true
#BOARD_RECOVERYIMAGE_PARTITION_SIZE := 24446976 # This is the maximum known partition size, but it can be higher, so we just omit it
BOARD_SYSTEMIMAGE_PARTITION_TYPE := ext4
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true
TARGET_COPY_OUT_VENDOR := vendor

# Kernel
BOARD_KERNEL_CMDLINE := bootopt=64S3,32N2,64N2 androidboot.configfs=true androidboot.selinux=permissive buildvariant=eng
TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/Image.gz-dtb
BOARD_KERNEL_BASE := 0x40078000
BOARD_KERNEL_PAGESIZE := 2048
BOARD_RAMDISK_OFFSET := 0x14f88000
BOARD_KERNEL_TAGS_OFFSET := 0x13f88000
BOARD_FLASH_BLOCK_SIZE := 131072 # (BOARD_KERNEL_PAGESIZE * 64)
BOARD_MKBOOTIMG_ARGS += --ramdisk_offset $(BOARD_RAMDISK_OFFSET)
BOARD_MKBOOTIMG_ARGS += --tags_offset $(BOARD_KERNEL_TAGS_OFFSET)
BOARD_KERNEL_IMAGE_NAME := Image.gz-dtb
TARGET_KERNEL_ARCH := arm64
TARGET_KERNEL_HEADER_ARCH := arm64
TARGET_KERNEL_SOURCE := kernel/realme/RMX1831
TARGET_KERNEL_CONFIG := RMX1831_defconfig

# Platform
TARGET_BOARD_PLATFORM :=

# Hack: prevent anti rollback
PLATFORM_SECURITY_PATCH := 2099-12-31
PLATFORM_VERSION := 16.1.0

# TWRP Configuration
TW_THEME := portrait_hdpi
TW_EXTRA_LANGUAGES := true
TW_SCREEN_BLANK_ON_BOOT := true
TW_INPUT_BLACKLIST := "hbtp_vm"
TW_USE_TOOLBOX := true
20 changes: 20 additions & 0 deletions device.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Copyright (C) 2020 The Android Open Source Project
# Copyright (C) 2020 The TWRP Open Source Project
# Copyright (C) 2020 SebaUbuntu's TWRP device tree generator
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH := device/realme/RMX1831

38 changes: 38 additions & 0 deletions omni_RMX1831.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright (C) 2020 The Android Open Source Project
# Copyright (C) 2020 The TWRP Open Source Project
# Copyright (C) 2020 SebaUbuntu's TWRP device tree generator
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# Inherit from those products. Most specific first.
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product-if-exists, $(SRC_TARGET_DIR)/product/embedded.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)

# Inherit from RMX1831 device
$(call inherit-product, device/realme/RMX1831/device.mk)

# Inherit some common Omni stuff.
$(call inherit-product, vendor/omni/config/common.mk)
$(call inherit-product, vendor/omni/config/gsm.mk)

# Device identifier. This must come after all inclusions
PRODUCT_DEVICE := RMX1831
PRODUCT_NAME := omni_RMX1831
PRODUCT_BRAND := realme
PRODUCT_MODEL := Realme RMX1831
PRODUCT_MANUFACTURER := realme
PRODUCT_RELEASE_NAME := realme Realme RMX1831
Binary file added prebuilt/Image.gz-dtb
Binary file not shown.
13 changes: 13 additions & 0 deletions recovery.fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/system ext4 /dev/block/platform/bootdevice/by-name/system flags=backup=1;wipeingui
/system_image emmc /dev/block/platform/bootdevice/by-name/system flags=flashimg=1
/vendor ext4 /dev/block/platform/bootdevice/by-name/vendor flags=display="Vendor";backup=1;wipeingui
/vendor_image emmc /dev/block/platform/bootdevice/by-name/vendor flags=display="Vendor Image";backup=1;flashimg=1
/data ext4 /dev/block/platform/bootdevice/by-name/userdata flags=encryptable=/dev/block/platform/bootdevice/by-name/metadata
/misc emmc /dev/block/platform/bootdevice/by-name/para
/cache ext4 /dev/block/platform/bootdevice/by-name/cache flags=backup=1;wipeingui;wipeduringfactoryreset
/boot emmc /dev/block/platform/bootdevice/by-name/boot flags=display="Boot";backup=1;flashimg=1
/recovery emmc /dev/block/platform/bootdevice/by-name/recovery flags=display="Recovery";backup=1;flashimg=1
/persist ext4 /dev/block/platform/bootdevice/by-name/persist flags=display="Persist";backup=1

/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="External SDcard";storage;wipeingui;removable;backup=0
/usbotg auto /dev/block/sda1 /dev/block/sda flags=display="Usb-Otg";storage;removable;backup=0
122 changes: 122 additions & 0 deletions recovery/root/init.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import /init.recovery.logd.rc
import /init.recovery.mksh.rc
import /init.recovery.usb.rc
import /init.recovery.service.rc
import /init.recovery.vold_decrypt.rc
import /init.recovery.${ro.hardware}.rc

on early-init
# Apply strict SELinux checking of PROT_EXEC on mmap/mprotect calls.
write /sys/fs/selinux/checkreqprot 0

# Set the security context for the init process.
# This should occur before anything else (e.g. ueventd) is started.
setcon u:r:init:s0

# Set the security context of /postinstall if present.
restorecon /postinstall

start ueventd

service set_permissive /sbin/permissive.sh
oneshot
seclabel u:r:recovery:s0

on init
export PATH /sbin:/system/bin
export LD_LIBRARY_PATH /sbin

export ANDROID_ROOT /system
export ANDROID_DATA /data
export EXTERNAL_STORAGE /sdcard

mount cgroup none /acct cpuacct
mkdir /acct/uid

mkdir /system
mkdir /data
mkdir /cache
mkdir /sideload
mount tmpfs tmpfs /tmp

chown root shell /tmp
chmod 0775 /tmp

write /proc/sys/kernel/panic_on_oops 1
write /proc/sys/vm/max_map_count 1000000

on fs
mount pstore pstore /sys/fs/pstore
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000

on boot
ifup lo
hostname localhost
domainname localdomain

class_start default

# Load properties, pre-Android 6.0
on load_all_props_action
load_all_props

# Load properties, Android 6.0+
on load_system_props_action
load_system_props

# Load properties, Android 6.0+, vendor init lives here
on load_persist_props_action
load_persist_props

on firmware_mounts_complete
rm /dev/.booting

# Mount filesystems and start core system services.
on late-init
trigger early-fs
trigger fs
trigger post-fs
trigger post-fs-data

# Load properties, pre-Android 6.0
trigger load_all_props_action

# Load properties from /system/ + /factory after fs mount. Place
# this in another action so that the load will be scheduled after the prior
# issued fs triggers have completed.
trigger load_system_props_action

# Load properties, Android 6.0+, vendor init lives here
trigger load_persist_props_action

# Remove a file to wake up anything waiting for firmware
trigger firmware_mounts_complete

trigger early-boot
trigger boot

on property:sys.powerctl=*
powerctl ${sys.powerctl}

service ueventd /sbin/ueventd
critical
seclabel u:r:ueventd:s0

service adbd /sbin/adbd --root_seclabel=u:r:su:s0 --device_banner=recovery
disabled
socket adbd stream 660 system system
seclabel u:r:adbd:s0

# Always start adbd on userdebug and eng builds
on property:ro.debuggable=1
#write /sys/class/android_usb/android0/enable 1
#start adbd
setprop service.adb.root 1

# Restart adbd so it can run as root
on property:service.adb.root=1
write /sys/class/android_usb/android0/enable 0
restart adbd
write /sys/class/android_usb/android0/enable 1
5 changes: 5 additions & 0 deletions recovery/root/init.recovery.hlthchrg.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# charger for Android 8.0 and up

service charger /charger -r
critical
seclabel u:r:charger:s0
2 changes: 2 additions & 0 deletions recovery/root/init.recovery.mksh.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
on init
export ENV /etc/mkshrc
41 changes: 41 additions & 0 deletions recovery/root/init.recovery.mt6771.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on init
mkdir /config
mount configfs none /config
mkdir /config/usb_gadget/g1 0770 shell shell
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0xd001
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
mkdir /config/usb_gadget/g1/functions/ffs.adb
setprop sys.usb.ffs.aio_compat 1

on property:ro.debuggable=0
# distinguish USB shoulde connect or not, i.e. CDP vs SDP
write /sys/class/udc/musb-hdrc/device/cmode 2
# set charging free due to it wait for USB activation
start adbd

on property:sys.usb.ffs.ready=1
write /config/usb_gadget/g1/UDC "none"
rm /config/usb_gadget/g1/configs/b.1/f1
rm /config/usb_gadget/g1/configs/b.1/f2
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
write /config/usb_gadget/g1/idVendor 0x18d1
write /config/usb_gadget/g1/idProduct 0xd001
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC "musb-hdrc"

on property:ro.mtk_emmc_support=1
# Support A/B feature for emmc boot region
symlink /dev/block/mmcblk0boot0 /dev/block/platform/bootdevice/by-name/preloader_a
symlink /dev/block/mmcblk0boot1 /dev/block/platform/bootdevice/by-name/preloader_b

on property:ro.mtk_ufs_booting=1
# Support A/B feature for ufs boot region
symlink /dev/block/sda /dev/block/platform/bootdevice/by-name/preloader_a
symlink /dev/block/sdb /dev/block/platform/bootdevice/by-name/preloader_b

5 changes: 5 additions & 0 deletions recovery/root/init.recovery.service.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
on boot

# For starting recovery on 5.0 and newer
service recovery /sbin/recovery
seclabel u:r:recovery:s0
Loading

0 comments on commit 30b17a8

Please sign in to comment.