Skip to content

Commit

Permalink
Merge pull request luigirizzo#334 from desbma/travis-ci
Browse files Browse the repository at this point in the history
Add Travis CI integration
  • Loading branch information
giuseppelettieri authored Jul 16, 2017
2 parents 267fbed + 0b5227d commit 0847fa8
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
dist: trusty
sudo: false
language: c
cache:
directories:
- $HOME/Linux
- $HOME/Drivers
env:
- KERNEL_VERSION=3.2 ARCH=i386
- KERNEL_VERSION=3.4 ARCH=i386
- KERNEL_VERSION=3.10 ARCH=i386
- KERNEL_VERSION=3.16 ARCH=i386
- KERNEL_VERSION=4.1 ARCH=i386
- KERNEL_VERSION=4.4 ARCH=i386
- KERNEL_VERSION=4.9 ARCH=i386
- KERNEL_VERSION=linus ARCH=i386
- KERNEL_VERSION=3.2 ARCH=x86_64
- KERNEL_VERSION=3.4 ARCH=x86_64
- KERNEL_VERSION=3.10 ARCH=x86_64
- KERNEL_VERSION=3.16 ARCH=x86_64
- KERNEL_VERSION=4.1 ARCH=x86_64
- KERNEL_VERSION=4.4 ARCH=x86_64
- KERNEL_VERSION=4.9 ARCH=x86_64
- KERNEL_VERSION=linus ARCH=x86_64
matrix:
allow_failures:
- env: KERNEL_VERSION=linus ARCH=i386
- env: KERNEL_VERSION=linus ARCH=x86_64
install:
- "rm -Rf LINUX/ext-drivers && mkdir -p $HOME/Drivers && ln -sv $HOME/Drivers LINUX/ext-drivers"
script:
- "./ci/build-linux $KERNEL_VERSION $ARCH"
53 changes: 53 additions & 0 deletions ci/build-linux
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash -eu

set -o pipefail

readonly KERNEL_VERSION=${1:?}
readonly ARCH=${2:?}
readonly GCC_MAJOR_VERSION=$(echo '#include <stdio.h>
void main() { printf("%u\n", __GNUC__); }' | gcc -x c - -o /tmp/getgccversion && /tmp/getgccversion)
readonly PROC_COUNT=$(grep -c '^processor' /proc/cpuinfo)


if [ ! -d ~/Linux/$KERNEL_VERSION ]
then
# clone
if [ "$KERNEL_VERSION" = "linus" ]
then
git clone 'https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git' ~/Linux/$KERNEL_VERSION
else
git clone 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git' ~/Linux/$KERNEL_VERSION
pushd ~/Linux/$KERNEL_VERSION
git checkout linux-${KERNEL_VERSION}.y
popd
fi
else
# update
pushd ~/Linux/$KERNEL_VERSION
git pull
popd
fi

# configure kernel
pushd ~/Linux/$KERNEL_VERSION
compiler_file=compiler-gcc${GCC_MAJOR_VERSION}.h
if [ ! -f include/linux/${compiler_file} -a ! -h include/linux/${compiler_file} ]
then
# fix compilation of old kernels with recent GCC
pushd include/linux
if [ -f compiler-gcc5.h -a $GCC_MAJOR_VERSION -gt 5 ]
then
ln -sv compiler-gcc5.h ${compiler_file}
else
ln -sv compiler-gcc4.h ${compiler_file}
fi
popd
fi
make mrproper
make -j $PROC_COUNT ARCH=${ARCH} defconfig
make -j $PROC_COUNT ARCH=${ARCH} modules_prepare
popd

# build
./configure --kernel-dir=$HOME/Linux/$KERNEL_VERSION
make -j $PROC_COUNT

0 comments on commit 0847fa8

Please sign in to comment.