Skip to content

Commit 173b37c

Browse files
committed
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
1 parent bfd6ae3 commit 173b37c

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
dist: trusty
2+
language: c
3+
compiler: gcc
4+
cache: ccache
5+
env:
6+
- ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LOCALVERSION=-git$TRAVIS_COMMIT
7+
addons:
8+
apt:
9+
packages:
10+
- gcc-arm-linux-gnueabihf
11+
- debootstrap
12+
- qemu-user-static
13+
- binfmt-support
14+
- sbuild
15+
- lzop
16+
script:
17+
- bash -ex build_deb_in_arm_chroot.sh

build_deb_in_arm_chroot.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
CHROOT_DIR=/tmp/arm-chroot
3+
VERSION=jessie
4+
CHROOT_ARCH=armhf
5+
MIRROR=http://httpredir.debian.org/debian
6+
GUEST_DEPENDENCIES="build-essential git sudo lzop"
7+
DEBOOT="1.0.80"
8+
9+
function run_build {
10+
cd ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}
11+
make bb.org_defconfig
12+
make -s -j4 CROSS_COMPILE=arm-linux-gnueabihf-
13+
}
14+
15+
function run_package {
16+
if [ ! true ] ; then
17+
make KBUILD_DEBARCH=armhf KDEB_SOURCENAME=linux KDEB_CHANGELOG_DIST=unstable
18+
else
19+
echo "Not running this time"
20+
fi
21+
}
22+
23+
function setup_arm_chroot {
24+
pushd /tmp
25+
wget https://beagleboard.org/static/arm-debian-jessie.rootfs.tgz
26+
popd
27+
28+
sudo mkdir ${CHROOT_DIR}
29+
sudo tar xzf /tmp/arm-debian-jessie.rootfs.tgz -C ${CHROOT_DIR}
30+
31+
echo "export ARCH=${ARCH}" > envvars.sh
32+
echo "export TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR}" >> envvars.sh
33+
chmod a+x envvars.sh
34+
35+
sudo chroot ${CHROOT_DIR} apt-get update
36+
sudo chroot ${CHROOT_DIR} apt-get --allow-unauthenticated install \
37+
-qq -y ${GUEST_DEPENDENCIES}
38+
sudo mkdir -p ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}
39+
sudo rsync -a ${TRAVIS_BUILD_DIR}/ ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}/
40+
41+
sudo touch ${CHROOT_DIR}/.chroot_is_done
42+
}
43+
44+
function setup_arm_chroot_orig {
45+
wget -c https://rcn-ee.net/mirror/debootstrap/debootstrap_${DEBOOT}_all.deb
46+
if [ -f debootstrap_${DEBOOT}_all.deb ] ; then
47+
sudo dpkg -i debootstrap_${DEBOOT}_all.deb
48+
rm -rf debootstrap_${DEBOOT}_all.deb
49+
fi
50+
sudo mkdir ${CHROOT_DIR}
51+
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential \
52+
--arch=${CHROOT_ARCH} ${VERSION} ${CHROOT_DIR} ${MIRROR}
53+
sudo cp /usr/bin/qemu-arm-static ${CHROOT_DIR}/usr/bin/
54+
sudo chroot ${CHROOT_DIR} ./debootstrap/debootstrap --second-stage
55+
sudo sbuild-createchroot --arch=${CHROOT_ARCH} --foreign --setup-only \
56+
${VERSION} ${CHROOT_DIR} ${MIRROR}
57+
58+
echo "export ARCH=${ARCH}" > envvars.sh
59+
echo "export TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR}" >> envvars.sh
60+
chmod a+x envvars.sh
61+
62+
sudo chroot ${CHROOT_DIR} apt-get update
63+
sudo chroot ${CHROOT_DIR} apt-get --allow-unauthenticated install \
64+
-qq -y ${GUEST_DEPENDENCIES}
65+
sudo mkdir -p ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}
66+
sudo rsync -a ${TRAVIS_BUILD_DIR}/ ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}/
67+
68+
sudo touch ${CHROOT_DIR}/.chroot_is_done
69+
}
70+
71+
if [ -e "/.chroot_is_done" ]; then
72+
. ./envvars.sh
73+
run_package
74+
else
75+
echo "Setting up chrooted ARM environment"
76+
setup_arm_chroot
77+
run_build
78+
sudo chroot ${CHROOT_DIR} bash -c "cd ${TRAVIS_BUILD_DIR} && bash -ex build_deb_in_arm_chroot.sh"
79+
fi

0 commit comments

Comments
 (0)