Commit cedca0ea authored by David Brown's avatar David Brown Committed by Stephen Boyd

skales: Simplify the workflow for common usage

The default workflow in Skales is fairly complex and uses features of
git not everyone will be familiar or comfortable with.

Instead, simplify the instructions a bit, and implement a config file
that can be used to control some of the behavior of skales if desired:

  - The cross compiler can be set here instead of in the environment.

  - The user can specify a defconfig which will automatically be
    copied in and out of the tree as part of the build. This more
    closely resembles the behavior that android developers are used
    to.

[sboyd: Use config.sh.example to avoid dirty trees. Use test
	instead of brackets. Don't assume defconfigs end in
	"_defconfig". Default to msm_defconfig for upstream]
Signed-off-by: 's avatarStephen Boyd <sboyd@codeaurora.org>
parent b1d50854
...@@ -12,19 +12,10 @@ your $PATH. ...@@ -12,19 +12,10 @@ your $PATH.
Background Background
---------- ----------
This collection of scripts that can be used as a 'meta' branch within your Cloning skales should give you a collection of scripts and some
kernel.git or as a standalone repo that you stick in your $PATH. It is directories:
distributed as a standalone git repo so that you can choose your own workflow.
The workflow below assumes the 'meta' branch workflow.
kernel.git $ git remote add skales skales.git skales $ ls
kernel.git $ git fetch skales
kernel.git $ git checkout -t skales/master -b meta
Checking out the meta branch should present you with a collection of scripts
and some directories.
kernel.git $ ls
README atag-fix init-branch initrds README atag-fix init-branch initrds
make-arm mkbootimg package source-me make-arm mkbootimg package source-me
...@@ -52,43 +43,33 @@ and some directories. ...@@ -52,43 +43,33 @@ and some directories.
Getting Started Getting Started
--------------- ---------------
NOTE: This workflow assumes you have git-new-workdir in your path. A simple workflow:
git-new-workdir can be downloaded here[1].
A typical workflow would be as follows: 1. Clone skales
1. Source the source-me script $ git clone skales.git
$ . source-me 1.1 Add skales to your path
1.1 Choose a cross-compiler $ source source-me
$ export CROSS_COMPILE=/path/to/my/compiler/arm-eabi- 1.2. Copy the config.sh.example to config.sh
2. Initialize a new working branch (b/ is not necessary but default ignored) $ cp config.sh.example config.sh
with an optional defconfig (in this example we'll use no defconfig)
$ mkdir -p b/my-branch 1.3. Edit the config file to set options like cross-compiler,
$ cd b/my-branch defconfig, etc.
$ init-branch my-branch
$ ls
kernel kobj
The 'kernel' directory contains the sources of the kernel tree checked out 2. Checkout or clone a kernel
to the branch that was specified (in this case my-branch). The 'kobj'
directory contains any object files and build products.
3. Enter the kernel directory and configure your kernel $ git clone git://git.kernel.org/... kernel
$ cd kernel
$ make-arm menuconfig
<configure things>
4. Build the kernel 3. Build the kernel
$ make-arm -j $ cd kernel
$ make-arm -j 16 ...
5. Package the kernel up into a boot.img 4. Package the kernel up into a boot.img
$ package 8960dt initrd.gz --cmdline="console=ttyMSM0,115200,n8" $ package 8960dt initrd.gz --cmdline="console=ttyMSM0,115200,n8"
Packaged /usr/src/linux/b/my-branch/boot.img Packaged /usr/src/linux/b/my-branch/boot.img
...@@ -98,10 +79,38 @@ A typical workflow would be as follows: ...@@ -98,10 +79,38 @@ A typical workflow would be as follows:
$ ls ../ $ ls ../
boot.img kernel kobj boot.img kernel kobj
6. Boot the kernel 5. Boot the kernel
$ fastboot boot /usr/src/linux/b/my-branch/boot.img $ fastboot boot /usr/src/linux/b/my-branch/boot.img
Skales also contains a script, called init-branch, which uses the
git-new-workdir utility to help work with multiple git trees that
share history[1].
Most steps are similar to above, but the kernel can be managed with
these steps:
1. Initialize a new working branch (b/ is not necessary but default ignored)
with an optional defconfig (in this example we'll use no defconfig)
$ mkdir -p b/my-branch
$ cd b/my-branch
$ init-branch my-branch
$ ls
kernel kobj
The 'kernel' directory contains the sources of the kernel tree checked out
to the branch that was specified (in this case my-branch). The 'kobj'
directory contains any object files and build products.
2. Enter the kernel directory and configure your kernel
$ cd kernel
$ make-arm menuconfig
<configure things>
Continue at step 3 listed above in the simple workflow.
Footnotes Footnotes
--------- ---------
[1] http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/workdir/git-new-workdir [1] http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/workdir/git-new-workdir
# Copyright (c) 2013, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Cross compiler to use. If not set, CROSS_COMPILE must be in your enviornment
#CROSS_COMPILE=/path/to/my/compiler/arm-eabi-
# The make-arm script can behave one of two ways in regards to the
# defconfig. The default, if this is not set, is to just invoke make
# directly. If you prefer, set this variable to the name of a defconfig file.
# In this case, the script will copy the file from the kernel source on each
# build, and place the resulting savedefconfig back into the user's
# tree.
#defconfig=msm_defconfig
...@@ -29,4 +29,38 @@ ...@@ -29,4 +29,38 @@
# #
# ARM compiler wrapper # ARM compiler wrapper
make ARCH=arm O=../kobj $@ exe=$(readlink -f "$0")
META_ROOT=$(dirname "$exe")
META_ROOT=$(cd "$META_ROOT" && pwd)
if test -f "$META_ROOT/config.sh"
then
source "$META_ROOT/config.sh"
fi
die()
{
echo Build failure
exit 1
}
if test -z "$defconfig"
then
# Simple case
make ARCH=arm O=../kobj "$@"
exit $?
fi
# Copy the defconfig in and out of the kernel source tree as part of
# the build.
config=arch/arm/configs/${defconfig}
# cp $config ../kobj/.config
make ARCH=arm O=../kobj ${defconfig} || die
make ARCH=arm O=../kobj "$@"
status=$?
make ARCH=arm O=../kobj savedefconfig
cp ../kobj/defconfig $config
exit $status
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment