Nico Huber | c0b52db | 2022-12-15 12:42:32 +0000 | [diff] [blame] | 1 | FROM debian:bullseye |
| 2 | |
| 3 | ARG PKG_PATH=http://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/7.1/All |
| 4 | ARG INST_IMG=http://ftp.de.netbsd.org/pub/NetBSD/NetBSD-7.1/amd64/ |
| 5 | |
| 6 | RUN \ |
| 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 | |
| 14 | RUN git clone https://github.com/gson1703/anita.git |
| 15 | RUN cd anita && python setup.py install |
| 16 | |
| 17 | ARG DISK_SIZE=1G |
| 18 | ARG INSTALL_MEM=128M |
| 19 | USER mani |
| 20 | RUN 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 | |
| 26 | ARG EXTRA_PKG="" |
| 27 | ARG RUNTIME_MEM=128M |
| 28 | ARG ORIGIN=https://review.coreboot.org/flashrom-stable.git |
| 29 | RUN cd && anita --persist --memory-size=${RUNTIME_MEM} --run \ |
| 30 | "echo 'dhcpcd' >init && \ |
| 31 | echo 'export PKG_PATH=${PKG_PATH}' >>init && \ |
| 32 | . ./init && \ |
| 33 | pkg_add gmake git-base ccache pciutils libusb1 libusb-compat libftdi \ |
| 34 | ${EXTRA_PKG} && \ |
| 35 | git config --global --add http.sslVerify false && \ |
| 36 | git clone ${ORIGIN} flashrom" \ |
| 37 | boot ${INST_IMG} |
| 38 | |
| 39 | RUN cd && dd if=/dev/zero bs=1M count=64 of=cache.img && \ |
| 40 | anita --vmm-args '-hdb cache.img' --persist \ |
| 41 | --memory-size=${RUNTIME_MEM} --run \ |
| 42 | "if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \ |
| 43 | bdev=wd1d; \ |
| 44 | else \ |
| 45 | bdev=wd1c; \ |
| 46 | fi; \ |
| 47 | newfs -I \${bdev} && \ |
| 48 | mkdir .ccache && \ |
| 49 | mount /dev/\${bdev} .ccache && \ |
| 50 | ccache -M 60M && \ |
| 51 | umount .ccache && \ |
| 52 | echo 'manitest() {' >>init && \ |
| 53 | echo ' fsck -y -t ffs /dev/'\${bdev} >>init && \ |
| 54 | echo ' mount /dev/'\${bdev}' ~/.ccache' >>init && \ |
| 55 | echo ' (cd ~/flashrom && eval \" \$*\")' >>init && \ |
| 56 | echo ' ret=\$?' >>init && \ |
| 57 | echo ' umount ~/.ccache' >>init && \ |
| 58 | echo ' return \$ret' >>init && \ |
| 59 | echo '}' >>init" \ |
| 60 | boot ${INST_IMG} && \ |
| 61 | gzip cache.img |
| 62 | |
| 63 | COPY anita-wrapper.sh /home/mani/mani-wrapper.sh |
| 64 | ENV INST_IMG ${INST_IMG} |
| 65 | ENV MEM_SIZE ${RUNTIME_MEM} |
| 66 | ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"] |