]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/vm/netbsd
5 # Copyright 2017-2019 Red Hat Inc.
8 # Fam Zheng <famz@redhat.com>
9 # Gerd Hoffmann <kraxel@redhat.com>
11 # This code is licensed under the GPL version 2 or later. See
12 # the COPYING file in the top-level directory.
21 class NetBSDVM(basevm
.BaseVM
):
25 link
= "https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/images/NetBSD-9.0-amd64.iso"
26 csum
= "34da4882ee61bdbf69f241195a8933dc800949d30b43fc6988da853d57fc2b8cac50cf97a0d2adaf93250b4e329d189c1a8b83c33bd515226f37745d50c33369"
59 rm -rf /home/qemu/qemu-test.*
60 cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
61 mkdir src build; cd src;
64 ../src/configure --python=python3.7 --disable-opengl {configure_opts};
65 gmake --output-sync -j{jobs} {target} {verbose};
67 poweroff
= "/sbin/poweroff"
69 # Workaround for NetBSD + IPv6 + slirp issues.
70 # NetBSD seems to ignore the ICMPv6 Destination Unreachable
71 # messages generated by slirp. When the host has no IPv6
72 # connectivity, this causes every connection to ftp.NetBSD.org
73 # take more than a minute to be established.
76 def build_image(self
, img
):
77 cimg
= self
._download
_with
_cache
(self
.link
, sha512sum
=self
.csum
)
78 img_tmp
= img
+ ".tmp"
79 iso
= img
+ ".install.iso"
81 self
.print_step("Preparing iso and disk image")
82 subprocess
.check_call(["ln", "-f", cimg
, iso
])
83 self
.exec_qemu_img("create", "-f", "qcow2", img_tmp
, self
.size
)
85 self
.print_step("Booting installer")
86 self
.boot(img_tmp
, extra_args
= [
87 "-bios", "pc-bios/bios-256k.bin",
88 "-machine", "graphics=off",
92 self
.console_wait_send("3. Drop to boot prompt", "3")
93 self
.console_wait_send("> ", "consdev com0\n")
94 self
.console_wait_send("> ", "boot\n")
96 self
.console_wait_send("Terminal type", "xterm\n")
97 self
.console_wait_send("a: Installation messages", "a\n")
98 self
.console_wait_send("a: Install NetBSD", "a\n")
99 self
.console_wait("Shall we continue?")
100 self
.console_wait_send("b: Yes", "b\n")
102 self
.console_wait_send("a: ld0", "a\n")
103 self
.console_wait_send("a: Guid Partition Table", "a\n")
104 self
.console_wait_send("a: This is the correct", "a\n")
105 self
.console_wait_send("b: Use default part", "b\n")
106 self
.console_wait_send("x: Partition sizes ok", "x\n")
107 self
.console_wait("Shall we continue?")
108 self
.console_wait_send("b: Yes", "b\n")
110 self
.console_wait_send("b: Use serial port com0", "b\n")
111 self
.console_wait_send("f: Set serial baud rate", "f\n")
112 self
.console_wait_send("a: 9600", "a\n")
113 self
.console_wait_send("x: Continue", "x\n")
115 self
.console_wait_send("a: Full installation", "a\n")
116 self
.console_wait_send("a: CD-ROM", "a\n")
118 self
.print_step("Installation started now, this will take a while")
119 self
.console_wait_send("Hit enter to continue", "\n")
121 self
.console_wait_send("d: Change root password", "d\n")
122 self
.console_wait_send("a: Yes", "a\n")
123 self
.console_wait("New password:")
124 self
.console_send("%s\n" % self
.ROOT_PASS
)
125 self
.console_wait("New password:")
126 self
.console_send("%s\n" % self
.ROOT_PASS
)
127 self
.console_wait("Retype new password:")
128 self
.console_send("%s\n" % self
.ROOT_PASS
)
130 self
.console_wait_send("o: Add a user", "o\n")
131 self
.console_wait("username")
132 self
.console_send("%s\n" % self
.GUEST_USER
)
133 self
.console_wait("to group wheel")
134 self
.console_wait_send("a: Yes", "a\n")
135 self
.console_wait_send("a: /bin/sh", "a\n")
136 self
.console_wait("New password:")
137 self
.console_send("%s\n" % self
.GUEST_PASS
)
138 self
.console_wait("New password:")
139 self
.console_send("%s\n" % self
.GUEST_PASS
)
140 self
.console_wait("Retype new password:")
141 self
.console_send("%s\n" % self
.GUEST_PASS
)
143 self
.console_wait_send("a: Configure network", "a\n")
144 self
.console_wait_send("a: vioif0", "a\n")
145 self
.console_wait_send("Network media type", "\n")
146 self
.console_wait("autoconfiguration")
147 self
.console_wait_send("a: Yes", "a\n")
148 self
.console_wait_send("DNS domain", "localnet\n")
149 self
.console_wait("Are they OK?")
150 self
.console_wait_send("a: Yes", "a\n")
151 self
.console_wait("installed in /etc")
152 self
.console_wait_send("a: Yes", "a\n")
154 self
.console_wait_send("e: Enable install", "e\n")
155 proxy
= os
.environ
.get("http_proxy")
156 if not proxy
is None:
157 self
.console_wait_send("f: Proxy", "f\n")
158 self
.console_wait("Proxy")
159 self
.console_send("%s\n" % proxy
)
160 self
.console_wait_send("x: Install pkgin", "x\n")
161 self
.console_init(1200)
162 self
.console_wait_send("Hit enter to continue", "\n")
165 self
.console_wait_send("g: Enable sshd", "g\n")
166 self
.console_wait_send("x: Finished conf", "x\n")
167 self
.console_wait_send("Hit enter to continue", "\n")
169 self
.print_step("Installation finished, rebooting")
170 self
.console_wait_send("d: Reboot the computer", "d\n")
173 prompt
= "localhost$"
174 self
.console_ssh_init(prompt
, self
.GUEST_USER
, self
.GUEST_PASS
)
175 self
.console_wait_send(prompt
, "exit\n")
178 prompt
= "localhost#"
179 self
.console_ssh_init(prompt
, "root", self
.ROOT_PASS
)
180 self
.console_sshd_config(prompt
)
182 # setup virtio-blk #1 (tarfile)
183 self
.console_wait(prompt
)
184 self
.console_send("echo 'chmod 666 /dev/rld1a' >> /etc/rc.local\n")
186 # turn off mprotect (conflicts with tcg)
187 self
.console_wait(prompt
)
188 self
.console_send("echo security.pax.mprotect.enabled=0 >> /etc/sysctl.conf\n")
190 self
.print_step("Configuration finished, rebooting")
191 self
.console_wait_send(prompt
, "reboot\n")
192 self
.console_wait("login:")
195 self
.print_step("Installing packages")
196 self
.ssh_root_check("pkgin update\n")
197 self
.ssh_root_check("pkgin -y install %s\n" % " ".join(self
.pkgs
))
200 self
.ssh_root(self
.poweroff
)
201 self
.console_wait("entering state S5")
204 os
.rename(img_tmp
, img
)
206 self
.print_step("All done")
208 if __name__
== "__main__":
209 sys
.exit(basevm
.main(NetBSDVM
))