blob: 0b75240d77371afa263c2282c0287df2b83a1651 [file] [log] [blame]
// 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 flash and boot into Zedboot.
func FastbootToZedboot(ctx context.Context, fastbootTool, zirconRPath string) error {
f := fastboot.Fastboot{fastbootTool}
if _, err := f.Flash(ctx, "boot", zirconRPath); err != nil {
return fmt.Errorf("failed to flash the fastboot device: %v", err)
}
if _, err := f.Continue(ctx); err != nil {
return fmt.Errorf("failed to boot the device with \"fastboot continue\": %v", err)
}
return nil
}