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