@@ -64,15 +64,16 @@ var images = map[string]Image{
6464// It will return an error if there is a problem uncompressing
6565// the kernel and initramfs.
6666func New (kernel , arch string ) (* Image , error ) {
67- common := []string { /*"-serial", "/dev/tty",*/ "-nographic" ,
67+ common := []string {
68+ "-nographic" ,
6869 "-netdev" , "user,id=net0,ipv4=on,hostfwd=tcp::17010-:17010" ,
6970 // required for mac. No idea why. Should work on linux. If not, we'll need a bit
7071 // more logic.
7172 "-device" , "e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27" ,
7273 // No password needed, you're just a guest vm ...
7374 // The kernel may not understand ip=dhcp, in which case it just ends up
7475 // in init's environment.
75- //"--append", "ip=dhcp init=/init -pk \"\" -d",
76+ // To add cpud debugging, you can add -d to the append string.
7677 "--append" , "ip=dhcp init=/init -pk \" \" " ,
7778 }
7879 env := []string {}
@@ -154,9 +155,10 @@ func (image *Image) CommandContext(ctx context.Context, d string, extra ...strin
154155 return c , nil
155156}
156157
157- // StartVm is used to starta VM (or in fact any exec.Cmd).
158- // It includes a one second delay, experimentally needed to wait for the
159- // guest network to be ready.
158+ // StartVM is used to start a VM (or in fact any exec.Cmd).
159+ // Once cmd.Start is called, StartVM delays for one second.
160+ // This time has been experimentally determined as the minimum
161+ // required for the guest network to be ready.
160162func (* Image ) StartVM (c * exec.Cmd ) error {
161163 if err := c .Start (); err != nil {
162164 return fmt .Errorf ("starting VM: %w" , err )
@@ -165,7 +167,7 @@ func (*Image) StartVM(c *exec.Cmd) error {
165167 return nil
166168}
167169
168- // CPUCommand runs a command in a guest runnign cpud.
170+ // CPUCommand runs a command in a guest running cpud.
169171// It is similar to exec.Command, in that it accepts an arg and
170172// a set of optional args. It differs in that it can return an error.
171173// If there are no errors, it returns a client.Cmd.
0 commit comments