[Miscellaneous Android Development] yuweng:
Reserved

Case Study

Qualcomm

Qualcomm SoC has the best cm support so typically you can find all infos there.

When you use mkvendor.sh to unpack HTC One M8 all the necessary files are auto-generated correctly.

Below is the BoardConfig.mk auto-generated by mkvendor.sh

USE_CAMERA_STUB := true

# inherit from the proprietary version
-include vendor/HTC/One/BoardConfigVendor.mk

TARGET_ARCH := arm
TARGET_NO_BOOTLOADER := true
TARGET_BOARD_PLATFORM := unknown
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_VARIANT := cortex-a7
TARGET_CPU_SMP := true
ARCH_ARM_HAVE_TLS_REGISTER := true

TARGET_BOOTLOADER_BOARD_NAME := One

[COLOR="blue"]BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.hardware=qcom user_debug=31 ehci-hcd.park=3
BOARD_KERNEL_BASE := 0x00000000
BOARD_KERNEL_PAGESIZE := 2048[/COLOR]

# fix this up by examining /proc/mtd on a running device
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_FLASH_BLOCK_SIZE := 131072

TARGET_PREBUILT_KERNEL := device/HTC/One/kernel

BOARD_HAS_NO_SELECT_BUTTON := true

You'll notice it has the same config as here

mkvendor.sh will also correctly extract the recovery.fstab from M8 recovery.img too

# Android fstab file.
#<src>	<mnt_point>	<type>	<mnt_flags>	<fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

/dev/block/mmcblk0p42 /boot emmc defaults defaults
/dev/block/mmcblk0p43 /recovery emmc defaults defaults
/dev/block/mmcblk0p45 /system ext4 ro,seclabel,noatime,data=ordered wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,relatime,discard,noauto_da_alloc,data=ordered wait,check
/dev/block/mmcblk0p46 /cache ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered wait,check
/dev/block/mmcblk0p39 /devlog ext4 rw,seclabel,nosuid,nodev,relatime,errors=continue,data=ordered wait
/dev/block/mmcblk0p27 /fataldevlog ext4 rw,seclabel,nosuid,nodev,relatime,errors=continue,data=ordered wait
/dev/block/platform/msm_sdcc.1/by-name/radio /firmware/radio vfat ro,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro wait
/dev/block/platform/msm_sdcc.1/by-name/adsp /firmware/adsp vfat ro,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro wait
/dev/block/platform/msm_sdcc.1/by-name/wcnss /firmware/wcnss vfat ro,relatime,uid=1000,gid=1000,fmask=0337,dmask=0227,codepage=cp437,iocharset=iso8859-1,shortname=lower,errors=remount-ro wait
/dev/block/mmcblk0p22 /custdata ext4 rw,seclabel,nosuid,nodev,relatime,data=ordered defaults

/devices/msm_sdcc.2/mmc_host auto auto defaults voldmanaged=sdcard1:auto
/devices/platform/xhci-hcd auto auto defaults voldmanaged=usb:auto

So compare between both & make the necessary updates, AFAIK, you don't need to include all the other build flags, those are for building ROMs/ kernels, just update the correct TARGET_CPU_VARIANT & PhilZ Touch build flags will do & if it doesn't boot then you'll have to find that out yourself . . . :laugh:

HTC One M8 recovery.img from here

Broadcom

Recently got a request for building PhilZ Touch for Lava Magnum X604 which uses Broadcom BCM23550 & there isn't much development on this SoC even thought its released on 2012 !

A quick search found Samsung Galaxy Grand Neo uses the same SoC & it doesn't have cm device tree.

AKA GT-I9060 & further search found this & it leads to few more . . . (1) (2) (3)

Above shall give some hint on how to build PhilZ Touch on your BCM23550.

Below are the mkvendor.sh generated files that needs editing.

BoardConfig.mk

USE_CAMERA_STUB := true

# inherit from the proprietary version
-include vendor/Magnum/X604/BoardConfigVendor.mk

TARGET_ARCH := arm
TARGET_NO_BOOTLOADER := true
TARGET_BOARD_PLATFORM := unknown [COLOR="Red"]<- Optionally, you can rename accordingly to [COLOR="Blue"]default.prop -> ro.board.platform=[B][COLOR="Black"]java[/COLOR][/B][/COLOR][/COLOR]
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_VARIANT := cortex-a7
TARGET_CPU_SMP := true
ARCH_ARM_HAVE_TLS_REGISTER := true

TARGET_BOOTLOADER_BOARD_NAME := X604

BOARD_KERNEL_CMDLINE :=
BOARD_KERNEL_BASE := 0x10000000
BOARD_KERNEL_PAGESIZE := 2048

# fix this up by examining /proc/mtd on a running device
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x105c0000
BOARD_FLASH_BLOCK_SIZE := 131072

TARGET_PREBUILT_KERNEL := device/Magnum/X604/kernel

BOARD_HAS_NO_SELECT_BUTTON := true

[COLOR="Blue"]#Philz Touch build flags for Magnum X604[/COLOR]
TARGET_COMMON_NAME := Magnum X604
[COLOR="red"]#[/COLOR]BOARD_USE_NTFS_3G := false [COLOR="Blue"]<- if it doesn't boot then remove [COLOR="red"]#[/COLOR] remark[/COLOR]
[COLOR="Red"]#[/COLOR]TARGET_RECOVERY_PIXEL_FORMAT := "BGRA_8888" [COLOR="Blue"]<- if distorted graphics then remove [COLOR="red"]#[/COLOR] remark[/COLOR]
TARGET_SCREEN_HEIGHT := 1280
TARGET_SCREEN_WIDTH := 720
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/usb_mass_storage/lun0/file"
BRIGHTNESS_SYS_FILE := "/sys/class/leds/lcd-backlight/brightness"

recovery.fstab

# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

[COLOR="blue"]#Init[/COLOR]
/dev/block/platform/sdhci.1/by-name/boot /boot	emmc defaults defaults
/dev/block/platform/sdhci.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/sdhci.1/by-name/system /system ext4 ro wait
/dev/block/platform/sdhci.1/by-name/cache /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait
/dev/block/platform/sdhci.1/by-name/userdata /data ext4 rw,nosuid,nodev,noatime,errors=panic,user_xattr,barrier=1,data=ordered,noauto_da_alloc wait,encryptable=footer
/dev/block/zram0 none swap defaults zramsize=201326592

[COLOR="Blue"]#voldmanaged[/COLOR]
/devices/platform/sdhci.1/mmc_host/mmc0 auto vfat defaults noemulatedsd,nonremovable,voldmanaged=sdcard0:auto
/devices/platform/sdhci.0/mmc_host/mmc2 auto vfat defaults voldmanaged=sdcard1:auto
/devices/platform/3f120000.usb-otg/usb1 auto vfat defaults voldmanaged=usbdisk0:auto

device_X604.mk

$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)

# The gps config appropriate for this device
[COLOR="Red"]#[/COLOR]$(call inherit-product, device/common/gps/gps_us_supl.mk)

$(call inherit-product-if-exists, vendor/Magnum/X604/X604-vendor.mk)

DEVICE_PACKAGE_OVERLAYS += device/Magnum/X604/overlay

LOCAL_PATH := device/Magnum/X604
ifeq ($(TARGET_PREBUILT_KERNEL),)
LOCAL_KERNEL := $(LOCAL_PATH)/kernel
else
LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
endif

PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel

$(call inherit-product, build/target/product/full.mk)

PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0
PRODUCT_NAME := full_X604
PRODUCT_DEVICE := X604

[COLOR="Blue"]#PhilZ Touch[/COLOR]
PRODUCT_COPY_FILES +=
$(LOCAL_PATH)/recovery.fstab:recovery/root/[COLOR="blue"]fstab.java[/COLOR]

Follow necessary steps at post #1 & #2 & you shall be able to build PhilZ Touch . . . :fingers-crossed:

Intel x86

To build PhilZ Touch for Atom using this Part-Source will require one additional project.

grep -v linux-x86/x86/i686-linux-android-4.7 ~/Documents/x>~/Documents/x.tmp;mv ~/Documents/x.tmp ~/Documents/x

Add the above to Line 82 of the Part-Source script. Below are the changes to BoardConfig.mk for building on x86 target

TARGET_ARCH := [COLOR="blue"]x86[/COLOR]
TARGET_NO_BOOTLOADER := true
TARGET_BOARD_PLATFORM := unknown [COLOR="Red"]<- Optionally, you can rename accordingly to [COLOR="Blue"]default.prop -> ro.board.platform[/COLOR][/COLOR]
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
TARGET_ARCH_VARIANT := [COLOR="blue"]x86-atom[/COLOR]
TARGET_CPU_VARIANT := [COLOR="blue"]x86[/COLOR]
TARGET_CPU_SMP := true
ARCH_ARM_HAVE_TLS_REGISTER := true

Source 1 <- For ref, you don't need to do all that on BBQLinux . . . :cool:

Source 2