diff --git a/Dockerfile.dapper b/Dockerfile.dapper new file mode 100644 index 0000000..0bf5859 --- /dev/null +++ b/Dockerfile.dapper @@ -0,0 +1,12 @@ +FROM ubuntu:14.04 + +RUN apt-get update && \ + apt-get install -y build-essential wget libncurses5-dev unzip bc curl python rsync ccache git vim + +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 + +ENV DAPPER_SOURCE /source +ENV DAPPER_OUTPUT ./dist +ENV SHELL /bin/bash +WORKDIR ${DAPPER_SOURCE} diff --git a/build.sh b/build.sh index 06db260..a4fdb79 100755 --- a/build.sh +++ b/build.sh @@ -3,18 +3,6 @@ set -e cd $(dirname $0) -export DOCKER_IMAGE=rancher-os-kernel-build - -./scripts/ci - -rm -rf dist - -echo "Build complete. Copying artifacts..." - -DIST_CONTAINER=$(docker create ${DOCKER_IMAGE}) -trap "docker rm -v ${DIST_CONTAINER}" EXIT - -mkdir -p dist -docker cp ${DIST_CONTAINER}:/source/dist/kernel dist/ +dapper ./scripts/ci ls -lh dist/kernel diff --git a/scripts/bootstrap b/scripts/bootstrap deleted file mode 100755 index 7f9a44e..0000000 --- a/scripts/bootstrap +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e -set -x - -cd $(dirname $0)/.. - -apt-get update -apt-get install -y build-essential wget libncurses5-dev unzip bc curl python rsync ccache git diff --git a/scripts/build-common b/scripts/build-common index 041491d..51f6eee 100644 --- a/scripts/build-common +++ b/scripts/build-common @@ -8,109 +8,6 @@ set -e : ${CONFIG:=$(pwd)/config} : ${DIST:=$(pwd)/dist} -DOCKER_FILE=${CONFIG}/.dockerfile - -write_base() -{ - if [ "${BASE_WRITTEN}" = "true" ]; then - return - fi - - mkdir -p $(dirname ${DOCKER_FILE}) - - cat > ${DOCKER_FILE} << EOF -FROM ${DOCKER_BASE:=ubuntu:14.04.3} -ENV TERM xterm -WORKDIR /source -EOF - - BASE_WRITTEN=true -} - -run() -{ - local content - - while [ $# -gt 1 ]; do - case $1 in - --assets) - shift 1 - if [ -e "$1" ]; then - content="$content\nCOPY $1 /source/$1" - else - content="$content\nCOPY $1 /source/" - fi - ;; - esac - - shift 1 - done - - write_base - if [ -n "$content" ]; then - echo -e "$content" >> ${DOCKER_FILE} - fi - if [ -n "$1" ]; then - echo -e "\nCOPY $1 /source/$1" >> ${DOCKER_FILE} - echo -e "RUN /source/$1" >> ${DOCKER_FILE} - fi - - if [ "$RUN_EXEC" = "true" ]; then - $1 - fi -} - -finish() -{ - if [ "$RUN_EXEC" = true ]; then - return 0 - fi - local cmd="docker build -t ${DOCKER_IMAGE} -f ${DOCKER_FILE} ." - echo Running $cmd - echo Pwd $(pwd) - - cat ${DOCKER_FILE} - - $cmd -} - -reset_docker_build() -{ - BASE_WRITTEN=false -} - -check() -{ - local hash=$1 - local file=$2 - - if [ ! -e "$file" ]; then - return 1 - fi - - CURRENT=$(sha1sum $file | awk '{print $1}') - - [ "$hash" = "$CURRENT" ] -} - -download() -{ - mkdir -p ${ARTIFACTS} - - local url=$2 - local file=${ARTIFACTS}/$(basename $2) - local hash=$1 - - if ! check $hash $file; then - curl -sL $url > $file - fi - - if ! check $hash $file; then - echo "ERROR: $file does not match checksum $hash, got $CURRENT" 1>&2 - return 1 - fi -} - list_build_files() { find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl find $(find ./arch/${SRCARCH} -name include -o -name scripts -type d) ./include ./scripts -type f diff --git a/scripts/build-kernel b/scripts/build-kernel index e5f3068..38cf79b 100755 --- a/scripts/build-kernel +++ b/scripts/build-kernel @@ -29,6 +29,7 @@ fi cd ${DIR} cp ${CONFIG}/kernel-config .config +# TODO update config/kernel-config for the latest kernel make oldconfig make -j$(nproc) tar-pkg diff --git a/scripts/ci b/scripts/ci index f71efad..296268d 100755 --- a/scripts/ci +++ b/scripts/ci @@ -3,15 +3,5 @@ set -e cd $(dirname $0)/.. -DOCKER_IMAGE=${DOCKER_IMAGE:=rancher-os-kernel-build} - -source scripts/build-common - -run --assets ./scripts/build-common \ - ./scripts/bootstrap -run ./scripts/download -run --assets ./scripts/firmware -run --assets ./config/kernel-config \ - ./scripts/build-kernel - -finish +./scripts/download +./scripts/build-kernel diff --git a/scripts/download b/scripts/download index 4cfb9a2..494f4ef 100755 --- a/scripts/download +++ b/scripts/download @@ -6,4 +6,36 @@ cd $(dirname $0)/.. source scripts/build-common +check() +{ + local hash=$1 + local file=$2 + + if [ ! -e "$file" ]; then + return 1 + fi + + CURRENT=$(sha1sum $file | awk '{print $1}') + + [ "$hash" = "$CURRENT" ] +} + +download() +{ + mkdir -p ${ARTIFACTS} + + local url=$2 + local file=${ARTIFACTS}/$(basename $2) + local hash=$1 + + if ! check $hash $file; then + curl -sL $url > $file + fi + + if ! check $hash $file; then + echo "ERROR: $file does not match checksum $hash, got $CURRENT" 1>&2 + return 1 + fi +} + download ${KERNEL_SHA1} ${KERNEL_URL}