Skip to content

Commit

Permalink
Support for HMD Global Nokia 5
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgigena committed Dec 4, 2024
0 parents commit 137cc52
Show file tree
Hide file tree
Showing 20 changed files with 631 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// Copyright (C) 2024 The Android Open Source Project
//
// SPDX-License-Identifier: Apache-2.0
//

soong_namespace {
}
11 changes: 11 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (C) 2024 The Android Open Source Project
#
# SPDX-License-Identifier: Apache-2.0
#

LOCAL_PATH := $(call my-dir)

ifeq ($(TARGET_DEVICE),ND1)
include $(call all-subdir-makefiles,$(LOCAL_PATH))
endif
13 changes: 13 additions & 0 deletions AndroidProducts.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (C) 2024 The Android Open Source Project
#
# SPDX-License-Identifier: Apache-2.0
#

PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/omni_ND1.mk

COMMON_LUNCH_CHOICES := \
omni_ND1-user \
omni_ND1-userdebug \
omni_ND1-eng
103 changes: 103 additions & 0 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#
# Copyright (C) 2024 The Android Open Source Project
#
# SPDX-License-Identifier: Apache-2.0
#

DEVICE_PATH := device/nokia/ND1

# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_CORTEX_A53 := true
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 := cortex-a53

# Platform
TARGET_BOARD_PLATFORM := msm8937
TARGET_BOARD_PLATFORM_GPU := qcom-adreno505
TARGET_BOARD_SUFFIX := _64

# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := msm8937
TARGET_NO_BOOTLOADER := true

# Kernel
BOARD_KERNEL_CMDLINE := androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 androidboot.bootdevice=7824900.sdhci earlycon=msm_hsl_uart,0x78B0000 buildvariant=eng
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
BOARD_KERNEL_BASE := 0x80000000
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_TAGS_OFFSET := 0x00000100
BOARD_RAMDISK_OFFSET := 0x01000000
BOARD_KERNEL_IMAGE_NAME := Image.gz-dtb
TARGET_KERNEL_CONFIG := FIH-msm8937_defconfig
TARGET_KERNEL_SOURCE := kernel/nokia/ND1
TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) $(recovery_uncompressed_device_ramdisk) $(uncompressed_ramdisk)
$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE)
$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules
$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules_install

# Kernel - prebuilt
TARGET_FORCE_PREBUILT_KERNEL := false
ifeq ($(TARGET_FORCE_PREBUILT_KERNEL),true)
TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/Image.gz-dtb
endif

# Encryption
TARGET_CRYPTFS_HW_PATH := vendor/qcom/opensource/commonsys/cryptfs_hw
TARGET_HW_DISK_ENCRYPTION := true

# Keymaster
TARGET_PROVIDES_KEYMASTER := true

# Partitions
BOARD_FLASH_BLOCK_SIZE := 131072 # (BOARD_KERNEL_PAGESIZE * 64)
BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
BOARD_PERSISTIMAGE_PARTITION_SIZE := 33554432
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 67108864
BOARD_SYSTEMIMAGE_PARTITION_TYPE := ext4
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
TARGET_COPY_OUT_VENDOR := vendor

# FS Configs
BOARD_HAS_LARGE_FILESYSTEM := true
BOARD_HAS_NO_SELECT_BUTTON := true
TARGET_USERIMAGES_USE_F2FS := true
TARGET_USERIMAGES_USE_EXT4 := true
TW_INCLUDE_FUSE_EXFAT := true
TW_INCLUDE_FUSE_NTFS := true
TW_INCLUDE_NTFS_3G := true

# TWRP Configuration
TW_SCREEN_BLANK_ON_BOOT := true
TW_EXTRA_LANGUAGES := true
TW_THEME := portrait_hdpi
TW_INCLUDE_CRYPTO := true
TW_MAX_BRIGHTNESS := 255
TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness"
TW_SCREEN_BLANK_ON_BOOT := true
TARGET_RECOVERY_QCOM_RTC_FIX := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TARGET_RECOVERY_FSTAB := device/nokia/ND1/recovery/root/etc/twrp.fstab
BOARD_SUPPRESS_SECURE_ERASE := true
RECOVERY_SDCARD_ON_DATA := true
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TW_USE_TOOLBOX := true
TW_EXCLUDE_TWRPAPP := true

# Qcom Hardware
BOARD_USES_QCOM_HARDWARE := true

# Hack: prevent anti rollbackTARGET_PROVIDES_KEYMASTER
PLATFORM_SECURITY_PATCH := 2099-12-31
VENDOR_SECURITY_PATCH := 2099-12-31
PLATFORM_VERSION := 16.1.0
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
HMD Global Nokia 5 (ND1)
==========================

Device specifications
=======================

Basic | Spec Sheet
-------:|:-------------------------
Chipset | Qualcomm MSM8937 Snapdragon 430
CPU | Octa-core (4x1.40 GHz Cortex-A53 & 4x1.09 GHz Cortex-A53)
GPU | Adreno 505 (450 MHz)
Memory | 2/3 GB RAM
Shipped Android Version | 7.1.1 (Nougat)
Storage | 16/32 GB (eMMC 5.0/5.1 flash)
MicroSD | up to 256 GB (dedicated slot)
Battery | Li-Po 3000 mAh (Non-removable)
Dimensions | 149.7 x 72.5 x 8 mm
Display | 1280 x 720 pixels, 5.0 inches (~282 ppi pixel density)
Rear Camera | 13 MP, f/2.0, phase detection autofocus, LED flash
Front Camera | 8 MP, f/2.0

## Device picture

![HMD Global Nokia 5](https://fdn2.gsmarena.com/vv/pics/nokia/nokia-5-3.jpg "HMD Global Nokia 5")
14 changes: 14 additions & 0 deletions omni.dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"remote": "omnirom",
"repository": "android_vendor_qcom_opensource_commonsys",
"target_path": "vendor/qcom/opensource/commonsys",
"revision": "android-9.0"
},
{
"remote": "andrewgigena",
"repository": "android_kernel_nokia_ND1",
"target_path": "kernel/nokia/ND1",
"revision": "twrp"
}
]
39 changes: 39 additions & 0 deletions omni_ND1.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#
# Copyright (C) 2024 The Android Open Source Project
#
# SPDX-License-Identifier: Apache-2.0
#

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

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

# Inherit from ND1 device
LOCAL_PATH := device/nokia/ND1
PRODUCT_DEVICE := ND1
PRODUCT_NAME := omni_ND1
PRODUCT_BRAND := Nokia
PRODUCT_MODEL := Nokia 5
PRODUCT_MANUFACTURER := HMD Global

PRODUCT_GMS_CLIENTID_BASE := android-nokia

PRODUCT_BUILD_PROP_OVERRIDES += \
BUILD_FINGERPRINT="Nokia/TA-1024_00WW/ND1:9/PKQ1.181105.001/00WW_6_18A:user/release-keys" \
PRIVATE_BUILD_DESC="TA-1024_00WW-user 9 PKQ1.181105.001 00WW_6_18A release-keys"

# Screen Resolution
TARGET_SCREEN_HEIGHT := 1280
TARGET_SCREEN_WIDTH := 720

# Charger
PRODUCT_PACKAGES += \
charger \
charger_res_images

# Encryption
PRODUCT_PACKAGES += \
libcryptfs_hw
16 changes: 16 additions & 0 deletions recovery/root/etc/twrp.fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# mount point fstype device device2 flags
/system ext4 /dev/block/bootdevice/by-name/system
/system_image emmc /dev/block/bootdevice/by-name/system
/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer
/cache ext4 /dev/block/bootdevice/by-name/cache
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=backup=1
/persist ext4 /dev/block/bootdevice/by-name/persist flags=backup=1;display="Persist";mounttodecrypt
/boot emmc /dev/block/bootdevice/by-name/boot
/misc emmc /dev/block/bootdevice/by-name/misc

/efs1 emmc /dev/block/bootdevice/by-name/modemst1 flags=display="EFS";backup=1
/efs2 emmc /dev/block/bootdevice/by-name/modemst2 flags=backup=1;subpartitionof=/efs1
/firmware vfat /dev/block/bootdevice/by-name/modem flags=display="Firmware";mounttodecrypt

/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=removable;storage;wipeingui;display="Micro SDCard"
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=removable;storage;wipeingui;display="USB OTG"
22 changes: 22 additions & 0 deletions recovery/root/init.recovery.qcom.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on fs
# needed to make qseecomd work in recovery
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
chmod 0660 /dev/qseecom
chown system drmrpc /dev/qseecom
chmod 0664 /dev/ion
chown system system /dev/ion

on property:ro.crypto.state=encrypted
start sbinqseecomd

# separate copy needed to use /sbin/linker64 instead of /system/bin/linker64
service sbinqseecomd /sbin/qseecomd
oneshot
disabled
user root
group root
seclabel u:r:recovery:s0

on property:ro.crypto.fs_crypto_blkdev=/dev/block/dm-0
stop sbinqseecomd
30 changes: 30 additions & 0 deletions recovery/root/init.recovery.usb.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on fs
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct 4EE2
write /sys/class/android_usb/android0/f_ffs/aliases adb
write /sys/class/android_usb/android0/functions mtp,adb
write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
write /sys/class/android_usb/android0/iProduct ${ro.product.model}
write /sys/class/android_usb/android0/iSerial ${ro.serialno}

on property:sys.usb.config=none
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/bDeviceClass 0

on property:sys.usb.config=mass_storage,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1

on property:sys.usb.config=mtp,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd

on property:sys.usb.config=adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable ${service.adb.root}
start adbd
Binary file added recovery/root/sbin/qseecomd
Binary file not shown.
Loading

0 comments on commit 137cc52

Please sign in to comment.