Skip to content

Commit

Permalink
a3y17lte: Add init
Browse files Browse the repository at this point in the history
  • Loading branch information
ch8matt committed May 13, 2018
0 parents commit 82aee20
Show file tree
Hide file tree
Showing 13 changed files with 338 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
sudo: required
services:
- docker
before_install:
- docker pull yshalsager/cyanogenmod:latest
before_script:
- cd $HOME && mkdir twrp
- wget -q https://github.com/TwrpBuilder/twrp-sources/releases/download/omni_twrp-5.1.1-20180211/omni_twrp-5.1.1-20180211-norepo.tar.xz
-O $HOME/twrp.tar.xz
- tar -xJf twrp.tar.xz --directory $HOME/twrp/ && rm twrp.tar.xz
script:
- cd $HOME/twrp/ && git clone https://github.com/TwrpBuilder/android_device_a3y17lte.git device/samsung/a3y17lte
- git clone https://github.com/TwrpBuilder/device_generic_twrpbuilder.git device/generic/twrpbuilder
- rm -rf bootable/recovery && git clone https://github.com/omnirom/android_bootable_recovery.git bootable/recovery
- |
docker run --rm -i -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/home/cmbuild/twrp/:rw,z" yshalsager/cyanogenmod bash << EOF
cd /home/cmbuild/twrp/
source build/envsetup.sh && lunch omni_a3y17lte-userdebug && make -j16 recoveryimage
exit
EOF
after_success:
- export version=$(cat bootable/recovery/variables.h | grep "define TW_MAIN_VERSION_STR" | cut -d '"' -f2)
- cp $HOME/twrp/out/target/product/a3y17lte/recovery.img $HOME/twrp/TWRP-$version-a3y17lte-$(date +"%Y%m%d").img

deploy:
skip_cleanup: true
provider: releases
api_key: "$GIT_OAUTH_TOKEN_TB"
file_glob: true
file: $HOME/twrp/*.img
on:
tags: false
repo: TwrpBuilder/android_device_a3y17lte
branch: master

branches:
except:
- /^(?i:untagged)-.*$/
23 changes: 23 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (C) 2018 The TwrpBuilder 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.
#

ifneq ($(filter a3y17lte,$(TARGET_DEVICE)),)

LOCAL_PATH := device/samsung/a3y17lte

include $(call all-makefiles-under,$(LOCAL_PATH))

endif
19 changes: 19 additions & 0 deletions AndroidProducts.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (C) 2018 The TwrpBuilder 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.
#

LOCAL_PATH := device/samsung/a3y17lte

PRODUCT_MAKEFILES := $(LOCAL_PATH)/omni_a3y17lte.mk
34 changes: 34 additions & 0 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# Copyright (C) 2018 The TwrpBuilder 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.
#

LOCAL_PATH := device/samsung/a3y17lte

TARGET_BOARD_PLATFORM := exynos5
TARGET_BOOTLOADER_BOARD_NAME := a3y17lte

# Recovery
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 39845888
BOARD_FLASH_BLOCK_SIZE := 1000000
BOARD_HAS_NO_REAL_SDCARD := true
TW_EXCLUDE_SUPERSU := true
include $(LOCAL_PATH)/kernel.mk
BOARD_CUSTOM_BOOTIMG_MK := device/generic/twrpbuilder/seEnforcing.mk
include device/generic/twrpbuilder/BoardConfig32.mk

# Init
TARGET_INIT_VENDOR_LIB := libinit_sec

Binary file added dt.img
Binary file not shown.
30 changes: 30 additions & 0 deletions init/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright (C) 2018 The LineageOS 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.
#

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := \
system/core/base/include \
system/core/init
LOCAL_CFLAGS := -Wall -DANDROID_TARGET=\"$(TARGET_BOARD_PLATFORM)\"
LOCAL_SRC_FILES := init_sec.cpp
LOCAL_MODULE := libinit_sec
LOCAL_STATIC_LIBRARIES += libbase

include $(BUILD_STATIC_LIBRARY)
96 changes: 96 additions & 0 deletions init/init.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

/*
Copyright (c) 2018, The Lineage Project. 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.
*/

#include <stdlib.h>
#include <string.h>
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>

#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <android-base/properties.h>

#include "property_service.h"
#include "vendor_init.h"

using android::base::GetProperty;
using android::base::ReadFileToString;
using android::base::Trim;

void property_override(char const prop[], char const value[])
{
prop_info *pi;

pi = (prop_info*) __system_property_find(prop);
if (pi)
__system_property_update(pi, value, strlen(value));
else
__system_property_add(prop, strlen(prop), value, strlen(value));
}

void property_override_dual(char const system_prop[],
char const vendor_prop[], char const value[])
{
property_override(system_prop, value);
property_override(vendor_prop, value);
}


void vendor_load_properties()
{
std::string platform;
std::string bootloader = GetProperty("ro.bootloader", "");
std::string device;

platform = GetProperty("ro.board.platform", "");
if (platform != ANDROID_TARGET)
return;

if (bootloader.find("A320F") != std::string::npos) {

/* SM-A320F */
property_override_dual("ro.product.model", "ro.vendor.product.model", "SM-A320F");
property_override_dual("ro.product.device", "ro.vendor.product.device", "a3y17ltexx");

} else if (bootloader.find("A320Y") != std::string::npos) {

/* SM-A320Y */
property_override_dual("ro.product.model", "ro.vendor.product.model", "SM-A320Y");
property_override_dual("ro.product.device", "ro.vendor.product.device", "a3y17ltelk");

} else if (bootloader.find("A320FL") != std::string::npos) {

/* SM-A320FL */
property_override_dual("ro.product.model", "ro.vendor.product.model", "SM-A320FL");
property_override_dual("ro.product.device", "ro.vendor.product.device", "a3xeltexc");


}

}
Binary file added kernel
Binary file not shown.
22 changes: 22 additions & 0 deletions kernel.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright (C) 2018 The TwrpBuilder 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.
#

# Kernel
TARGET_PREBUILT_KERNEL := device/samsung/a3y17lte/kernel
BOARD_KERNEL_CMDLINE := androidboot.selinux=permissive
BOARD_KERNEL_BASE := 0x10000000
BOARD_KERNEL_PAGESIZE := 2048
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --dt device/samsung/a3y17lte/dt.img
25 changes: 25 additions & 0 deletions omni_a3y17lte.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Copyright (C) 2018 The TwrpBuilder 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.
#

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

PRODUCT_COPY_FILES += device/samsung/a3y17lte/kernel:kernel

PRODUCT_DEVICE := a3y17lte
PRODUCT_NAME := omni_a3y17lte
PRODUCT_BRAND := samsung
PRODUCT_MODEL := SM-A320FL
PRODUCT_MANUFACTURER := samsung
17 changes: 17 additions & 0 deletions recovery.fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/boot emmc /dev/block/platform/13540000.dwmmc0/by-name/BOOT
/cache ext4 /dev/block/platform/13540000.dwmmc0/by-name/CACHE
/data ext4 /dev/block/platform/13540000.dwmmc0/by-name/USERDATA length=-16384
/recovery emmc /dev/block/platform/13540000.dwmmc0/by-name/RECOVERY
/system ext4 /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM
/efs emmc /dev/block/platform/13540000.dwmmc0/by-name/EFS flags=display="EFS";backup=1
/radio emmc /dev/block/platform/13540000.dwmmc0/by-name/RADIO flags=display="Modem";backup=1
/cpefs emmc /dev/block/platform/13540000.dwmmc0/by-name/CPEFS flags=display="CPEFS";backup=1


/system_image emmc /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM
/cache_image emmc /dev/block/platform/13540000.dwmmc0/by-name/CACHE
/radio_image emmc /dev/block/platform/13540000.dwmmc0/by-name/RADIO
/hidden_image emmc /dev/block/platform/13540000.dwmmc0/by-name/HIDDEN

/external_sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="Micro SDcard";storage;wipeingui;removable
/usb-otg vfat /dev/block/sdd1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable
17 changes: 17 additions & 0 deletions stock/mke2fs.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[defaults]
base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr
blocksize = 4096
inode_size = 256
inode_ratio = 16384

[fs_types]
ext2 = {

}
ext3 = {
features = has_journal
}
ext4 = {
features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
inode_size = 256
}
17 changes: 17 additions & 0 deletions stock/recovery.fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/boot emmc /dev/block/platform/13540000.dwmmc0/by-name/BOOT
/cache ext4 /dev/block/platform/13540000.dwmmc0/by-name/CACHE
/data ext4 /dev/block/platform/13540000.dwmmc0/by-name/USERDATA length=-16384
/recovery emmc /dev/block/platform/13540000.dwmmc0/by-name/RECOVERY
/system ext4 /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM
/efs emmc /dev/block/platform/13540000.dwmmc0/by-name/EFS flags=display="EFS";backup=1
/radio emmc /dev/block/platform/13540000.dwmmc0/by-name/RADIO flags=display="Modem";backup=1
/cpefs emmc /dev/block/platform/13540000.dwmmc0/by-name/CPEFS flags=display="CPEFS";backup=1


/system_image emmc /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM
/cache_image emmc /dev/block/platform/13540000.dwmmc0/by-name/CACHE
/radio_image emmc /dev/block/platform/13540000.dwmmc0/by-name/RADIO
/hidden_image emmc /dev/block/platform/13540000.dwmmc0/by-name/HIDDEN

/external_sdcard vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="Micro SDcard";storage;wipeingui;removable
/usb-otg vfat /dev/block/sdd1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable

0 comments on commit 82aee20

Please sign in to comment.