blob: 21e168eed0801972de24528333deb44675955f32 [file] [log] [blame]
Nico Huber02a6ef32022-12-15 12:42:32 +00001FROM debian:bullseye
2
3ARG PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.1/All
4ARG INST_IMG=http://ftp.de.netbsd.org/pub/NetBSD/NetBSD-7.1/amd64/
5
6RUN \
7 useradd -p locked -m mani && \
8 apt-get -qq update && \
9 apt-get -qq upgrade && \
10 apt-get -qqy install git python-is-python3 python3-pexpect \
11 python3-distutils genisoimage qemu-system && \
12 apt-get clean
13
14RUN git clone https://github.com/gson1703/anita.git
15RUN cd anita && python setup.py install
16
17ARG DISK_SIZE=1G
18ARG INSTALL_MEM=128M
19USER mani
20RUN cd && mkdir .ccache && chown mani:mani .ccache && \
21 anita --sets kern-GENERIC,modules,base,etc,comp \
22 --disk-size ${DISK_SIZE} --memory-size=${INSTALL_MEM} \
23 install ${INST_IMG} && \
24 rm -rf work-*/download
25
26ARG EXTRA_PKG=""
27ARG RUNTIME_MEM=128M
28ARG ORIGIN=https://review.coreboot.org/flashrom-stable.git
29RUN cd && anita --persist --memory-size=${RUNTIME_MEM} --run \
30"echo 'dhcpcd' >init && \
31 echo 'export PKG_PATH=${PKG_PATH}' >>init && \
32 . ./init && \
Nico Huber267279f2022-12-11 17:22:19 +000033 pkg_add gmake git-base ccache pkg-config \
34 pciutils libusb1 libusb-compat libftdi \
Nico Huber02a6ef32022-12-15 12:42:32 +000035 ${EXTRA_PKG} && \
36 git config --global --add http.sslVerify false && \
37 git clone ${ORIGIN} flashrom" \
38 boot ${INST_IMG}
39
40RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \
Nico Huber055a8972022-12-11 17:19:36 +000041 anita --vmm-args \
42 '-drive file=cache.img,index=1,media=disk,format=raw' \
43 --persist \
Nico Huber02a6ef32022-12-15 12:42:32 +000044 --memory-size=${RUNTIME_MEM} --run \
45"if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \
46 bdev=wd1d; \
47 else \
48 bdev=wd1c; \
49 fi; \
50 newfs -I \${bdev} && \
51 mkdir .ccache && \
52 mount /dev/\${bdev} .ccache && \
53 ccache -M 60M && \
54 umount .ccache && \
55 echo 'manitest() {' >>init && \
56 echo ' fsck -y -t ffs /dev/'\${bdev} >>init && \
57 echo ' mount /dev/'\${bdev}' ~/.ccache' >>init && \
58 echo ' (cd ~/flashrom && eval \" \$*\")' >>init && \
59 echo ' ret=\$?' >>init && \
60 echo ' umount ~/.ccache' >>init && \
61 echo ' return \$ret' >>init && \
62 echo '}' >>init" \
63 boot ${INST_IMG} && \
64 gzip cache.img
65
66COPY anita-wrapper.sh /home/mani/mani-wrapper.sh
67ENV INST_IMG ${INST_IMG}
68ENV MEM_SIZE ${RUNTIME_MEM}
69ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"]