No longer need the local registry
This commit is contained in:
@@ -12,6 +12,7 @@ cp -a "${REGISTRY_DATA_DIR}/." "${ROOTFS}/var/lib/registry/"
|
|||||||
mkdir -p "$ROOTFS/var/cache/apk"
|
mkdir -p "$ROOTFS/var/cache/apk"
|
||||||
mkdir -p "$ROOTFS/var/cache/k8s-images"
|
mkdir -p "$ROOTFS/var/cache/k8s-images"
|
||||||
mkdir -p "$ROOTFS/build"
|
mkdir -p "$ROOTFS/build"
|
||||||
|
|
||||||
mount --bind /var/cache/apk "$ROOTFS/var/cache/apk"
|
mount --bind /var/cache/apk "$ROOTFS/var/cache/apk"
|
||||||
mount --bind /var/cache/k8s-images "$ROOTFS/var/cache/k8s-images"
|
mount --bind /var/cache/k8s-images "$ROOTFS/var/cache/k8s-images"
|
||||||
mount --bind /dev "$ROOTFS/dev"
|
mount --bind /dev "$ROOTFS/dev"
|
||||||
@@ -22,7 +23,6 @@ mount --bind /run "$ROOTFS/run"
|
|||||||
cp /usr/bin/qemu-aarch64-static "$ROOTFS/usr/bin/"
|
cp /usr/bin/qemu-aarch64-static "$ROOTFS/usr/bin/"
|
||||||
cp /etc/resolv.conf "$ROOTFS/etc/resolv.conf"
|
cp /etc/resolv.conf "$ROOTFS/etc/resolv.conf"
|
||||||
cp /build/crio.tar.gz "$ROOTFS/build/"
|
cp /build/crio.tar.gz "$ROOTFS/build/"
|
||||||
cp /build/registry.tar.gz "$ROOTFS/build/"
|
|
||||||
cp -r /build/rootfs/* "$ROOTFS/"
|
cp -r /build/rootfs/* "$ROOTFS/"
|
||||||
|
|
||||||
chroot "$ROOTFS" /bin/sh -c "ln -s /var/cache/apk /etc/apk/cache"
|
chroot "$ROOTFS" /bin/sh -c "ln -s /var/cache/apk /etc/apk/cache"
|
||||||
@@ -32,6 +32,12 @@ cp "/install-packages.sh" "$ROOTFS/install-packages.sh"
|
|||||||
chroot "$ROOTFS" /bin/bash /install-packages.sh || exit 1
|
chroot "$ROOTFS" /bin/bash /install-packages.sh || exit 1
|
||||||
rm "$ROOTFS/install-packages.sh"
|
rm "$ROOTFS/install-packages.sh"
|
||||||
|
|
||||||
|
/merge-rootfs.sh "/build/rootfs-extra" "$ROOTFS"
|
||||||
|
|
||||||
|
cp "/configure-system.sh" "$ROOTFS/configure-system.sh"
|
||||||
|
chroot "$ROOTFS" /bin/bash /configure-system.sh || exit 1
|
||||||
|
rm "$ROOTFS/configure-system.sh"
|
||||||
|
|
||||||
umount "$ROOTFS/var/cache/apk"
|
umount "$ROOTFS/var/cache/apk"
|
||||||
umount "$ROOTFS/var/cache/k8s-images"
|
umount "$ROOTFS/var/cache/k8s-images"
|
||||||
umount "$ROOTFS/dev"
|
umount "$ROOTFS/dev"
|
||||||
@@ -41,10 +47,8 @@ umount "$ROOTFS/run"
|
|||||||
|
|
||||||
rm -r "$ROOTFS/build"
|
rm -r "$ROOTFS/build"
|
||||||
|
|
||||||
/merge-rootfs.sh "/build/rootfs-extra" "$ROOTFS"
|
|
||||||
|
|
||||||
### Begin making full disk image for the device
|
### Begin making full disk image for the device
|
||||||
echo "=========================== RootFS "$( du -sh "$ROOTFS/" )
|
echo "##################################################### Packaging RootFS "$( du -sh "$ROOTFS/" )
|
||||||
|
|
||||||
IMG=output.img
|
IMG=output.img
|
||||||
SIZE=1536MB
|
SIZE=1536MB
|
||||||
@@ -78,5 +82,5 @@ umount /mnt/img-root
|
|||||||
|
|
||||||
losetup -d "$LOOP"
|
losetup -d "$LOOP"
|
||||||
|
|
||||||
echo "GZipping the image"
|
echo "##################################################### Compressing Image"
|
||||||
gzip "/build/$IMG"
|
gzip "/build/$IMG"
|
||||||
|
|||||||
13
alpine/configure-system.sh
Executable file
13
alpine/configure-system.sh
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /build
|
||||||
|
|
||||||
|
echo "##################################################### Install RC Services"
|
||||||
|
rc-update add devfs sysinit
|
||||||
|
rc-update add procfs sysinit
|
||||||
|
rc-update add sysfs sysinit
|
||||||
|
rc-update add fancontrol boot
|
||||||
|
rc-update add loopback boot
|
||||||
|
rc-update add hostname boot
|
||||||
|
rc-update add localmount boot
|
||||||
|
rc-update add crio default
|
||||||
@@ -6,33 +6,16 @@ echo "##################################################### Installing basic pac
|
|||||||
apk add alpine-base \
|
apk add alpine-base \
|
||||||
openrc busybox-openrc bash nftables \
|
openrc busybox-openrc bash nftables \
|
||||||
lm-sensors lm-sensors-fancontrol lm-sensors-fancontrol-openrc
|
lm-sensors lm-sensors-fancontrol lm-sensors-fancontrol-openrc
|
||||||
rc-update add devfs sysinit
|
|
||||||
rc-update add procfs sysinit
|
|
||||||
rc-update add sysfs sysinit
|
|
||||||
rc-update add loopback boot
|
|
||||||
rc-update add hostname boot
|
|
||||||
rc-update add localmount boot
|
|
||||||
rc-update add fancontrol default
|
|
||||||
echo '[ -x /bin/bash ] && exec /bin/bash -l' >> "/root/.profile"
|
echo '[ -x /bin/bash ] && exec /bin/bash -l' >> "/root/.profile"
|
||||||
|
|
||||||
# We need this to ship k8s components. (coredns, kube-apiserver, etc)
|
|
||||||
echo "##################################################### Install Local Registry"
|
|
||||||
mkdir -p /usr/local/bin
|
|
||||||
|
|
||||||
apk add skopeo
|
|
||||||
|
|
||||||
tar zxf registry.tar.gz
|
|
||||||
mv registry /usr/local/bin/registry
|
|
||||||
/usr/local/bin/registry --version
|
|
||||||
|
|
||||||
echo "##################################################### Installing CRI-O"
|
echo "##################################################### Installing CRI-O"
|
||||||
|
mkdir -p /usr/local/bin
|
||||||
|
|
||||||
tar zxf crio.tar.gz
|
tar zxf crio.tar.gz
|
||||||
cd cri-o
|
cd cri-o
|
||||||
|
|
||||||
./install
|
./install
|
||||||
|
|
||||||
crio --version
|
|
||||||
crio config 2>&1 > /dev/null
|
crio config 2>&1 > /dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
crio config
|
crio config
|
||||||
@@ -42,14 +25,19 @@ fi
|
|||||||
mv /etc/cni/net.d/10-crio-bridge.conflist.disabled \
|
mv /etc/cni/net.d/10-crio-bridge.conflist.disabled \
|
||||||
/etc/cni/net.d/10-crio-bridge.conflist
|
/etc/cni/net.d/10-crio-bridge.conflist
|
||||||
|
|
||||||
echo "--------------"
|
|
||||||
sed -i "s/default_runtime = \"crun\"/\0\ncgroup_manager = \"cgroupfs\"/g" /etc/crio/crio.conf.d/10-crio.conf
|
sed -i "s/default_runtime = \"crun\"/\0\ncgroup_manager = \"cgroupfs\"/g" /etc/crio/crio.conf.d/10-crio.conf
|
||||||
grep cgroup_manager /etc/crio/crio.conf.d/10-crio.conf || exit 1
|
grep cgroup_manager /etc/crio/crio.conf.d/10-crio.conf || exit 1
|
||||||
|
|
||||||
|
chmod +x /opt/scripts/*
|
||||||
|
chmod +x /etc/init.d/*
|
||||||
|
|
||||||
mkdir -p /var/run/crio
|
mkdir -p /var/run/crio
|
||||||
mkdir -p /var/lib/containers/storage
|
mkdir -p /var/lib/containers/storage
|
||||||
mkdir -p /var/lib/cni
|
mkdir -p /var/lib/cni
|
||||||
|
mkdir -p /var/log/crio
|
||||||
mkdir -p /etc/cni/net.d
|
mkdir -p /etc/cni/net.d
|
||||||
mkdir -p /opt/cni/bin
|
mkdir -p /opt/cni/bin
|
||||||
mkdir -p /run/crun
|
mkdir -p /run/crun
|
||||||
mkdir -p /run/runc
|
mkdir -p /run/runc
|
||||||
|
|
||||||
|
touch /var/log/crio/crio.log
|
||||||
|
|||||||
39
alpine/rootfs-extra/etc/init.d/crio
Executable file
39
alpine/rootfs-extra/etc/init.d/crio
Executable file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/sbin/openrc-run
|
||||||
|
# Copyright 2015-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
|
||||||
|
|
||||||
|
description="OCI Kubernetes Container Runtime daemon"
|
||||||
|
pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
|
||||||
|
extra_started_commands="reload"
|
||||||
|
command="/usr/local/bin/${RC_SVCNAME}"
|
||||||
|
command_args="${command_args}"
|
||||||
|
command_background="true"
|
||||||
|
start_stop_daemon_args=" \
|
||||||
|
--stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \
|
||||||
|
--stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
need net
|
||||||
|
}
|
||||||
|
|
||||||
|
checkconfig() {
|
||||||
|
checkpath --directory --owner root:root --mode 0775 \
|
||||||
|
/var/log/${RC_SVCNAME}
|
||||||
|
checkpath --file --owner root:root --mode 0644 \
|
||||||
|
/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
|
||||||
|
checkpath --directory --owner root:root --mode 0750 \
|
||||||
|
/var/lib/crio
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
checkconfig
|
||||||
|
default_start
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Reloading ${RC_SVCNAME}"
|
||||||
|
start-stop-daemon --signal HUP --pidfile "${pidfile}"
|
||||||
|
eend $?
|
||||||
|
}
|
||||||
@@ -8,9 +8,6 @@ NXP_VERSION=lf-6.18.2-1.0.0
|
|||||||
CRIO_VERSION=cri-o.arm64.v1.35.1
|
CRIO_VERSION=cri-o.arm64.v1.35.1
|
||||||
KUBE_VERSION=v1.35.3
|
KUBE_VERSION=v1.35.3
|
||||||
|
|
||||||
# Local registry for exporting k8s images
|
|
||||||
REGISTRY_VERSION=2.8.3
|
|
||||||
|
|
||||||
# Mono's tutorial said fsl-ls1046a-rdb.dtb but our shipped board is not that one
|
# Mono's tutorial said fsl-ls1046a-rdb.dtb but our shipped board is not that one
|
||||||
# We need fsl-ls1046a-rdb-sdk.dtb here
|
# We need fsl-ls1046a-rdb-sdk.dtb here
|
||||||
DEVICE_TREE_TARGET=mono-gateway-dk-sdk
|
DEVICE_TREE_TARGET=mono-gateway-dk-sdk
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ FROM --platform=$BUILDPLATFORM ${DOCKER_IMAGE_ROOT}/build-base:${TAG} AS build-b
|
|||||||
ARG ALPINE_ARCH
|
ARG ALPINE_ARCH
|
||||||
ARG ALPINE_VER
|
ARG ALPINE_VER
|
||||||
ARG CRIO_VERSION
|
ARG CRIO_VERSION
|
||||||
ARG REGISTRY_VERSION
|
|
||||||
ARG DEVICE_TREE_TARGET
|
ARG DEVICE_TREE_TARGET
|
||||||
|
|
||||||
RUN mkdir -p "/out/rootfs"
|
RUN mkdir -p "/out/rootfs"
|
||||||
|
|
||||||
COPY packages/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz ./alpine.tar.gz
|
COPY packages/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz ./alpine.tar.gz
|
||||||
COPY packages/${CRIO_VERSION}.tar.gz ./crio.tar.gz
|
COPY packages/${CRIO_VERSION}.tar.gz ./crio.tar.gz
|
||||||
COPY packages/registry-${REGISTRY_VERSION}.tar.gz ./registry.tar.gz
|
|
||||||
COPY out/board.itb ./
|
COPY out/board.itb ./
|
||||||
COPY out/rootfs ./rootfs
|
COPY out/rootfs ./rootfs
|
||||||
COPY out/${DEVICE_TREE_TARGET}.dtb ./
|
COPY out/${DEVICE_TREE_TARGET}.dtb ./
|
||||||
|
|||||||
6
makefile
6
makefile
@@ -10,7 +10,6 @@ BUSYBOX_TAR := $(PACKAGES_DIR)/busybox-$(BUSYBOX_VERSION).tar.gz
|
|||||||
ALPINE_TAR := $(PACKAGES_DIR)/alpine-minirootfs-$(ALPINE_VER)-$(ALPINE_ARCH).tar.gz
|
ALPINE_TAR := $(PACKAGES_DIR)/alpine-minirootfs-$(ALPINE_VER)-$(ALPINE_ARCH).tar.gz
|
||||||
NXP_TAR := $(PACKAGES_DIR)/$(NXP_VERSION).tar.gz
|
NXP_TAR := $(PACKAGES_DIR)/$(NXP_VERSION).tar.gz
|
||||||
CRIO_TAR := $(PACKAGES_DIR)/$(CRIO_VERSION).tar.gz
|
CRIO_TAR := $(PACKAGES_DIR)/$(CRIO_VERSION).tar.gz
|
||||||
REGISTRY_TAR := $(PACKAGES_DIR)/registry-$(REGISTRY_VERSION).tar.gz
|
|
||||||
|
|
||||||
# Kubernetes components
|
# Kubernetes components
|
||||||
KUBELET_BIN := $(PACKAGES_DIR)/kubernetes/kubelet
|
KUBELET_BIN := $(PACKAGES_DIR)/kubernetes/kubelet
|
||||||
@@ -71,7 +70,6 @@ RELEASE_DEPS := \
|
|||||||
$(KUBELET_BIN) \
|
$(KUBELET_BIN) \
|
||||||
$(KUBEADM_BIN) \
|
$(KUBEADM_BIN) \
|
||||||
$(KUBECTL_BIN) \
|
$(KUBECTL_BIN) \
|
||||||
$(REGISTRY_TAR) \
|
|
||||||
docker/alpine.Dockerfile \
|
docker/alpine.Dockerfile \
|
||||||
$(ALPINE_SRCS) \
|
$(ALPINE_SRCS) \
|
||||||
build.env \
|
build.env \
|
||||||
@@ -105,9 +103,6 @@ $(BUSYBOX_TAR): | $(PACKAGES_DIR)
|
|||||||
$(ALPINE_TAR): | $(PACKAGES_DIR)
|
$(ALPINE_TAR): | $(PACKAGES_DIR)
|
||||||
curl -L -o $@ "https://dl-cdn.alpinelinux.org/alpine/v$(ALPINE_SERIES)/releases/$(ALPINE_ARCH)/alpine-minirootfs-$(ALPINE_VER)-$(ALPINE_ARCH).tar.gz"
|
curl -L -o $@ "https://dl-cdn.alpinelinux.org/alpine/v$(ALPINE_SERIES)/releases/$(ALPINE_ARCH)/alpine-minirootfs-$(ALPINE_VER)-$(ALPINE_ARCH).tar.gz"
|
||||||
|
|
||||||
$(REGISTRY_TAR): | $(PACKAGES_DIR)
|
|
||||||
curl -L -o $@ "https://github.com/distribution/distribution/releases/download/v$(REGISTRY_VERSION)/registry_$(REGISTRY_VERSION)_linux_$(ARCH).tar.gz"
|
|
||||||
|
|
||||||
$(NXP_TAR): | $(PACKAGES_DIR)
|
$(NXP_TAR): | $(PACKAGES_DIR)
|
||||||
curl -L -o $@ "https://github.com/nxp-qoriq/linux/archive/refs/tags/$(NXP_VERSION).tar.gz"
|
curl -L -o $@ "https://github.com/nxp-qoriq/linux/archive/refs/tags/$(NXP_VERSION).tar.gz"
|
||||||
|
|
||||||
@@ -164,7 +159,6 @@ $(RELEASE_IMAGE): $(RELEASE_DEPS) | $(OUT_DIR)
|
|||||||
--build-arg ALPINE_ARCH=$(ALPINE_ARCH) \
|
--build-arg ALPINE_ARCH=$(ALPINE_ARCH) \
|
||||||
--build-arg ALPINE_VER=$(ALPINE_VER) \
|
--build-arg ALPINE_VER=$(ALPINE_VER) \
|
||||||
--build-arg CRIO_VERSION=$(CRIO_VERSION) \
|
--build-arg CRIO_VERSION=$(CRIO_VERSION) \
|
||||||
--build-arg REGISTRY_VERSION=$(REGISTRY_VERSION) \
|
|
||||||
--build-arg DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
|
--build-arg DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
|
||||||
-t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) .
|
-t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) .
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user