Firmwared is a daemon whose job is to manage a pool of machine firmwares, to run one or even several instances of these firmwares and to make sure there is no harmful interaction between them and with the host system.
Three man pages are available : firmwared, fdc and firmwared.conf. To display them:
$ man /opt/parrot-sphinx/usr/share/man/man1/fdc.1 $ man /opt/parrot-sphinx/usr/share/man/man1/firmwared.1 $ man /opt/parrot-sphinx/usr/share/man/man5/firmwared.conf.5
As already discussed in First step, firmwared can be started either via systemd, or by calling it directly.
If you know what you are doing, you can customize the default settings.
To achieve that, create a file
firmwared.conf in the folder of your
choice and put the following in it:
-- lua language syntax -- these are just temporary variables, not used as configs in firmwared base_dir = "/path/to/sphinx/" firmwared_dir = base_dir .. "packages/firmwared/" hooks_dir = firmwared_dir .. "hooks/" final_dir = base_dir .. "out/sphinx-base/final/" share_dir = final_dir .. "usr/share/firmwared/" -- here the real configuration keys do start -- the commented out are the ones wich wouldn't change the default value -- see man firmwared(1)#ENVIRONMENT VARIABLES fo the meaning of each key FIRMWARED_APPARMOR_PROFILE = share_dir .. "firmwared.apparmor.profile" FIRMWARED_POST_PREPARE_INSTANCE_HOOK = hooks_dir .. "post_prepare_instance.hook" -- FIRMWARED_CONTAINER_INTERFACE = "eth0" FIRMWARED_CURL_HOOK = hooks_dir .. "curl.hook" -- FIRMWARED_DISABLE_APPARMOR = "n" -- FIRMWARED_DUMP_PROFILE = "n" -- FIRMWARED_HOST_INTERFACE_PREFIX = "fd_veth" FIRMWARED_MOUNT_HOOK = hooks_dir .. "mount.hook" FIRMWARED_MOUNT_PATH = base_dir .. "mount/" -- FIRMWARED_NET_FIRST_TWO_BYTES = "10.202." FIRMWARED_NET_HOOK = hooks_dir .. "net.hook" -- FIRMWARED_PREVENT_REMOVAL = "n" FIRMWARED_RESOURCES_DIR = share_dir FIRMWARED_REPOSITORY_PATH = base_dir .. "firmwares/" FIRMWARED_X11_PATH = "/tmp/.X11-unix/" -- FIRMWARED_HOSTLIBS_PATHS = "/usr:/usr/lib" -- FIRMWARED_SOCKET_PATH = "/var/run/firmwared.sock" -- FIRMWARED_VERBOSE_HOOK_SCRIPTS = "n" FIRMWARED_MAX_CACHED_FIRMWARES = "10"
Now you can customize the way firmwared is running by modifying the configuration file. To have firmwared take this file into account, stop firmwared if already running and type:
$ sudo firmwared ./firmwared.conf
Note: all logs produced by firmwared are directed into syslog.
fdc (FirmwareD Client)¶
fdc is a command line tool that lets you control and monitor firmwared.
Below are some typical examples of what fdc can do. To have more info, refer
to the man page.
- list up the firmwares present in the cache
$ fdc list firmwares
- list up the existing firmware instances (should be none if no simulation is running):
$ fdc list instances
- retrieve information about an existing instance:
$ fdc show instances tremulous_patty name: tremulous_patty sha1: 13238174bdcb5db0327832bc39c5bd240b4637d7 id: 1 pid: 1 state: ready firmware_path: /opt2/work/sphinx/firmwares//ardrone3-milos_pc.ext2.firmware base_workspace: /opt2/work/sphinx/mount//7d99bf3e58c94f938113cdcf24a0b0d00e240840 inner_pts: /dev/pts/10 outer_pts: /dev/pts/7 firmware_sha1: 2722eb42c643febd76fa9d99433b7e56a8778737 time: Fri Jun 12 14:39:06 2015 interface: eth0 cmdline: /sbin/boxinit ro.hardware=mk3_sim_pc ro.debuggable=1 ro.boot.console=/pts/10
- kill (if needed) and remove a specific instance:
$ fdc drop instances tremulous_patty
- kill (if needed) and remove ALL instances. This command is convenient when spurious instances are still running in background for any reasons.
$ fdc drop_all instances