@@ -4,8 +4,12 @@ ARG rm2_stuff_tag=v0.1.2
44ARG fw_version=3.5.2.1807
55ARG linux_release=5.8.18
66
7+ # By default use a cached linux kernel. To build locally pass:
8+ # --build-arg linux_image=linux-build
9+ ARG linux_image=ghcr.io/timower/rm-docker-linux:linux-image
10+
711# Step 1: Build Linux for the emulator
8- FROM $toltec_image as linux-build
12+ FROM $toltec_image as linux-builder
913
1014RUN apt-get update && \
1115 apt-get install -y bison bc lzop libssl-dev flex
@@ -33,6 +37,13 @@ RUN make O=imx7 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j $(nproc) && \
3337 cp imx7/arch/arm/boot/dts/imx7d-rm.dtb /opt && \
3438 rm -rf imx7
3539
40+ # This container just needs to kernel and device tree
41+ FROM scratch AS linux-build
42+ COPY --from=linux-builder /opt/zImage /opt/imx7d-rm.dtb /
43+
44+ # Dummy stage to use in the arg below
45+ FROM $linux_image AS linux-image
46+
3647# Step 2: rootfs
3748FROM linuxkit/guestfs:f85d370f7a3b0749063213c2dd451020e3a631ab AS rootfs
3849
@@ -69,8 +80,8 @@ RUN apt-get update && \
6980
7081RUN mkdir -p /opt/root
7182
72- COPY --from=linux-build /opt /zImage /opt
73- COPY --from=linux-build /opt /imx7d-rm.dtb /opt
83+ COPY --from=linux-image /zImage /opt
84+ COPY --from=linux-image /imx7d-rm.dtb /opt
7485COPY --from=rootfs /opt/rootfs.qcow2 /opt/root
7586
7687ADD bin /opt/bin
0 commit comments