Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Nelson <[email protected]>
  • Loading branch information
RobertCNelson committed Apr 14, 2016
1 parent ff3e9a6 commit 924e651
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions build_deb_in_arm_chroot.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 924e651

Please sign in to comment.