From b117b6ed3dc89b7e307dab907dafc0e7defd5756 Mon Sep 17 00:00:00 2001 From: Greg Steuck Date: Wed, 19 Sep 2018 16:28:02 -0700 Subject: tools/*openbsd*: smaller VMM images and tweaks. --- tools/create-openbsd-gce-ci.sh | 8 +- tools/create-openbsd-vmm-worker.sh | 181 +++++++++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 2 deletions(-) create mode 100755 tools/create-openbsd-vmm-worker.sh (limited to 'tools') diff --git a/tools/create-openbsd-gce-ci.sh b/tools/create-openbsd-gce-ci.sh index 458f76cd3..e813dbc5b 100755 --- a/tools/create-openbsd-gce-ci.sh +++ b/tools/create-openbsd-gce-ci.sh @@ -30,13 +30,17 @@ mkdir -p etc cat >install.site < boot.conf echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config mkdir /syzkaller echo '/dev/sd1a /syzkaller ffs rw,noauto 1 0' >> /etc/fstab + +rm -rf /usr/{src,ports} +ln -s /syzkaller/src /usr/src +ln -s /syzkaller/ports /usr/ports EOF cat >etc/installurl < /dev/null \ # Create Compute Engine disk image. echo "Archiving disk.raw... (this may take a while)" -i="openbsd-${ARCH}-gce.tar.gz" +i="openbsd-${ARCH}-${RELNO}-gce.tar.gz" tar -Szcf "$i" disk.raw cat <install.site <<'EOF' +#!/bin/sh +echo 'set tty com0' > boot.conf +echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config + +rm /usr/libexec/reorder_kernel +ln -s /usr/bin/true /usr/libexec/reorder_kernel +rm -fr /usr/share/relink + +perl -i.bak -pne 's/^(ttyC.*)vt220.*/$1unknown off/' /etc/ttys + +touch root/.hushlogin home/syzkaller/.hushlogin +EOF + +cat >etc/installurl <etc/rc.local <etc/rc.conf.local <auto_install.conf <disklabel.template < boot.conf +dd if=/dev/urandom of=random.seed bs=4096 count=1 +cp "${ISO}" "${ISO_PATCHED}" +growisofs -M "${ISO_PATCHED}" -l -R -graft-points \ + /${VERSION}/${ARCH}/site${RELNO}.tgz=site${RELNO}.tgz \ + /auto_install.conf=auto_install.conf \ + /disklabel.template=disklabel.template \ + /etc/boot.conf=boot.conf \ + /etc/random.seed=random.seed + +# Initialize disk image. +rm -f worker_disk.raw +qemu-img create -f raw worker_disk.raw 1G + +# Run the installer to create the disk image. +expect 2>&1 <" +send "\n" + +# Need to wait for the kernel to boot. +expect timeout { exit 1 } "\(I\)nstall, \(U\)pgrade, \(A\)utoinstall or \(S\)hell\?" +send "s\n" + +expect timeout { exit 1 } "# " +send "mount /dev/cd0c /mnt\n" +send "cp /mnt/auto_install.conf /mnt/disklabel.template /\n" +send "chmod a+r /disklabel.template\n" +send "umount /mnt\n" +send "exit\n" + +expect timeout { exit 1 } "CONGRATULATIONS!" + +proc login {} { + send "root\n" + + expect "Password:" + send "root\n" + + expect "# " + send "cat /etc/ssh/ssh_host_*_key.pub\nhalt -p\n" + + expect eof +} + +# There is some form of race condition with OpenBSD 6.2 MP +# and qemu, which can result in init(1) failing to run /bin/sh +# the first time around... +expect { + timeout { exit 1 } + "Enter pathname of shell or RETURN for sh:" { + send "\nexit\n" + expect "login:" { + login + } + } + "login:" { + login + } +} +EOF + +# Create Compute Engine disk image. +echo "Archiving worker_disk.raw... (this may take a while)" +i="openbsd-${ARCH}-${RELNO}-vmm.tar.gz" +tar -zcf "$i" worker_disk.raw + +cat <