diff options
author | Andrey Konovalov <andrey.konovalov@linaro.org> | 2013-12-02 22:21:00 +0400 |
---|---|---|
committer | Andrey Konovalov <andrey.konovalov@linaro.org> | 2013-12-02 22:21:00 +0400 |
commit | d072225dc2822d6193327927e08681796d8b9c4e (patch) | |
tree | 005afa77d3005cb10a7c331859c6732fc9d28624 | |
parent | 62bc5a0782851a382dcd8befda732532ef056fc2 (diff) | |
parent | 4ba4a4c4c05f082a877f45e2764cc9209ff01fa6 (diff) |
Merge branch 'tracking-linaro-builddeb-tweaks' into merge-linux-linaro-core-tracking
-rw-r--r-- | scripts/package/builddeb | 104 |
1 files changed, 61 insertions, 43 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 90e521fde35f..e3429198853e 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -12,6 +12,47 @@ set -e +# Attempt to find the correct Debian architecture +forcearch="" +debarch="" +case "$UTS_MACHINE" in +i386|ia64|alpha) + debarch="$UTS_MACHINE" ;; +x86_64) + debarch=amd64 ;; +sparc*) + debarch=sparc ;; +s390*) + debarch=s390 ;; +ppc*) + debarch=powerpc ;; +parisc*) + debarch=hppa ;; +mips*) + debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el) ;; +arm*) + if grep -q '^CONFIG_ARM64=y' $KCONFIG_CONFIG ; then + debarch=arm64 + else + debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) + fi ;; +*) + echo "" >&2 + echo "** ** ** WARNING ** ** **" >&2 + echo "" >&2 + echo "Your architecture doesn't have it's equivalent" >&2 + echo "Debian userspace architecture defined!" >&2 + echo "Falling back to using your current userspace instead!" >&2 + echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 + echo "" >&2 +esac +if [ -n "$KBUILD_DEBARCH" ] ; then + debarch="$KBUILD_DEBARCH" +fi +if [ -n "$debarch" ] ; then + forcearch="-DArchitecture=$debarch" +fi + create_package() { local pname="$1" pdir="$2" @@ -25,42 +66,6 @@ create_package() { chown -R root:root "$pdir" chmod -R go-w "$pdir" - # Attempt to find the correct Debian architecture - local forcearch="" debarch="" - case "$UTS_MACHINE" in - i386|ia64|alpha) - debarch="$UTS_MACHINE" ;; - x86_64) - debarch=amd64 ;; - sparc*) - debarch=sparc ;; - s390*) - debarch=s390 ;; - ppc*) - debarch=powerpc ;; - parisc*) - debarch=hppa ;; - mips*) - debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el) ;; - arm*) - debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el) ;; - *) - echo "" >&2 - echo "** ** ** WARNING ** ** **" >&2 - echo "" >&2 - echo "Your architecture doesn't have it's equivalent" >&2 - echo "Debian userspace architecture defined!" >&2 - echo "Falling back to using your current userspace instead!" >&2 - echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 - echo "" >&2 - esac - if [ -n "$KBUILD_DEBARCH" ] ; then - debarch="$KBUILD_DEBARCH" - fi - if [ -n "$debarch" ] ; then - forcearch="-DArchitecture=$debarch" - fi - # Create the package dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir" dpkg --build "$pdir" .. @@ -99,6 +104,9 @@ um) parisc|mips|powerpc) installed_image_path="boot/vmlinux-$version" ;; +arm64) + installed_image_path="boot/Image-$version" + ;; *) installed_image_path="boot/vmlinuz-$version" esac @@ -155,11 +163,11 @@ if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then for module in $(find lib/modules/ -name *.ko); do mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) # only keep debug symbols in the debug file - objcopy --only-keep-debug $module $dbg_dir/usr/lib/debug/$module + $OBJCOPY --only-keep-debug $module $dbg_dir/usr/lib/debug/$module # strip original module from debug symbols - objcopy --strip-debug $module + $OBJCOPY --strip-debug $module # then add a link to those - objcopy --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module + $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $module done ) fi @@ -288,15 +296,14 @@ mkdir -p "$destdir" (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" -arch=$(dpkg --print-architecture) cat <<EOF >> debian/control Package: $kernel_headers_packagename Provides: linux-headers, linux-headers-2.6 -Architecture: $arch -Description: Linux kernel headers for $KERNELRELEASE on $arch - This package provides kernel header files for $KERNELRELEASE on $arch +Architecture: $debarch +Description: Linux kernel headers for $KERNELRELEASE on $debarch + This package provides kernel header files for $KERNELRELEASE on $debarch . This is useful for people who need to build external modules EOF @@ -317,6 +324,17 @@ EOF create_package "$fwpackagename" "$fwdir" fi +# Copy device tree files if generated +stat arch/$ARCH/boot/dts/*.dtb && { + mkdir -p "$tmpdir/lib/firmware/$version/device-tree" + cp arch/$ARCH/boot/dts/*.dtb "$tmpdir/lib/firmware/$version/device-tree" +} + +# Copy boot wrapper files if built +if [ "$ARCH" = "arm64" ] ; then + stat arch/arm64/boot/*.axf && cp arch/arm64/boot/*.axf "$tmpdir/boot" +fi + cat <<EOF >> debian/control Package: $libc_headers_packagename |