From fddb618c794bce4862c81983de81a5e392512eef Mon Sep 17 00:00:00 2001 From: Arnav Gupta Date: Wed, 18 Jul 2012 00:12:20 +0530 Subject: [PATCH] initial device config (minimal) for bootimage creation Signed-off-by: Arnav Gupta --- Android.mk | 6 +++ AndroidBoard.mk | 19 ++++++++++ AndroidProducts.mk | 29 ++++++++++++++ BoardConfig.mk | 9 +++++ CleanSpec.mk | 49 ++++++++++++++++++++++++ cm.mk | 35 +++++++++++++++++ extract-files.sh | 33 ++++++++++++++++ full_nypon.mk | 15 ++++++++ prebuilt/bootrec-device | 16 ++++++++ prebuilt/kernel | 1 + proprietary-files.txt | 1 + recovery.fstab | 6 +++ recovery/recovery_keys.c | 60 +++++++++++++++++++++++++++++ setup-makefiles.sh | 81 ++++++++++++++++++++++++++++++++++++++++ vendorsetup.sh | 3 ++ 15 files changed, 363 insertions(+) create mode 100644 Android.mk create mode 100644 AndroidBoard.mk create mode 100644 AndroidProducts.mk create mode 100644 BoardConfig.mk create mode 100644 CleanSpec.mk create mode 100644 cm.mk create mode 100644 extract-files.sh create mode 100644 full_nypon.mk create mode 100644 prebuilt/bootrec-device create mode 100644 prebuilt/kernel create mode 100644 proprietary-files.txt create mode 100644 recovery.fstab create mode 100644 recovery/recovery_keys.c create mode 100755 setup-makefiles.sh create mode 100755 vendorsetup.sh diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..935fd67 --- /dev/null +++ b/Android.mk @@ -0,0 +1,6 @@ +LOCAL_PATH := $(call my-dir) +# if some modules are built directly from this directory (not subdirectories), +# their rules should be written here. +ifeq ($(TARGET_DEVICE),nypon) + include $(call all-makefiles-under,$(LOCAL_PATH)) +endif diff --git a/AndroidBoard.mk b/AndroidBoard.mk new file mode 100644 index 0000000..609c27c --- /dev/null +++ b/AndroidBoard.mk @@ -0,0 +1,19 @@ +# Copyright (C) 2007 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. + +LOCAL_PATH := $(call my-dir) + +# Least specific includes go first, so that they can get +# overridden further down +include $(CLEAR_VARS) diff --git a/AndroidProducts.mk b/AndroidProducts.mk new file mode 100644 index 0000000..a0ab11f --- /dev/null +++ b/AndroidProducts.mk @@ -0,0 +1,29 @@ +# +# Copyright (C) 2008 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. +# + +# +# This file should set PRODUCT_MAKEFILES to a list of product makefiles +# to expose to the build system. LOCAL_DIR will already be set to +# the directory containing this file. +# +# This file may not rely on the value of any variable other than +# LOCAL_DIR; do not use any conditionals, and do not look up the +# value of any variable that isn't set in this file or in a file that +# it includes. +# + +PRODUCT_MAKEFILES := \ + $(LOCAL_DIR)/full_nypon.mk diff --git a/BoardConfig.mk b/BoardConfig.mk new file mode 100644 index 0000000..4670175 --- /dev/null +++ b/BoardConfig.mk @@ -0,0 +1,9 @@ +-include device/sony/u8500_common/BoardConfigCommon.mk + +TARGET_KERNEL_SOURCE := kernel/sony/u8500 +#TARGET_KERNEL_CONFIG := cyanogen_zeus_defconfig +TARGET_PREBUILT_KERNEL := device/semc/zeus/prebuilt/kernel + +BOARD_CUSTOM_RECOVERY_KEYMAPPING := ../../device/sony/nypon/recovery/recovery_keys.c + +TARGET_OTA_ASSERT_DEVICE := LT22i,LT22a,nypon,Sola,LT22 diff --git a/CleanSpec.mk b/CleanSpec.mk new file mode 100644 index 0000000..cc9849f --- /dev/null +++ b/CleanSpec.mk @@ -0,0 +1,49 @@ +# Copyright (C) 2007 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. +# + +# If you don't need to do a full clean build but would like to touch +# a file or delete some intermediate files, add a clean step to the end +# of the list. These steps will only be run once, if they haven't been +# run before. +# +# E.g.: +# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) +# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) +# +# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with +# files that are missing or have been moved. +# +# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. +# Use $(OUT_DIR) to refer to the "out" directory. +# +# If you need to re-do something that's already mentioned, just copy +# the command and add it to the bottom of the list. E.g., if a change +# that you made last week required touching a file and a change you +# made today requires touching the same file, just copy the old +# touch step and add it to the end of the list. +# +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ + +# For example: +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) +#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) +#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) +#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) + +# ************************************************ +# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST +# ************************************************ diff --git a/cm.mk b/cm.mk new file mode 100644 index 0000000..4dc0d8a --- /dev/null +++ b/cm.mk @@ -0,0 +1,35 @@ +# Release name +PRODUCT_RELEASE_NAME := LT22i +# Inherit some common CM stuff. +$(call inherit-product, vendor/cm/config/common_full_phone.mk) +# Inherit device configuration +$(call inherit-product, device/sony/nypon/full_nypon.mk) +## Device identifier. This must come after all inclusions +PRODUCT_DEVICE := nypon +PRODUCT_NAME := cm_nypon +PRODUCT_BRAND := Sony +PRODUCT_MODEL := LT22i +PRODUCT_MANUFACTURER := Sony + +PRODUCT_COPY_FILES += \ + bootable/recovery/res/images/icon_firmware_error.png:root/res/images/icon_firmware_error.png \ + bootable/recovery/res/images/icon_firmware_install.png:root/res/images/icon_firmware_install.png \ + bootable/recovery/res/images/icon_clockwork.png:root/res/images/icon_clockwork.png \ + bootable/recovery/res/images/icon_error.png:root/res/images/icon_error.png \ + bootable/recovery/res/images/icon_installing.png:root/res/images/icon_installing.png \ + bootable/recovery/res/images/icon_installing_overlay01.png:root/res/images/icon_installing_overlay01.png \ + bootable/recovery/res/images/icon_installing_overlay02.png:root/res/images/icon_installing_overlay02.png \ + bootable/recovery/res/images/icon_installing_overlay03.png:root/res/images/icon_installing_overlay03.png \ + bootable/recovery/res/images/icon_installing_overlay04.png:root/res/images/icon_installing_overlay04.png \ + bootable/recovery/res/images/icon_installing_overlay05.png:root/res/images/icon_installing_overlay05.png \ + bootable/recovery/res/images/icon_installing_overlay06.png:root/res/images/icon_installing_overlay06.png \ + bootable/recovery/res/images/icon_installing_overlay07.png:root/res/images/icon_installing_overlay07.png \ + bootable/recovery/res/images/indeterminate01.png:root/res/images/indeterminate01.png \ + bootable/recovery/res/images/indeterminate02.png:root/res/images/indeterminate02.png \ + bootable/recovery/res/images/indeterminate03.png:root/res/images/indeterminate03.png \ + bootable/recovery/res/images/indeterminate04.png:root/res/images/indeterminate04.png \ + bootable/recovery/res/images/indeterminate05.png:root/res/images/indeterminate05.png \ + bootable/recovery/res/images/indeterminate06.png:root/res/images/indeterminate06.png \ + bootable/recovery/res/images/progress_empty.png:root/res/images/progress_empty.png \ + bootable/recovery/res/images/progress_fill.png:root/res/images/progress_fill.png + diff --git a/extract-files.sh b/extract-files.sh new file mode 100644 index 0000000..966046c --- /dev/null +++ b/extract-files.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +VENDOR=sony +DEVICE=nypon + +BASE=../../../vendor/$VENDOR/$DEVICE/proprietary + +while getopts ":nh" options +do +case $options in + n ) NC=1 ;; + h ) echo "Usage: `basename $0` [OPTIONS] " + echo " -n No clenup" + echo " -h Show this help" + exit ;; + * ) ;; + esac +done + +if [ "x$NC" != "x1" ]; +then +rm -rf $BASE/* +fi + +for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do +DIR=`dirname $FILE` + if [ ! -d $BASE/$DIR ]; then +mkdir -p $BASE/$DIR + fi +adb pull /system/$FILE $BASE/$FILE +done + +./setup-makefiles.sh diff --git a/full_nypon.mk b/full_nypon.mk new file mode 100644 index 0000000..627acbb --- /dev/null +++ b/full_nypon.mk @@ -0,0 +1,15 @@ + +$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk) + +# proprietary side of the device +$(call inherit-product-if-exists, vendor/sony/nypon/nypon-vendor.mk) + +# Set those variables here to overwrite the inherited values. +PRODUCT_DEVICE := nypon +PRODUCT_NAME := nypon +PRODUCT_BRAND := Sony +PRODUCT_MANUFACTURER := Sony +PRODUCT_MODEL := LT22i + +PRODUCT_COPY_FILES += \ + device/sony/u8500_common/prebuilt/bootrec:root/sbin/bootrec diff --git a/prebuilt/bootrec-device b/prebuilt/bootrec-device new file mode 100644 index 0000000..d3dd79f --- /dev/null +++ b/prebuilt/bootrec-device @@ -0,0 +1,16 @@ +#!/sbin/sh + + +# short vibration +echo '200' > /sys/class/timed_output/vibrator/enable +# softkey backlight on +echo '255' > /sys/class/leds/button-backlight/brightness +# check for volume key presses +cat /dev/input/event2 > /dev/keycheck& +# wait 3 seconds +sleep 3 + + +echo '0' > /sys/class/leds/button-backlight/brightness + +kill -9 $! diff --git a/prebuilt/kernel b/prebuilt/kernel new file mode 100644 index 0000000..f644533 --- /dev/null +++ b/prebuilt/kernel @@ -0,0 +1 @@ +empty placeholder prebuilt kernel diff --git a/proprietary-files.txt b/proprietary-files.txt new file mode 100644 index 0000000..96333d5 --- /dev/null +++ b/proprietary-files.txt @@ -0,0 +1 @@ +#we will populate this later on diff --git a/recovery.fstab b/recovery.fstab new file mode 100644 index 0000000..4d3ba9f --- /dev/null +++ b/recovery.fstab @@ -0,0 +1,6 @@ +# mount point fstype device [device2] fstype2 +/cache ext4 /dev/block/mmcblk0p12 +/data ext4 /dev/block/mmcblk0p11 +/system ext4 /dev/block/mmcblk0p10 +/sdcard vfat /dev/block/mmcblk0p14 +/boot emmc /dev/block/mmcblk0p9 diff --git a/recovery/recovery_keys.c b/recovery/recovery_keys.c new file mode 100644 index 0000000..0595d60 --- /dev/null +++ b/recovery/recovery_keys.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 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. + */ +#include +#include "recovery_ui.h" +#include "common.h" +#include "extendedcommands.h" +int device_toggle_display(volatile char* key_pressed, int key_code) { + // hold power and press volume-up + return key_pressed[KEY_POWER] && key_code == KEY_VOLUMEUP; +} +int device_handle_key(int key_code, int visible) { + if (visible) { + switch (key_code) { + case KEY_CAPSLOCK: + case KEY_DOWN: + case KEY_VOLUMEDOWN: + case KEY_MENU: + return HIGHLIGHT_DOWN; + case KEY_LEFTSHIFT: + case KEY_UP: + case KEY_VOLUMEUP: + return HIGHLIGHT_UP; + case KEY_POWER: + if (ui_get_showing_back_button()) { + return SELECT_ITEM; + } + break; + case KEY_HOME: + case KEY_LEFTBRACE: + case KEY_ENTER: + case BTN_MOUSE: + case KEY_CAMERA: + case KEY_F21: + case KEY_SEND: + return SELECT_ITEM; + case KEY_END: + case KEY_BACKSPACE: + case KEY_SEARCH: + if (ui_get_showing_back_button()) { + return SELECT_ITEM; + } + case KEY_BACK: + return GO_BACK; + } + } + return NO_ACTION; +} \ No newline at end of file diff --git a/setup-makefiles.sh b/setup-makefiles.sh new file mode 100755 index 0000000..e1cfc0d --- /dev/null +++ b/setup-makefiles.sh @@ -0,0 +1,81 @@ +#!/bin/sh + +VENDOR=sony +DEVICE=nypon +OUTDIR=vendor/$VENDOR/$DEVICE +MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk + +(cat << EOF) > $MAKEFILE +# Copyright (C) 2011 The CyanogenMod 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. + +# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh + +# Prebuilt libraries that are needed to build open-source libraries +#PRODUCT_COPY_FILES += \\ +#$OUTDIR/proprietary/lib/libaudioalsa.so:obj/lib/libaudioalsa.so \\ +#$OUTDIR/proprietary/lib/libv8.so:obj/lib/libv8.so + +PRODUCT_COPY_FILES += \\ +EOF + +LINEEND=" \\" +COUNT=`cat proprietary-files.txt | grep -v ^# | grep -v ^$ | wc -l | awk {'print $1'}` +for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do +COUNT=`expr $COUNT - 1` + if [ $COUNT = "0" ]; then +LINEEND="" + fi +echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE +done + +(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk +# Copyright (C) 2011 The CyanogenMod 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. + +# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh + +\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk) +EOF + +(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk +# Copyright (C) 2011 The CyanogenMod 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. + +# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh + +USE_CAMERA_STUB := false +EOF diff --git a/vendorsetup.sh b/vendorsetup.sh new file mode 100755 index 0000000..c607a7c --- /dev/null +++ b/vendorsetup.sh @@ -0,0 +1,3 @@ +add_lunch_combo nypon-eng +add_lunch_combo cm_nypon-userdebug +add_lunch_combo aokp_nypon-userdebug