1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 15:33:42 +02:00
flashrom/util/manibuilder/Dockerfile.anita
Nico Huber f4196c6f94 manibuilder/anita: Always provide reasonable --memory-size
It turned out that the `--memory-size` given at install time is
not persistent. All later anita runs use an arch-dependent default
(32M for i386, so this might explain why it was never stable).

Assuming most machines have >1GiB RAM per processor core available,
we can also increase the runtime size further (better to waste some
RAM than to wait very long because it starts swapping things out).
We choose 512MiB for 64-bit targets and 256MiB for 32-bit ones.

However, we don't need that much for the initial installation step
and it also decides the size of the swap partition. So we use a
smaller size initially that's just enough to get us through the
installation quickly enough (192MiB & 128MiB).

Change-Id: I255c41aeb92cda29ed23a236017472982e839530
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52484
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-04-22 15:16:59 +00:00

66 lines
2.2 KiB
Docker

FROM debian:stable
ARG PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.1/All
ARG INST_IMG=http://ftp.de.netbsd.org/pub/NetBSD/NetBSD-7.1/amd64/
ARG DISK_SIZE=1G
ARG INSTALL_MEM=128M
ARG EXTRA_PKG=""
RUN \
useradd -p locked -m mani && \
apt-get -qq update && \
apt-get -qq upgrade && \
apt-get -qq dist-upgrade && \
apt-get -qqy install git python python-pexpect \
genisoimage qemu-system && \
apt-get clean && \
git clone https://github.com/gson1703/anita.git && \
cd anita && python setup.py install
USER mani
RUN cd && mkdir .ccache && chown mani:mani .ccache && \
anita --sets kern-GENERIC,modules,base,etc,comp \
--disk-size ${DISK_SIZE} --memory-size=${INSTALL_MEM} \
install ${INST_IMG} && \
rm -rf work-*/download
ARG RUNTIME_MEM=128M
RUN cd && anita --persist --memory-size=${RUNTIME_MEM} --run \
"echo 'dhcpcd' >init && \
echo 'export PKG_PATH=${PKG_PATH}' >>init && \
. ./init && \
pkg_add gmake git-base ccache pciutils libusb1 libusb-compat libftdi \
${EXTRA_PKG} && \
git config --global --add http.sslVerify false && \
git clone https://review.coreboot.org/flashrom.git" \
boot ${INST_IMG}
RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \
anita --vmm-args '-hdb cache.img' --persist \
--memory-size=${RUNTIME_MEM} --run \
"if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \
bdev=wd1d; \
else \
bdev=wd1c; \
fi; \
newfs -I \${bdev} && \
mkdir .ccache && \
mount /dev/\${bdev} .ccache && \
ccache -M 60M && \
umount .ccache && \
echo 'manitest() {' >>init && \
echo ' fsck -y -t ffs /dev/'\${bdev} >>init && \
echo ' mount /dev/'\${bdev}' ~/.ccache' >>init && \
echo ' (cd ~/flashrom && eval \" \$*\")' >>init && \
echo ' ret=\$?' >>init && \
echo ' umount ~/.ccache' >>init && \
echo ' return \$ret' >>init && \
echo '}' >>init" \
boot ${INST_IMG} && \
gzip cache.img
COPY anita-wrapper.sh /home/mani/mani-wrapper.sh
ENV INST_IMG ${INST_IMG}
ENV MEM_SIZE ${RUNTIME_MEM}
ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"]