github.com/google/trillian-examples@v0.0.0-20240520080811-0d40d35cef0e/binary_transparency/firmware/cmd/emulator/dummy/impl/inner_main.go (about) 1 // Copyright 2020 Google LLC. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // Package impl is the implementation of the emulator for the dummy device. 16 package impl 17 18 import ( 19 "fmt" 20 21 "github.com/google/trillian-examples/binary_transparency/firmware/devices/dummy/rom" 22 ) 23 24 // EmulatorOpts encapsulates the parameters for running the emulator. 25 type EmulatorOpts struct { 26 DeviceStorage string 27 } 28 29 // Main is the entry point for the dummy emulator 30 func Main(opts EmulatorOpts) error { 31 boot, err := rom.Reset(opts.DeviceStorage) 32 if err != nil { 33 return fmt.Errorf("ROM: %w", err) 34 } 35 36 if err := boot(); err != nil { 37 return fmt.Errorf("boot(): %w", err) 38 } 39 40 return nil 41 }