initrd/uname.go

21 lines
347 B
Go
Raw Normal View History

2023-12-04 12:59:37 +00:00
package main
import "syscall"
func unameRelease() string {
uname := &syscall.Utsname{}
if err := syscall.Uname(uname); err != nil {
fatalf("failed to get kernel version: %v", err)
}
ba := make([]byte, 0, len(uname.Release))
for _, c := range uname.Release {
if c == 0 {
break
}
ba = append(ba, byte(c))
}
return string(ba)
}