Skip to content

Commit

Permalink
Build kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
diego-cr committed Sep 10, 2019
1 parent 0f71c6b commit 6fda789
Show file tree
Hide file tree
Showing 14 changed files with 1,648 additions and 5 deletions.
31 changes: 27 additions & 4 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,36 @@ TARGET_CPU_ABI2 := armeabi
TARGET_CPU_SMP := true

# Kernel Config
#BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x04000000 --tags_offset 0x00000100
#BOARD_KERNEL_CMDLINE := androidboot.selinux=permissive
#BOARD_KERNEL_BASE := 0x80000000
#BOARD_KERNEL_PAGESIZE := 4096
#BOARD_PAGE_SIZE := 0x800


# Kernel
BOARD_CUSTOM_BOOTIMG_MK := device/amazon/tank/mkbootimg.mk
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x04000000 --tags_offset 0x00000100
BOARD_KERNEL_CMDLINE := androidboot.selinux=permissive
TARGET_KERNEL_CONFIG := tank_defconfig
TARGET_KERNEL_SOURCE := kernel/amazon/mt8127
BOARD_KERNEL_BASE := 0x80000000
BOARD_KERNEL_PAGESIZE := 4096
BOARD_PAGE_SIZE := 0x800
BOARD_KERNEL_TAGS_OFFSET := 0x00000100
BOARD_KERNEL_PAGESIZE := 2048
BOARD_RAMDISK_OFFSET := 0x04000000
BOARD_SECOND_OFFSET := 0x00f00000
TARGET_KERNEL_CROSS_COMPILE_PREFIX := arm-eabi-


BOARD_KERNEL_CMDLINE := androidboot.selinux=permissive
#BOARD_KERNEL_CMDLINE := androidboot.console=ttyMSM0 androidboot.hardware=qcom
#BOARD_KERNEL_CMDLINE += user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3
#BOARD_KERNEL_CMDLINE += service_locator.enable=1
#BOARD_KERNEL_CMDLINE += swiotlb=2048

BOARD_HAS_MTK_HARDWARE := true
MTK_HARDWARE := true

TARGET_PREBUILT_KERNEL := device/amazon/tank/boot.img
#TARGET_PREBUILT_KERNEL := device/amazon/tank/boot.img

# Flags
TARGET_GLOBAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp
Expand Down Expand Up @@ -74,6 +94,9 @@ TARGET_DISPLAY_USE_RETIRE_FENCE := true
MAX_EGL_CACHE_KEY_SIZE := 12*1024
MAX_EGL_CACHE_SIZE := 1024*1024

TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK := true
TARGET_HAS_WAITFORVSYNC := true

# Surfaceflinger optimization for VD surfaces
TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS := true
#NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
Expand Down
6 changes: 5 additions & 1 deletion full_tank.mk
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)

######## tank

# Ramdisk
PRODUCT_COPY_FILES += \
device/amazon/tank/boot.img:kernel
$(call find-copy-subdir-files,*,device/amazon/tank/rootdir,root)

#PRODUCT_COPY_FILES += \
# device/amazon/tank/boot.img:kernel

# Inherit from the common Open Source product configuration
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
Expand Down
77 changes: 77 additions & 0 deletions mkbootimg.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# Copyright (C) 2017 The Android Open-Source Project
#
# 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.
#

# can this be done in bash? credits go to bgcngm
define make_header
perl -e 'print pack("a4 L a32 a472", "\x88\x16\x88\x58", $$ARGV[0], $$ARGV[1], "\xFF"x472)' $(1) $(2) > $(3)
endef

# this is overriding targets from build/core/Makefile
$(INSTALLED_KERNEL_TARGET).mtk.header: $(INSTALLED_KERNEL_TARGET)
size=$$($(call get-file-size,$(INSTALLED_KERNEL_TARGET))); \
$(call make_header, $$((size)), "KERNEL", $@)
$(INSTALLED_KERNEL_TARGET).mtk: $(INSTALLED_KERNEL_TARGET).mtk.header
$(call pretty,"Adding MTK header to kernel.")
cat $(INSTALLED_KERNEL_TARGET).mtk.header $(INSTALLED_KERNEL_TARGET) \
> $@

$(INSTALLED_RAMDISK_TARGET).mtk.header: $(INSTALLED_RAMDISK_TARGET)
size=$$($(call get-file-size,$(INSTALLED_RAMDISK_TARGET))); \
$(call make_header, $$((size)), "ROOTFS", $@)
$(INSTALLED_RAMDISK_TARGET).mtk: $(INSTALLED_RAMDISK_TARGET).mtk.header
$(call pretty,"Adding MTK header to ramdisk.")
cat $(INSTALLED_RAMDISK_TARGET).mtk.header $(INSTALLED_RAMDISK_TARGET) \
> $@

$(PRODUCT_OUT)/recovery_kernel.mtk.header: $(recovery_kernel)
size=$$($(call get-file-size,$(recovery_kernel))); \
$(call make_header, $$((size)), "KERNEL", $@)
$(PRODUCT_OUT)/recovery_kernel.mtk: $(PRODUCT_OUT)/recovery_kernel.mtk.header
$(call pretty,"Adding MTK header to recovery kernel.")
cat $(PRODUCT_OUT)/recovery_kernel.mtk.header $(recovery_kernel) > $@

$(recovery_ramdisk).mtk.header: $(recovery_ramdisk)
size=$$($(call get-file-size,$(recovery_ramdisk))); \
$(call make_header, $$((size)), "RECOVERY", $@)
$(recovery_ramdisk).mtk: $(MKBOOTIMG) $(recovery_ramdisk).mtk.header
$(call pretty,"Adding MTK header to recovery ramdisk.")
cat $(recovery_ramdisk).mtk.header $(recovery_ramdisk) > $@

INTERNAL_MTK_BOOTIMAGE_ARGS := \
--kernel $(INSTALLED_KERNEL_TARGET).mtk \
--ramdisk $(INSTALLED_RAMDISK_TARGET).mtk

$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG)\
$(INSTALLED_RAMDISK_TARGET).mtk $(INSTALLED_KERNEL_TARGET).mtk
$(call pretty,"Target boot image: $@")
$(MKBOOTIMG) $(INTERNAL_MTK_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) \
--output $@
$(hide) $(call assert-max-image-size,$@, \
$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
@echo -e ${CL_CYN}"Made boot image: $@"${CL_RST}

INTERNAL_MTK_RECOVERYIMAGE_ARGS := \
--kernel $(INSTALLED_KERNEL_TARGET).mtk \
--ramdisk $(recovery_ramdisk).mtk

$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) \
$(recovery_ramdisk).mtk $(INSTALLED_KERNEL_TARGET).mtk
@echo -e ${CL_CYN}"----- Making recovery image ------"${CL_RST}
$(MKBOOTIMG) $(INTERNAL_MTK_RECOVERYIMAGE_ARGS) \
$(BOARD_MKBOOTIMG_ARGS) --output $@
$(hide) $(call assert-max-image-size,$@, \
$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
@echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
1 change: 1 addition & 0 deletions roomservice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<project name="cmtank/device_amazon_tank" path="device/amazon/tank" remote="github" revision="cm-12.1" />
<project name="cmtank/vendor_amazon_tank" path="vendor/amazon/tank" remote="github" revision="cm-12.1" />
<project name="cmtank/android_kernel_amazon_mt8127" path="kernel/amazon/mt8127" remote="github" revision="cm-12.1" />

<project name="LineageOS/android_hardware_broadcom_wlan" path="hardware/broadcom/wlan" remote="github" revision="cm-12.1" />

Expand Down
11 changes: 11 additions & 0 deletions rootdir/fstab.mt8127
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 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
/dev/block/platform/mtk-msdc.0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,resize,encryptable=footer
/dev/block/platform/mtk-msdc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
/devices/platform/mtk-msdc.0/mmc_host auto vfat defaults voldmanaged=sdcard0:emmc@fat,noemulatedsd
/devices/platform/mtk-msdc.1/mmc_host auto vfat defaults voldmanaged=sdcard1:auto,noemulatedsd
/devices/platform/mt_usb auto vfat defaults voldmanaged=usbotg:auto
/dev/block/zram0 none swap defaults zramsize=268435456
/dev/block/platform/mtk-msdc.0/by-name/MISC /misc emmc defaults defaults
46 changes: 46 additions & 0 deletions rootdir/init.base.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) 2013, The Linux Foundation. All rights reserved.
# Not a Contribution.
#
# Copyright (C) 2012 The Android Open Source Project
#
# IMPORTANT: Do not create world writable files or directories.
# This is a common source of Android security bugs.
#
# MTK variant
#
# init.rc content unique to Mediatek devices should go here. Otherwise,
# put it in the common init.rc

on boot
# Adjust minimum free memory space (default is 2.5M)
write /proc/sys/vm/min_free_kbytes 16384

on init
mkdir /config 0500 root root

service drm /system/bin/drmserver
class main
user drm
group drm system inet drmrpc

service media /system/bin/mediaserver
class main
user media
##ACOS_MOD_BEGIN {asset_storage}
group audio camera inet net_bt net_bt_admin net_bw_acct drmrpc mediadrm drm amz_group media
##ACOS_MOD_END {asset_storage}
onrestart restart drm
ioprio rt 4

service keystore /system/bin/keystore /data/misc/keystore
class main
user keystore
group keystore drmrpc

service ril-daemon /system/bin/rild
class main
socket rild stream 660 root radio
socket rild-debug stream 660 radio system
user root
disabled
group radio cache inet misc audio sdcard_r sdcard_rw log dhcp net_admin
11 changes: 11 additions & 0 deletions rootdir/init.charging.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import init.fulldump.rc

on charger
mount ext4 /dev/block/platform/mtk-msdc.0/by-name/system /system ro wait
start kpoc_charger

service kpoc_charger /system/bin/kpoc_charger
user root
group root
class charger

Loading

0 comments on commit 6fda789

Please sign in to comment.