Commit a8c9933d authored by James Robinson's avatar James Robinson Committed by Commit Bot

[build/fuchsia] Add a flag to control autorun in filesystem

Sometimes it's useful to boot with a binary in the boot filesystem that
isn't run from the autorun script but is instead run from a shell (or
ssh or other mechanism). This adds a flag to the runners to control it.
It's defaulted to generating the autorun, and always set for the test
runners since it's pretty much always what you want there.

Bug: 707031
Change-Id: I14af4011d6536482f15cb92fc73d21c4fc84642b
Reviewed-on: https://chromium-review.googlesource.com/734722
Commit-Queue: James Robinson <jamesr@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511267}
parent 5446eb5f
...@@ -39,6 +39,8 @@ def main(): ...@@ -39,6 +39,8 @@ def main():
parser.add_argument('--kernel', type=os.path.realpath, parser.add_argument('--kernel', type=os.path.realpath,
help='Path to a kernel to use instead of the default ' help='Path to a kernel to use instead of the default '
'one from the SDK') 'one from the SDK')
parser.add_argument('--no-autorun', action='store_true',
help='Disable generating an autorun file')
args, child_args = parser.parse_known_args() args, child_args = parser.parse_known_args()
bootfs = BuildBootfs( bootfs = BuildBootfs(
...@@ -46,7 +48,7 @@ def main(): ...@@ -46,7 +48,7 @@ def main():
ReadRuntimeDeps(args.runtime_deps_path, args.output_directory), ReadRuntimeDeps(args.runtime_deps_path, args.output_directory),
args.exe_name, child_args, args.dry_run, args.bootdata, args.exe_name, child_args, args.dry_run, args.bootdata,
summary_output=None, shutdown_machine=False, target_cpu=args.target_cpu, summary_output=None, shutdown_machine=False, target_cpu=args.target_cpu,
use_device=args.device) use_device=args.device, use_autorun=not args.no_autorun)
if not bootfs: if not bootfs:
return 2 return 2
......
...@@ -198,13 +198,8 @@ class BootfsData(object): ...@@ -198,13 +198,8 @@ class BootfsData(object):
self.target_cpu = target_cpu self.target_cpu = target_cpu
def BuildBootfs(output_directory, runtime_deps, bin_name, child_args, dry_run, def WriteAutorun(bin_name, child_args, summary_output, shutdown_machine,
bootdata, summary_output, shutdown_machine, target_cpu, dry_run, use_device, file_mapping):
use_device):
# |runtime_deps| already contains (target, source) pairs for the runtime deps,
# so we can initialize |file_mapping| from it directly.
file_mapping = dict(runtime_deps)
# Generate a script that runs the binaries and shuts down QEMU (if used). # Generate a script that runs the binaries and shuts down QEMU (if used).
autorun_file = open(bin_name + '.bootfs_autorun', 'w') autorun_file = open(bin_name + '.bootfs_autorun', 'w')
autorun_file.write('#!/boot/bin/sh\n') autorun_file.write('#!/boot/bin/sh\n')
...@@ -255,6 +250,17 @@ def BuildBootfs(output_directory, runtime_deps, bin_name, child_args, dry_run, ...@@ -255,6 +250,17 @@ def BuildBootfs(output_directory, runtime_deps, bin_name, child_args, dry_run,
file_mapping['autorun'] = autorun_file.name file_mapping['autorun'] = autorun_file.name
file_mapping[os.path.basename(bin_name)] = bin_name file_mapping[os.path.basename(bin_name)] = bin_name
def BuildBootfs(output_directory, runtime_deps, bin_name, child_args, dry_run,
bootdata, summary_output, shutdown_machine, target_cpu,
use_device, use_autorun):
# |runtime_deps| already contains (target, source) pairs for the runtime deps,
# so we can initialize |file_mapping| from it directly.
file_mapping = dict(runtime_deps)
if use_autorun:
WriteAutorun(bin_name, child_args, summary_output, shutdown_machine,
dry_run, use_device, file_mapping)
# Find the full list of files to add to the bootfs. # Find the full list of files to add to the bootfs.
file_mapping = _ExpandDirectories( file_mapping = _ExpandDirectories(
file_mapping, file_mapping,
......
...@@ -200,7 +200,7 @@ def main(): ...@@ -200,7 +200,7 @@ def main():
args.dry_run, bootdata=args.bootdata, args.dry_run, bootdata=args.bootdata,
summary_output=args.test_launcher_summary_output, summary_output=args.test_launcher_summary_output,
shutdown_machine=True, target_cpu=args.target_cpu, shutdown_machine=True, target_cpu=args.target_cpu,
use_device=args.device) use_device=args.device, use_autorun=True)
if not bootfs: if not bootfs:
return 2 return 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment