Skip to content

Commit 0cdb6d7

Browse files
committed
Create scratch image to contain kernel
1 parent d64ca11 commit 0cdb6d7

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ ARG toltec_image=ghcr.io/toltec-dev/base:v3.1
33
ARG rm2_stuff_tag=v0.1.2
44
ARG fw_version=3.5.2.1807
55
ARG linux_release=5.8.18
6+
7+
# By default use a cached linux kernel. To build locally pass:
8+
# --build-arg linux_image=linux-build
69
ARG linux_image=ghcr.io/timower/rm-docker-linux:linux-image
710

811
# Step 1: Build Linux for the emulator
9-
FROM $toltec_image as linux-build
12+
FROM $toltec_image as linux-builder
1013

1114
RUN apt-get update && \
1215
apt-get install -y bison bc lzop libssl-dev flex
@@ -34,6 +37,10 @@ RUN make O=imx7 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j $(nproc) && \
3437
cp imx7/arch/arm/boot/dts/imx7d-rm.dtb /opt && \
3538
rm -rf imx7
3639

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+
3744
# Dummy stage to use in the arg below
3845
FROM $linux_image AS linux-image
3946

@@ -73,8 +80,8 @@ RUN apt-get update && \
7380

7481
RUN mkdir -p /opt/root
7582

76-
COPY --from=linux-image /opt/zImage /opt
77-
COPY --from=linux-image /opt/imx7d-rm.dtb /opt
83+
COPY --from=linux-image /zImage /opt
84+
COPY --from=linux-image /imx7d-rm.dtb /opt
7885
COPY --from=rootfs /opt/rootfs.qcow2 /opt/root
7986

8087
ADD bin /opt/bin

0 commit comments

Comments
 (0)