func mountAndSwitchRoot() {
	createBasicHirarchy()
	if *mtd {
		mountMtd()
	}
	if *blk {
		mountBlk()
	}
	mountOverlay()
	err := uroot.SwitchRoot("/mnt", "/bin/init")
	if err != nil {
		log.Fatalf("SwitchRoot: %v", err)
	}
}
mountAndSwitchRoot mounts the rootfs and overlay then runs switch_root
package main
import (
	"bytes"
	"context"
	"crypto"
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"path/filepath"
	"time"
	"github.com/machinebox/progress"
	"github.com/u-root/u-root/pkg/boot"
	"github.com/u-root/u-root/pkg/boot/kexec"
	"github.com/u-root/u-root/pkg/kmodule"
	uroot "github.com/u-root/u-root/pkg/mount"
	"github.com/u-root/u-root/pkg/uio"
	"golang.org/x/crypto/openpgp/errors"
	"golang.org/x/crypto/openpgp/packet"
	"golang.org/x/sys/unix"
)
const (
	pubKeyPath = "/u-bmc.pub"
	kernelPath = "/ro/boot/zImage"
	dtbPath    = "/ro/boot/platform.dtb"
	initPath   = "/ro/bin/init"
)
var (
	kload  = flag.Bool("kexec", false, "Mount rootfs and call kexec")
	swroot = flag.Bool("switch", false, "Mount rootfs and call switch_root")
	mtd    = flag.Bool("mtd", false, "Mount and load u-bmc from MTD flash")
	blk    = flag.Bool("blk", false, "Mount and load u-bmc from block device")
	ast    = flag.Bool("ast", false, "ASPEED ast specific option")
	verify = []string{initPath, kernelPath, dtbPath}
)
func main() {
	flag.Parse()
	if *mtd && *blk {
		log.Fatal("mtd and blk are mutually exclusive!")
	}
	if !*mtd && !*blk {
		log.Fatal("please choose either mtd or blk!")
	}
	if *kload && *swroot {
		log.Fatal("kexec and switch are mutually exclusive!")
	}
	if !*kload && !*swroot {
		log.Fatal("please choose either kexec or switch!")
	}
	if *ast {
		err := loadModule("/bootlock.ko")
		if err != nil {
			log.Fatalf("loadModule(/bootlock.ko): %v", err)
		}
	}
	if *kload {
		loadAndExec()
	}
	if *swroot {
		mountAndSwitchRoot()
	}
}