Hasty Briefsbeta

Bilingual

Proposal: Add bare metal support to Go

a year ago
  • #BareMetal
  • #Runtime
  • #Go
  • Proposal for a new GOOS target named GOOS=none to enable Go runtime execution without OS support.
  • GOOS=none allows Go applications to run on bare metal, with all necessary support provided by the Go runtime and external driver packages.
  • Key functions required for GOOS=none include cpuinit, runtime.hwinit, runtime.printk, runtime.initRNG, runtime.getRandomData, runtime.nanotime1, and RAM layout variables.
  • Optional functions include runtime.Bloc, runtime.Exit, runtime.Idle, and network I/O setup via SocketFunc.
  • The Go runtime would implement functions like runtime.GetG, runtime.WakeG, and runtime.Wake for interrupt handling.
  • Compilation remains similar to standard Go binaries, with loading strategies varying by hardware.
  • The proposal is based on the TamaGo project, which supports bare metal execution on AMD64, ARM, and RISCV64.
  • TamaGo now supports unmodified Go applications, AMD64 KVM execution, and UEFI applications.
  • The changes are hardware-independent and unified across architectures, making maintenance reasonable.
  • Adoption of GOOS=none could expand Go's use in new environments like secure OS, bootloaders, and microVMs.