diff --git a/.gitignore b/.gitignore index cc4e0cff..b87caa71 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,10 @@ modules.builtin *.lzo *.patch *.gcno +*.log +*bzImage +*zImage +*.zip # # Top-level generic files diff --git a/arch/x86/configs/zenfone2_defconfig b/arch/x86/configs/zenfone2_defconfig index 4b699eae..0fa0a15e 100755 --- a/arch/x86/configs/zenfone2_defconfig +++ b/arch/x86/configs/zenfone2_defconfig @@ -56,7 +56,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y +# CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y CONFIG_HAVE_KERNEL_LZMA=y diff --git a/buildzf2 b/buildzf2 new file mode 100755 index 00000000..10855300 --- /dev/null +++ b/buildzf2 @@ -0,0 +1,138 @@ +#!/bin/bash + +export ARCH=x86_64 +export CCOMPILE=$CROSS_COMPILE +export CROSS_COMPILE=x86_64-linux-android- + +#Change Toolchain GCC versions from here +#But I personally prefer Google's x86_64-linux-android-4.9 +GCC_VERSION=4.9 + +TC_PREFIX=x86_64-linux-android +TOOLCHAIN=$TC_PREFIX-$GCC_VERSION +CUR_DIR=$PWD + +clear + +echo "---------------SETTING UP ENVIRONMENT---------------" +start=`date +%s` +NOW=$(date +"%d-%m-%Y") +echo "Current Date : $NOW" +echo "Applying Build Settings" +export SLEEP=1 +echo "Setting CPU Cores/Threads" +export CPUS=`nproc` +echo "Setting Version Number" +export VER=v1$1 +echo "Setting Defconfig" +export DEFCONFIG=zenfone2_defconfig +echo "Setting bzImage Location" +export BZIMAGE=arch/x86/boot/bzImage +echo "Environment Setup Complete Now Moving To Compiling" +echo "" +echo "" +echo "" +echo "-----CHECKING IF TOOLCHAIN IS IN CORRECT PATH-------" +sleep $SLEEP +cd .. +TC=$PWD +if [ -f $TC/$TOOLCHAIN/bin/$TC_PREFIX-gcc ]; +then + cd $CUR_DIR + echo "ToolChain exists" + echo "Starting Compilation" + echo "SETTING TOOLCHAIN PATH : $TC/$TOOLCHAIN/bin" + export PATH=$TC/$TOOLCHAIN/bin-ccache:$TC/$TOOLCHAIN/bin:$PATH + echo "" + echo "" + echo "" + sleep $SLEEP + echo "------------------COMPILING----------------------" +else + echo "Could not find toolchain at $TC/$TOOLCHAIN/" + echo "DOWNLOADING TOOLCAHIN" + git clone https://github.com/Zenfone2-development/x86_64-linux-android-$GCC_VERSION + echo "Starting Compilation" + echo "SETTING TOOLCHAIN PATH : $TC/$TOOLCHAIN/bin" + export PATH=$TC/$TOOLCHAIN/bin-ccache:$TC/$TOOLCHAIN/bin:$PATH + echo "" + echo "" + echo "" + sleep $SLEEP + cd $CUR_DIR + echo "------------------COMPILING----------------------" +fi + + + +#Build +sleep $SLEEP +#make clean +echo "Starting Build Process" +export USE_CCACHE=1 +sleep $SLEEP +if [ -f .config ]; +then + echo ".config exists" + echo "Starting Compilation" + echo "" + echo "" + echo "" + echo "------------------COMPILING----------------------" + sleep $SLEEP +else + echo ".config Does Not Exists" + echo "Compiling From $DEFCONFIG" + make $DEFCONFIG + echo "Starting Compilation" + sleep $SLEEP +fi +make $EV -j$CPUS 2>&1 | tee build.log + +if [ -f $BZIMAGE ]; +then + echo "$BZIMAGE exists" + echo "-------------------SUCCESS-----------------------" + echo "" + echo "" + echo "" + sleep $SLEEP +else + echo "-----------------------------------ERROR------------------------------------" + echo " Failed to compile. Please Check *build.log* For Compile Errors" + echo "-----------------------------------ERROR------------------------------------" + echo "exiting script" + sleep $SLEEP + exit 0 +fi + +clear +echo "--------------------PACKING-------------------------" +echo "Starting Packing To Recovery Flashable Zip" +cd out/ +echo "Removing Old Files" +rm -rf bzImage *.zip +sleep $SLEEP +echo "Copying bzImage" +mv ../arch/x86/boot/bzImage bzImage +sleep $SLEEP +echo "Compiling Atom7_"$VER".zip" +find . -type f -exec zip Atom7_"$VER".zip {} + +nowf=$(date +"%T") +cd .. +echo "Current Date : $NOW" +echo "Applying Build Settings : done" +echo "Version Number = $VER" +echo "cleaning previous files : done" +echo "Starting Build Process : done" +echo "Build complete" + +end=`date +%s` +runtime=$((end-start)) +echo "Completion Time :" +echo "$runtime sec\n" + +echo "------------------- CLEANING------------------------" +make clean && make mrproper +echo "----------------------DONE--------------------------" + diff --git a/out/META-INF/com/google/android/update-binary b/out/META-INF/com/google/android/update-binary new file mode 100644 index 00000000..7084c927 --- /dev/null +++ b/out/META-INF/com/google/android/update-binary @@ -0,0 +1,84 @@ +#!/sbin/sh +# AnyKernel2 Backend +# osm0sis @ xda-developers + +OUTFD=/proc/self/fd/$2; +ZIP="$3"; +DIR=`dirname "$ZIP"`; + +ui_print() { + until [ ! "$1" ]; do + echo -e "ui_print $1\nui_print" > $OUTFD; + shift; + done; +} +show_progress() { echo "progress $1 $2" > $OUTFD; } +set_perm_recursive() { + dirs=$(echo $* | awk '{ print substr($0, index($0,$5)) }'); + for i in $dirs; do + chown -R $1.$2 $i; chown -R $1:$2 $i; + find "$i" -type d -exec chmod $3 {} +; + find "$i" -type f -exec chmod $4 {} +; + done; +} +file_getprop() { grep "^$2" "$1" | cut -d= -f2; } +getprop() { test -e /sbin/getprop && /sbin/getprop $1 || file_getprop /default.prop $1; } +abort() { ui_print "$*"; exit 1; } + +show_progress 1.34 4; +ui_print " "; +mkdir -p /tmp/anykernel; +cd /tmp/anykernel; +unzip -o "$ZIP"; + +ui_print "$(file_getprop /tmp/anykernel/anykernel.sh kernel.string)"; +ui_print "=========================================="; +ui_print " Atom7 by @rb_rasekar "; +ui_print "=========================================="; + +/sbin/busybox mount /system; + +if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.devicecheck)" == 1 ]; then + ui_print "Checking device..."; + ui_print " "; + for i in 1 2 3 4 5; do + testname="$(file_getprop /tmp/anykernel/anykernel.sh device.name$i)"; + if [ "$(getprop ro.product.device)" == "$testname" -o "$(getprop ro.build.product)" == "$testname" ]; then + match=1; + fi; + done; + if [ "$match" != 1 ]; then + umount /system; + abort "Unsupported device. Aborting..."; + fi; +fi; + +if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.initd)" == 1 ]; then + ui_print "Creating init.d..."; + ui_print " "; + mkdir /system/etc/init.d; + set_perm_recursive 0 0 0755 0755 /system/etc/init.d; +fi; + +ui_print "Installing Atom7 kernel..."; +/sbin/sh /tmp/anykernel/anykernel.sh; +if [ "$(cat /tmp/anykernel/exitcode)" == 1 ]; then + umount /system; + abort; +fi; + +if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.modules)" == 1 ]; then + ui_print "Pushing modules..."; + ui_print " "; + cp -f /tmp/anykernel/modules/* /system/lib/modules/; + set_perm_recursive 0 0 0755 0644 /system/lib/modules; +fi; + +if [ "$(file_getprop /tmp/anykernel/anykernel.sh do.cleanup)" == 1 ]; then + rm -rf /tmp/anykernel; +fi; + +umount /system; +ui_print " "; +ui_print "Reboot and enjoy ;)"; + diff --git a/out/META-INF/com/google/android/updater-script b/out/META-INF/com/google/android/updater-script new file mode 100644 index 00000000..8582673c --- /dev/null +++ b/out/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +# Dummy file; update-binary is a shell script. diff --git a/out/README b/out/README new file mode 100644 index 00000000..95f68d67 --- /dev/null +++ b/out/README @@ -0,0 +1,63 @@ +AnyKernel 2.0 - Flashable Zip Template for Kernel Releases with Ramdisk Modifications +by osm0sis @ xda-developers + +"AnyKernel is a template for an update.zip that can apply any kernel to any ROM, regardless of ramdisk." - Koush + +AnyKernel2 pushes the format even further by allowing kernel developers to modify the underlying ramdisk for kernel feature support easily using a number of included command methods along with properties and variables. + +A working script based on DirtyV Kernel for Galaxy Nexus (tuna) is included for reference. + +// Properties / Variables + +kernel.string=KernelName by YourName @ xda-developers +do.devicecheck=1 +do.initd=1 +do.modules=1 +do.cleanup=1 +device.name1=maguro +device.name2=toro +device.name3=toroplus +block=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot; + +do.devicecheck=1 specified requires at least device.name1 to be present. This should match ro.product.device or ro.build.product for your device. There is support for up to 5 device.name# properties. + +do.initd=1 will create the init.d directory in /system/etc/init.d/ and apply 755 permissions. + +do.modules=1 will push the contents of the module directory to /system/lib/modules/ and apply 644 permissions. + +do.cleanup=0 will keep the zip from removing it's working directory in /tmp/anykernel - this can be useful if trying to debug in adb shell whether the patches worked correctly. + +// Command Methods + +dump_boot +backup_file +replace_string +insert_line +replace_line +remove_line +prepend_file +append_file +replace_file +write_boot + +"if search string" is the string it looks for to decide whether it needs to add the tweak or not, so generally something to indicate the tweak already exists. + +Similarly, "line match string" and "line replace string" are the search strings that locate where the modification needs to be made for those commands. + +"before/after" requires you simply specify "before" or "after" for the placement of the inserted line, in relation to "line match string". + +You may also use ui_print "" to write messages back to the recovery during the modification process. + +// Instructions + +1- Place zImage in the root (dtb should also go here for devices that require a custom one, both will fallback to the original if not included) +2- Place any required ramdisk files in /ramdisk +3- Place any required patch files (generally partial files which go with commands) in /patch +4- Modify the anykernel.sh to add your kernel's name, boot partition location, permissions for included ramdisk files, and use methods for any required ramdisk modifications +5- zip -r9 UPDATE-AnyKernel2.zip * -x README UPDATE-AnyKernel2.zip + +Not required, but any tweaks you can't hardcode into the source should be added with a bootscript.sh like is done in the example provided. + + +Have fun! + diff --git a/out/anykernel.sh b/out/anykernel.sh new file mode 100644 index 00000000..0ef4e35d --- /dev/null +++ b/out/anykernel.sh @@ -0,0 +1,75 @@ +# AnyKernel 2.0 Ramdisk Mod Script +# osm0sis @ xda-developers + +## AnyKernel setup +# EDIFY properties +kernel.string=Zenfone 2 AnyKernel Script +do.devicecheck=0 +do.initd=1 +do.modules=0 +do.cleanup=0 +device.name1=Z00A +device.name2=z008 +device.name3= +device.name4= +device.name5= + +# shell variables +block=/dev/block/by-name/boot; + +## end setup + + +## AnyKernel methods (DO NOT CHANGE) +# set up extracted files and directories +ramdisk=/tmp/anykernel/ramdisk; +bin=/tmp/anykernel/tools; +split_img=/tmp/anykernel/split_img; +patch=/tmp/anykernel/patch; + +chmod -R 777 $bin; +mkdir -p $ramdisk $split_img; +#cd /tmp/anykernel; + +OUTFD=`ps | grep -v "grep" | grep -oE "update(.*)" | cut -d" " -f3`; +ui_print() { echo "ui_print $1" >&$OUTFD; echo "ui_print" >&$OUTFD; } + +# dump boot and extract ramdisk +dump_boot() { + dd if=$block of=/tmp/anykernel/boot.img; + /tmp/anykernel/tools/unmkbootimg /tmp/anykernel/boot.img; + #/tmp/anykernel/tools/unmkbootimg /tmp/anykernel/boot.img; + if [ $? != 0 ]; then + ui_print "Dumping/unpacking image failed. Aborting..."; + echo "Unpack Failed" > /tmp/anykernel/exitcode; exit; + fi; +} + +# repack ramdisk then build and write image +write_boot() { + /tmp/anykernel/tools/mkbootimg --kernel /tmp/anykernel/bzImage --ramdisk /tmp/anykernel/initramfs.cpio.gz --cmdline "init=/init pci=noearly loglevel=0 vmalloc=256M androidboot.hardware=mofd_v1 watchdog.watchdog_thresh=60 androidboot.spid=xxxx:xxxx:xxxx:xxxx:xxxx:xxxx androidboot.serialno=01234567890123456789 snd_pcm.maximum_substreams=8 ip=50.0.0.2:50.0.0.1::255.255.255.0::usb0:on debug_locks=0 bootboost=1 androidboot.selinux=permissive" --base 0x10000000 --pagesize 2048 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --second /tmp/anykernel/second.gz -o /tmp/anykernel/boot-new.img; + + if [ $? != 0 -o `wc -c < /tmp/anykernel/boot-new.img` -gt `wc -c < /tmp/anykernel/boot.img` ]; then + ui_print "Repacking image failed. Aborting..."; + echo "Repack Failed" > /tmp/anykernel/exitcode; exit; + fi; + if [ "$(getprop ro.product.device)" == "Z00A" ]; then + echo "Device : Z00A"; + cat /tmp/anykernel/boot-new.img /tmp/anykernel/boot_z00a.sig > /tmp/anykernel/boot.img; + fi + if [ "$(getprop ro.product.device)" == "Z008" ]; then + echo "Device : Z008"; + cat /tmp/anykernel/boot-new.img /tmp/anykernel/boot_z008.sig > /tmp/anykernel/boot.img; + fi + dd if=/tmp/anykernel/boot.img of=$block; +} + +## end methods + +## AnyKernel install +dump_boot; + +write_boot; + +## end install + diff --git a/out/boot_z008.sig b/out/boot_z008.sig new file mode 100644 index 00000000..b4b4d70d Binary files /dev/null and b/out/boot_z008.sig differ diff --git a/out/boot_z00a.sig b/out/boot_z00a.sig new file mode 100644 index 00000000..642a0306 Binary files /dev/null and b/out/boot_z00a.sig differ diff --git a/out/modules/placeholder b/out/modules/placeholder new file mode 100644 index 00000000..e69de29b diff --git a/out/ramdisk/sbin/bb/busybox b/out/ramdisk/sbin/bb/busybox new file mode 100644 index 00000000..b319cfc2 Binary files /dev/null and b/out/ramdisk/sbin/bb/busybox differ diff --git a/out/tools/mkbootimg b/out/tools/mkbootimg new file mode 100644 index 00000000..927d267e Binary files /dev/null and b/out/tools/mkbootimg differ diff --git a/out/tools/unmkbootimg b/out/tools/unmkbootimg new file mode 100644 index 00000000..3e3c4073 Binary files /dev/null and b/out/tools/unmkbootimg differ diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index f221ddf6..bd6a224b 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -43,12 +43,14 @@ else TIMESTAMP=$KBUILD_BUILD_TIMESTAMP fi if test -z "$KBUILD_BUILD_USER"; then - LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/') +# LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/') + LINUX_COMPILE_BY=`echo Atom7_v1` else LINUX_COMPILE_BY=$KBUILD_BUILD_USER fi if test -z "$KBUILD_BUILD_HOST"; then - LINUX_COMPILE_HOST=`hostname` +# LINUX_COMPILE_HOST=`hostname` + LINUX_COMPILE_HOST=`echo rb_rasekar` else LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST fi diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 84b88f10..21bc2ea6 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -169,7 +169,7 @@ else # LOCALVERSION= is not specified if test "${LOCALVERSION+set}" != "set"; then scm=$(scm_version --short) - res="$res${scm:++}" + res="$res" fi fi diff --git a/sound/soc/intel/effects.c b/sound/soc/intel/effects.c index b3430321..06bd6442 100644 --- a/sound/soc/intel/effects.c +++ b/sound/soc/intel/effects.c @@ -291,7 +291,7 @@ static int sst_effects_set_params(struct snd_card *card, struct snd_effect_params *params) { int ret = 0; - u8 pipe_id; + u8 pipe_id=pipe_id; u16 algo_id; struct ipc_effect_payload dsp_payload; struct sst_data *sst; @@ -325,7 +325,7 @@ static int sst_effects_get_params(struct snd_card *card, struct snd_effect_params *params) { int ret = 0; - u8 pipe_id; + u8 pipe_id=pipe_id; u16 algo_id; struct ipc_effect_payload dsp_payload; struct sst_data *sst;