summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@intel.com>2013-01-18 12:27:07 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-20 13:05:38 +0000
commit792b1bf0147a72613e76ce8f88764e99c51b80eb (patch)
treefa1cd3eee7f0a378cda517899844e48487656f47 /scripts
parent3b75d85ac2b356f21fbe4032ba9b492211e22541 (diff)
downloadpoky-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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/bsp/engine.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index 8985544811..d406e79fe4 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -1352,6 +1352,62 @@ def expand_targets(context, bsp_output_dir):
1352 return target_files 1352 return target_files
1353 1353
1354 1354
1355def yocto_layer_create(layer_name, scripts_path, layer_output_dir, codedump, properties_file):
1356 """
1357 Create yocto layer
1358
1359 layer_name - user-defined layer name
1360 scripts_path - absolute path to yocto /scripts dir
1361 bsp_output_dir - dirname to create for BSP
1362 codedump - dump generated code to bspgen.out
1363 properties_file - use values from here if nonempty i.e no prompting
1364
1365 arch - the arch for a generic layer is 'generic-layer', defined in
1366 scripts/lib/bsp/substrate/target/generic-layer
1367 """
1368 if os.path.exists(bsp_output_dir):
1369 print "\nBSP output dir already exists, exiting. (%s)" % bsp_output_dir
1370 sys.exit(1)
1371
1372 properties = None
1373
1374 if properties_file:
1375 try:
1376 infile = open(properties_file, "r")
1377 except IOError:
1378 print "Couldn't open properties file %s for reading, exiting" % properties_file
1379 sys.exit(1)
1380
1381 properties = json.load(infile)
1382
1383 os.mkdir(bsp_output_dir)
1384
1385 context = create_context(machine, arch, scripts_path)
1386 target_files = expand_targets(context, bsp_output_dir)
1387
1388 input_lines = gather_inputlines(target_files)
1389
1390 program_lines = []
1391
1392 gen_program_header_lines(program_lines)
1393
1394 gen_initial_property_vals(input_lines, program_lines)
1395
1396 if properties:
1397 gen_supplied_property_vals(properties, program_lines)
1398
1399 gen_program_machine_lines(machine, program_lines)
1400
1401 if not properties:
1402 gen_program_input_lines(input_lines, program_lines, context)
1403
1404 gen_program_lines(target_files, program_lines)
1405
1406 run_program_lines(program_lines, codedump)
1407
1408 print "New %s BSP created in %s" % (arch, bsp_output_dir)
1409
1410
1355def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file): 1411def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file):
1356 """ 1412 """
1357 Create bsp 1413 Create bsp