Commit 47f1709e authored by Stephen Boyd's avatar Stephen Boyd

skales: Make kobj and bootimage directory configurable

Some users of skales don't want to rely on the kernel, kobj
directory structure. Instead they want to build the object files
within the same directory as the kernel sources. Support this
configuration with a KOBJ variable that can be set in the config.
If KOBJ isn't set we fall-back to the original configuration
where kobj lives next to the kernel sources. We also expose a
BOOTIMG_DIR config so that users can configure where their boot
images are generated. If it isn't set we fall-back to the
original configuration where the bootimages live directly above
the kernel sources.

To make things nicer on these users we also cleanup the
intermediate objects during the package invocation so that their
git status comes out clean.
Signed-off-by: 's avatarStephen Boyd <sboyd@codeaurora.org>
parent 325a7030
......@@ -28,4 +28,19 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
fastboot boot ../boot.img
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
if test -f .skales/config
then
source .skales/config
fi
BOOTIMG_DIR="${BOOTIMG_DIR:-../}"
BOOTIMG_DIR="$(readlink -f $BOOTIMG_DIR)"
fastboot boot "$BOOTIMG_DIR/boot.img"
......@@ -35,3 +35,9 @@
# build, and place the resulting savedefconfig back into the user's
# tree.
#defconfig=msm_defconfig
# Where to put kernel build objects
#KOBJ=../kobj
# Where to put boot images
#BOOTIMG_DIR=../
......@@ -41,6 +41,13 @@ if test -f .skales/config
then
source .skales/config
fi
KOBJ="${KOBJ:-../kobj}"
O_STR=
if ! test "$PWD" -ef "$KOBJ"
then
O_STR="O=$KOBJ"
fi
die()
{
......@@ -51,7 +58,7 @@ die()
if test -z "$defconfig"
then
# Simple case
make ARCH=arm O=../kobj "$@"
make ARCH=arm $O_STR "$@"
exit $?
fi
......@@ -61,10 +68,10 @@ fi
config=arch/arm/configs/${defconfig}
# cp $config ../kobj/.config
make ARCH=arm O=../kobj ${defconfig} || die
make ARCH=arm O=../kobj "$@"
make ARCH=arm $O_STR ${defconfig} || die
make ARCH=arm $O_STR "$@"
status=$?
make ARCH=arm O=../kobj savedefconfig
cp ../kobj/defconfig $config
make ARCH=arm $O_STR savedefconfig
mv $KOBJ/defconfig $config
exit $status
......@@ -48,6 +48,9 @@ if test -f .skales/config
then
source .skales/config
fi
KOBJ="${KOBJ:-../kobj}"
BOOTIMG_DIR="${BOOTIMG_DIR:-../}"
BOOTIMG_DIR="$(readlink -f $BOOTIMG_DIR)"
die() {
printf >&2 "%s\n" "$@"
......@@ -159,6 +162,8 @@ do
done
exit 1
fi
else
initrd="$(readlink -f $initrd)"
fi
;;
esac
......@@ -166,7 +171,7 @@ do
done
(
cd ../kobj &&
cd $KOBJ &&
if test -n "$modules"
then
......@@ -175,10 +180,10 @@ then
die "Need an initrd to append modules to"
fi
rm -rf ../modules/ &&
INSTALL_MOD_PATH=../modules make-arm modules_install > /dev/null 2>&1 &&
rm -rf modules &&
INSTALL_MOD_PATH=modules make modules_install > /dev/null 2>&1 &&
(
cd ../modules/ && find . | cpio --quiet -o -H newc
cd modules && find . | cpio --quiet -o -H newc
) | gzip -n -9 > initrd-modules.gz &&
cat $initrd initrd-modules.gz > initrd.gz
initrd=initrd.gz
......@@ -222,7 +227,14 @@ fi
--cmdline "$cmdline" \
--base $base \
--pagesize $pagesize \
--output ../boot-$target.img &&
echo "Packaged $(readlink -f ../boot-$target.img)" &&
ln -fs boot-$target.img ../boot.img
--output $BOOTIMG_DIR/boot-$target.img &&
echo "Packaged $(readlink -f $BOOTIMG_DIR/boot-$target.img)" &&
ln -fs boot-$target.img $BOOTIMG_DIR/boot.img
# Cleanup for people with kobj=working_dir
rm -rf fImage dImage modules initrd-modules.gz
if test -n "$modules"
then
rm -rf $initrd
fi
)
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