github.com/google/trillian-examples@v0.0.0-20240520080811-0d40d35cef0e/binary_transparency/firmware/cmd/emulator/dummy/dummy_emu.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 // dummy_emu is an "emulator" for the dummy device. 16 // 17 // This emulator shows how the firmware transparency artifacts stored 18 // when firmware is updates are validated on boot to protect the device against 19 // tampering. 20 // 21 // The device's initialisation routines in "ROM" are where this validation 22 // takes place, and the device only "jumps into" the firmware payload once 23 // successful validation has taken place. 24 // 25 // Usage: 26 // 27 // go run ./cmd/emulator/dummy --logtostderr --dummy_storage_dir=/tmp/dummy_device 28 package main 29 30 import ( 31 "flag" 32 33 "github.com/golang/glog" 34 "github.com/google/trillian-examples/binary_transparency/firmware/cmd/emulator/dummy/impl" 35 ) 36 37 var ( 38 dummyDirectory = flag.String("dummy_storage_dir", "/tmp/dummy_device", "Directory path of the dummy device's state storage") 39 ) 40 41 func main() { 42 flag.Parse() 43 44 if err := impl.Main(impl.EmulatorOpts{ 45 DeviceStorage: *dummyDirectory, 46 }); err != nil { 47 glog.Exit(err.Error()) 48 } 49 }