From 765e016601aad682a7ce9a4df79a2741f93d179b Mon Sep 17 00:00:00 2001 From: Stefan Seidel Date: Thu, 16 Feb 2012 20:55:03 +0100 Subject: [PATCH] shell script and patches for complete build: build own toolchain and patch kernel suspend --- patches/apply.sh | 21 +++++++++++++++++++++ patches/kernel-suspend.patch | 34 ++++++++++++++++++++++++++++++++++ patches/ndk.patch | 15 +++++++++++++++ patches/prebuilt.patch | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100755 patches/apply.sh create mode 100644 patches/kernel-suspend.patch create mode 100644 patches/ndk.patch create mode 100644 patches/prebuilt.patch diff --git a/patches/apply.sh b/patches/apply.sh new file mode 100755 index 0000000..5ff71d8 --- /dev/null +++ b/patches/apply.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# sanity test +[ -d prebuilt ] || { echo "You need to run this script from the top of an Android source tree"; exit 1; } + +MYDIR="$(readlink -f $(dirname $0))" + +# build toolchain +[ -e prebuilt/linux-x86/toolchain/i686-android-linux-4.4.3/build-toolchain.sh ] && { + cd prebuilt + git apply "$MYDIR/prebuilt.patch" + cd ../ndk + git apply "$MYDIR/ndk.patch" + cd .. + prebuilt/linux-x86/toolchain/i686-android-linux-4.4.3/build-toolchain.sh +} + +# apply kernel patches +cd kernel +git status kernel/power/suspend.c | tail -1 | grep -q 'nothing to commit' && git apply "$MYDIR/kernel-suspend.patch" +cd .. diff --git a/patches/kernel-suspend.patch b/patches/kernel-suspend.patch new file mode 100644 index 0000000..d7922a6 --- /dev/null +++ b/patches/kernel-suspend.patch @@ -0,0 +1,34 @@ +diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c +index 63774df..091ded0 100644 +--- a/kernel/power/suspend.c ++++ b/kernel/power/suspend.c +@@ -94,7 +94,9 @@ static int suspend_prepare(void) + if (!suspend_ops || !suspend_ops->enter) + return -EPERM; + ++#ifndef CONFIG_FB_EARLYSUSPEND + pm_prepare_console(); ++#endif + + error = pm_notifier_call_chain(PM_SUSPEND_PREPARE); + if (error) +@@ -112,7 +114,9 @@ static int suspend_prepare(void) + usermodehelper_enable(); + Finish: + pm_notifier_call_chain(PM_POST_SUSPEND); ++#ifndef CONFIG_FB_EARLYSUSPEND + pm_restore_console(); ++#endif + return error; + } + +@@ -253,7 +257,9 @@ static void suspend_finish(void) + suspend_thaw_processes(); + usermodehelper_enable(); + pm_notifier_call_chain(PM_POST_SUSPEND); ++#ifndef CONFIG_FB_EARLYSUSPEND + pm_restore_console(); ++#endif + } + + /** diff --git a/patches/ndk.patch b/patches/ndk.patch new file mode 100644 index 0000000..d0a73bf --- /dev/null +++ b/patches/ndk.patch @@ -0,0 +1,15 @@ +diff --git a/build/tools/toolchain-patches/gcc/0004-Enable-x86-gcc-defaults.patch b/build/tools/toolchain-patches/gcc/0004-Enable-x86-gcc-defaults.patch +index 792bc14..ee4e9b6 100644 +--- a/build/tools/toolchain-patches/gcc/0004-Enable-x86-gcc-defaults.patch ++++ b/build/tools/toolchain-patches/gcc/0004-Enable-x86-gcc-defaults.patch +@@ -72,8 +72,8 @@ index f3a98c2..bc2a5d5 100644 + +#define CC1_SPEC \ + + LINUX_OR_ANDROID_CC (OVERRIDE_LINUX_TARGET_CC1_SPEC, \ + + OVERRIDE_LINUX_TARGET_CC1_SPEC \ +-+ " -march=i686 -mtune=atom" \ +-+ " -mstackrealign -msse3 -mfpmath=sse" \ +++ " -march=pentium-m -mmmx -msse -msse2 -mno-sse3" \ +++ " -mstackrealign -mfpmath=sse" \ + + " -m32 -fno-short-enums" \ + + " " \ + + ANDROID_CC1_SPEC("-fPIC")) diff --git a/patches/prebuilt.patch b/patches/prebuilt.patch new file mode 100644 index 0000000..a6916e9 --- /dev/null +++ b/patches/prebuilt.patch @@ -0,0 +1,33 @@ +diff --git a/linux-x86/toolchain/i686-android-linux-4.4.3/build-toolchain.sh b/linux-x86/toolchain/i686-android-linux-4.4.3/build-toolchain.sh +index e61172a..98918e0 100755 +--- a/linux-x86/toolchain/i686-android-linux-4.4.3/build-toolchain.sh ++++ b/linux-x86/toolchain/i686-android-linux-4.4.3/build-toolchain.sh +@@ -126,24 +126,11 @@ download_toolchain_sources () + # because it removes all .info files, which breaks the ToT source + # build as of 2011-03-03 + # ++ # ==> seems to work fine (2012-01-28), so do use the correct script ++ + echo "Download toolchain patches to: $TOOLCHAIN_SRC_DIR" +- GIT_PREFIX=git://android.git.kernel.org/toolchain +- for PROJECT in build binutils gcc gdb mpfr gmp gold; do +- PROJECT_DIR="$TOOLCHAIN_SRC_DIR/$PROJECT" +- PROJECT_GIT="$GIT_PREFIX/$PROJECT.git" +- echo "$PROJECT: Cleaning" +- rm -rf $PROJECT_DIR +- echo "$PROJECT: Downloading sources from: $PROJECT_GIT" +- (git clone $PROJECT_GIT $PROJECT_DIR) > /dev/null 2>&1 +- fail_panic "$PROJECT: Could not git clone!!" +- if [ -n "$GIT_DATE" ] ; then +- echo "$PROJECT: Switching to sources for date '$GIT_DATE'" +- (cd $PROJECT_DIR && +- REVISION=`git rev-list -n 1 --until="$GIT_DATE" HEAD` && +- run git checkout $REVISION) > /dev/null 2>&1 +- fail_panic "$PROJECT: Could not checkout?" +- fi +- done ++ ++ ndk/build/tools/download-toolchain-sources.sh "$TOOLCHAIN_SRC_DIR" + fail_panic "Could not download toolchain sources!" + } + -- 2.11.0