       build_release()
     end
 
-    build_firmware(system_path)
+    config = Mix.Project.config()
+    fw_out = opts[:out] || Nerves.Env.firmware_path(config)
+    build_firmware(config, system_path, fw_out)
   end
 
   @doc false

    Mix.Task.run("distillery.release", [verbosity, "--no-tar"])
  end

  defp build_firmware(system_path) do
    config = Mix.Project.config()
    otp_app = config[:app]

    compiler_check()
    firmware_config = Application.get_env(:nerves, :firmware)


  ## Command line options

    * `--verbose` - produce detailed output about release assembly
    * `--output` - (Optional) The path to the .fw file used to write the patch
      firmware. Defaults to `Nerves.Env.firmware_path/1`
  ## Environment variables

    * `NERVES_SYSTEM`    - may be set to a local directory to specify the Nerves
