forked from luigirizzo/netmap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request luigirizzo#334 from desbma/travis-ci
Add Travis CI integration
- Loading branch information
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |