CRI-O runs but not tested yet
This commit is contained in:
@@ -11,12 +11,14 @@ 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 -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"
|
||||||
# chroot "$ROOTFS" /bin/sh -c "apk update"
|
# chroot "$ROOTFS" /bin/sh -c "apk update"
|
||||||
chroot "$ROOTFS" /bin/sh -c "apk add bash curl"
|
chroot "$ROOTFS" /bin/sh -c "apk add bash curl"
|
||||||
cp "/install-packages.sh" "$ROOTFS/install-packages.sh"
|
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"
|
||||||
|
|
||||||
umount "$ROOTFS/var/cache/apk"
|
umount "$ROOTFS/var/cache/apk"
|
||||||
umount "$ROOTFS/dev"
|
umount "$ROOTFS/dev"
|
||||||
@@ -30,13 +32,12 @@ rm -r "$ROOTFS/build"
|
|||||||
echo "=========================== RootFS "$( du -sh "$ROOTFS/" )
|
echo "=========================== RootFS "$( du -sh "$ROOTFS/" )
|
||||||
|
|
||||||
IMG=output.img
|
IMG=output.img
|
||||||
SIZE=512MB
|
SIZE=1024MB
|
||||||
|
|
||||||
dd if=/dev/zero of="$IMG" bs=1 count=0 seek=$SIZE
|
dd if=/dev/zero of="$IMG" bs=1 count=0 seek=$SIZE
|
||||||
|
|
||||||
sgdisk -o "$IMG" \
|
sgdisk -o "$IMG" \
|
||||||
-n 1:2048:+64M -t 1:0700 \
|
-n 1:65536:-1M -t 1:8300
|
||||||
-n 2:0:-1M -t 2:8300
|
|
||||||
|
|
||||||
losetup -D
|
losetup -D
|
||||||
LOOP=$(losetup --find --show -P "$IMG")
|
LOOP=$(losetup --find --show -P "$IMG")
|
||||||
@@ -44,18 +45,23 @@ LOOP=$(losetup --find --show -P "$IMG")
|
|||||||
/sync-loop.sh "$LOOP"
|
/sync-loop.sh "$LOOP"
|
||||||
|
|
||||||
TMP_LOOP="/tmp$LOOP"
|
TMP_LOOP="/tmp$LOOP"
|
||||||
mkfs.vfat "${TMP_LOOP}p1"
|
mkfs.ext4 -F "${TMP_LOOP}p1"
|
||||||
mkfs.ext4 "${TMP_LOOP}p2"
|
|
||||||
|
|
||||||
mkdir -p /mnt/img-root /mnt/img-boot
|
mkdir -p /mnt/img-root
|
||||||
|
|
||||||
mount ${TMP_LOOP}p1 /mnt/img-boot
|
mount "${TMP_LOOP}p1" /mnt/img-root
|
||||||
mount ${TMP_LOOP}p2 /mnt/img-root
|
|
||||||
|
|
||||||
cp -a "$ROOTFS"/. /mnt/img-root/
|
cp -a "$ROOTFS"/. /mnt/img-root/
|
||||||
cp /build/board.itb /mnt/img-boot
|
|
||||||
|
|
||||||
|
mkdir -p /mnt/img-root/boot
|
||||||
|
cp /build/Image.gz /mnt/img-root/boot/Image.gz
|
||||||
|
cp /build/board.itb /mnt/img-root/boot/kernel.itb
|
||||||
|
cp /build/${DEVICE_TREE_TARGET}.dtb /mnt/img-root/boot/${DEVICE_TREE_TARGET}.dtb
|
||||||
|
|
||||||
|
sync
|
||||||
umount /mnt/img-root
|
umount /mnt/img-root
|
||||||
umount /mnt/img-boot
|
|
||||||
|
|
||||||
losetup -d "$LOOP"
|
losetup -d "$LOOP"
|
||||||
|
|
||||||
|
echo "GZipping the image"
|
||||||
|
gzip "/build/$IMG"
|
||||||
|
|||||||
9
alpine/etc/fancontrol
Normal file
9
alpine/etc/fancontrol
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
INTERVAL=10
|
||||||
|
DEVPATH=hwmon0=devices/platform/soc/2180000.i2c/i2c-0/i2c-7/7-002e hwmon1=devices/virtual/thermal/thermal_zone0
|
||||||
|
DEVNAME=hwmon0=emc2305 hwmon1=ddr_thermal
|
||||||
|
FCTEMPS=hwmon0/pwm2=hwmon1/temp1_input
|
||||||
|
FCFANS= hwmon0/pwm2=hwmon0/fan1_input
|
||||||
|
MINTEMP=hwmon0/pwm2=40
|
||||||
|
MAXTEMP=hwmon0/pwm2=60
|
||||||
|
MINSTART=hwmon0/pwm2=60
|
||||||
|
MINSTOP=hwmon0/pwm2=45
|
||||||
@@ -2,7 +2,21 @@
|
|||||||
|
|
||||||
cd /build
|
cd /build
|
||||||
|
|
||||||
### CRI-O
|
echo "##################################################### Installing basic packages"
|
||||||
|
apk add alpine-base \
|
||||||
|
openrc busybox-openrc bash nftables \
|
||||||
|
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 fancontrol default
|
||||||
|
echo "ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 -n -l /bin/sh" >> "/etc/inittab"
|
||||||
|
echo '[ -x /bin/bash ] && exec /bin/bash -l' >> "/root/.profile"
|
||||||
|
echo "export PATH=\"/usr/local/bin:$PATH\"" >> "/etc/profile.d/settings.sh"
|
||||||
|
|
||||||
|
|
||||||
|
echo "##################################################### Installing CRI-O"
|
||||||
|
|
||||||
tar zxf crio.tar.gz
|
tar zxf crio.tar.gz
|
||||||
cd cri-o
|
cd cri-o
|
||||||
|
|||||||
@@ -6,13 +6,18 @@ 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 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 out/board.itb ./
|
COPY out/board.itb ./
|
||||||
|
COPY out/rootfs ./rootfs
|
||||||
|
COPY out/${DEVICE_TREE_TARGET}.dtb ./
|
||||||
|
COPY out/Image.gz ./
|
||||||
|
|
||||||
RUN tar -xf alpine.tar.gz -C "/out/rootfs"
|
RUN tar -xf alpine.tar.gz -C "/out/rootfs"
|
||||||
|
|
||||||
|
COPY alpine/etc ./rootfs/etc
|
||||||
COPY alpine/*.sh /
|
COPY alpine/*.sh /
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ WORKDIR /out/initramfs
|
|||||||
|
|
||||||
COPY initramfs/init init
|
COPY initramfs/init init
|
||||||
RUN chmod +x init
|
RUN chmod +x init
|
||||||
RUN mkdir -p bin sbin etc proc sys dev lib usr/bin usr/sbin
|
RUN mkdir -p bin sbin etc proc sys dev lib mnt usr/bin usr/sbin
|
||||||
|
|
||||||
# Selective mods
|
# Selective mods
|
||||||
RUN mkdir -p /out/selected-mods /out/kernel
|
RUN mkdir -p /out/selected-mods /out/kernel
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ RUN grep -q "^dtb-\\\$(CONFIG_ARCH_LAYERSCAPE) += ${DEVICE_TREE_TARGET}.dtb$" \
|
|||||||
RUN make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" defconfig lsdk.config \
|
RUN make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" defconfig lsdk.config \
|
||||||
&& ./scripts/kconfig/merge_config.sh -m .config /tmp/kernel-extra.config \
|
&& ./scripts/kconfig/merge_config.sh -m .config /tmp/kernel-extra.config \
|
||||||
&& make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig \
|
&& make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig \
|
||||||
|
&& grep '^CONFIG_NF_TABLES=' .config \
|
||||||
&& make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" -j"$(nproc)"
|
&& make ARCH="${ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" -j"$(nproc)"
|
||||||
|
|
||||||
# artifact collection
|
# artifact collection
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ mount -t devtmpfs devtmpfs /dev
|
|||||||
mount -t proc proc /proc
|
mount -t proc proc /proc
|
||||||
mount -t sysfs sysfs /sys
|
mount -t sysfs sysfs /sys
|
||||||
|
|
||||||
|
# Spin the fan
|
||||||
|
echo 100 > /sys/class/hwmon/hwmon0/pwm1
|
||||||
|
|
||||||
# Optional but nice
|
# Optional but nice
|
||||||
mkdir -p /dev/pts
|
mkdir -p /dev/pts
|
||||||
mount -t devpts devpts /dev/pts
|
mount -t devpts devpts /dev/pts
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ CONFIG_TMPFS_XATTR=y
|
|||||||
CONFIG_TMPFS_POSIX_ACL=y
|
CONFIG_TMPFS_POSIX_ACL=y
|
||||||
# POSIX ACLs on tmpfs. Good compatibility feature for userland.
|
# POSIX ACLs on tmpfs. Good compatibility feature for userland.
|
||||||
|
|
||||||
CONFIG_OVERLAY_FS=m
|
CONFIG_OVERLAY_FS=y
|
||||||
# Overlay filesystem. This is the big one for container image/layer storage.
|
# Overlay filesystem. This is the big one for container image/layer storage.
|
||||||
# Module is fine; CRI-O can load/use it after boot. No need to bloat FIT image.
|
# Module is fine; CRI-O can load/use it after boot. No need to bloat FIT image.
|
||||||
|
|
||||||
@@ -131,34 +131,34 @@ CONFIG_DUMMY=m
|
|||||||
# This is where container networking gets messy. Better to enable a sane baseline.
|
# This is where container networking gets messy. Better to enable a sane baseline.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
CONFIG_NETFILTER=m
|
CONFIG_NETFILTER=y
|
||||||
# Netfilter core framework. Module is okay if your setup loads it before use.
|
# Netfilter core framework. Module is okay if your setup loads it before use.
|
||||||
|
|
||||||
CONFIG_NETFILTER_ADVANCED=y
|
CONFIG_NETFILTER_ADVANCED=y
|
||||||
# Exposes more advanced netfilter options and modules.
|
# Exposes more advanced netfilter options and modules.
|
||||||
|
|
||||||
CONFIG_NF_CONNTRACK=m
|
CONFIG_NF_CONNTRACK=y
|
||||||
# Connection tracking. Critical for NAT, Kubernetes service traffic, and many CNIs.
|
# Connection tracking. Critical for NAT, Kubernetes service traffic, and many CNIs.
|
||||||
|
|
||||||
CONFIG_NF_NAT=m
|
CONFIG_NF_NAT=y
|
||||||
# NAT framework. Required for masquerading and pod egress in many setups.
|
# NAT framework. Required for masquerading and pod egress in many setups.
|
||||||
|
|
||||||
CONFIG_NF_TABLES=m
|
CONFIG_NF_TABLES=y
|
||||||
# nftables framework. Modern Linux packet filtering backend.
|
# nftables framework. Modern Linux packet filtering backend.
|
||||||
|
|
||||||
CONFIG_NFT_CT=m
|
CONFIG_NFT_CT=m
|
||||||
# nftables conntrack expressions.
|
# nftables conntrack expressions.
|
||||||
|
|
||||||
CONFIG_NFT_CHAIN_NAT=m
|
CONFIG_NFT_CHAIN_NAT=y
|
||||||
# nftables NAT chain support.
|
# nftables NAT chain support.
|
||||||
|
|
||||||
CONFIG_NFT_MASQ=m
|
CONFIG_NFT_MASQ=y
|
||||||
# nftables masquerade support. Often needed for pod egress NAT.
|
# nftables masquerade support. Often needed for pod egress NAT.
|
||||||
|
|
||||||
CONFIG_NFT_REDIR=m
|
CONFIG_NFT_REDIR=y
|
||||||
# nftables redirect target.
|
# nftables redirect target.
|
||||||
|
|
||||||
CONFIG_NFT_NAT=m
|
CONFIG_NFT_NAT=y
|
||||||
# nftables NAT support.
|
# nftables NAT support.
|
||||||
|
|
||||||
CONFIG_NF_NAT_IPV4=m
|
CONFIG_NF_NAT_IPV4=m
|
||||||
@@ -216,14 +216,14 @@ CONFIG_NETFILTER_XT_TARGET_CT=m
|
|||||||
# Bridge / container interface plumbing
|
# Bridge / container interface plumbing
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
CONFIG_VETH=m
|
CONFIG_VETH=y
|
||||||
# Virtual Ethernet pairs. This is how container interfaces are commonly connected
|
# Virtual Ethernet pairs. This is how container interfaces are commonly connected
|
||||||
# to the host/network namespace.
|
# to the host/network namespace.
|
||||||
|
|
||||||
CONFIG_BRIDGE=m
|
CONFIG_BRIDGE=y
|
||||||
# Ethernet bridge support. Needed by bridge-based CNIs.
|
# Ethernet bridge support. Needed by bridge-based CNIs.
|
||||||
|
|
||||||
CONFIG_BRIDGE_NETFILTER=m
|
CONFIG_BRIDGE_NETFILTER=y
|
||||||
# Allows bridged traffic to pass through netfilter/iptables/nftables hooks.
|
# Allows bridged traffic to pass through netfilter/iptables/nftables hooks.
|
||||||
# Important for Kubernetes networking behavior.
|
# Important for Kubernetes networking behavior.
|
||||||
|
|
||||||
|
|||||||
7
makefile
7
makefile
@@ -13,7 +13,7 @@ CRIO_TAR := $(PACKAGES_DIR)/$(CRIO_VERSION).tar.gz
|
|||||||
|
|
||||||
BOARD_ITB := $(OUT_DIR)/board.itb
|
BOARD_ITB := $(OUT_DIR)/board.itb
|
||||||
INITRAMFS := $(OUT_DIR)/initramfs.cpio.gz
|
INITRAMFS := $(OUT_DIR)/initramfs.cpio.gz
|
||||||
RELEASE_IMAGE := $(OUT_DIR)/monok8s-$(TAG).img
|
RELEASE_IMAGE := $(OUT_DIR)/monok8s-$(TAG).img.gz
|
||||||
|
|
||||||
KERNEL_IMAGE := $(OUT_DIR)/Image.gz
|
KERNEL_IMAGE := $(OUT_DIR)/Image.gz
|
||||||
|
|
||||||
@@ -139,6 +139,7 @@ $(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 DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
|
||||||
-t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) .
|
-t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) .
|
||||||
|
|
||||||
@cid=$$(docker create \
|
@cid=$$(docker create \
|
||||||
@@ -146,12 +147,12 @@ $(RELEASE_IMAGE): $(RELEASE_DEPS) | $(OUT_DIR)
|
|||||||
-v /cache/apk:/var/cache/apk \
|
-v /cache/apk:/var/cache/apk \
|
||||||
--device=/dev/loop0:/dev/loop0 \
|
--device=/dev/loop0:/dev/loop0 \
|
||||||
-e ROOTFS=/out/rootfs \
|
-e ROOTFS=/out/rootfs \
|
||||||
-e ARTIFACT_DIR=/artifacts \
|
|
||||||
-e RELEASE_IMAGE=$(RELEASE_IMAGE) \
|
-e RELEASE_IMAGE=$(RELEASE_IMAGE) \
|
||||||
|
-e DEVICE_TREE_TARGET=$(DEVICE_TREE_TARGET) \
|
||||||
$(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \
|
$(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \
|
||||||
bash -lc '/build-rootfs.sh'); \
|
bash -lc '/build-rootfs.sh'); \
|
||||||
docker start -a $$cid; \
|
docker start -a $$cid; \
|
||||||
docker cp $$cid:/build/output.img $@; \
|
docker cp $$cid:/build/output.img.gz $@; \
|
||||||
docker rm $$cid
|
docker rm $$cid
|
||||||
|
|
||||||
test -f $@
|
test -f $@
|
||||||
|
|||||||
Reference in New Issue
Block a user