github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/cmds/exp/zimage/zimage.go (about) 1 // Copyright 2019 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 // zimage dumps the header of a zImage. 6 // 7 // Synopsis: 8 // 9 // zimage FILE 10 // 11 // Description: 12 // 13 // This is mainly for debugging purposes. 14 package main 15 16 import ( 17 "fmt" 18 "log" 19 "os" 20 21 "github.com/mvdan/u-root-coreutils/pkg/boot/zimage" 22 ) 23 24 func main() { 25 if len(os.Args) != 2 { 26 log.Fatalf("usage: %s FILE", os.Args[0]) 27 } 28 29 f, err := os.Open(os.Args[1]) 30 if err != nil { 31 log.Fatal(err) 32 } 33 34 header, err := zimage.Parse(f) 35 if err != nil { 36 log.Fatal(err) 37 } 38 fmt.Printf("%#v\n", header) 39 }