blob: ff5a19c3929a1e6ed2ce4a6ba98bb5e151ff7e9c [file] [edit]
package actions
import (
goflag "flag"
"github.com/golang/glog"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
)
var arch, build, board, configFile string
var useRegional bool
var rootCmd = &cobra.Command{
Use: "cos-kernel [action]",
Short: "cos-kernel - Tool for interacting with the COS kernel",
Long: `The cos-kernel tool performs common COS kernel development operations.
It supports workflows such as:
* Building a COS kernel from a local source tree.
* Building a COS kernel variant (e.g., lakitu-arm64, kselftest).
* Running arbitrary make commands using the COS toolchain.
* Downloading the COS C toolchain and kernel headers.
* Preparing patches for a new kernel feature.`,
SilenceUsage: true,
}
func addCommonFlags(flags *flag.FlagSet) {
flags.StringVarP(&arch, "arch", "a", "",
"the compiler architecture (e.g., x86_64, aarch64; defaults to the arch of the running kernel)")
flags.StringVar(&build, "build", "",
"the kernel build; this can be either a build number (e.g., 12345.01.02) or a branch (e.g., release-R117)")
flags.StringVar(&board, "board", "",
"the kernel board")
flags.BoolVar(&useRegional, "use-regional-bucket", true,
"use regional GCS buckets (e.g. cos-tools-us-central1) for downloading artifacts")
}
func init() {
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
glog.Exitf("%v", err)
}
}