[fastboot] Remove fastboot support.
vim2s which previously needed this are transitioning to a non-Fastboot
flow, we will at a later date add Fastboot support to a future iteration
of health checker to provide more complex device support.
Change-Id: I7f0dd95e1ae8f4f0c9f8571697a57b2c0d4bba3a
diff --git a/botanist/target/device.go b/botanist/target/device.go
index 57e519b..5840da2 100644
--- a/botanist/target/device.go
+++ b/botanist/target/device.go
@@ -117,22 +117,6 @@
// Start starts the device target.
func (t *DeviceTarget) Start(ctx context.Context, images build.Images, args []string) error {
- if t.opts.Fastboot != "" {
- zirconR := images.Get("zircon-r")
- if zirconR == nil {
- return fmt.Errorf("zircon-r not provided")
- }
- // If it can't find any fastboot device, the fastboot tool will hang
- // waiting, so we add a timeout. All fastboot operations take less
- // than a second on a developer workstation, so two minutes to flash
- // and continue is very generous.
- ctx, cancel := context.WithTimeout(ctx, 2*time.Minute)
- defer cancel()
- if err := botanist.FastbootToZedboot(ctx, t.opts.Fastboot, zirconR.Path); err != nil {
- return fmt.Errorf("failed to fastboot to zedboot: %v", err)
- }
- }
-
// Set up log listener and dump kernel output to stdout.
l, err := netboot.NewLogListener(t.Nodename())
if err != nil {
diff --git a/botanist/target/options.go b/botanist/target/options.go
index 9546bb7..8440c0d 100644
--- a/botanist/target/options.go
+++ b/botanist/target/options.go
@@ -15,9 +15,4 @@
// SSHKey is a private SSH key file, corresponding to an authorized key to be paved or
// to one baked into a boot image.
SSHKey string
-
- // Fastboot is a path to the fastboot binary. If provided, it will be assumed that
- // the device is waiting in fastboot mode, and it will be attempted to 'continue'
- // it into zedboot. Ignored for QEMUTarget.
- Fastboot string
}
diff --git a/botanist/zedboot.go b/botanist/zedboot.go
deleted file mode 100644
index 054f591..0000000
--- a/botanist/zedboot.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-package botanist
-
-import (
- "context"
- "fmt"
-
- "fuchsia.googlesource.com/tools/fastboot"
-)
-
-// FastbootToZedboot uses fastboot to boot into Zedboot.
-func FastbootToZedboot(ctx context.Context, fastbootTool, zirconRPath string) error {
- f := fastboot.Fastboot{ToolPath: fastbootTool}
- if _, err := f.Continue(ctx); err != nil {
- return fmt.Errorf("failed to boot the device with \"fastboot continue\": %v", err)
- }
- return nil
-}
diff --git a/cmd/botanist/run.go b/cmd/botanist/run.go
index fdd9421..82e6407 100644
--- a/cmd/botanist/run.go
+++ b/cmd/botanist/run.go
@@ -69,10 +69,6 @@
// Netboot tells botanist to netboot (and not to pave).
netboot bool
- // Fastboot is a path to the fastboot tool. If set, botanist will flash
- // the device into zedboot.
- fastboot string
-
// ZirconArgs are kernel command-line arguments to pass on boot.
zirconArgs command.StringsFlag
@@ -115,7 +111,6 @@
f.StringVar(&r.configFile, "config", "/etc/botanist/device.json", "path to file of device config")
f.Var(&r.imageManifests, "images", "paths to image manifests")
f.BoolVar(&r.netboot, "netboot", false, "if set, botanist will not pave; but will netboot instead")
- f.StringVar(&r.fastboot, "fastboot", "", "path to the fastboot tool; if set, the device will be flashed into Zedboot. A zircon-r must be supplied via -images")
f.Var(&r.zirconArgs, "zircon-args", "kernel command-line arguments")
f.DurationVar(&r.timeout, "timeout", 10*time.Minute, "duration allowed for the command to finish execution.")
f.StringVar(&r.cmdStdout, "stdout", "", "file to redirect the command's stdout into; if unspecified, it will be redirected to the process' stdout")
@@ -207,7 +202,6 @@
opts := target.Options{
Netboot: r.netboot,
- Fastboot: r.fastboot,
SSHKey: r.sshKey,
}
diff --git a/cmd/botanist/zedboot.go b/cmd/botanist/zedboot.go
index bf98c83..5caaea1 100644
--- a/cmd/botanist/zedboot.go
+++ b/cmd/botanist/zedboot.go
@@ -59,10 +59,6 @@
// CmdlineFile is the path to a file of additional kernel command-line arguments.
cmdlineFile string
- // Fastboot is a path to the fastboot tool. If set, botanist will flash
- // the device into zedboot.
- fastboot string
-
// Host command to run after paving device
// TODO(IN-831): Remove when host-target-interaction infra is ready
hostCmd string
@@ -89,7 +85,6 @@
f.DurationVar(&cmd.filePollInterval, "poll-interval", 1*time.Minute, "time between checking for summary.json on the target")
f.StringVar(&cmd.configFile, "config", "/etc/botanist/config.json", "path to file of device config")
f.StringVar(&cmd.cmdlineFile, "cmdline-file", "", "path to a file containing additional kernel command-line arguments")
- f.StringVar(&cmd.fastboot, "fastboot", "", "path to the fastboot tool; if set, the device will be flashed into Zedboot. A zircon-r must be supplied via -images")
f.StringVar(&cmd.hostCmd, "hacky-host-cmd", "", "host command to run after paving. To be removed on completion of IN-831")
}
@@ -201,7 +196,6 @@
}
opts := target.Options{
Netboot: cmd.netboot,
- Fastboot: cmd.fastboot,
}
var devices []*target.DeviceTarget
diff --git a/fastboot/fastboot.go b/fastboot/fastboot.go
deleted file mode 100644
index 592247c..0000000
--- a/fastboot/fastboot.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package fastboot
-
-import (
- "context"
- "fmt"
- "log"
- "os/exec"
-)
-
-// Fastboot provides a subset of the functionality of the fastboot CLI tool.
-type Fastboot struct {
- // ToolPath is the path to the fastboot command line tool.
- ToolPath string
-}
-
-func (f *Fastboot) exec(ctx context.Context, args ...string) ([]byte, error) {
- cmd := exec.CommandContext(ctx, f.ToolPath, args...)
- log.Printf("running:\n\tArgs: %s\n\tEnv: %s", cmd.Args, cmd.Env)
- out, err := cmd.Output()
- if ctx.Err() != nil {
- return nil, fmt.Errorf("context error: %v", ctx.Err())
- }
- if err != nil {
- // Put the standard error text into the returned error object
- if exitError, ok := err.(*exec.ExitError); ok && exitError.Stderr != nil {
- return out, fmt.Errorf(string(exitError.Stderr))
- }
- }
- return out, err
-}
-
-// Continue is equivalent to the command "fastboot continue".
-func (f *Fastboot) Continue(ctx context.Context) ([]byte, error) {
- return f.exec(ctx, "continue")
-}
diff --git a/fastboot/fastboot_test.go b/fastboot/fastboot_test.go
deleted file mode 100644
index 1b1d9cd..0000000
--- a/fastboot/fastboot_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2018 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-package fastboot
-
-import (
- "context"
- "strings"
- "testing"
- "time"
-)
-
-func TestErrorContainsStderr(t *testing.T) {
- // Use any binary that will fail and print to stderr when given unexpected arguments.
- // Using something that should be in PATH on any POSIX system:
- // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html
- shD := Fastboot{"date"}
- _, err := shD.Continue(context.Background())
- if err == nil {
- t.Error("Expected an error")
- }
- if !strings.Contains(err.Error(), "date:") {
- t.Errorf("Expected the standard error text in the error, got: %v", err)
- }
-}
-
-func TestRespectsContext(t *testing.T) {
- // Use cat because it doesn't terminate on its own.
- // Using something that should be in PATH on any POSIX system:
- // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html
- shD := Fastboot{"cat"}
- ctx, cancel := context.WithTimeout(context.Background(), time.Microsecond)
- defer cancel()
- _, err := shD.Continue(ctx)
- if err == nil {
- t.Error("Expected a timeout error, got no error")
- }
- if !strings.Contains(err.Error(), "deadline") {
- t.Errorf("Expected a timeout error, got: %v", err)
- }
-}