OSDN Git Service

shell script and patches for complete build: build own toolchain and patch kernel...
authorStefan Seidel <android@stefanseidel.info>
Thu, 16 Feb 2012 19:55:03 +0000 (20:55 +0100)
committerStefan Seidel <android@stefanseidel.info>
Thu, 16 Feb 2012 19:55:03 +0000 (20:55 +0100)
patches/apply.sh [new file with mode: 0755]
patches/kernel-suspend.patch [new file with mode: 0644]
patches/ndk.patch [new file with mode: 0644]
patches/prebuilt.patch [new file with mode: 0644]

diff --git a/patches/apply.sh b/patches/apply.sh
new file mode 100755 (executable)
index 0000000..5ff71d8
--- /dev/null
@@ -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 (file)
index 0000000..d7922a6
--- /dev/null
@@ -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 (file)
index 0000000..d0a73bf
--- /dev/null
@@ -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 (file)
index 0000000..a6916e9
--- /dev/null
@@ -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!"
+ }