diff options
author | Nico Huber <nico.h@gmx.de> | 2021-04-17 23:40:52 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2021-04-22 15:16:59 +0000 |
commit | f4196c6f94c2a3eb114a6e10cde929dbb0fbf72a (patch) | |
tree | 0a6d160c321d0122e995de9fbfce04303e5940ef /util | |
parent | 08dc3e55fe8a42cb776f5107ad15287b4cce01c9 (diff) | |
download | flashrom-f4196c6f94c2a3eb114a6e10cde929dbb0fbf72a.tar.gz flashrom-f4196c6f94c2a3eb114a6e10cde929dbb0fbf72a.tar.bz2 flashrom-f4196c6f94c2a3eb114a6e10cde929dbb0fbf72a.zip |
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>
Diffstat (limited to 'util')
-rw-r--r-- | util/manibuilder/Dockerfile.anita | 11 | ||||
-rw-r--r-- | util/manibuilder/Makefile.anita | 12 | ||||
-rw-r--r-- | util/manibuilder/anita-wrapper.sh | 7 |
3 files changed, 19 insertions, 11 deletions
diff --git a/util/manibuilder/Dockerfile.anita b/util/manibuilder/Dockerfile.anita index dd6f4dd2..f4b1309c 100644 --- a/util/manibuilder/Dockerfile.anita +++ b/util/manibuilder/Dockerfile.anita @@ -3,7 +3,7 @@ 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 MEM_SIZE=128M +ARG INSTALL_MEM=128M ARG EXTRA_PKG="" RUN \ @@ -20,11 +20,12 @@ RUN \ USER mani RUN cd && mkdir .ccache && chown mani:mani .ccache && \ 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} && \ 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 'export PKG_PATH=${PKG_PATH}' >>init && \ . ./init && \ @@ -35,7 +36,8 @@ RUN cd && anita --persist --run \ boot ${INST_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 \ bdev=wd1d; \ 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 ENV INST_IMG ${INST_IMG} +ENV MEM_SIZE ${RUNTIME_MEM} ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"] diff --git a/util/manibuilder/Makefile.anita b/util/manibuilder/Makefile.anita index e7951945..21cad8c6 100644 --- a/util/manibuilder/Makefile.anita +++ b/util/manibuilder/Makefile.anita @@ -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: NETBSD_IMAGE=pub/NetBSD/NetBSD-8.2/amd64/ 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: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/amd64/ 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: NETBSD_IMAGE=pub/NetBSD/NetBSD-7.1/i386/ 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 $(QUIET_SETUP)docker build . -f $< -t mani/$* \ --build-arg PKG_PATH=$(PKGSRC_MIRROR)$(PKGSRC_PATH) \ --build-arg INST_IMG=$(NETBSD_MIRROR)$(NETBSD_IMAGE) \ --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) diff --git a/util/manibuilder/anita-wrapper.sh b/util/manibuilder/anita-wrapper.sh index 617e17f8..3ff9ee17 100644 --- a/util/manibuilder/anita-wrapper.sh +++ b/util/manibuilder/anita-wrapper.sh @@ -9,9 +9,10 @@ CCACHE=.ccache/anita-${IDENT}.img [ -f ${CCACHE} ] || zcat cache.img.gz >${CCACHE} 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 - exec anita --vmm-args "-hdb ${CCACHE}" --persist \ - --run ". ./init && manitest \"$*\"" \ + exec anita --vmm-args "-hdb ${CCACHE}" --memory-size=${MEM_SIZE} \ + --persist --run ". ./init && manitest \"$*\"" \ boot ${INST_IMG} fi |