summaryrefslogtreecommitdiffstats
path: root/scripts/lib/bsp
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/bsp')
-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