tools: microcode-tool: Support parsing header file with a license block
The microcode header files in the Intel Chief River FSP package have a license comment block. Update the microcode-tool to support parsing it and extract the license text to the .dtsi file. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
394e0b6624
commit
aefba6f1b5
|
@ -95,9 +95,23 @@ def ParseHeaderFiles(fname_list):
|
||||||
name = os.path.splitext(name)[0]
|
name = os.path.splitext(name)[0]
|
||||||
data = []
|
data = []
|
||||||
with open(fname) as fd:
|
with open(fname) as fd:
|
||||||
|
license_start = False
|
||||||
|
license_end = False
|
||||||
for line in fd:
|
for line in fd:
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
|
|
||||||
|
if len(line) >= 2:
|
||||||
|
if line[0] == '/' and line[1] == '*':
|
||||||
|
license_start = True
|
||||||
|
continue
|
||||||
|
if line[0] == '*' and line[1] == '/':
|
||||||
|
license_end = True
|
||||||
|
continue
|
||||||
|
if license_start and not license_end:
|
||||||
|
# Ignore blank line
|
||||||
|
if len(line) > 0:
|
||||||
|
license_text.append(line)
|
||||||
|
continue
|
||||||
# Omit anything after the last comma
|
# Omit anything after the last comma
|
||||||
words = line.split(',')[:-1]
|
words = line.split(',')[:-1]
|
||||||
data += [word + ',' for word in words]
|
data += [word + ',' for word in words]
|
||||||
|
|
Loading…
Reference in New Issue