1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 07:23:43 +02:00

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>
This commit is contained in:
Nico Huber 2021-04-17 23:40:52 +02:00
parent 08dc3e55fe
commit f4196c6f94
3 changed files with 19 additions and 11 deletions

View File

@ -3,7 +3,7 @@ FROM debian:stable
ARG PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.1/All 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 INST_IMG=http://ftp.de.netbsd.org/pub/NetBSD/NetBSD-7.1/amd64/
ARG DISK_SIZE=1G ARG DISK_SIZE=1G
ARG MEM_SIZE=128M ARG INSTALL_MEM=128M
ARG EXTRA_PKG="" ARG EXTRA_PKG=""
RUN \ RUN \
@ -20,11 +20,12 @@ RUN \
USER mani USER mani
RUN cd && mkdir .ccache && chown mani:mani .ccache && \ RUN cd && mkdir .ccache && chown mani:mani .ccache && \
anita --sets kern-GENERIC,modules,base,etc,comp \ anita --sets kern-GENERIC,modules,base,etc,comp \
--disk-size ${DISK_SIZE} --memory-size=${MEM_SIZE} \ --disk-size ${DISK_SIZE} --memory-size=${INSTALL_MEM} \
install ${INST_IMG} && \ install ${INST_IMG} && \
rm -rf work-*/download rm -rf work-*/download
RUN cd && anita --persist --run \ ARG RUNTIME_MEM=128M
RUN cd && anita --persist --memory-size=${RUNTIME_MEM} --run \
"echo 'dhcpcd' >init && \ "echo 'dhcpcd' >init && \
echo 'export PKG_PATH=${PKG_PATH}' >>init && \ echo 'export PKG_PATH=${PKG_PATH}' >>init && \
. ./init && \ . ./init && \
@ -35,7 +36,8 @@ RUN cd && anita --persist --run \
boot ${INST_IMG} boot ${INST_IMG}
RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \ RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \
anita --vmm-args '-hdb cache.img' --persist --run \ anita --vmm-args '-hdb cache.img' --persist \
--memory-size=${RUNTIME_MEM} --run \
"if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \ "if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \
bdev=wd1d; \ bdev=wd1d; \
else \ else \
@ -59,4 +61,5 @@ RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \
COPY anita-wrapper.sh /home/mani/mani-wrapper.sh COPY anita-wrapper.sh /home/mani/mani-wrapper.sh
ENV INST_IMG ${INST_IMG} ENV INST_IMG ${INST_IMG}
ENV MEM_SIZE ${RUNTIME_MEM}
ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"] ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"]

View File

@ -4,21 +4,25 @@ NETBSD_MIRROR = http://ftp.de.netbsd.org/
anita\:8.2-amd64-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/amd64/8.2/All anita\:8.2-amd64-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/amd64/8.2/All
anita\:8.2-amd64-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-8.2/amd64/ anita\:8.2-amd64-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-8.2/amd64/
anita\:8.2-amd64-build: QEMU_DISK_SIZE=2G anita\:8.2-amd64-build: QEMU_DISK_SIZE=2G
anita\:8.2-amd64-build: QEMU_MEM_SIZE=256M anita\:8.2-amd64-build: QEMU_INSTALL_MEM=192M
anita\:8.2-amd64-build: QEMU_RUNTIME_MEM=512M
anita\:7.1-amd64-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/amd64/7.1/All anita\:7.1-amd64-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/amd64/7.1/All
anita\:7.1-amd64-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/amd64/ anita\:7.1-amd64-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/amd64/
anita\:7.1-amd64-build: QEMU_DISK_SIZE=1G anita\:7.1-amd64-build: QEMU_DISK_SIZE=1G
anita\:7.1-amd64-build: QEMU_MEM_SIZE=128M anita\:7.1-amd64-build: QEMU_INSTALL_MEM=192M
anita\:7.1-amd64-build: QEMU_RUNTIME_MEM=512M
anita\:7.1-i386-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/i386/7.1/All anita\:7.1-i386-build: PKGSRC_PATH=pub/pkgsrc/packages/NetBSD/i386/7.1/All
anita\:7.1-i386-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/i386/ anita\:7.1-i386-build: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/i386/
anita\:7.1-i386-build: QEMU_DISK_SIZE=1G anita\:7.1-i386-build: QEMU_DISK_SIZE=1G
anita\:7.1-i386-build: QEMU_MEM_SIZE=128M anita\:7.1-i386-build: QEMU_INSTALL_MEM=128M
anita\:7.1-i386-build: QEMU_RUNTIME_MEM=256M
$(addsuffix -build,$(ANITA_TAGS)): %-build: Dockerfile.anita anita-wrapper.sh $(addsuffix -build,$(ANITA_TAGS)): %-build: Dockerfile.anita anita-wrapper.sh
$(QUIET_SETUP)docker build . -f $< -t mani/$* \ $(QUIET_SETUP)docker build . -f $< -t mani/$* \
--build-arg PKG_PATH=$(PKGSRC_MIRROR)$(PKGSRC_PATH) \ --build-arg PKG_PATH=$(PKGSRC_MIRROR)$(PKGSRC_PATH) \
--build-arg INST_IMG=$(NETBSD_MIRROR)$(NETBSD_IMAGE) \ --build-arg INST_IMG=$(NETBSD_MIRROR)$(NETBSD_IMAGE) \
--build-arg DISK_SIZE=$(QEMU_DISK_SIZE) \ --build-arg DISK_SIZE=$(QEMU_DISK_SIZE) \
--build-arg MEM_SIZE=$(QEMU_MEM_SIZE) --build-arg INSTALL_MEM=$(QEMU_INSTALL_MEM) \
--build-arg RUNTIME_MEM=$(QEMU_RUNTIME_MEM)

View File

@ -9,9 +9,10 @@ CCACHE=.ccache/anita-${IDENT}.img
[ -f ${CCACHE} ] || zcat cache.img.gz >${CCACHE} [ -f ${CCACHE} ] || zcat cache.img.gz >${CCACHE}
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
exec anita --vmm-args "-hdb ${CCACHE}" interact ${INST_IMG} exec anita --vmm-args "-hdb ${CCACHE}" --memory-size=${MEM_SIZE} \
interact ${INST_IMG}
else else
exec anita --vmm-args "-hdb ${CCACHE}" --persist \ exec anita --vmm-args "-hdb ${CCACHE}" --memory-size=${MEM_SIZE} \
--run ". ./init && manitest \"$*\"" \ --persist --run ". ./init && manitest \"$*\"" \
boot ${INST_IMG} boot ${INST_IMG}
fi fi