[FE training-materials-updates] Improvements to the git part

michael.opdenacker at free-electrons.com michael.opdenacker at free-electrons.com
Tue Jun 5 14:10:15 CEST 2012


- Log -----------------------------------------------------------------
http://git.free-electrons.com/training-materials/commit/?id=fecf6edd0f9cebece63d6c69967c37d30f65a916

commit fecf6edd0f9cebece63d6c69967c37d30f65a916
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Tue Jun 5 14:10:39 2012 +0200

    Improvements to the git part

diff --git a/labs/android-boot/android-boot.tex b/labs/android-boot/android-boot.tex
index b4ba0d7..1088523 100644
--- a/labs/android-boot/android-boot.tex
+++ b/labs/android-boot/android-boot.tex
@@ -24,8 +24,11 @@ So the first thing to do is download the Android kernel sources.
 Go to the \code{kernel} directory. That's where the kernel source repository
 was cloned.
 
-Using \code{git branch -a}, find the most recent kernel for the Goldfish platform
-and switch to this branch with the command 
+Using \code{git branch -a}, find the name of the most recent stable kernel version that 
+supports the Goldfish platform. At the time of this writing, Linux 3.0 still doesn't
+seem to work with the emulator, and you will have to choose the 2.6.29 kernel.
+
+Switch to this branch as follows:
 
 \code{git checkout <branch>}.
 
@@ -77,13 +80,13 @@ emulator -kernel ~/felabs/android/kernel/kernel/arch/arm/boot/zImage
 Once again, check the kernel version in the Android settings. Make sure
 that the kernel was built today.
 
-\section{Generate a patchset from Android Kernel}
+\section{Generate a patchset from the Android Kernel}
 
 To compare the Android kernel sources with the official kernel ones,
 we need to fetch the latter sources too, allowing us to see which 
-commits differ.Git is great for that and offers everything we need.
+commits differ. Git is great for that and offers everything we need.
 
-First, add the linux-stable repository from Greg Kroah-Hartmann to our
+First, add the \code{linux-stable} repository from Greg Kroah-Hartmann to our
 repository:
 
 \code{git remote add stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git}
@@ -101,9 +104,11 @@ differ from the linux kernel by doing:
 
 \code{git log v<kernel-version>..HEAD}
 
-In this set of commits, find the one that adds the wakelocks.
+Now, extract the corresponding set of patches\footnote{Git generates one patch per commit.}:
+
+\code{git format-patch v<kernel-version>..HEAD}
 
-Now, extract the set of patches with the \code{git format-patch} command.
+In this set of patches, find the one that adds the wakelocks.
 
-Congrats! You now have all the patches to apply to a vanilla kernel to obtain a
+Congratuations! You now have all the patches to apply to a vanilla kernel version to obtain a
 full Android kernel.

http://git.free-electrons.com/training-materials/commit/?id=547a093bc8bbd1f8add8fdc6f5d7669c7a4a8ec2

commit 547a093bc8bbd1f8add8fdc6f5d7669c7a4a8ec2
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Tue Jun 5 13:56:14 2012 +0200

    Details about how to restore the Android env
    
    Required to run the emulator once again

diff --git a/labs/android-boot/android-boot.tex b/labs/android-boot/android-boot.tex
index a32f1f4..b4ba0d7 100644
--- a/labs/android-boot/android-boot.tex
+++ b/labs/android-boot/android-boot.tex
@@ -43,9 +43,39 @@ to the kernel version and compile the kernel!
 
 \code{ARCH=arm CROSS_COMPILE=arm-eabi- make -j 4}
 
-A few minutes later, you can boot the emulator with the image found in
-\code{arch/arm/boot}, and when it's booted, check the kernel version in the
-Android Settings.
+A few minutes later, you have a kernel image in \code{arch/arm/boot}.
+
+\code{Boot your new kernel}
+
+To run the emulator again, this time with your new kernel image, you
+have to restore the environment that you had after building Android from
+sources. This is needed every time you reboot your workstation, and every time
+you work with a new terminal.
+
+Go back to \code{$HOME/felabs/android/aosp/android/}.
+
+All you need to do is source the environment and run the \code{lunch}
+command to specify which product you're working with
+\footnote{Remember that Android sources allow you to work with
+multiple products}:
+
+\begin{verbatim}
+source build/envsetup.sh
+lunch generic-eng
+\end{verbatim}
+
+Now, test that you can still run the emulator as you did in the
+previous lab.
+
+To run the emulator with your own kernel, you can use the \code{-kernel}
+option:
+
+\begin{verbatim}
+emulator -kernel ~/felabs/android/kernel/kernel/arch/arm/boot/zImage
+\end{verbatim}
+
+Once again, check the kernel version in the Android settings. Make sure
+that the kernel was built today.
 
 \section{Generate a patchset from Android Kernel}
 
diff --git a/labs/android-first-compilation/android-first-compilation.tex b/labs/android-first-compilation/android-first-compilation.tex
index 84adebc..97682ca 100644
--- a/labs/android-first-compilation/android-first-compilation.tex
+++ b/labs/android-first-compilation/android-first-compilation.tex
@@ -36,7 +36,7 @@ engineering build. To do this, run \code{lunch generic-eng}
 \section{Compile the root filesystem}
 
 The build system will use the proper setup to build this target. Before running
-\code{make}, first check the number of CPUs cores in your workstation, as seen by
+\code{make}, first check the number of CPU cores in your workstation, as seen by
 the operating system (hyperthreading could make your OS see 4 cores instead of 2,
 for example).
 
@@ -81,11 +81,6 @@ Run the \code{emulator} command. It will run the emulator with these generated i
 Wait a few minutes for the emulator to load the system, and then 
 check the build number in the \code{Settings} application in Android.
 
-\textbf{Tip}: the \code{PATH} settings automatically added by the build
-process will be lost if you close your terminal. To access the emulator
-from another session, you will have
-to set your \code{PATH} manually: 
-
-\begin{verbatim}
-PATH=$PATH:$HOME/felabs/android/aosp/android/out/host/linux-x86/bin/
-\end{verbatim}
+\textbf{Note}: the \code{PATH} settings automatically added by the build
+process will be lost if you close your terminal. We will see how to restore
+this environment in the next lab.

http://git.free-electrons.com/training-materials/commit/?id=91de220e081d53660a28e173616fcfa542372995

commit 91de220e081d53660a28e173616fcfa542372995
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Tue Jun 5 11:49:17 2012 +0200

    Minor style improvement

diff --git a/labs/android-boot/android-boot.tex b/labs/android-boot/android-boot.tex
index d77e9cc..a32f1f4 100644
--- a/labs/android-boot/android-boot.tex
+++ b/labs/android-boot/android-boot.tex
@@ -71,7 +71,7 @@ differ from the linux kernel by doing:
 
 \code{git log v<kernel-version>..HEAD}
 
-Find in that set of commits the one that adds the wakelocks.
+In this set of commits, find the one that adds the wakelocks.
 
 Now, extract the set of patches with the \code{git format-patch} command.
 

http://git.free-electrons.com/training-materials/commit/?id=3ce3b801dc687c3fc8947cc491ca4d08791eb9a0

commit 3ce3b801dc687c3fc8947cc491ca4d08791eb9a0
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Tue Jun 5 11:45:05 2012 +0200

    Fixed the URL to the stable Linux tree
    
    - The previous one didn't work

diff --git a/labs/android-boot/android-boot.tex b/labs/android-boot/android-boot.tex
index 3ae2375..d77e9cc 100644
--- a/labs/android-boot/android-boot.tex
+++ b/labs/android-boot/android-boot.tex
@@ -21,16 +21,19 @@ So the first thing to do is download the Android kernel sources.
 
 \code{git clone https://android.googlesource.com/kernel/goldfish.git kernel}
 
-Now that we have kernel sources, we need a toolchain to compile them. Fortunately,
-Android provides one. First, add the toolchain from the previous lab to your \code{PATH}.
-
-\code{PATH=$HOME/felabs/android/aosp/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH}
+Go to the \code{kernel} directory. That's where the kernel source repository
+was cloned.
 
 Using \code{git branch -a}, find the most recent kernel for the Goldfish platform
 and switch to this branch with the command 
 
 \code{git checkout <branch>}.
 
+Now that we have kernel sources, we now need a toolchain to compile the kernel. Fortunately,
+Android provides one. First, add the toolchain from the previous lab to your \code{PATH}.
+
+\code{PATH=$HOME/felabs/android/aosp/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH}
+
 Now, configure the kernel for the target platform
 
 \code{ARCH=arm make goldfish_defconfig}
@@ -46,15 +49,14 @@ Android Settings.
 
 \section{Generate a patchset from Android Kernel}
 
-Go to the \code{kernel} directory. That's where the kernel source code is. The
-kernel however is the one from Android, and we need to fetch the source code
-from the official kernel to get a point of reference to know which commits
-differ. Git is great for that and offers everything we need to do so.
+To compare the Android kernel sources with the official kernel ones,
+we need to fetch the latter sources too, allowing us to see which 
+commits differ.Git is great for that and offers everything we need.
 
 First, add the linux-stable repository from Greg Kroah-Hartmann to our
 repository:
 
-\code{git remote add stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6-stable.git}
+\code{git remote add stable git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git}
 
 Now, we need to fetch the changes from this remote repository:
 
@@ -63,7 +65,7 @@ Now, we need to fetch the changes from this remote repository:
 A while later, you should have all the changes in your own repository, browsable
 offline!
 
-Now, open the main Makefile with your favorite editor and get the kernel version
+Now, open the main \code{Makefile} with your favorite editor and get the kernel version
 that is in it. Now that we have it, we can generate the whole set of commits that
 differ from the linux kernel by doing:
 

http://git.free-electrons.com/training-materials/commit/?id=a0085dcee52c0d2cab8508d628ca6d1353e4ca14

commit a0085dcee52c0d2cab8508d628ca6d1353e4ca14
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Tue Jun 5 10:57:46 2012 +0200

    Misc improvements
    
    - Fixed toolchain path
    - Added the exact git command to find the right kernel branch
      (git branch -a)
    - Added "-j 4" for the kernel build

diff --git a/labs/android-boot/android-boot.tex b/labs/android-boot/android-boot.tex
index e16fc45..3ae2375 100644
--- a/labs/android-boot/android-boot.tex
+++ b/labs/android-boot/android-boot.tex
@@ -16,17 +16,17 @@ Go to the \code{/home/<user>/felabs/android/kernel} directory.
 
 The Android emulator uses QEMU to create a virtual ARM9 SoC called Goldfish.
 
-In the standard Android source code we fetched, the kernel source is not included.
+In the standard Android source code we fetched, the kernel source was not included.
 So the first thing to do is download the Android kernel sources.
 
 \code{git clone https://android.googlesource.com/kernel/goldfish.git kernel}
 
 Now that we have kernel sources, we need a toolchain to compile them. Fortunately,
-Android provides one. First, add the toolchain to your \code{PATH}.
+Android provides one. First, add the toolchain from the previous lab to your \code{PATH}.
 
-\code{export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH}
+\code{PATH=$HOME/felabs/android/aosp/android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH}
 
-Using Git, find the latest kernel for the Goldfish platform
+Using \code{git branch -a}, find the most recent kernel for the Goldfish platform
 and switch to this branch with the command 
 
 \code{git checkout <branch>}.
@@ -38,7 +38,7 @@ Now, configure the kernel for the target platform
 Then, configure the kernel using the tool of your choice to add a custom suffix
 to the kernel version and compile the kernel!
 
-\code{ARCH=arm CROSS_COMPILE=arm-eabi- make}
+\code{ARCH=arm CROSS_COMPILE=arm-eabi- make -j 4}
 
 A few minutes later, you can boot the emulator with the image found in
 \code{arch/arm/boot}, and when it's booted, check the kernel version in the

-----------------------------------------------------------------------

Summary of changes:
 labs/android-boot/android-boot.tex                 |   79 ++++++++++++++------
 .../android-first-compilation.tex                  |   13 +---
 2 files changed, 62 insertions(+), 30 deletions(-)


More information about the training-materials-updates mailing list