Added make download-packages

This commit is contained in:
2026-03-22 17:56:33 +08:00
parent 0091b86cf5
commit 02a9209370
11 changed files with 56 additions and 39 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
dev/ packages/
out/ out/
.swp .swp

View File

@@ -4,6 +4,9 @@ Kubernetes image for Mono Gateway Development Kit
https://docs.mono.si/gateway-development-kit/getting-started 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 ### 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 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. * 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 ## Build
To avoid frequent downloading on rebuild. Find and download the latest packages To avoid frequent downloading on rebuild. Find the latest packages and update build.env
* [kernel](https://github.com/nxp-qoriq/linux/archive/refs/tags/) - `dev/nxplinux.tar.gz` * [kernel](https://github.com/nxp-qoriq/linux/archive/refs/tags/)
* [busybox](https://github.com/mirror/busybox/archive/refs/tags/) (for initramfs) - `dev/busybox.tar.gz` * [busybox](https://github.com/mirror/busybox/archive/refs/tags/)
* [CRI-O](https://github.com/cri-o/cri-o/releases) - `dev/crio.tar.gz` * [CRI-O](https://github.com/cri-o/cri-o/releases)
* [Kubelet](https://kubernetes.io/releases/download/) - `dev/kubelet.tar.gz` * [Kubelet](https://kubernetes.io/releases/download/)
Put them into the `dev/` directory Then run
```
make download-packages
```
```bash ```bash
make itb # for out/board.itb (contains the kernel and the initramfs) make itb # for out/board.itb (contains the kernel and the initramfs)

View File

@@ -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" 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 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

View File

@@ -16,8 +16,6 @@ if [ $? -ne 0 ]; then
exit $? exit $?
fi 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 "--------------" 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
cat /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 /opt/cni/bin
mkdir -p /run/crun mkdir -p /run/crun
mkdir -p /run/runc mkdir -p /run/runc
crio --log-level debug

View File

@@ -5,6 +5,7 @@ TAG=dev
# The Linux kernel, from NXP # The Linux kernel, from NXP
NXP_VERSION=lf-6.18.2-1.0.0 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 # 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

View File

@@ -4,19 +4,12 @@ FROM --platform=linux/amd64 ${DOCKER_IMAGE_ROOT}/build-base:${TAG} AS build-base
ARG ALPINE_ARCH ARG ALPINE_ARCH
ARG ALPINE_VER ARG ALPINE_VER
ARG CRIO_VERSION
RUN apt-get update && apt-get install -y qemu-user-static --no-install-recommends
RUN mkdir -p "/out/rootfs" RUN mkdir -p "/out/rootfs"
# RUN curl -L \ COPY packages/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz ./alpine.tar.gz
# "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/${ALPINE_ARCH}/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz" \ COPY packages/${CRIO_VERSION}.tar.gz ./crio.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 ./
RUN tar -xf alpine.tar.gz -C "/out/rootfs" RUN tar -xf alpine.tar.gz -C "/out/rootfs"

View File

@@ -12,6 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
cpio \ cpio \
curl \ curl \
file \ file \
fdisk \
flex \ flex \
git \ git \
gettext-base \ gettext-base \
@@ -22,6 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
pahole \ pahole \
perl \ perl \
python3 \ python3 \
qemu-user-static \
rsync \ rsync \
tar \ tar \
xz-utils \ xz-utils \

View File

@@ -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 "${ARCH}" || (echo "Please specify ARCH" >&2; exit 1); \
test -n "${CROSS_COMPILE}" || (echo "Please specify CROSS_COMPILE" >&2; exit 1) test -n "${CROSS_COMPILE}" || (echo "Please specify CROSS_COMPILE" >&2; exit 1)
COPY dev/busybox.tar.gz ./ COPY packages/busybox-${BUSYBOX_VERSION}.tar.gz ./
RUN tar -xf busybox.tar.gz && mv "busybox-${BUSYBOX_VERSION}" busybox RUN tar -xf busybox-${BUSYBOX_VERSION}.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
WORKDIR /build/busybox WORKDIR /build/busybox

View File

@@ -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 "${CROSS_COMPILE}" || (echo "Please specify CROSS_COMPILE" >&2; exit 1); \
test -n "${DEVICE_TREE_TARGET}" || (echo "Please specify DEVICE_TREE_TARGET" >&2; exit 1) test -n "${DEVICE_TREE_TARGET}" || (echo "Please specify DEVICE_TREE_TARGET" >&2; exit 1)
# Dev-only shortcut COPY packages/${NXP_VERSION}.tar.gz ./
COPY dev/nxplinux.tar.gz ./ RUN tar -xf ${NXP_VERSION}.tar.gz \
RUN tar -xf nxplinux.tar.gz \
&& mv "linux-${NXP_VERSION}" nxplinux \ && mv "linux-${NXP_VERSION}" nxplinux \
&& rm -f nxplinux.tar.gz && rm -f ${NXP_VERSION}.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
WORKDIR /build/nxplinux WORKDIR /build/nxplinux

View File

@@ -1,7 +1,5 @@
############################################################################### ###############################################################################
# Core initramfs / board support # 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 CONFIG_HWMON=y

View File

@@ -3,6 +3,26 @@ export
TAG ?= dev 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: build-base:
docker build \ docker build \
-f docker/build-base.Dockerfile \ -f docker/build-base.Dockerfile \
@@ -47,6 +67,7 @@ buildenv-alpine: build-base
--build-arg TAG=$(TAG) \ --build-arg TAG=$(TAG) \
--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) \
-t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) . -t $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) .
alpine-rootfs: buildenv-alpine kernel-build alpine-rootfs: buildenv-alpine kernel-build
@@ -55,5 +76,6 @@ alpine-rootfs: buildenv-alpine kernel-build
-v /cache/apk:/var/cache/apk \ -v /cache/apk:/var/cache/apk \
-v /cache/artifacts:/artifacts \ -v /cache/artifacts:/artifacts \
-e ROOTFS=/out/rootfs \ -e ROOTFS=/out/rootfs \
-e ARTIFACT_DIR=/artifacts \
$(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \ $(DOCKER_IMAGE_ROOT)/buildenv-alpine:$(TAG) \
bash -lc '/build-rootfs.sh' bash -lc '/build-rootfs.sh'