summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiku Voipio <riku.voipio@linaro.org>2015-06-24 15:33:08 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2015-06-27 18:32:26 +0300
commit6d190cb41e9b10dbe6c3857666c2271f9e98754c (patch)
tree4c2b5ee67f0f24cf4d7cf8b6c6c7f33b2f1d84e7
parent0dcdf89d62e20dc3d244ba5e63661fa191165b67 (diff)
downloadlci-build-tools-6d190cb41e9b10dbe6c3857666c2271f9e98754c.tar.gz
builddeb: sync with latest upstreamed/submitted code
New features: - builds source package - builds changes Copy the builddeb from lci-build-tools universally so the patches can be removed from linux-linaro Remaining changes: - arm64 kernel installed to boot/Image-$version - dtb's installed to lib/firmware/$version/device-tree - arm64 boot wrapper installed to boot/ Change-Id: I2afcc2695edb9e45b90db53371a366504c829b01 Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
-rw-r--r--build-scripts/builddeb118
-rwxr-xr-xjenkins_common_lib28
-rwxr-xr-xjenkins_kernel_build_inst1
3 files changed, 100 insertions, 47 deletions
diff --git a/build-scripts/builddeb b/build-scripts/builddeb
index 3dfd2ba..09707e4 100644
--- a/build-scripts/builddeb
+++ b/build-scripts/builddeb
@@ -15,6 +15,8 @@ set -e
create_package() {
local pname="$1" pdir="$2"
+ mkdir -m 755 -p "$pdir/DEBIAN"
+ mkdir -p "$pdir/usr/share/doc/$pname"
cp debian/copyright "$pdir/usr/share/doc/$pname/"
cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
@@ -25,8 +27,13 @@ create_package() {
chown -R root:root "$pdir"
chmod -R go-w "$pdir"
+ # Create the package
+ dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
+ dpkg --build "$pdir" ..
+}
+
+set_debarch() {
# Attempt to find the correct Debian architecture
- local forcearch="" debarch=""
case "$UTS_MACHINE" in
i386|ia64|alpha)
debarch="$UTS_MACHINE" ;;
@@ -45,8 +52,18 @@ create_package() {
arm64)
debarch=arm64 ;;
arm*)
- debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;;
+ if grep -q CONFIG_AEABI=y $KCONFIG_CONFIG; then
+ if grep -q CONFIG_VFP=y $KCONFIG_CONFIG; then
+ debarch=armhf
+ else
+ debarch=armel
+ fi
+ else
+ debarch=arm
+ fi
+ ;;
*)
+ debarch=$(dpkg --print-architecture)
echo "" >&2
echo "** ** ** WARNING ** ** **" >&2
echo "" >&2
@@ -59,13 +76,8 @@ create_package() {
if [ -n "$KBUILD_DEBARCH" ] ; then
debarch="$KBUILD_DEBARCH"
fi
- if [ -n "$debarch" ] ; then
- forcearch="-DArchitecture=$debarch"
- fi
+ forcearch="-DArchitecture=$debarch"
- # Create the package
- dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir"
- dpkg --build "$pdir" ..
}
# Some variables and settings used throughout the script
@@ -76,6 +88,11 @@ if [ -n "$KDEB_PKGVERSION" ]; then
else
packageversion=$version-$revision
fi
+if [ -n "$KDEB_SOURCENAME" ]; then
+ sourcename=$KDEB_SOURCENAME
+else
+ sourcename=linux-upstream
+fi
tmpdir="$objtree/debian/tmp"
fwdir="$objtree/debian/fwtmp"
kernel_headers_dir="$objtree/debian/hdrtmp"
@@ -86,6 +103,9 @@ fwpackagename=linux-firmware-image-$version
kernel_headers_packagename=linux-headers-$version
libc_headers_packagename=linux-libc-dev
dbg_packagename=$packagename-dbg
+debarch=
+forcearch=
+set_debarch
if [ "$ARCH" = "um" ] ; then
packagename=user-mode-linux-$version
@@ -113,24 +133,13 @@ BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)"
# Setup the directory structure
rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir"
mkdir -m 755 -p "$tmpdir/DEBIAN"
-mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
-mkdir -m 755 -p "$fwdir/DEBIAN"
-mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename"
-mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
-mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
-mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
-mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename"
+mkdir -p "$tmpdir/lib" "$tmpdir/boot"
+mkdir -p "$fwdir/lib/firmware/$version/"
mkdir -p "$kernel_headers_dir/lib/modules/$version/"
-if [ "$ARCH" = "um" ] ; then
- mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin"
-fi
-if [ -n "$BUILD_DEBUG" ] ; then
- mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename"
- mkdir -m 755 -p "$dbg_dir/DEBIAN"
-fi
# Build and install the kernel
if [ "$ARCH" = "um" ] ; then
+ mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
$MAKE linux
cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
@@ -146,6 +155,13 @@ else
cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path"
fi
+if grep -q "^CONFIG_OF=y" $KCONFIG_CONFIG ; then
+ # Only some architectures with OF support have this target
+ if grep -q dtbs_install "${srctree}/arch/$SRCARCH/Makefile"; then
+ $MAKE KBUILD_SRC= INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
+ fi
+fi
+
if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install
rm -f "$tmpdir/lib/modules/$version/build"
@@ -165,6 +181,12 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then
# then add a link to those
$OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
done
+
+ # resign stripped modules
+ MODULE_SIG_ALL="$(grep -s '^CONFIG_MODULE_SIG_ALL=y' $KCONFIG_CONFIG || true)"
+ if [ -n "$MODULE_SIG_ALL" ]; then
+ INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_sign
+ fi
fi
fi
@@ -220,9 +242,20 @@ else
fi
maintainer="$name <$email>"
+# Try to determine distribution
+if [ -n "$KDEB_CHANGELOG_DIST" ]; then
+ distribution=$KDEB_CHANGELOG_DIST
+elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ]; then
+ : # nothing to do in this case
+else
+ distribution="unstable"
+ echo >&2 "Using default distribution of 'unstable' in the changelog"
+ echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
+fi
+
# Generate a simple changelog template
cat <<EOF > debian/changelog
-linux-upstream ($packageversion) unstable; urgency=low
+$sourcename ($packageversion) $distribution; urgency=low
* Custom built Linux kernel.
@@ -236,10 +269,10 @@ This is a packacked upstream version of the Linux kernel.
The sources may be found at most Linux ftp sites, including:
ftp://ftp.kernel.org/pub/linux/kernel
-Copyright: 1991 - 2009 Linus Torvalds and others.
+Copyright: 1991 - 2015 Linus Torvalds and others.
The git repository for mainline kernel development is at:
-git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
+git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -249,12 +282,16 @@ On Debian GNU/Linux systems, the complete text of the GNU General Public
License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
EOF
+
+build_depends="bc, kmod, cpio "
+
# Generate a control file
cat <<EOF > debian/control
-Source: linux-upstream
+Source: $sourcename
Section: kernel
Priority: optional
Maintainer: $maintainer
+Build-Depends: $build_depends
Standards-Version: 3.8.4
Homepage: http://www.kernel.org/
EOF
@@ -385,4 +422,33 @@ EOF
create_package "$dbg_packagename" "$dbg_dir"
fi
+if [ "x$1" != "xbindeb-pkg" ]
+then
+ cat <<EOF > debian/rules
+#!/usr/bin/make -f
+
+build:
+ cp debian/config .config
+ \$(MAKE) oldconfig
+
+binary-arch:
+ \$(MAKE) KDEB_SOURCENAME=${sourcename} KDEB_PKGVERSION=${packageversion} bindeb-pkg
+
+clean:
+ \$(MAKE) clean
+
+binary: binary-arch
+EOF
+
+ (cd $KBUILD_SRC; git archive --prefix=${sourcename}-${version}/ HEAD)|gzip -9 > ../${sourcename}_${version}.orig.tar.gz
+ cp $KCONFIG_CONFIG debian/config
+ tar caf ../${sourcename}_${packageversion}.debian.tar.gz debian/{config,copyright,rules,changelog,control}
+ dpkg-source -cdebian/control -ldebian/changelog --format="3.0 (custom)" --target-format="3.0 (quilt)" \
+ -b / ../${sourcename}_${version}.orig.tar.gz ../${sourcename}_${packageversion}.debian.tar.gz
+ mv ${sourcename}_${packageversion}*dsc ..
+ dpkg-genchanges > ../${sourcename}_${packageversion}_${debarch}.changes
+else
+ dpkg-genchanges -b > ../${sourcename}_${packageversion}_${debarch}.changes
+fi
+
exit 0
diff --git a/jenkins_common_lib b/jenkins_common_lib
index e141b74..650fd3b 100755
--- a/jenkins_common_lib
+++ b/jenkins_common_lib
@@ -42,21 +42,11 @@ fi
build_setup()
{
rm -f linux-*.deb
- # The builddeb has the changes to successfully build for armhf/arm64 in linux-linaro-tracking tree.
- # Hence copy the modified builddeb for other trees only, which is required to do armhf or arm64 builds.
- # last-modified: 2014-04-11 - linux-linaro-tracking (ll-20140411.1)
- # https://git.linaro.org/kernel/linux-linaro-tracking.git/blob_plain/refs/heads/linux-linaro:/scripts/package/builddeb
- repo_name="linux-linaro-tracking"
- if [[ ! "$KERNEL_GIT" =~ "$repo_name" ]]
+ if [ -e $WORKSPACE/lci-build-tools/build-scripts/builddeb ]
then
- if [[ -e $WORKSPACE/lci-build-tools/build-scripts/builddeb ]]
- then
- echo "Copying the local builddeb..."
- cp scripts/package/builddeb scripts/package/builddeb.orig
- cp $WORKSPACE/lci-build-tools/build-scripts/builddeb scripts/package/builddeb
- else
- echo "Missing builddeb file"
- fi
+ echo "Copying the local builddeb..."
+ cp scripts/package/builddeb scripts/package/builddeb.orig
+ cp $WORKSPACE/lci-build-tools/build-scripts/builddeb scripts/package/builddeb
else
echo "Using the builddeb available in the tree..."
fi
@@ -200,13 +190,9 @@ build_instructions()
fi
# Restore the orig buildeb, which was copied to build non linux-linaro-tracking tree
- repo_name="linux-linaro-tracking"
- if [[ ! "$KERNEL_GIT" =~ "$repo_name" ]]
+ if [ -e scripts/package/builddeb.orig ]
then
- if [[ -e scripts/package/builddeb.orig ]]
- then
- echo "Copying back the builddeb that was replaced.."
- cp scripts/package/builddeb.orig scripts/package/builddeb
- fi
+ echo "Copying back the builddeb that was replaced.."
+ cp scripts/package/builddeb.orig scripts/package/builddeb
fi
}
diff --git a/jenkins_kernel_build_inst b/jenkins_kernel_build_inst
index 6bd1b3e..c1e6846 100755
--- a/jenkins_kernel_build_inst
+++ b/jenkins_kernel_build_inst
@@ -129,6 +129,7 @@ export kernel_version=`make kernelversion`
export kernel_release=${kernel_version}-linaro-${kernel_flavour}
export KERNELVERSION=${kernel_version}
export KERNELRELEASE=${kernel_release}
+export KDEB_SOURCENAME=linux-${kernel_release}
# Below is the list of values that will be used in the json files
export KERNEL_GIT=`git config remote.origin.url`