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 | |
Nico Huber | fb433ba | 2023-03-04 19:09:47 +0000 | [diff] [blame] | 14 | RUN mkdir -p -m 1777 /ccache |
| 15 | |
Nico Huber | c0b52db | 2022-12-15 12:42:32 +0000 | [diff] [blame] | 16 | ARG DISK_SIZE=1G |
| 17 | ARG INSTALL_MEM=128M |
Nico Huber | 3ddd603 | 2022-12-11 17:23:22 +0000 | [diff] [blame] | 18 | 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] | 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 |
Nico Huber | 3ddd603 | 2022-12-11 17:23:22 +0000 | [diff] [blame] | 29 | 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] | 30 | RUN cd && anita --persist --memory-size=${RUNTIME_MEM} --run \ |
| 31 | "echo 'dhcpcd' >init && \ |
| 32 | echo 'export PKG_PATH=${PKG_PATH}' >>init && \ |
| 33 | . ./init && \ |
Nico Huber | bad19ae | 2023-03-01 17:24:28 +0000 | [diff] [blame] | 34 | pkg_add gmake git-base ccache pkg-config meson \ |
Nico Huber | 76afdac | 2022-12-11 17:22:19 +0000 | [diff] [blame] | 35 | pciutils libusb1 libusb-compat libftdi \ |
Nico Huber | c0b52db | 2022-12-15 12:42:32 +0000 | [diff] [blame] | 36 | ${EXTRA_PKG} && \ |
| 37 | git config --global --add http.sslVerify false && \ |
| 38 | git clone ${ORIGIN} flashrom" \ |
| 39 | boot ${INST_IMG} |
| 40 | |
| 41 | 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] | 42 | anita --vmm-args \ |
| 43 | '-drive file=cache.img,index=1,media=disk,format=raw' \ |
| 44 | --persist \ |
Nico Huber | c0b52db | 2022-12-15 12:42:32 +0000 | [diff] [blame] | 45 | --memory-size=${RUNTIME_MEM} --run \ |
| 46 | "if [ \$(uname -m) = i386 -o \$(uname -m) = amd64 ]; then \ |
| 47 | bdev=wd1d; \ |
| 48 | else \ |
| 49 | bdev=wd1c; \ |
| 50 | fi; \ |
| 51 | newfs -I \${bdev} && \ |
| 52 | mkdir .ccache && \ |
| 53 | mount /dev/\${bdev} .ccache && \ |
| 54 | ccache -M 60M && \ |
| 55 | umount .ccache && \ |
| 56 | echo 'manitest() {' >>init && \ |
| 57 | echo ' fsck -y -t ffs /dev/'\${bdev} >>init && \ |
| 58 | echo ' mount /dev/'\${bdev}' ~/.ccache' >>init && \ |
| 59 | echo ' (cd ~/flashrom && eval \" \$*\")' >>init && \ |
| 60 | echo ' ret=\$?' >>init && \ |
| 61 | echo ' umount ~/.ccache' >>init && \ |
| 62 | echo ' return \$ret' >>init && \ |
| 63 | echo '}' >>init" \ |
| 64 | boot ${INST_IMG} && \ |
| 65 | gzip cache.img |
| 66 | |
| 67 | COPY anita-wrapper.sh /home/mani/mani-wrapper.sh |
| 68 | ENV INST_IMG ${INST_IMG} |
| 69 | ENV MEM_SIZE ${RUNTIME_MEM} |
| 70 | ENTRYPOINT ["/bin/sh", "/home/mani/mani-wrapper.sh"] |