diff options
author | Tom Zanussi <tom.zanussi@intel.com> | 2013-01-18 12:27:07 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-01-20 13:05:38 +0000 |
commit | 792b1bf0147a72613e76ce8f88764e99c51b80eb (patch) | |
tree | fa1cd3eee7f0a378cda517899844e48487656f47 | |
parent | 3b75d85ac2b356f21fbe4032ba9b492211e22541 (diff) | |
download | ast2050-yocto-poky-792b1bf0147a72613e76ce8f88764e99c51b80eb.zip ast2050-yocto-poky-792b1bf0147a72613e76ce8f88764e99c51b80eb.tar.gz |
scripts/lib/bsp/engine.py: add yocto_layer_create()
Add a new yocto_layer_create() function that will be used to generate
a generic yocto layer (for the new 'yocto-layer' command).
(From meta-yocto rev: 44acd01bf47c2e0a777e686c9339a6ff951fc972)
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/bsp/engine.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py index 8985544..d406e79 100644 --- a/scripts/lib/bsp/engine.py +++ b/scripts/lib/bsp/engine.py @@ -1352,6 +1352,62 @@ def expand_targets(context, bsp_output_dir): return target_files +def yocto_layer_create(layer_name, scripts_path, layer_output_dir, codedump, properties_file): + """ + Create yocto layer + + layer_name - user-defined layer name + scripts_path - absolute path to yocto /scripts dir + bsp_output_dir - dirname to create for BSP + codedump - dump generated code to bspgen.out + properties_file - use values from here if nonempty i.e no prompting + + arch - the arch for a generic layer is 'generic-layer', defined in + scripts/lib/bsp/substrate/target/generic-layer + """ + if os.path.exists(bsp_output_dir): + print "\nBSP output dir already exists, exiting. (%s)" % bsp_output_dir + sys.exit(1) + + properties = None + + if properties_file: + try: + infile = open(properties_file, "r") + except IOError: + print "Couldn't open properties file %s for reading, exiting" % properties_file + sys.exit(1) + + properties = json.load(infile) + + os.mkdir(bsp_output_dir) + + context = create_context(machine, arch, scripts_path) + target_files = expand_targets(context, bsp_output_dir) + + input_lines = gather_inputlines(target_files) + + program_lines = [] + + gen_program_header_lines(program_lines) + + gen_initial_property_vals(input_lines, program_lines) + + if properties: + gen_supplied_property_vals(properties, program_lines) + + gen_program_machine_lines(machine, program_lines) + + if not properties: + gen_program_input_lines(input_lines, program_lines, context) + + gen_program_lines(target_files, program_lines) + + run_program_lines(program_lines, codedump) + + print "New %s BSP created in %s" % (arch, bsp_output_dir) + + def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file): """ Create bsp |