Added make download-packages
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
dev/
|
||||
packages/
|
||||
out/
|
||||
.swp
|
||||
|
||||
18
README.md
18
README.md
@@ -4,6 +4,9 @@ Kubernetes image for Mono Gateway Development Kit
|
||||
|
||||
https://docs.mono.si/gateway-development-kit/getting-started
|
||||
|
||||
## DISCLAIMER
|
||||
I used ChatGPT a lot for this. I also tested them thoroughly enough that until confident that's what we need.
|
||||
|
||||
### The device's dts files are located at here
|
||||
https://github.com/we-are-mono/OpenWRT-ASK/tree/mono-25.12.0-rc3/target/linux/layerscape/files/arch/arm64/boot/dts/freescale
|
||||
* We need both `mono-gateway-dk-sdk.dts` and `mono-gateway-dk.dts` since the sdk one includes the non-sdk one.
|
||||
@@ -12,13 +15,16 @@ https://github.com/we-are-mono/OpenWRT-ASK/tree/mono-25.12.0-rc3/target/linux/la
|
||||
|
||||
## Build
|
||||
|
||||
To avoid frequent downloading on rebuild. Find and download the latest packages
|
||||
* [kernel](https://github.com/nxp-qoriq/linux/archive/refs/tags/) - `dev/nxplinux.tar.gz`
|
||||
* [busybox](https://github.com/mirror/busybox/archive/refs/tags/) (for initramfs) - `dev/busybox.tar.gz`
|
||||
* [CRI-O](https://github.com/cri-o/cri-o/releases) - `dev/crio.tar.gz`
|
||||
* [Kubelet](https://kubernetes.io/releases/download/) - `dev/kubelet.tar.gz`
|
||||
To avoid frequent downloading on rebuild. Find the latest packages and update build.env
|
||||
* [kernel](https://github.com/nxp-qoriq/linux/archive/refs/tags/)
|
||||
* [busybox](https://github.com/mirror/busybox/archive/refs/tags/)
|
||||
* [CRI-O](https://github.com/cri-o/cri-o/releases)
|
||||
* [Kubelet](https://kubernetes.io/releases/download/)
|
||||
|
||||
Put them into the `dev/` directory
|
||||
Then run
|
||||
```
|
||||
make download-packages
|
||||
```
|
||||
|
||||
```bash
|
||||
make itb # for out/board.itb (contains the kernel and the initramfs)
|
||||
|
||||
@@ -17,3 +17,13 @@ chroot "$ROOTFS" /bin/sh -c "ln -s /var/cache/apk /etc/apk/cache"
|
||||
chroot "$ROOTFS" /bin/sh -c "apk add bash curl"
|
||||
cp "/install-packages.sh" "$ROOTFS/install-packages.sh"
|
||||
chroot "$ROOTFS" /bin/bash /install-packages.sh
|
||||
|
||||
umount "$ROOTFS/var/cache/apk"
|
||||
umount "$ROOTFS/dev"
|
||||
umount "$ROOTFS/proc"
|
||||
umount "$ROOTFS/sys"
|
||||
umount "$ROOTFS/run"
|
||||
|
||||
rm -r "$ROOTFS/build"
|
||||
|
||||
# Begin making full disk image for the device
|
||||
|
||||
@@ -16,8 +16,6 @@ if [ $? -ne 0 ]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
#grep -nE 'conmon|default_runtime|runtime_path|monitor-path|pinns_path' /etc/crio/crio.conf.d/10-crio.conf
|
||||
#crio config | grep -E 'conmon|default_runtime|runtime_path|pinns_path|network_dir|plugin_dirs|cgroup_manager'
|
||||
echo "--------------"
|
||||
sed -i "s/default_runtime = \"crun\"/\0\ncgroup_manager = \"cgroupfs\"/g" /etc/crio/crio.conf.d/10-crio.conf
|
||||
cat /etc/crio/crio.conf.d/10-crio.conf
|
||||
@@ -29,5 +27,3 @@ mkdir -p /etc/cni/net.d
|
||||
mkdir -p /opt/cni/bin
|
||||
mkdir -p /run/crun
|
||||
mkdir -p /run/runc
|
||||
|
||||
crio --log-level debug
|
||||
|
||||
@@ -5,6 +5,7 @@ TAG=dev
|
||||
|
||||
# The Linux kernel, from NXP
|
||||
NXP_VERSION=lf-6.18.2-1.0.0
|
||||
CRIO_VERSION=cri-o.arm64.v1.35.1
|
||||
|
||||
# Mono's tutorial said fsl-ls1046a-rdb.dtb but our shipped board is not that one
|
||||
# We need fsl-ls1046a-rdb-sdk.dtb here
|
||||
|
||||
@@ -4,19 +4,12 @@ FROM --platform=linux/amd64 ${DOCKER_IMAGE_ROOT}/build-base:${TAG} AS build-base
|
||||
|
||||
ARG ALPINE_ARCH
|
||||
ARG ALPINE_VER
|
||||
|
||||
RUN apt-get update && apt-get install -y qemu-user-static --no-install-recommends
|
||||
ARG CRIO_VERSION
|
||||
|
||||
RUN mkdir -p "/out/rootfs"
|
||||
|
||||
# RUN curl -L \
|
||||
# "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/${ALPINE_ARCH}/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz" \
|
||||
# -o alpine-minirootfs.tar.gz
|
||||
# RUN tar -xzf alpine-minirootfs.tar.gz -C "/out/rootfs"
|
||||
|
||||
# Dev-only shortcut
|
||||
COPY dev/alpine.tar.gz ./
|
||||
COPY dev/crio.tar.gz ./
|
||||
COPY packages/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz ./alpine.tar.gz
|
||||
COPY packages/${CRIO_VERSION}.tar.gz ./crio.tar.gz
|
||||
|
||||
RUN tar -xf alpine.tar.gz -C "/out/rootfs"
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
cpio \
|
||||
curl \
|
||||
file \
|
||||
fdisk \
|
||||
flex \
|
||||
git \
|
||||
gettext-base \
|
||||
@@ -22,6 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
pahole \
|
||||
perl \
|
||||
python3 \
|
||||
qemu-user-static \
|
||||
rsync \
|
||||
tar \
|
||||
xz-utils \
|
||||
|
||||
@@ -19,12 +19,8 @@ RUN test -n "${BUSYBOX_VERSION}" || (echo "Please specify BUSYBOX_VERSION" >&2;
|
||||
test -n "${ARCH}" || (echo "Please specify ARCH" >&2; exit 1); \
|
||||
test -n "${CROSS_COMPILE}" || (echo "Please specify CROSS_COMPILE" >&2; exit 1)
|
||||
|
||||
COPY dev/busybox.tar.gz ./
|
||||
RUN tar -xf busybox.tar.gz && mv "busybox-${BUSYBOX_VERSION}" busybox
|
||||
|
||||
# RUN curl -L https://github.com/mirror/busybox/archive/refs/tags/${BUSYBOX_VERSION}.tar.gz -o busybox.tar.gz \
|
||||
# && tar -xf busybox.tar.gz \
|
||||
# && mv "busybox-${BUSYBOX_VERSION}" busybox
|
||||
COPY packages/busybox-${BUSYBOX_VERSION}.tar.gz ./
|
||||
RUN tar -xf busybox-${BUSYBOX_VERSION}.tar.gz && mv "busybox-${BUSYBOX_VERSION}" busybox
|
||||
|
||||
WORKDIR /build/busybox
|
||||
|
||||
|
||||
@@ -14,17 +14,10 @@ RUN test -n "${NXP_VERSION}" || (echo "Please specify NXP_VERSION" >&2; exit 1);
|
||||
test -n "${CROSS_COMPILE}" || (echo "Please specify CROSS_COMPILE" >&2; exit 1); \
|
||||
test -n "${DEVICE_TREE_TARGET}" || (echo "Please specify DEVICE_TREE_TARGET" >&2; exit 1)
|
||||
|
||||
# Dev-only shortcut
|
||||
COPY dev/nxplinux.tar.gz ./
|
||||
RUN tar -xf nxplinux.tar.gz \
|
||||
COPY packages/${NXP_VERSION}.tar.gz ./
|
||||
RUN tar -xf ${NXP_VERSION}.tar.gz \
|
||||
&& mv "linux-${NXP_VERSION}" nxplinux \
|
||||
&& rm -f nxplinux.tar.gz
|
||||
|
||||
# Or download directly:
|
||||
# RUN curl -L "https://github.com/nxp-qoriq/linux/archive/refs/tags/${NXP_VERSION}.tar.gz" -o nxplinux.tar.gz \
|
||||
# && tar -xf nxplinux.tar.gz \
|
||||
# && mv "linux-${NXP_VERSION}" nxplinux \
|
||||
# && rm -f nxplinux.tar.gz
|
||||
&& rm -f ${NXP_VERSION}.tar.gz
|
||||
|
||||
WORKDIR /build/nxplinux
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
###############################################################################
|
||||
# Core initramfs / board support
|
||||
# These are built-in because you said initramfs needs them and you want them
|
||||
# available early during boot.
|
||||
###############################################################################
|
||||
|
||||
CONFIG_HWMON=y
|
||||
|
||||
22
makefile
22
makefile
@@ -3,6 +3,26 @@ export
|
||||
|
||||
TAG ?= dev
|
||||
|
||||
define fetch_if_missing
|
||||
@if [ ! -f "$1" ]; then \
|
||||
echo "Downloading $1"; \
|
||||
curl -L -o "$1" "$2"; \
|
||||
fi
|
||||
endef
|
||||
|
||||
ALPINE_SERIES := $(word 1,$(subst ., ,${ALPINE_VER})).$(word 2,$(subst ., ,${ALPINE_VER}))
|
||||
|
||||
download-packages:
|
||||
@mkdir -p packages
|
||||
|
||||
$(call fetch_if_missing,packages/busybox-${BUSYBOX_VERSION}.tar.gz,https://github.com/mirror/busybox/archive/refs/tags/${BUSYBOX_VERSION}.tar.gz)
|
||||
|
||||
$(call fetch_if_missing,packages/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz,https://dl-cdn.alpinelinux.org/alpine/v$(ALPINE_SERIES)/releases/${ALPINE_ARCH}/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz)
|
||||
|
||||
$(call fetch_if_missing,packages/${NXP_VERSION}.tar.gz,https://github.com/nxp-qoriq/linux/archive/refs/tags/${NXP_VERSION}.tar.gz)
|
||||
|
||||
$(call fetch_if_missing,packages/${CRIO_VERSION}.tar.gz,https://storage.googleapis.com/cri-o/artifacts/${CRIO_VERSION}.tar.gz)
|
||||
|
||||
build-base:
|
||||
docker build \
|
||||
-f docker/build-base.Dockerfile \
|
||||
@@ -47,6 +67,7 @@ buildenv-alpine: build-base
|
||||
--build-arg TAG=$(TAG) \
|
||||
--build-arg ALPINE_ARCH=$(ALPINE_ARCH) \
|
||||
--build-arg ALPINE_VER=$(ALPINE_VER) \
|
||||
--build-arg CRIO_VERSION=$(CRIO_VERSION) \
|
||||
-t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) .
|
||||
|
||||
alpine-rootfs: buildenv-alpine kernel-build
|
||||
@@ -55,5 +76,6 @@ alpine-rootfs: buildenv-alpine kernel-build
|
||||
-v /cache/apk:/var/cache/apk \
|
||||
-v /cache/artifacts:/artifacts \
|
||||
-e ROOTFS=/out/rootfs \
|
||||
-e ARTIFACT_DIR=/artifacts \
|
||||
$(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \
|
||||
bash -lc '/build-rootfs.sh'
|
||||
|
||||
Reference in New Issue
Block a user