github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/cmds/core/rsdp/rsdp.go (about) 1 // Copyright 2012-2018 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build !plan9 6 // +build !plan9 7 8 // rsdp allows to determine the ACPI RSDP structure address which could 9 // be passed to the boot command later on 10 // It must be executed at the system init as it relies on scanning 11 // the kernel messages which could be quickly filled up in some cases 12 // 13 // Synopsis: 14 // 15 // rsdp [-f file] 16 // 17 // Description: 18 // 19 // Look for rsdp value in a file, default /dev/kmsg 20 // 21 // Example: 22 // 23 // rsdp 24 // rsdp -f /path/to/file 25 package main 26 27 import ( 28 "fmt" 29 "log" 30 31 flag "github.com/spf13/pflag" 32 "github.com/mvdan/u-root-coreutils/pkg/acpi" 33 ) 34 35 var cmdUsage = "Usage: rsdp" 36 37 func usage() { 38 log.Fatalf(cmdUsage) 39 } 40 41 func main() { 42 flag.Parse() 43 if flag.NArg() != 0 { 44 usage() 45 } 46 rsdp, err := acpi.GetRSDP() 47 if err != nil { 48 log.Fatal(err) 49 } 50 fmt.Printf(" acpi_rsdp=%#x \n", rsdp.RSDPAddr()) 51 }