mirror of
https://github.com/rancher/os.git
synced 2025-08-22 08:35:38 +00:00
Merge pull request #795 from imikushin/customize-installer
ARM installer
This commit is contained in:
commit
e9ab9e408e
2
.docker-env.sample
Normal file
2
.docker-env.sample
Normal file
@ -0,0 +1,2 @@
|
||||
DOCKER_HOST="tcp://192.168.2.2:2375"
|
||||
DOCKER_TLS_VERIFY=
|
@ -1,7 +1,6 @@
|
||||
build:
|
||||
image: rancher/dapper:1.9.1
|
||||
image: rancher/dapper:1.10.2
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
commands:
|
||||
- dapper -O make ARCH=arm rootfs
|
||||
- dapper -O make DEV_BUILD=1 test
|
||||
- ./scripts/ci
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@
|
||||
/tests/integration/.tox
|
||||
*.pyc
|
||||
__pychache__
|
||||
.docker-env.*
|
||||
|
@ -1 +0,0 @@
|
||||
--privileged
|
18
Dockerfile.arm64
Normal file
18
Dockerfile.arm64
Normal 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"]
|
@ -1,58 +1,74 @@
|
||||
FROM ubuntu:15.10
|
||||
FROM rancher/os-dapper-base
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y install locales sudo vim less curl wget git rsync build-essential syslinux isolinux xorriso \
|
||||
libblkid-dev libmount-dev libselinux1-dev cpio genisoimage qemu-kvm python-pip ca-certificates pkg-config
|
||||
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 tox
|
||||
|
||||
RUN locale-gen en_US.UTF-8
|
||||
ENV LANG en_US.UTF-8
|
||||
ENV PATH $PATH:/usr/local/go/bin
|
||||
ARG HOST_ARCH
|
||||
ENV HOST_ARCH ${HOST_ARCH}
|
||||
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
|
||||
ENV GOPATH /go
|
||||
ENV PATH /go/bin:$PATH
|
||||
|
||||
RUN pip install tox
|
||||
RUN curl -sSL https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz | tar -xz -C /usr/local
|
||||
RUN curl -sL https://get.docker.com/builds/Linux/x86_64/docker-1.9.1 > /usr/local/bin/docker
|
||||
ARG HOST_DOCKER_BINARY_URL
|
||||
ENV HOST_DOCKER_BINARY_URL ${HOST_DOCKER_BINARY_URL}
|
||||
RUN wget -O - ${HOST_DOCKER_BINARY_URL} > /usr/local/bin/docker
|
||||
RUN chmod +x /usr/local/bin/docker
|
||||
|
||||
ENV DAPPER_DOCKER_SOCKET true
|
||||
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 SHELL /bin/bash
|
||||
WORKDIR ${DAPPER_SOURCE}
|
||||
|
||||
COPY .dockerignore.docker .dockerignore
|
||||
COPY .dockerignore.dapper .dockerignore
|
||||
|
||||
RUN cd /usr/local/src && \
|
||||
for i in libselinux pcre3 util-linux; do \
|
||||
apt-get build-dep -y $i && \
|
||||
apt-get source -y $i \
|
||||
;done
|
||||
CMD make
|
||||
|
||||
RUN apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
|
||||
RUN cd /usr/local/src/pcre3-* && \
|
||||
autoreconf && \
|
||||
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf && \
|
||||
make -j$(nproc) && \
|
||||
make install
|
||||
ARG TOOLCHAIN
|
||||
ENV TOOLCHAIN ${TOOLCHAIN}
|
||||
|
||||
RUN cd /usr/local/src/libselinux-* && \
|
||||
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ make CFLAGS=-Wall && \
|
||||
make PREFIX=/usr/arm-linux-gnueabihf DESTDIR=/usr/arm-linux-gnueabihf install
|
||||
RUN if [ "${TOOLCHAIN}" != "" ] && ! which ${TOOLCHAIN}-gcc; then \
|
||||
apt-get install -y gcc-${TOOLCHAIN} g++-${TOOLCHAIN} \
|
||||
;fi
|
||||
|
||||
RUN cd /usr/local/src/util-linux-* && \
|
||||
autoreconf && \
|
||||
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf \
|
||||
--disable-all-programs \
|
||||
--enable-libmount \
|
||||
--enable-libblkid \
|
||||
--enable-libuuid \
|
||||
--enable-mount && \
|
||||
make -j$(nproc) && \
|
||||
make install
|
||||
RUN if [ "${TOOLCHAIN}" != "" ]; then \
|
||||
cd /usr/local/src && \
|
||||
for i in libselinux pcre3 util-linux; do \
|
||||
apt-get build-dep -y $i && \
|
||||
apt-get source -y $i \
|
||||
;done \
|
||||
;fi
|
||||
|
||||
CMD make all
|
||||
RUN if [ "${TOOLCHAIN}" != "" ]; then \
|
||||
cd /usr/local/src/pcre3-* && \
|
||||
autoreconf && \
|
||||
CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ ./configure --host=${TOOLCHAIN} --prefix=/usr/${TOOLCHAIN} && \
|
||||
make -j$(nproc) && \
|
||||
make install \
|
||||
;fi
|
||||
|
||||
ENV DAPPER_OUTPUT ./bin ./dist ./build/os-config.yml
|
||||
RUN if [ "${TOOLCHAIN}" != "" ]; then \
|
||||
cd /usr/local/src/libselinux-* && \
|
||||
CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ make CFLAGS=-Wall && \
|
||||
make PREFIX=/usr/${TOOLCHAIN} DESTDIR=/usr/${TOOLCHAIN} install \
|
||||
;fi
|
||||
|
||||
RUN if [ "${TOOLCHAIN}" != "" ]; then \
|
||||
cd /usr/local/src/util-linux-* && \
|
||||
autoreconf && \
|
||||
CC=${TOOLCHAIN}-gcc CXX=${TOOLCHAIN}-g++ ./configure --host=${TOOLCHAIN} --prefix=/usr/${TOOLCHAIN} \
|
||||
--disable-all-programs \
|
||||
--enable-libmount \
|
||||
--enable-libblkid \
|
||||
--enable-libuuid \
|
||||
--enable-mount && \
|
||||
make -j$(nproc) && \
|
||||
make install \
|
||||
;fi
|
||||
|
39
Makefile
39
Makefile
@ -1,6 +1,8 @@
|
||||
FORCE_PULL := 0
|
||||
DEV_BUILD := 0
|
||||
HOST_ARCH := amd64
|
||||
ARCH := amd64
|
||||
SUFFIX := $(if $(filter-out amd64,$(ARCH)),_$(ARCH))
|
||||
|
||||
include build.conf
|
||||
include build.conf.$(ARCH)
|
||||
@ -12,15 +14,12 @@ bin/ros:
|
||||
|
||||
build/host_ros: bin/ros
|
||||
mkdir -p $(dir $@)
|
||||
ifeq "$(ARCH)" "amd64"
|
||||
ifeq "$(ARCH)" "$(HOST_ARCH)"
|
||||
ln -sf ../bin/ros $@
|
||||
else
|
||||
ARCH=amd64 VERSION=$(VERSION) ./scripts/mk-ros.sh $@
|
||||
ARCH=$(HOST_ARCH) TOOLCHAIN= VERSION=$(VERSION) ./scripts/mk-ros.sh $@
|
||||
endif
|
||||
|
||||
pwd := $(shell pwd)
|
||||
include scripts/build-common
|
||||
|
||||
|
||||
assets/docker:
|
||||
mkdir -p $(dir $@)
|
||||
@ -34,33 +33,33 @@ assets/selinux/policy.29:
|
||||
ifdef COMPILED_KERNEL_URL
|
||||
|
||||
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 $@)
|
||||
mv $(BUILD)/kernel/boot/vmlinuz* $@
|
||||
mv $(or $(wildcard build/kernel/boot/vmlinuz*), $(wildcard build/kernel/boot/vmlinux*)) $@
|
||||
|
||||
|
||||
$(BUILD)/kernel/:
|
||||
build/kernel/:
|
||||
mkdir -p $@
|
||||
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 $@)
|
||||
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
|
||||
|
||||
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
|
||||
cd tests/integration && tox
|
||||
@ -74,22 +73,22 @@ build/os-config.yml: build/host_ros
|
||||
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
|
||||
|
||||
|
||||
$(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 $@)
|
||||
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
|
||||
|
||||
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
|
||||
rootfs: $(DIST)/artifacts/rootfs.tar.gz
|
||||
rootfs: dist/artifacts/rootfs.tar.gz
|
||||
|
||||
.PHONY: rootfs version bin/ros
|
||||
|
@ -1,6 +1,6 @@
|
||||
IMAGE_NAME=rancher/os
|
||||
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
|
||||
|
||||
HOSTNAME_DEFAULT=rancher
|
||||
|
@ -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
|
||||
DOCKER_BINARY_URL=https://get.docker.com/builds/Linux/x86_64/docker-1.10.2
|
||||
|
@ -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
5
build.conf.arm64
Normal 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
|
9
build.sh
9
build.sh
@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
export ARCH=${ARCH:-amd64}
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
if [ "$1" != "--dev" ]; then
|
||||
echo
|
||||
echo Running \"production\" build. Will use lzma to compress initrd, which is somewhat slow...
|
||||
@ -8,10 +12,9 @@ if [ "$1" != "--dev" ]; then
|
||||
echo
|
||||
echo For \"developer\" builds, run ./build.sh --dev
|
||||
echo
|
||||
dapper make all
|
||||
./scripts/make.sh all
|
||||
else
|
||||
dapper make DEV_BUILD=1 all
|
||||
./scripts/make.sh DEV_BUILD=1 all
|
||||
fi
|
||||
|
||||
|
||||
ls -lh dist/artifacts
|
||||
|
@ -66,7 +66,7 @@ rancher:
|
||||
nameservers: [8.8.8.8, 8.8.4.4]
|
||||
repositories:
|
||||
core:
|
||||
url: {{.OS_SERVICES_REPO}}/{{.VERSION}}
|
||||
url: {{.OS_SERVICES_REPO}}/{{.VERSION}}{{.SUFFIX}}
|
||||
state:
|
||||
fstype: auto
|
||||
dev: LABEL=RANCHER_STATE
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
cd $(dirname $0)/..
|
||||
. ./scripts/dapper-common
|
||||
|
||||
dapper -O make ARCH=arm rootfs
|
||||
dapper -O make DEV_BUILD=1 test
|
||||
dapper -d -O make HOST_ARCH=${HOST_ARCH} ARCH=${ARCH} DEV_BUILD=1 test
|
||||
|
20
scripts/dapper-common
Executable file
20
scripts/dapper-common
Executable 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
|
@ -21,6 +21,7 @@ do
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
done
|
||||
[ "$ARCH" == "arm" && "$ENV" != "rancher-upgrade" ] && ENV=arm
|
||||
|
||||
DIST=${DIST:-/dist}
|
||||
CLOUD_CONFIG=${CLOUD_CONFIG:-"${SCRIPTS_DIR}/conf/empty.yml"}
|
||||
@ -153,6 +154,10 @@ if [ -n ${ENV} ]; then
|
||||
install_grub
|
||||
"${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")
|
||||
CONSOLE=ttyS0
|
||||
format_and_mount
|
||||
|
7
scripts/make.sh
Executable file
7
scripts/make.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd $(dirname $0)/..
|
||||
. ./scripts/dapper-common
|
||||
|
||||
dapper make HOST_ARCH=${HOST_ARCH} ARCH=${ARCH} "$@"
|
@ -1,17 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
TARGET=${1}
|
||||
TARGET=$(pwd)/${1}
|
||||
|
||||
ARCH=${ARCH:-"amd64"}
|
||||
SUFFIX=${SUFFIX:-""}
|
||||
DFS_IMAGE=${DFS_IMAGE:?"DFS_IMAGE not set"}
|
||||
IS_ROOTFS=${IS_ROOTFS:-0}
|
||||
|
||||
suffix=""
|
||||
[ "$ARCH" == "amd64" ] || suffix="_${ARCH}"
|
||||
|
||||
DFS_ARCH_IMAGE=${DFS_IMAGE}${suffix}
|
||||
|
||||
cd $(dirname $0)/..
|
||||
. 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/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
|
||||
|
||||
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
|
||||
docker exec -i ${DFS} docker load < ${BUILD}/images.tar
|
||||
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} 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 ./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 ./overlay | tar -x -C ${INITRD_DIR}/var/lib/system-docker
|
||||
|
||||
cd ${INITRD_DIR}
|
||||
|
||||
|
@ -9,11 +9,11 @@ VERSION=${VERSION:?"VERSION not set"}
|
||||
cd $(dirname $0)/..
|
||||
|
||||
strip_bin=$(which strip)
|
||||
if [ "${ARCH}" == "arm" ]; then
|
||||
export GOARM=6
|
||||
export CC=/usr/bin/arm-linux-gnueabihf-gcc
|
||||
[ "${ARCH}" == "arm" ] && export GOARM=6
|
||||
if [ "${TOOLCHAIN}" != "" ]; then
|
||||
export CC=/usr/bin/${TOOLCHAIN}-gcc
|
||||
export CGO_ENABLED=1
|
||||
strip_bin=/usr/arm-linux-gnueabihf/bin/strip
|
||||
strip_bin=/usr/${TOOLCHAIN}/bin/strip
|
||||
fi
|
||||
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}
|
||||
|
10
scripts/run
10
scripts/run
@ -7,6 +7,9 @@ cd $(dirname $0)/..
|
||||
source scripts/build-common
|
||||
|
||||
BASE=$(pwd)
|
||||
UNAME=$(uname)
|
||||
QEMUARCH=$(uname -m)
|
||||
[ "${UNAME}" == "Darwin" ] && QEMUARCH=x86_64
|
||||
|
||||
KERNEL=${BASE}/dist/artifacts/vmlinuz
|
||||
INITRD=${BASE}/dist/artifacts/initrd
|
||||
@ -41,7 +44,7 @@ while [ "$#" -gt 0 ]; do
|
||||
fi
|
||||
;;
|
||||
--qemu)
|
||||
if [ -x $(which qemu-system-x86_64) ]; then
|
||||
if [ -x $(which qemu-system-${QEMUARCH}) ]; then
|
||||
QEMU=1
|
||||
fi
|
||||
;;
|
||||
@ -76,7 +79,6 @@ if [[ ! -e ${KERNEL} || ! -e ${INITRD} ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UNAME=$(uname)
|
||||
# Linux and Darwin SHA1 sum binary are different, pick which to use
|
||||
if [ "$UNAME" == "Darwin" ]; then sha1sum=$(which shasum)
|
||||
elif [ "$UNAME" == "Linux" ]; then sha1sum=$(which sha1sum);
|
||||
@ -102,7 +104,7 @@ if [ "$REBUILD" == "1" ]; then
|
||||
|
||||
mkdir -p ${INITRD_TMP}/usr/{bin,share/ros}
|
||||
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}
|
||||
find . | cpio -H newc -o | gzip > ${INITRD_TEST}
|
||||
@ -166,7 +168,7 @@ if [ "$XHYVE" == "1" ] || [ "$QEMU" == "1" ]; then
|
||||
if [ "$KVM" == "1" ]; then
|
||||
KVM_ENABLE="-machine accel=kvm -cpu host"
|
||||
fi
|
||||
exec qemu-system-x86_64 -serial stdio \
|
||||
exec qemu-system-${QEMUARCH} -serial stdio \
|
||||
-kernel ${KERNEL} \
|
||||
-initrd ${INITRD} \
|
||||
-m 1024 \
|
||||
|
6
selinux/selinux_linux_arm64.go
Normal file
6
selinux/selinux_linux_arm64.go
Normal file
@ -0,0 +1,6 @@
|
||||
package selinux
|
||||
|
||||
// InitializeSelinux is a stub for SELinux support on ARM64
|
||||
func InitializeSelinux() (int, error) {
|
||||
return 0, nil
|
||||
}
|
@ -66,7 +66,7 @@ import:
|
||||
version: 1349b37bd56f4f5ce2690b5b2c0f53f88a261c67
|
||||
|
||||
- package: github.com/rancher/docker-from-scratch
|
||||
version: v1.10.2
|
||||
version: v1.10.2-1
|
||||
|
||||
- package: github.com/rancher/netconf
|
||||
version: d7d620ef4ea62a9d04b51c7b3d9dc83fe7ffaa1b
|
||||
|
@ -3,7 +3,7 @@
|
||||
package util
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lmount -lblkid -luuid -lselinux
|
||||
#cgo LDFLAGS: -lmount -lblkid -luuid
|
||||
#include<blkid/blkid.h>
|
||||
#include<libmount/libmount.h>
|
||||
#include<stdlib.h>
|
||||
@ -34,10 +34,3 @@ func GetFsType(device string) (string, error) {
|
||||
}
|
||||
return "", errors.New("Error while getting fstype")
|
||||
}
|
||||
|
||||
func intToBool(value C.int) bool {
|
||||
if value == 0 {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
2
vendor/github.com/rancher/docker-from-scratch/.drone.yml
generated
vendored
2
vendor/github.com/rancher/docker-from-scratch/.drone.yml
generated
vendored
@ -1,5 +1,5 @@
|
||||
build:
|
||||
image: rancher/dapper:1.9.1
|
||||
image: rancher/dapper:1.10.2
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
commands:
|
||||
|
21
vendor/github.com/rancher/docker-from-scratch/Dockerfile.dapper
generated
vendored
21
vendor/github.com/rancher/docker-from-scratch/Dockerfile.dapper
generated
vendored
@ -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 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
|
||||
|
||||
ENV DAPPER_SOURCE /go/src/github.com/rancher/docker-from-scratch
|
||||
ENV DAPPER_OUTPUT ""
|
||||
ENV DAPPER_DOCKER_SOCKET true
|
||||
ENV DAPPER_ENV NO_TEST
|
||||
ENV DAPPER_ENV NO_TEST ARCH
|
||||
|
||||
ENV GO15VENDOREXPERIMENT 1
|
||||
|
||||
@ -18,21 +18,24 @@ WORKDIR ${DAPPER_SOURCE}
|
||||
RUN mkdir -p 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 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_amd64.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
|
||||
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
|
||||
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}
|
||||
|
||||
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 -' && \
|
||||
dpkg --add-architecture armhf && \
|
||||
dpkg --add-architecture armhf && dpkg --add-architecture arm64 && \
|
||||
apt-get update && \
|
||||
apt-get install -y crossbuild-essential-armhf
|
||||
apt-get install -y crossbuild-essential-armhf crossbuild-essential-arm64
|
||||
|
||||
CMD ./scripts/ci
|
||||
|
2
vendor/github.com/rancher/docker-from-scratch/scratch.go
generated
vendored
2
vendor/github.com/rancher/docker-from-scratch/scratch.go
generated
vendored
@ -453,7 +453,7 @@ func touchSockets(args ...string) 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
|
||||
}
|
||||
|
||||
|
6
vendor/github.com/rancher/docker-from-scratch/selinux/selinux_arm64.go
generated
vendored
Normal file
6
vendor/github.com/rancher/docker-from-scratch/selinux/selinux_arm64.go
generated
vendored
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user