summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/bsp/kernel.py38
1 files changed, 24 insertions, 14 deletions
diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py
index c3592a3691..1971e9009b 100644
--- a/scripts/lib/bsp/kernel.py
+++ b/scripts/lib/bsp/kernel.py
@@ -60,14 +60,12 @@ def find_bblayers(scripts_path):
60 in_bblayers = True 60 in_bblayers = True
61 quotes = line.strip().count('"') 61 quotes = line.strip().count('"')
62 if quotes > 1: 62 if quotes > 1:
63 break 63 in_bblayers = False
64 continue 64 continue
65 if in_bblayers: 65 if in_bblayers:
66 bblayers_lines.append(line) 66 bblayers_lines.append(line)
67 if line.strip().endswith("\""): 67 if line.strip().endswith("\""):
68 break 68 in_bblayers = False
69 else:
70 continue
71 69
72 for i, line in enumerate(bblayers_lines): 70 for i, line in enumerate(bblayers_lines):
73 if line.strip().endswith("\\"): 71 if line.strip().endswith("\\"):
@@ -75,19 +73,31 @@ def find_bblayers(scripts_path):
75 73
76 bblayers_line = " ".join(bblayers_lines) 74 bblayers_line = " ".join(bblayers_lines)
77 75
78 start_quote = bblayers_line.find("\"") 76 openquote = ''
79 if start_quote == -1: 77 for c in bblayers_line:
80 print "Invalid BBLAYERS found in %s, exiting" % bblayers_conf 78 if c == '\"' or c == '\'':
81 sys.exit(1) 79 if openquote:
80 if c != openquote:
81 print "Invalid BBLAYERS found in %s, exiting" % bblayers_conf
82 sys.exit(1)
83 else:
84 openquote = ''
85 else:
86 openquote = c
82 87
83 start_quote += 1 88 if openquote:
84 end_quote = bblayers_line.find("\"", start_quote)
85 if end_quote == -1:
86 print "Invalid BBLAYERS found in %s, exiting" % bblayers_conf 89 print "Invalid BBLAYERS found in %s, exiting" % bblayers_conf
87 sys.exit(1) 90 sys.exit(1)
88 91
89 bblayers_line = bblayers_line[start_quote:end_quote] 92 bblayers_line = bblayers_line.strip().replace('\"', '')
90 layers = bblayers_line.split() 93 bblayers_line = bblayers_line.strip().replace('\'', '')
94
95 raw_layers = bblayers_line.split()
96
97 for layer in raw_layers:
98 if layer == 'BBLAYERS' or '=' in layer:
99 continue
100 layers.append(layer)
91 101
92 f.close() 102 f.close()
93 103
@@ -114,7 +124,7 @@ def find_bsp_layer(scripts_path, machine):
114 layers = find_bblayers(scripts_path) 124 layers = find_bblayers(scripts_path)
115 125
116 for layer in layers: 126 for layer in layers:
117 if machine in layer: 127 if layer.endswith(machine):
118 return layer 128 return layer
119 129
120 print "Unable to find the BSP layer for machine %s." % machine 130 print "Unable to find the BSP layer for machine %s." % machine