summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/Makefile9
-rw-r--r--tools/device/AndroidBoard.mk.template8
-rw-r--r--tools/device/AndroidProducts.mk.template2
-rw-r--r--tools/device/BoardConfig.mk.template26
-rw-r--r--tools/device/device.mk.template24
-rw-r--r--tools/device/makerecoveries.sh69
-rwxr-xr-xtools/device/mkrecoveryzip.sh97
-rwxr-xr-xtools/device/mkvendor.sh107
-rw-r--r--tools/device/recovery.fstab.template10
-rw-r--r--tools/device/system.prop.template3
10 files changed, 354 insertions, 1 deletions
diff --git a/core/Makefile b/core/Makefile
index 74e1f96..2515376 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -27,7 +27,6 @@ unique_product_copy_files_destinations :=
$(foreach cf,$(PRODUCT_COPY_FILES), \
$(eval _src := $(call word-colon,1,$(cf))) \
$(eval _dest := $(call word-colon,2,$(cf))) \
- $(call check-product-copy-files,$(cf)) \
$(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
$(info PRODUCT_COPY_FILES $(cf) ignored.), \
$(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
@@ -766,6 +765,14 @@ endif
.PHONY: recoveryimage
recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET)
+INSTALLED_RECOVERYZIP_TARGET := $(PRODUCT_OUT)/utilities/update.zip
+$(INSTALLED_RECOVERYZIP_TARGET): $(INSTALLED_RECOVERYIMAGE_TARGET) $(TARGET_OUT)/bin/updater
+ @echo ----- Making recovery zip -----
+ ./build/tools/device/mkrecoveryzip.sh $(PRODUCT_OUT) $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar
+
+.PHONY: recoveryzip
+recoveryzip: $(INSTALLED_RECOVERYZIP_TARGET)
+
ifneq ($(BOARD_NAND_PAGE_SIZE),)
mkyaffs2_extra_flags := -c $(BOARD_NAND_PAGE_SIZE)
else
diff --git a/tools/device/AndroidBoard.mk.template b/tools/device/AndroidBoard.mk.template
new file mode 100644
index 0000000..55a36d5
--- /dev/null
+++ b/tools/device/AndroidBoard.mk.template
@@ -0,0 +1,8 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET)
+
+# include the non-open-source counterpart to this file
+-include vendor/__MANUFACTURER__/__DEVICE__/AndroidBoardVendor.mk
diff --git a/tools/device/AndroidProducts.mk.template b/tools/device/AndroidProducts.mk.template
new file mode 100644
index 0000000..f31c5bf
--- /dev/null
+++ b/tools/device/AndroidProducts.mk.template
@@ -0,0 +1,2 @@
+PRODUCT_MAKEFILES := \
+ $(LOCAL_DIR)/device___DEVICE__.mk
diff --git a/tools/device/BoardConfig.mk.template b/tools/device/BoardConfig.mk.template
new file mode 100644
index 0000000..b9996b0
--- /dev/null
+++ b/tools/device/BoardConfig.mk.template
@@ -0,0 +1,26 @@
+USE_CAMERA_STUB := true
+
+# inherit from the proprietary version
+-include vendor/__MANUFACTURER__/__DEVICE__/BoardConfigVendor.mk
+
+TARGET_NO_BOOTLOADER := true
+TARGET_BOARD_PLATFORM := unknown
+TARGET_CPU_ABI := armeabi
+TARGET_BOOTLOADER_BOARD_NAME := __DEVICE__
+
+BOARD_KERNEL_CMDLINE := __CMDLINE__
+BOARD_KERNEL_BASE := 0x__BASE__
+BOARD_KERNEL_PAGESIZE := __PAGE_SIZE__
+
+# fix this up by examining /proc/mtd on a running device
+BOARD_BOOTIMAGE_PARTITION_SIZE := 0x00380000
+BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00480000
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x08c60000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x105c0000
+BOARD_FLASH_BLOCK_SIZE := 131072
+
+TARGET_PREBUILT_KERNEL := device/__MANUFACTURER__/__DEVICE__/kernel
+
+#BOARD_HAS_NO_SELECT_BUTTON := true
+# Use this flag if the board has a ext4 partition larger than 2gb
+#BOARD_HAS_LARGE_FILESYSTEM := true \ No newline at end of file
diff --git a/tools/device/device.mk.template b/tools/device/device.mk.template
new file mode 100644
index 0000000..91ffdc9
--- /dev/null
+++ b/tools/device/device.mk.template
@@ -0,0 +1,24 @@
+$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
+
+# The gps config appropriate for this device
+$(call inherit-product, device/common/gps/gps_us_supl.mk)
+
+$(call inherit-product-if-exists, vendor/__MANUFACTURER__/__DEVICE__/__DEVICE__-vendor.mk)
+
+DEVICE_PACKAGE_OVERLAYS += device/__MANUFACTURER__/__DEVICE__/overlay
+
+
+ifeq ($(TARGET_PREBUILT_KERNEL),)
+ LOCAL_KERNEL := device/__MANUFACTURER__/__DEVICE__/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___DEVICE__
+PRODUCT_DEVICE := __DEVICE__
diff --git a/tools/device/makerecoveries.sh b/tools/device/makerecoveries.sh
new file mode 100644
index 0000000..f561c81
--- /dev/null
+++ b/tools/device/makerecoveries.sh
@@ -0,0 +1,69 @@
+if [ -z "$1" ]
+then
+ echo "Please provide a lunch option."
+ return
+fi
+
+PRODUCTS=$1
+
+for product in $PRODUCTS
+do
+ echo $product
+done
+
+echo $(echo $PRODUCTS | wc -w) Products
+
+unset PUBLISHED_RECOVERIES
+
+MCP=$(which mcp)
+if [ -z "$MCP" ]
+then
+ NO_UPLOAD=true
+fi
+
+function mcpguard () {
+ if [ -z $NO_UPLOAD ]
+ then
+ mcp $1 $2
+ md5sum $1 > $1.md5sum.txt
+ mcp $1.md5sum.txt $2.md5sum.txt
+ fi
+}
+
+VERSION=$(cat bootable/recovery/Android.mk | grep RECOVERY_VERSION | grep RECOVERY_NAME | awk '{ print $4 }' | sed s/v//g)
+echo Recovery Version: $VERSION
+
+for lunchoption in $PRODUCTS
+do
+ lunch $lunchoption
+ if [ -z $NO_CLEAN ]
+ then
+ rm -rf $OUT/obj/EXECUTABLES/recovery_intermediates
+ rm -rf $OUT/recovery*
+ rm -rf $OUT/root*
+ fi
+ DEVICE_NAME=$(echo $TARGET_PRODUCT | sed s/koush_// | sed s/aosp_// | sed s/motorola// | sed s/huawei_// | sed s/htc_// | sed s/_us// | sed s/cyanogen_// | sed s/generic_// | sed s/full_//)
+ PRODUCT_NAME=$(basename $OUT)
+ make -j16 recoveryzip
+ RESULT=$?
+ if [ $RESULT != "0" ]
+ then
+ echo build error!
+ break
+ fi
+ mcpguard $OUT/recovery.img recoveries/recovery-clockwork-$VERSION-$DEVICE_NAME.img
+ mcpguard $OUT/utilities/update.zip recoveries/recovery-clockwork-$VERSION-$DEVICE_NAME.zip
+
+ if [ -f "ROMManagerManifest/devices.rb" ]
+ then
+ pushd ROMManagerManifest
+ ruby devices.rb $DEVICE_NAME $VERSION $lunchoption
+ popd
+ fi
+done
+
+for published_recovery in $PUBLISHED_RECOVERIES
+do
+ echo $published_recovery
+done
+
diff --git a/tools/device/mkrecoveryzip.sh b/tools/device/mkrecoveryzip.sh
new file mode 100755
index 0000000..e6fae37
--- /dev/null
+++ b/tools/device/mkrecoveryzip.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+OUT=$1
+SIGNAPK=$2
+
+if [ -z "$OUT" -o -z "$SIGNAPK" ]
+then
+ echo "Android build environment not detected."
+ exit 1
+fi
+
+ANDROID_ROOT=$(pwd)
+OUT=$ANDROID_ROOT/$OUT
+SIGNAPK=$ANDROID_ROOT/$SIGNAPK
+
+pushd . > /dev/null 2> /dev/null
+
+UTILITIES_DIR=$OUT/utilities
+mkdir -p $UTILITIES_DIR
+RECOVERY_DIR=$UTILITIES_DIR/recovery
+rm -rf $RECOVERY_DIR
+mkdir -p $RECOVERY_DIR
+cd $RECOVERY_DIR
+cp -R $OUT/recovery/root/etc etc
+cp -R $OUT/recovery/root/sbin sbin
+cp -R $OUT/recovery/root/res res
+SCRIPT_DIR=META-INF/com/google/android
+mkdir -p $SCRIPT_DIR
+cp $OUT/system/bin/updater $SCRIPT_DIR/update-binary
+
+
+UPDATER_SCRIPT=$SCRIPT_DIR/updater-script
+rm -f $UPDATER_SCRIPT
+touch $UPDATER_SCRIPT
+mkdir -p $(dirname $UPDATER_SCRIPT)
+
+FILES=
+SYMLINKS=
+
+for file in $(find .)
+do
+
+if [ -d $file ]
+then
+ continue
+fi
+
+META_INF=$(echo $file | grep META-INF)
+if [ ! -z $META_INF ]
+then
+ continue;
+fi
+
+if [ -h $file ]
+then
+ SYMLINKS=$SYMLINKS' '$file
+elif [ -f $file ]
+then
+ FILES=$FILES' '$file
+fi
+done
+
+
+echo 'ui_print("Replacing stock recovery with ClockworkMod recovery...");' >> $UPDATER_SCRIPT
+
+echo 'delete("sbin/recovery");' >> $UPDATER_SCRIPT
+echo 'package_extract_file("sbin/recovery", "/sbin/recovery");' >> $UPDATER_SCRIPT
+echo 'set_perm(0, 0, 0755, "/sbin/recovery");' >> $UPDATER_SCRIPT
+echo 'symlink("recovery", "/sbin/busybox");' >> $UPDATER_SCRIPT
+
+echo 'run_program("/sbin/busybox", "sh", "-c", "busybox rm -f /etc ; busybox mkdir -p /etc;");' >> $UPDATER_SCRIPT
+
+for file in $FILES
+do
+ echo 'delete("'$(echo $file | sed s!\\./!!g)'");' >> $UPDATER_SCRIPT
+ echo 'package_extract_file("'$(echo $file | sed s!\\./!!g)'", "'$(echo $file | sed s!\\./!/!g)'");' >> $UPDATER_SCRIPT
+ if [ -x $file ]
+ then
+ echo 'set_perm(0, 0, 0755, "'$(echo $file | sed s!\\./!/!g)'");' >> $UPDATER_SCRIPT
+ fi
+done
+
+for file in $SYMLINKS
+do
+ echo 'symlink("'$(readlink $file)'", "'$(echo $file | sed s!\\./!/!g)'");' >> $UPDATER_SCRIPT
+done
+
+echo 'set_perm_recursive(0, 2000, 0755, 0755, "/sbin");' >> $UPDATER_SCRIPT
+echo 'run_program("/sbin/busybox", "sh", "-c", "/sbin/killrecovery.sh");' >> $UPDATER_SCRIPT
+rm -f $UTILITIES_DIR/unsigned.zip
+rm -f $UTILITIES_DIR/update.zip
+echo zip -ry $UTILITIES_DIR/unsigned.zip . -x $SYMLINKS '*\[*' '*\[\[*'
+zip -ry $UTILITIES_DIR/unsigned.zip . -x $SYMLINKS '*\[*' '*\[\[*'
+java -jar $SIGNAPK -w $ANDROID_ROOT/build/target/product/security/testkey.x509.pem $ANDROID_ROOT/build/target/product/security/testkey.pk8 $UTILITIES_DIR/unsigned.zip $UTILITIES_DIR/update.zip
+
+echo Recovery FakeFlash is now available at $OUT/utilities/update.zip
+popd > /dev/null 2> /dev/null
diff --git a/tools/device/mkvendor.sh b/tools/device/mkvendor.sh
new file mode 100755
index 0000000..c4b499a
--- /dev/null
+++ b/tools/device/mkvendor.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+function usage
+{
+ echo Usage:
+ echo " $(basename $0) manufacturer device [boot.img]"
+ echo " The boot.img argument is the extracted recovery or boot image."
+ echo " The boot.img argument should not be provided for devices"
+ echo " that have non standard boot images (ie, Samsung)."
+ echo
+ echo Example:
+ echo " $(basename $0) motorola sholes ~/Downloads/recovery-sholes.img"
+ exit 0
+}
+
+MANUFACTURER=$1
+DEVICE=$2
+BOOTIMAGE=$3
+
+UNPACKBOOTIMG=$(which unpackbootimg)
+
+if [ -z "$MANUFACTURER" ]
+then
+ usage
+fi
+
+if [ -z "$DEVICE" ]
+then
+ usage
+fi
+
+ANDROID_TOP=$(dirname $0)/../../../
+pushd $ANDROID_TOP > /dev/null
+ANDROID_TOP=$(pwd)
+popd > /dev/null
+
+TEMPLATE_DIR=$(dirname $0)
+pushd $TEMPLATE_DIR > /dev/null
+TEMPLATE_DIR=$(pwd)
+popd > /dev/null
+
+DEVICE_DIR=$ANDROID_TOP/device/$MANUFACTURER/$DEVICE
+
+if [ ! -z "$BOOTIMAGE" ]
+then
+ if [ -z "$UNPACKBOOTIMG" ]
+ then
+ echo unpackbootimg not found. Is your android build environment set up and have the host tools been built?
+ exit 0
+ fi
+
+ BOOTIMAGEFILE=$(basename $BOOTIMAGE)
+
+ echo Output will be in $DEVICE_DIR
+ mkdir -p $DEVICE_DIR
+
+ TMPDIR=/tmp/bootimg
+ rm -rf $TMPDIR
+ mkdir -p $TMPDIR
+ cp $BOOTIMAGE $TMPDIR
+ pushd $TMPDIR > /dev/null
+ unpackbootimg -i $BOOTIMAGEFILE > /dev/null
+ mkdir ramdisk
+ pushd ramdisk > /dev/null
+ gunzip -c ../$BOOTIMAGEFILE-ramdisk.gz | cpio -i
+ popd > /dev/null
+ BASE=$(cat $TMPDIR/$BOOTIMAGEFILE-base)
+ CMDLINE=$(cat $TMPDIR/$BOOTIMAGEFILE-cmdline)
+ PAGESIZE=$(cat $TMPDIR/$BOOTIMAGEFILE-pagesize)
+ export SEDCMD="s#__CMDLINE__#$CMDLINE#g"
+ echo $SEDCMD > $TMPDIR/sedcommand
+ cp $TMPDIR/$BOOTIMAGEFILE-zImage $DEVICE_DIR/kernel
+ popd > /dev/null
+else
+ mkdir -p $DEVICE_DIR
+ touch $DEVICE_DIR/kernel
+ BASE=10000000
+ CMDLINE=no_console_suspend
+ PAGESIZE=00000800
+ export SEDCMD="s#__CMDLINE__#$CMDLINE#g"
+ echo $SEDCMD > $TMPDIR/sedcommand
+fi
+
+for file in $(find $TEMPLATE_DIR -name '*.template')
+do
+ OUTPUT_FILE=$DEVICE_DIR/$(basename $(echo $file | sed s/\\.template//g))
+ cat $file | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g | sed -f $TMPDIR/sedcommand | sed s/__BASE__/$BASE/g | sed s/__PAGE_SIZE__/$PAGESIZE/g > $OUTPUT_FILE
+done
+
+if [ ! -z "$TMPDIR" ]
+then
+ RECOVERY_FSTAB=$TMPDIR/ramdisk/etc/recovery.fstab
+ if [ -f "$RECOVERY_FSTAB" ]
+ then
+ cp $RECOVERY_FSTAB $DEVICE_DIR/recovery.fstab
+ fi
+fi
+
+
+mv $DEVICE_DIR/device.mk $DEVICE_DIR/device_$DEVICE.mk
+
+
+echo Done!
+echo Use the following command to set up your build environment:
+echo ' 'lunch full_$DEVICE-eng
+echo And use the follwowing command to build a recovery:
+echo ' '. build/tools/device/makerecoveries.sh full_$DEVICE-eng \ No newline at end of file
diff --git a/tools/device/recovery.fstab.template b/tools/device/recovery.fstab.template
new file mode 100644
index 0000000..41fb92e
--- /dev/null
+++ b/tools/device/recovery.fstab.template
@@ -0,0 +1,10 @@
+# mount point fstype device [device2]
+
+/boot mtd boot
+/cache yaffs2 cache
+/data yaffs2 userdata
+/misc mtd misc
+/recovery mtd recovery
+/sdcard vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0
+/system yaffs2 system
+/sd-ext ext4 /dev/block/mmcblk0p2
diff --git a/tools/device/system.prop.template b/tools/device/system.prop.template
new file mode 100644
index 0000000..4113929
--- /dev/null
+++ b/tools/device/system.prop.template
@@ -0,0 +1,3 @@
+#
+# system.prop for __DEVICE__
+#