1
0
mirror of https://github.com/rancher/os.git synced 2025-08-23 08:58:17 +00:00

Merge pull request #795 from imikushin/customize-installer

ARM installer
This commit is contained in:
Darren Shepherd 2016-03-15 09:59:08 -07:00
commit e9ab9e408e
29 changed files with 194 additions and 108 deletions

2
.docker-env.sample Normal file
View File

@ -0,0 +1,2 @@
DOCKER_HOST="tcp://192.168.2.2:2375"
DOCKER_TLS_VERIFY=

View File

@ -1,7 +1,6 @@
build: build:
image: rancher/dapper:1.9.1 image: rancher/dapper:1.10.2
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
commands: commands:
- dapper -O make ARCH=arm rootfs - ./scripts/ci
- dapper -O make DEV_BUILD=1 test

1
.gitignore vendored
View File

@ -12,3 +12,4 @@
/tests/integration/.tox /tests/integration/.tox
*.pyc *.pyc
__pychache__ __pychache__
.docker-env.*

View File

@ -1 +0,0 @@
--privileged

18
Dockerfile.arm64 Normal file
View File

@ -0,0 +1,18 @@
FROM aarch64/debian:jessie
ENV DEBIAN_FRONTEND noninteractive
ENV ARCH arm
RUN apt-get update && apt-get install -y parted git gcc make autoconf
RUN mkdir -p /usr/local/src && \
cd /usr/local/src && \
git clone https://git.linaro.org/people/takahiro.akashi/kexec-tools.git && \
cd kexec-tools && git checkout kdump/for-14 && ./bootstrap && ./configure && make && make install
COPY ./scripts/installer /scripts
COPY ./build.conf /scripts/
COPY ./dist/artifacts/vmlinuz /dist/
COPY ./dist/artifacts/initrd /dist/
ENTRYPOINT ["/scripts/lay-down-os"]

View File

@ -1,58 +1,74 @@
FROM ubuntu:15.10 FROM rancher/os-dapper-base
RUN apt-get update && \ RUN apt-get update && \
apt-get -y install locales sudo vim less curl wget git rsync build-essential syslinux isolinux xorriso \ apt-get -y install locales sudo vim less curl wget git rsync build-essential isolinux xorriso gccgo \
libblkid-dev libmount-dev libselinux1-dev cpio genisoimage qemu-kvm python-pip ca-certificates pkg-config libblkid-dev libmount-dev libselinux1-dev cpio genisoimage qemu-kvm python-pip ca-certificates pkg-config tox
RUN locale-gen en_US.UTF-8 ARG HOST_ARCH
ENV LANG en_US.UTF-8 ENV HOST_ARCH ${HOST_ARCH}
ENV PATH $PATH:/usr/local/go/bin RUN mkdir -p /usr/local && cd /usr/local && \
wget -O - https://storage.googleapis.com/golang/go1.6.src.tar.gz | tar -xz && \
cd go/src && GOROOT_BOOTSTRAP=/usr GOARCH=${HOST_ARCH} GOHOSTARCH=${HOST_ARCH} ./make.bash
ENV PATH /usr/local/go/bin:$PATH
RUN mkdir -p /go/src /go/bin && chmod -R 777 /go RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
ENV GOPATH /go ENV GOPATH /go
ENV PATH /go/bin:$PATH ENV PATH /go/bin:$PATH
RUN pip install tox ARG HOST_DOCKER_BINARY_URL
RUN curl -sSL https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz | tar -xz -C /usr/local ENV HOST_DOCKER_BINARY_URL ${HOST_DOCKER_BINARY_URL}
RUN curl -sL https://get.docker.com/builds/Linux/x86_64/docker-1.9.1 > /usr/local/bin/docker RUN wget -O - ${HOST_DOCKER_BINARY_URL} > /usr/local/bin/docker
RUN chmod +x /usr/local/bin/docker RUN chmod +x /usr/local/bin/docker
ENV DAPPER_DOCKER_SOCKET true ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_SOURCE /go/src/github.com/rancher/os ENV DAPPER_SOURCE /go/src/github.com/rancher/os
ENV DAPPER_OUTPUT ./bin ./dist ENV DAPPER_OUTPUT ./bin ./dist ./build/os-config.yml
ENV DAPPER_RUN_ARGS --privileged ENV DAPPER_RUN_ARGS --privileged
ENV SHELL /bin/bash ENV SHELL /bin/bash
WORKDIR ${DAPPER_SOURCE} WORKDIR ${DAPPER_SOURCE}
COPY .dockerignore.docker .dockerignore COPY .dockerignore.dapper .dockerignore
RUN cd /usr/local/src && \ CMD make
ARG TOOLCHAIN
ENV TOOLCHAIN ${TOOLCHAIN}
RUN if [ "${TOOLCHAIN}" != "" ] && ! which ${TOOLCHAIN}-gcc; then \
apt-get install -y gcc-${TOOLCHAIN} g++-${TOOLCHAIN} \
;fi
RUN if [ "${TOOLCHAIN}" != "" ]; then \
cd /usr/local/src && \
for i in libselinux pcre3 util-linux; do \ for i in libselinux pcre3 util-linux; do \
apt-get build-dep -y $i && \ apt-get build-dep -y $i && \
apt-get source -y $i \ apt-get source -y $i \
;done ;done \
;fi
RUN apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf RUN if [ "${TOOLCHAIN}" != "" ]; then \
RUN cd /usr/local/src/pcre3-* && \ cd /usr/local/src/pcre3-* && \
autoreconf && \ autoreconf && \
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf && \ CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ ./configure --host=${TOOLCHAIN} --prefix=/usr/${TOOLCHAIN} && \
make -j$(nproc) && \ make -j$(nproc) && \
make install make install \
;fi
RUN cd /usr/local/src/libselinux-* && \ RUN if [ "${TOOLCHAIN}" != "" ]; then \
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ make CFLAGS=-Wall && \ cd /usr/local/src/libselinux-* && \
make PREFIX=/usr/arm-linux-gnueabihf DESTDIR=/usr/arm-linux-gnueabihf install CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ make CFLAGS=-Wall && \
make PREFIX=/usr/${TOOLCHAIN} DESTDIR=/usr/${TOOLCHAIN} install \
;fi
RUN cd /usr/local/src/util-linux-* && \ RUN if [ "${TOOLCHAIN}" != "" ]; then \
cd /usr/local/src/util-linux-* && \
autoreconf && \ autoreconf && \
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf \ CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ ./configure --host=${TOOLCHAIN} --prefix=/usr/${TOOLCHAIN} \
--disable-all-programs \ --disable-all-programs \
--enable-libmount \ --enable-libmount \
--enable-libblkid \ --enable-libblkid \
--enable-libuuid \ --enable-libuuid \
--enable-mount && \ --enable-mount && \
make -j$(nproc) && \ make -j$(nproc) && \
make install make install \
;fi
CMD make all
ENV DAPPER_OUTPUT ./bin ./dist ./build/os-config.yml

View File

@ -1,6 +1,8 @@
FORCE_PULL := 0 FORCE_PULL := 0
DEV_BUILD := 0 DEV_BUILD := 0
HOST_ARCH := amd64
ARCH := amd64 ARCH := amd64
SUFFIX := $(if $(filter-out amd64,$(ARCH)),_$(ARCH))
include build.conf include build.conf
include build.conf.$(ARCH) include build.conf.$(ARCH)
@ -12,15 +14,12 @@ bin/ros:
build/host_ros: bin/ros build/host_ros: bin/ros
mkdir -p $(dir $@) mkdir -p $(dir $@)
ifeq "$(ARCH)" "amd64" ifeq "$(ARCH)" "$(HOST_ARCH)"
ln -sf ../bin/ros $@ ln -sf ../bin/ros $@
else else
ARCH=amd64 VERSION=$(VERSION) ./scripts/mk-ros.sh $@ ARCH=$(HOST_ARCH) TOOLCHAIN= VERSION=$(VERSION) ./scripts/mk-ros.sh $@
endif endif
pwd := $(shell pwd)
include scripts/build-common
assets/docker: assets/docker:
mkdir -p $(dir $@) mkdir -p $(dir $@)
@ -34,33 +33,33 @@ assets/selinux/policy.29:
ifdef COMPILED_KERNEL_URL ifdef COMPILED_KERNEL_URL
installer: minimal installer: minimal
docker build -t $(IMAGE_NAME):$(VERSION) . docker build -t $(IMAGE_NAME):$(VERSION)$(SUFFIX) -f Dockerfile.$(ARCH) .
$(DIST)/artifacts/vmlinuz: $(BUILD)/kernel/ dist/artifacts/vmlinuz: build/kernel/
mkdir -p $(dir $@) mkdir -p $(dir $@)
mv $(BUILD)/kernel/boot/vmlinuz* $@ mv $(or $(wildcard build/kernel/boot/vmlinuz*), $(wildcard build/kernel/boot/vmlinux*)) $@
$(BUILD)/kernel/: build/kernel/:
mkdir -p $@ mkdir -p $@
curl -L "$(COMPILED_KERNEL_URL)" | tar -xzf - -C $@ curl -L "$(COMPILED_KERNEL_URL)" | tar -xzf - -C $@
$(DIST)/artifacts/initrd: bin/ros assets/docker assets/selinux/policy.29 $(BUILD)/kernel/ $(BUILD)/images.tar dist/artifacts/initrd: bin/ros assets/docker assets/selinux/policy.29 build/kernel/ build/images.tar
mkdir -p $(dir $@) mkdir -p $(dir $@)
ARCH=$(ARCH) DFS_IMAGE=$(DFS_IMAGE) DEV_BUILD=$(DEV_BUILD) ./scripts/mk-initrd.sh $@ SUFFIX=$(SUFFIX) DFS_IMAGE=$(DFS_IMAGE) DEV_BUILD=$(DEV_BUILD) ./scripts/mk-initrd.sh $@
$(DIST)/artifacts/rancheros.iso: minimal dist/artifacts/rancheros.iso: minimal
./scripts/mk-rancheros-iso.sh ./scripts/mk-rancheros-iso.sh
all: minimal installer iso all: minimal installer iso
initrd: $(DIST)/artifacts/initrd initrd: dist/artifacts/initrd
minimal: initrd $(DIST)/artifacts/vmlinuz minimal: initrd dist/artifacts/vmlinuz
iso: $(DIST)/artifacts/rancheros.iso $(DIST)/artifacts/iso-checksums.txt iso: dist/artifacts/rancheros.iso dist/artifacts/iso-checksums.txt
test: minimal test: minimal
cd tests/integration && tox cd tests/integration && tox
@ -74,22 +73,22 @@ build/os-config.yml: build/host_ros
ARCH=$(ARCH) VERSION=$(VERSION) ./scripts/gen-os-config.sh $@ ARCH=$(ARCH) VERSION=$(VERSION) ./scripts/gen-os-config.sh $@
$(BUILD)/images.tar: build/host_ros build/os-config.yml build/images.tar: build/host_ros build/os-config.yml
ARCH=$(ARCH) FORCE_PULL=$(FORCE_PULL) ./scripts/mk-images-tar.sh ARCH=$(ARCH) FORCE_PULL=$(FORCE_PULL) ./scripts/mk-images-tar.sh
$(DIST)/artifacts/rootfs.tar.gz: bin/ros assets/docker $(BUILD)/images.tar assets/selinux/policy.29 dist/artifacts/rootfs.tar.gz: bin/ros assets/docker build/images.tar assets/selinux/policy.29
mkdir -p $(dir $@) mkdir -p $(dir $@)
ARCH=$(ARCH) DFS_IMAGE=$(DFS_IMAGE) DEV_BUILD=$(DEV_BUILD) IS_ROOTFS=1 ./scripts/mk-initrd.sh $@ SUFFIX=$(SUFFIX) DFS_IMAGE=$(DFS_IMAGE) DEV_BUILD=$(DEV_BUILD) IS_ROOTFS=1 ./scripts/mk-initrd.sh $@
$(DIST)/artifacts/iso-checksums.txt: $(DIST)/artifacts/rancheros.iso dist/artifacts/iso-checksums.txt: dist/artifacts/rancheros.iso
./scripts/mk-iso-checksums-txt.sh ./scripts/mk-iso-checksums-txt.sh
version: version:
@echo $(VERSION) @echo $(VERSION)
rootfs: $(DIST)/artifacts/rootfs.tar.gz rootfs: dist/artifacts/rootfs.tar.gz
.PHONY: rootfs version bin/ros .PHONY: rootfs version bin/ros

View File

@ -1,6 +1,6 @@
IMAGE_NAME=rancher/os IMAGE_NAME=rancher/os
VERSION=v0.4.4-dev VERSION=v0.4.4-dev
DFS_IMAGE=rancher/docker:v1.10.2 DFS_IMAGE=rancher/docker:v1.10.2-1
SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.1/policy.29 SELINUX_POLICY_URL=https://github.com/rancher/refpolicy/releases/download/v0.0.1/policy.29
HOSTNAME_DEFAULT=rancher HOSTNAME_DEFAULT=rancher

View File

@ -1,2 +1,5 @@
DAPPER_BASE=ubuntu:16.04
TOOLCHAIN= #empty
COMPILED_KERNEL_URL=https://github.com/rancher/os-kernel/releases/download/Ubuntu-4.2.0-28.33-rancher/linux-4.2.8-ckt3-rancher-x86.tar.gz COMPILED_KERNEL_URL=https://github.com/rancher/os-kernel/releases/download/Ubuntu-4.2.0-28.33-rancher/linux-4.2.8-ckt3-rancher-x86.tar.gz
DOCKER_BINARY_URL=https://get.docker.com/builds/Linux/x86_64/docker-1.10.2 DOCKER_BINARY_URL=https://get.docker.com/builds/Linux/x86_64/docker-1.10.2

View File

@ -1 +1,5 @@
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.10.2-ros_arm/docker-1.10.2 DAPPER_BASE=armhf/ubuntu:16.04
TOOLCHAIN=arm-linux-gnueabihf
COMPILED_KERNEL_URL= #empty
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.10.2-arm2/docker-1.10.2_arm

5
build.conf.arm64 Normal file
View File

@ -0,0 +1,5 @@
DAPPER_BASE=aarch64/ubuntu:16.04
TOOLCHAIN=aarch64-linux-gnu
COMPILED_KERNEL_URL=https://github.com/imikushin/os-kernel/releases/download/Estuary-4.1.18-arm64/linux-4.1.18-arm64.tar.gz
DOCKER_BINARY_URL=https://github.com/rancher/docker/releases/download/v1.10.2-arm2/docker-1.10.2_arm64

View File

@ -1,6 +1,10 @@
#!/bin/bash #!/bin/bash
set -e set -e
export ARCH=${ARCH:-amd64}
cd $(dirname $0)
if [ "$1" != "--dev" ]; then if [ "$1" != "--dev" ]; then
echo echo
echo Running \"production\" build. Will use lzma to compress initrd, which is somewhat slow... echo Running \"production\" build. Will use lzma to compress initrd, which is somewhat slow...
@ -8,10 +12,9 @@ if [ "$1" != "--dev" ]; then
echo echo
echo For \"developer\" builds, run ./build.sh --dev echo For \"developer\" builds, run ./build.sh --dev
echo echo
dapper make all ./scripts/make.sh all
else else
dapper make DEV_BUILD=1 all ./scripts/make.sh DEV_BUILD=1 all
fi fi
ls -lh dist/artifacts ls -lh dist/artifacts

View File

@ -66,7 +66,7 @@ rancher:
nameservers: [8.8.8.8, 8.8.4.4] nameservers: [8.8.8.8, 8.8.4.4]
repositories: repositories:
core: core:
url: {{.OS_SERVICES_REPO}}/{{.VERSION}} url: {{.OS_SERVICES_REPO}}/{{.VERSION}}{{.SUFFIX}}
state: state:
fstype: auto fstype: auto
dev: LABEL=RANCHER_STATE dev: LABEL=RANCHER_STATE

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/sh
set -ex set -ex
cd $(dirname $0)/.. cd $(dirname $0)/..
. ./scripts/dapper-common
dapper -O make ARCH=arm rootfs dapper -d -O make HOST_ARCH=${HOST_ARCH} ARCH=${ARCH} DEV_BUILD=1 test
dapper -O make DEV_BUILD=1 test

20
scripts/dapper-common Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
set -ex
HOST_ARCH=${HOST_ARCH:-$(docker version | grep 'OS/Arch:' | tail -n+2 | awk '{print $2}' | cut -f2 -d'/')}
HOST_ARCH=${HOST_ARCH:?"Failed to guess HOST_ARCH"}
ARCH=${ARCH:-"$HOST_ARCH"}
export HOST_ARCH ARCH
cd $(dirname $0)/..
[ -f "./.docker-env.${HOST_ARCH}" ] && . ./.docker-env.${HOST_ARCH} || echo "WARNING: missing .docker-env.${HOST_ARCH} (to use an ${HOST_ARCH} docker host)"
. ./build.conf.${HOST_ARCH}
export HOST_DOCKER_BINARY_URL=${DOCKER_BINARY_URL}
docker inspect $DAPPER_BASE >/dev/null 2>&1 || docker pull $DAPPER_BASE
docker tag $DAPPER_BASE rancher/os-dapper-base
set -a
. ./build.conf.${ARCH}
set +a

View File

@ -21,6 +21,7 @@ do
*) exit 1 ;; *) exit 1 ;;
esac esac
done done
[ "$ARCH" == "arm" && "$ENV" != "rancher-upgrade" ] && ENV=arm
DIST=${DIST:-/dist} DIST=${DIST:-/dist}
CLOUD_CONFIG=${CLOUD_CONFIG:-"${SCRIPTS_DIR}/conf/empty.yml"} CLOUD_CONFIG=${CLOUD_CONFIG:-"${SCRIPTS_DIR}/conf/empty.yml"}
@ -153,6 +154,10 @@ if [ -n ${ENV} ]; then
install_grub install_grub
"${SCRIPTS_DIR}/seed-data" ${BASE_DIR} ${CLOUD_CONFIG} ${FILES} "${SCRIPTS_DIR}/seed-data" ${BASE_DIR} ${CLOUD_CONFIG} ${FILES}
;; ;;
"arm")
format_and_mount
"${SCRIPTS_DIR}/seed-data" ${BASE_DIR} ${CLOUD_CONFIG} ${FILES}
;;
"amazon-ebs-pv"|"amazon-ebs-hvm") "amazon-ebs-pv"|"amazon-ebs-hvm")
CONSOLE=ttyS0 CONSOLE=ttyS0
format_and_mount format_and_mount

7
scripts/make.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
cd $(dirname $0)/..
. ./scripts/dapper-common
dapper make HOST_ARCH=${HOST_ARCH} ARCH=${ARCH} "$@"

View File

@ -1,17 +1,12 @@
#!/bin/bash #!/bin/bash
set -ex set -ex
TARGET=${1} TARGET=$(pwd)/${1}
ARCH=${ARCH:-"amd64"} SUFFIX=${SUFFIX:-""}
DFS_IMAGE=${DFS_IMAGE:?"DFS_IMAGE not set"} DFS_IMAGE=${DFS_IMAGE:?"DFS_IMAGE not set"}
IS_ROOTFS=${IS_ROOTFS:-0} IS_ROOTFS=${IS_ROOTFS:-0}
suffix=""
[ "$ARCH" == "amd64" ] || suffix="_${ARCH}"
DFS_ARCH_IMAGE=${DFS_IMAGE}${suffix}
cd $(dirname $0)/.. cd $(dirname $0)/..
. scripts/build-common . scripts/build-common
@ -41,7 +36,7 @@ cp assets/selinux/seusers ${INITRD_DIR}/usr/etc/selinux/ros/
cp assets/selinux/lxc_contexts ${INITRD_DIR}/usr/etc/selinux/ros/contexts/ cp assets/selinux/lxc_contexts ${INITRD_DIR}/usr/etc/selinux/ros/contexts/
cp assets/selinux/failsafe_context ${INITRD_DIR}/usr/etc/selinux/ros/contexts/ cp assets/selinux/failsafe_context ${INITRD_DIR}/usr/etc/selinux/ros/contexts/
DFS_ARCH=$(docker create ${DFS_ARCH_IMAGE}) DFS_ARCH=$(docker create ${DFS_IMAGE}${SUFFIX})
trap "docker rm -fv ${DFS_ARCH}" EXIT trap "docker rm -fv ${DFS_ARCH}" EXIT
docker export ${DFS_ARCH} | tar xvf - -C ${INITRD_DIR} --exclude=usr/bin/dockerlaunch \ docker export ${DFS_ARCH} | tar xvf - -C ${INITRD_DIR} --exclude=usr/bin/dockerlaunch \
@ -57,8 +52,8 @@ if [ "$IS_ROOTFS" == "1" ]; then
trap "docker rm -fv ${DFS_ARCH} ${DFS}" EXIT trap "docker rm -fv ${DFS_ARCH} ${DFS}" EXIT
docker exec -i ${DFS} docker load < ${BUILD}/images.tar docker exec -i ${DFS} docker load < ${BUILD}/images.tar
docker stop ${DFS} docker stop ${DFS}
docker run --rm --volumes-from=${DFS} debian:jessie tar -c -C /var/lib/docker ./image | tar -x -C ${INITRD_DIR}/var/lib/system-docker docker run --rm --volumes-from=${DFS} rancher/os-dapper-base tar -c -C /var/lib/docker ./image | tar -x -C ${INITRD_DIR}/var/lib/system-docker
docker run --rm --volumes-from=${DFS} debian:jessie tar -c -C /var/lib/docker ./overlay | tar -x -C ${INITRD_DIR}/var/lib/system-docker docker run --rm --volumes-from=${DFS} rancher/os-dapper-base tar -c -C /var/lib/docker ./overlay | tar -x -C ${INITRD_DIR}/var/lib/system-docker
cd ${INITRD_DIR} cd ${INITRD_DIR}

View File

@ -9,11 +9,11 @@ VERSION=${VERSION:?"VERSION not set"}
cd $(dirname $0)/.. cd $(dirname $0)/..
strip_bin=$(which strip) strip_bin=$(which strip)
if [ "${ARCH}" == "arm" ]; then [ "${ARCH}" == "arm" ] && export GOARM=6
export GOARM=6 if [ "${TOOLCHAIN}" != "" ]; then
export CC=/usr/bin/arm-linux-gnueabihf-gcc export CC=/usr/bin/${TOOLCHAIN}-gcc
export CGO_ENABLED=1 export CGO_ENABLED=1
strip_bin=/usr/arm-linux-gnueabihf/bin/strip strip_bin=/usr/${TOOLCHAIN}/bin/strip
fi fi
GOARCH=${ARCH} go build -tags netgo -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${ros} GOARCH=${ARCH} go build -tags netgo -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${ros}
${strip_bin} --strip-all ${ros} ${strip_bin} --strip-all ${ros}

View File

@ -7,6 +7,9 @@ cd $(dirname $0)/..
source scripts/build-common source scripts/build-common
BASE=$(pwd) BASE=$(pwd)
UNAME=$(uname)
QEMUARCH=$(uname -m)
[ "${UNAME}" == "Darwin" ] && QEMUARCH=x86_64
KERNEL=${BASE}/dist/artifacts/vmlinuz KERNEL=${BASE}/dist/artifacts/vmlinuz
INITRD=${BASE}/dist/artifacts/initrd INITRD=${BASE}/dist/artifacts/initrd
@ -41,7 +44,7 @@ while [ "$#" -gt 0 ]; do
fi fi
;; ;;
--qemu) --qemu)
if [ -x $(which qemu-system-x86_64) ]; then if [ -x $(which qemu-system-${QEMUARCH}) ]; then
QEMU=1 QEMU=1
fi fi
;; ;;
@ -76,7 +79,6 @@ if [[ ! -e ${KERNEL} || ! -e ${INITRD} ]]; then
exit 1 exit 1
fi fi
UNAME=$(uname)
# Linux and Darwin SHA1 sum binary are different, pick which to use # Linux and Darwin SHA1 sum binary are different, pick which to use
if [ "$UNAME" == "Darwin" ]; then sha1sum=$(which shasum) if [ "$UNAME" == "Darwin" ]; then sha1sum=$(which shasum)
elif [ "$UNAME" == "Linux" ]; then sha1sum=$(which sha1sum); elif [ "$UNAME" == "Linux" ]; then sha1sum=$(which sha1sum);
@ -102,7 +104,7 @@ if [ "$REBUILD" == "1" ]; then
mkdir -p ${INITRD_TMP}/usr/{bin,share/ros} mkdir -p ${INITRD_TMP}/usr/{bin,share/ros}
cp bin/ros ${INITRD_TMP}/usr/bin/ cp bin/ros ${INITRD_TMP}/usr/bin/
cp -f os-config.yml ${INITRD_TMP}/usr/share/ros/ #FIXME: generate os-config.yml from os-config.tpl.yml cp -f build/os-config.yml ${INITRD_TMP}/usr/share/ros/
pushd ${INITRD_TMP} pushd ${INITRD_TMP}
find . | cpio -H newc -o | gzip > ${INITRD_TEST} find . | cpio -H newc -o | gzip > ${INITRD_TEST}
@ -166,7 +168,7 @@ if [ "$XHYVE" == "1" ] || [ "$QEMU" == "1" ]; then
if [ "$KVM" == "1" ]; then if [ "$KVM" == "1" ]; then
KVM_ENABLE="-machine accel=kvm -cpu host" KVM_ENABLE="-machine accel=kvm -cpu host"
fi fi
exec qemu-system-x86_64 -serial stdio \ exec qemu-system-${QEMUARCH} -serial stdio \
-kernel ${KERNEL} \ -kernel ${KERNEL} \
-initrd ${INITRD} \ -initrd ${INITRD} \
-m 1024 \ -m 1024 \

View File

@ -0,0 +1,6 @@
package selinux
// InitializeSelinux is a stub for SELinux support on ARM64
func InitializeSelinux() (int, error) {
return 0, nil
}

View File

@ -66,7 +66,7 @@ import:
version: 1349b37bd56f4f5ce2690b5b2c0f53f88a261c67 version: 1349b37bd56f4f5ce2690b5b2c0f53f88a261c67
- package: github.com/rancher/docker-from-scratch - package: github.com/rancher/docker-from-scratch
version: v1.10.2 version: v1.10.2-1
- package: github.com/rancher/netconf - package: github.com/rancher/netconf
version: d7d620ef4ea62a9d04b51c7b3d9dc83fe7ffaa1b version: d7d620ef4ea62a9d04b51c7b3d9dc83fe7ffaa1b

View File

@ -3,7 +3,7 @@
package util package util
/* /*
#cgo LDFLAGS: -lmount -lblkid -luuid -lselinux #cgo LDFLAGS: -lmount -lblkid -luuid
#include<blkid/blkid.h> #include<blkid/blkid.h>
#include<libmount/libmount.h> #include<libmount/libmount.h>
#include<stdlib.h> #include<stdlib.h>
@ -34,10 +34,3 @@ func GetFsType(device string) (string, error) {
} }
return "", errors.New("Error while getting fstype") return "", errors.New("Error while getting fstype")
} }
func intToBool(value C.int) bool {
if value == 0 {
return false
}
return true
}

View File

@ -1,5 +1,5 @@
build: build:
image: rancher/dapper:1.9.1 image: rancher/dapper:1.10.2
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
commands: commands:

View File

@ -1,13 +1,13 @@
FROM golang:1.5.3 FROM golang:1.6
RUN apt-get update && apt-get -y install libselinux-dev pkg-config RUN apt-get update && apt-get -y install libselinux-dev pkg-config
RUN curl -o /usr/local/bin/docker -L https://get.docker.com/builds/Linux/x86_64/docker-1.9.1 && \ RUN wget -O /usr/local/bin/docker -L https://get.docker.com/builds/Linux/x86_64/docker-1.10.2 && \
chmod +x /usr/local/bin/docker chmod +x /usr/local/bin/docker
ENV DAPPER_SOURCE /go/src/github.com/rancher/docker-from-scratch ENV DAPPER_SOURCE /go/src/github.com/rancher/docker-from-scratch
ENV DAPPER_OUTPUT "" ENV DAPPER_OUTPUT ""
ENV DAPPER_DOCKER_SOCKET true ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_ENV NO_TEST ENV DAPPER_ENV NO_TEST ARCH
ENV GO15VENDOREXPERIMENT 1 ENV GO15VENDOREXPERIMENT 1
@ -18,21 +18,24 @@ WORKDIR ${DAPPER_SOURCE}
RUN mkdir -p assets RUN mkdir -p assets
WORKDIR ${DAPPER_SOURCE}/assets WORKDIR ${DAPPER_SOURCE}/assets
RUN curl -OL https://github.com/rancher/docker-from-scratch/releases/download/bin-v0.3.1/base-files_amd64.tar.gz RUN wget https://github.com/rancher/docker-from-scratch/releases/download/bin-v0.4.0/base-files_amd64.tar.gz
RUN curl -OL https://github.com/rancher/docker-from-scratch/releases/download/bin-v0.3.1/base-files_arm.tar.gz RUN wget https://github.com/rancher/docker-from-scratch/releases/download/bin-v0.4.0/base-files_arm.tar.gz
RUN wget https://github.com/rancher/docker-from-scratch/releases/download/bin-v0.4.0/base-files_arm64.tar.gz
RUN curl -o ./docker_amd64 -L https://get.docker.com/builds/Linux/x86_64/docker-1.10.2 && \ RUN wget -O ./docker_amd64 -L https://get.docker.com/builds/Linux/x86_64/docker-1.10.2 && \
chmod +x ./docker_amd64 chmod +x ./docker_amd64
RUN curl -o ./docker_arm -L https://github.com/rancher/docker/releases/download/v1.10.2-ros_arm/docker-1.10.2 && \ RUN wget -O ./docker_arm -L https://github.com/rancher/docker/releases/download/v1.10.2-arm2/docker-1.10.2_arm && \
chmod +x ./docker_arm chmod +x ./docker_arm
RUN wget -O ./docker_arm64 -L https://github.com/rancher/docker/releases/download/v1.10.2-arm2/docker-1.10.2_arm64 && \
chmod +x ./docker_arm64
WORKDIR ${DAPPER_SOURCE} WORKDIR ${DAPPER_SOURCE}
COPY ./scripts/crosstools.list /etc/apt/sources.list.d/ COPY ./scripts/crosstools.list /etc/apt/sources.list.d/
RUN sh -c 'curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -' && \ RUN sh -c 'curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -' && \
dpkg --add-architecture armhf && \ dpkg --add-architecture armhf && dpkg --add-architecture arm64 && \
apt-get update && \ apt-get update && \
apt-get install -y crossbuild-essential-armhf apt-get install -y crossbuild-essential-armhf crossbuild-essential-arm64
CMD ./scripts/ci CMD ./scripts/ci

View File

@ -453,7 +453,7 @@ func touchSockets(args ...string) error {
} }
func createLayout(config *Config) error { func createLayout(config *Config) error {
if err := createDirs("/tmp", "/root/.ssh", "/var"); err != nil { if err := createDirs("/tmp", "/root/.ssh", "/var", "/usr/lib"); err != nil {
return err return err
} }

View File

@ -0,0 +1,6 @@
package selinux
// SetFileContext is a stub for SELinux support on ARM
func SetFileContext(path string, context string) (int, error) {
return 0, nil
}