From 924e6510cf263af158b4a8c8bf0aed27a908e30b Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Thu, 14 Apr 2016 11:44:51 -0500 Subject: [PATCH] enable: travis: https://travis-ci.org/beagleboard/linux Signed-off-by: Robert Nelson --- .travis.yml | 17 ++++++++++++ build_deb_in_arm_chroot.sh | 54 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .travis.yml create mode 100644 build_deb_in_arm_chroot.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000..8f4e8f607a3db --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +dist: trusty +language: c +compiler: gcc +cache: ccache +env: + - ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOCALVERSION=-git$TRAVIS_COMMIT +addons: + apt: + packages: + - gcc-arm-linux-gnueabihf + - debootstrap + - qemu-user-static + - binfmt-support + - sbuild + - lzop +script: + - bash -ex build_deb_in_arm_chroot.sh diff --git a/build_deb_in_arm_chroot.sh b/build_deb_in_arm_chroot.sh new file mode 100644 index 0000000000000..c02f39db6f2cf --- /dev/null +++ b/build_deb_in_arm_chroot.sh @@ -0,0 +1,54 @@ +#!/bin/bash +CHROOT_DIR=/tmp/arm-chroot +VERSION=jessie +CHROOT_ARCH=armhf +MIRROR=http://httpredir.debian.org/debian +GUEST_DEPENDENCIES="build-essential git sudo lzop" +DEBOOT="1.0.80" + +function run_build { + cd ${CHROOT_DIR}/${TRAVIS_BUILD_DIR} + make bb.org_defconfig + make -s -j4 CROSS_COMPILE="ccache arm-linux-gnueabihf-" +} + +function run_package { + make KBUILD_DEBARCH=armhf KDEB_SOURCENAME=linux KDEB_CHANGELOG_DIST=unstable +} + +function setup_arm_chroot { + wget -c https://rcn-ee.net/mirror/debootstrap/debootstrap_${DEBOOT}_all.deb + if [ -f debootstrap_${DEBOOT}_all.deb ] ; then + sudo dpkg -i debootstrap_${DEBOOT}_all.deb + rm -rf debootstrap_${DEBOOT}_all.deb + fi + sudo mkdir ${CHROOT_DIR} + sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential \ + --arch=${CHROOT_ARCH} ${VERSION} ${CHROOT_DIR} ${MIRROR} + sudo cp /usr/bin/qemu-arm-static ${CHROOT_DIR}/usr/bin/ + sudo chroot ${CHROOT_DIR} ./debootstrap/debootstrap --second-stage + sudo sbuild-createchroot --arch=${CHROOT_ARCH} --foreign --setup-only \ + ${VERSION} ${CHROOT_DIR} ${MIRROR} + + echo "export ARCH=${ARCH}" > envvars.sh + echo "export TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR}" >> envvars.sh + chmod a+x envvars.sh + + sudo chroot ${CHROOT_DIR} apt-get update + sudo chroot ${CHROOT_DIR} apt-get --allow-unauthenticated install \ + -qq -y ${GUEST_DEPENDENCIES} + sudo mkdir -p ${CHROOT_DIR}/${TRAVIS_BUILD_DIR} + sudo rsync -a ${TRAVIS_BUILD_DIR}/ ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}/ + + sudo touch ${CHROOT_DIR}/.chroot_is_done +} + +if [ -e "/.chroot_is_done" ]; then + . ./envvars.sh + run_package +else + echo "Setting up chrooted ARM environment" + setup_arm_chroot + run_build + sudo chroot ${CHROOT_DIR} bash -c "cd ${TRAVIS_BUILD_DIR} && bash -ex build_deb_in_arm_chroot.sh" +fi