summaryrefslogtreecommitdiffstats
path: root/recipes-bsp
diff options
context:
space:
mode:
authorTing Liu <ting.liu@nxp.com>2020-12-15 09:25:26 +0530
committerOtavio Salvador <otavio@ossystems.com.br>2020-12-16 08:38:13 -0300
commitbd61523a08419322b5bb71bd84b5f719ec1eab71 (patch)
tree2b24297a00cdd4128ab18189c06bcee7bbc7cb11 /recipes-bsp
parent1ecd36e2c99c311dca574cc901b24d32762e5de9 (diff)
downloadmeta-freescale-bd61523a08419322b5bb71bd84b5f719ec1eab71.tar.gz
u-boot-qoriq: update to LSDK-20.12 release (2020.04)
Key changes: * Upgrade to 2020.04 * Support of LX2162A QDS * GPIO on LX2160A * SDHC: HS200 and HS400 on LX2162A * Watchdog: SBSA on LX2160A Backported patches are removed. Signed-off-by: Ting Liu <ting.liu@nxp.com>
Diffstat (limited to 'recipes-bsp')
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-Remove-redundant-YYLOC-global-declaration.patch29
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Convert-a-few-tests-to-Python-3.patch79
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Move-to-use-Python-3.patch30
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-buildman-Convert-to-Python-3.patch928
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Adjust-command-to-return-strings-instead-of-b.patch228
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Drop-binary-parameter.patch105
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Update-command.Run-to-handle-failure-better.patch42
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq/0001-pylibfdt-Convert-to-Python-3.patch117
-rw-r--r--recipes-bsp/u-boot/u-boot-qoriq_2020.04.bb (renamed from recipes-bsp/u-boot/u-boot-qoriq_2019.10.bb)13
9 files changed, 2 insertions, 1569 deletions
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-Remove-redundant-YYLOC-global-declaration.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-Remove-redundant-YYLOC-global-declaration.patch
deleted file mode 100644
index 2609760c..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-Remove-redundant-YYLOC-global-declaration.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 018921ee79d3f30893614b3b2b63b588d8544f73 Mon Sep 17 00:00:00 2001
2From: Peter Robinson <pbrobinson@gmail.com>
3Date: Thu, 30 Jan 2020 09:37:15 +0000
4Subject: [PATCH] Remove redundant YYLOC global declaration
5
6Same as the upstream fix for building dtc with gcc 10.
7
8Upstream-Status: Backport
9
10Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
11---
12 scripts/dtc/dtc-lexer.l | 1 -
13 1 file changed, 1 deletion(-)
14
15diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l
16index fd825ebba69c..24af54997758 100644
17--- a/scripts/dtc/dtc-lexer.l
18+++ b/scripts/dtc/dtc-lexer.l
19@@ -38,7 +38,6 @@ LINECOMMENT "//".*\n
20 #include "srcpos.h"
21 #include "dtc-parser.tab.h"
22
23-YYLTYPE yylloc;
24 extern bool treesource_error;
25
26 /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
27--
282.26.2
29
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Convert-a-few-tests-to-Python-3.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Convert-a-few-tests-to-Python-3.patch
deleted file mode 100644
index e530b7ca..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Convert-a-few-tests-to-Python-3.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From b6ee0cf89f9405094cbb6047076a13e14ebc030b Mon Sep 17 00:00:00 2001
2From: Simon Glass <sjg@chromium.org>
3Date: Thu, 31 Oct 2019 07:43:03 -0600
4Subject: [PATCH] binman: Convert a few tests to Python 3
5
6Some tests have crept in with Python 2 strings and constructs. Convert
7then.
8
9Upstream-Status: Backport
10
11Signed-off-by: Simon Glass <sjg@chromium.org>
12---
13 tools/binman/ftest.py | 14 +++++++-------
14 1 file changed, 7 insertions(+), 7 deletions(-)
15
16diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
17index 93507993a0..80df0e3ca9 100644
18--- a/tools/binman/ftest.py
19+++ b/tools/binman/ftest.py
20@@ -2113,7 +2113,7 @@ class TestFunctional(unittest.TestCase):
21 data = self.data = self._DoReadFileRealDtb('115_fdtmap.dts')
22 fdtmap_data = data[len(U_BOOT_DATA):]
23 magic = fdtmap_data[:8]
24- self.assertEqual('_FDTMAP_', magic)
25+ self.assertEqual(b'_FDTMAP_', magic)
26 self.assertEqual(tools.GetBytes(0, 8), fdtmap_data[8:16])
27
28 fdt_data = fdtmap_data[16:]
29@@ -2156,7 +2156,7 @@ class TestFunctional(unittest.TestCase):
30 dtb = fdt.Fdt.FromData(fdt_data)
31 fdt_size = dtb.GetFdtObj().totalsize()
32 hdr_data = data[-8:]
33- self.assertEqual('BinM', hdr_data[:4])
34+ self.assertEqual(b'BinM', hdr_data[:4])
35 offset = struct.unpack('<I', hdr_data[4:])[0] & 0xffffffff
36 self.assertEqual(fdtmap_pos - 0x400, offset - (1 << 32))
37
38@@ -2165,7 +2165,7 @@ class TestFunctional(unittest.TestCase):
39 data = self.data = self._DoReadFileRealDtb('117_fdtmap_hdr_start.dts')
40 fdtmap_pos = 0x100 + len(U_BOOT_DATA)
41 hdr_data = data[:8]
42- self.assertEqual('BinM', hdr_data[:4])
43+ self.assertEqual(b'BinM', hdr_data[:4])
44 offset = struct.unpack('<I', hdr_data[4:])[0]
45 self.assertEqual(fdtmap_pos, offset)
46
47@@ -2174,7 +2174,7 @@ class TestFunctional(unittest.TestCase):
48 data = self.data = self._DoReadFileRealDtb('118_fdtmap_hdr_pos.dts')
49 fdtmap_pos = 0x100 + len(U_BOOT_DATA)
50 hdr_data = data[0x80:0x88]
51- self.assertEqual('BinM', hdr_data[:4])
52+ self.assertEqual(b'BinM', hdr_data[:4])
53 offset = struct.unpack('<I', hdr_data[4:])[0]
54 self.assertEqual(fdtmap_pos, offset)
55
56@@ -2435,9 +2435,9 @@ class TestFunctional(unittest.TestCase):
57 ' section 100 %x section 100' % section_size,
58 ' cbfs 100 400 cbfs 0',
59 ' u-boot 138 4 u-boot 38',
60-' u-boot-dtb 180 10f u-boot-dtb 80 3c9',
61+' u-boot-dtb 180 105 u-boot-dtb 80 3c9',
62 ' u-boot-dtb 500 %x u-boot-dtb 400 3c9' % fdt_size,
63-' fdtmap %x 3b4 fdtmap %x' %
64+' fdtmap %x 3bd fdtmap %x' %
65 (fdtmap_offset, fdtmap_offset),
66 ' image-header bf8 8 image-header bf8',
67 ]
68@@ -2522,7 +2522,7 @@ class TestFunctional(unittest.TestCase):
69 data = self._RunExtractCmd('section')
70 cbfs_data = data[:0x400]
71 cbfs = cbfs_util.CbfsReader(cbfs_data)
72- self.assertEqual(['u-boot', 'u-boot-dtb', ''], cbfs.files.keys())
73+ self.assertEqual(['u-boot', 'u-boot-dtb', ''], list(cbfs.files.keys()))
74 dtb_data = data[0x400:]
75 dtb = self._decompress(dtb_data)
76 self.assertEqual(EXTRACT_DTB_SIZE, len(dtb))
77--
782.24.0
79
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Move-to-use-Python-3.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Move-to-use-Python-3.patch
deleted file mode 100644
index c1a05b32..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-binman-Move-to-use-Python-3.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 388560134b99dc4cc752627d3a7e9f8c8c2a89a7 Mon Sep 17 00:00:00 2001
2From: Simon Glass <sjg@chromium.org>
3Date: Thu, 31 Oct 2019 07:43:05 -0600
4Subject: [PATCH] binman: Move to use Python 3
5
6Update this tool to use Python 3 to meet the 2020 deadline.
7
8Unfortunately this introduces a test failure due to a problem in pylibfdt
9on Python 3. I will investigate.
10
11Upstream-Status: Backport
12
13Signed-off-by: Simon Glass <sjg@chromium.org>
14---
15 tools/binman/binman.py | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/tools/binman/binman.py b/tools/binman/binman.py
19index 8bd5868df2..9e6fd72117 100755
20--- a/tools/binman/binman.py
21+++ b/tools/binman/binman.py
22@@ -1,4 +1,4 @@
23-#!/usr/bin/env python2
24+#!/usr/bin/env python3
25 # SPDX-License-Identifier: GPL-2.0+
26
27 # Copyright (c) 2016 Google, Inc
28--
292.24.0
30
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-buildman-Convert-to-Python-3.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-buildman-Convert-to-Python-3.patch
deleted file mode 100644
index 5d7ec42f..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-buildman-Convert-to-Python-3.patch
+++ /dev/null
@@ -1,928 +0,0 @@
1From c05aa0364280803d8274e260a739553d588ea052 Mon Sep 17 00:00:00 2001
2From: Simon Glass <sjg@chromium.org>
3Date: Thu, 31 Oct 2019 07:42:53 -0600
4Subject: [PATCH] buildman: Convert to Python 3
5
6Convert buildman to Python 3 and make it use that, to meet the 2020
7deadline.
8
9Upstream-Status: Backport
10
11Signed-off-by: Simon Glass <sjg@chromium.org>
12---
13 tools/buildman/board.py | 9 +--
14 tools/buildman/bsettings.py | 20 +++----
15 tools/buildman/builder.py | 47 ++++++++--------
16 tools/buildman/builderthread.py | 24 ++++----
17 tools/buildman/buildman.py | 10 ++--
18 tools/buildman/control.py | 44 +++++++--------
19 tools/buildman/func_test.py | 16 +++---
20 tools/buildman/test.py | 22 ++++----
21 tools/buildman/toolchain.py | 99 +++++++++++++++++----------------
22 9 files changed, 146 insertions(+), 145 deletions(-)
23
24diff --git a/tools/buildman/board.py b/tools/buildman/board.py
25index 2a1d021574..447aaabea8 100644
26--- a/tools/buildman/board.py
27+++ b/tools/buildman/board.py
28@@ -1,6 +1,7 @@
29 # SPDX-License-Identifier: GPL-2.0+
30 # Copyright (c) 2012 The Chromium OS Authors.
31
32+from collections import OrderedDict
33 import re
34
35 class Expr:
36@@ -120,7 +121,7 @@ class Boards:
37 Args:
38 fname: Filename of boards.cfg file
39 """
40- with open(fname, 'r') as fd:
41+ with open(fname, 'r', encoding='utf-8') as fd:
42 for line in fd:
43 if line[0] == '#':
44 continue
45@@ -155,7 +156,7 @@ class Boards:
46 key is board.target
47 value is board
48 """
49- board_dict = {}
50+ board_dict = OrderedDict()
51 for board in self._boards:
52 board_dict[board.target] = board
53 return board_dict
54@@ -166,7 +167,7 @@ class Boards:
55 Returns:
56 List of Board objects that are marked selected
57 """
58- board_dict = {}
59+ board_dict = OrderedDict()
60 for board in self._boards:
61 if board.build_it:
62 board_dict[board.target] = board
63@@ -259,7 +260,7 @@ class Boards:
64 due to each argument, arranged by argument.
65 List of errors found
66 """
67- result = {}
68+ result = OrderedDict()
69 warnings = []
70 terms = self._BuildTerms(args)
71
72diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py
73index 03d7439aa5..0b7208da37 100644
74--- a/tools/buildman/bsettings.py
75+++ b/tools/buildman/bsettings.py
76@@ -1,9 +1,9 @@
77 # SPDX-License-Identifier: GPL-2.0+
78 # Copyright (c) 2012 The Chromium OS Authors.
79
80-import ConfigParser
81+import configparser
82 import os
83-import StringIO
84+import io
85
86
87 def Setup(fname=''):
88@@ -15,20 +15,20 @@ def Setup(fname=''):
89 global settings
90 global config_fname
91
92- settings = ConfigParser.SafeConfigParser()
93+ settings = configparser.SafeConfigParser()
94 if fname is not None:
95 config_fname = fname
96 if config_fname == '':
97 config_fname = '%s/.buildman' % os.getenv('HOME')
98 if not os.path.exists(config_fname):
99- print 'No config file found ~/.buildman\nCreating one...\n'
100+ print('No config file found ~/.buildman\nCreating one...\n')
101 CreateBuildmanConfigFile(config_fname)
102- print 'To install tool chains, please use the --fetch-arch option'
103+ print('To install tool chains, please use the --fetch-arch option')
104 if config_fname:
105 settings.read(config_fname)
106
107 def AddFile(data):
108- settings.readfp(StringIO.StringIO(data))
109+ settings.readfp(io.StringIO(data))
110
111 def GetItems(section):
112 """Get the items from a section of the config.
113@@ -41,7 +41,7 @@ def GetItems(section):
114 """
115 try:
116 return settings.items(section)
117- except ConfigParser.NoSectionError as e:
118+ except configparser.NoSectionError as e:
119 return []
120 except:
121 raise
122@@ -68,10 +68,10 @@ def CreateBuildmanConfigFile(config_fname):
123 try:
124 f = open(config_fname, 'w')
125 except IOError:
126- print "Couldn't create buildman config file '%s'\n" % config_fname
127+ print("Couldn't create buildman config file '%s'\n" % config_fname)
128 raise
129
130- print >>f, '''[toolchain]
131+ print('''[toolchain]
132 # name = path
133 # e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux
134
135@@ -93,5 +93,5 @@ openrisc = or1k
136 # snapper-boards=ENABLE_AT91_TEST=1
137 # snapper9260=${snapper-boards} BUILD_TAG=442
138 # snapper9g45=${snapper-boards} BUILD_TAG=443
139-'''
140+''', file=f)
141 f.close();
142diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py
143index fbb236676c..cfbe4c26b1 100644
144--- a/tools/buildman/builder.py
145+++ b/tools/buildman/builder.py
146@@ -9,7 +9,7 @@ from datetime import datetime, timedelta
147 import glob
148 import os
149 import re
150-import Queue
151+import queue
152 import shutil
153 import signal
154 import string
155@@ -92,11 +92,10 @@ u-boot/ source directory
156 """
157
158 # Possible build outcomes
159-OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN = range(4)
160+OUTCOME_OK, OUTCOME_WARNING, OUTCOME_ERROR, OUTCOME_UNKNOWN = list(range(4))
161
162 # Translate a commit subject into a valid filename (and handle unicode)
163-trans_valid_chars = string.maketrans('/: ', '---')
164-trans_valid_chars = trans_valid_chars.decode('latin-1')
165+trans_valid_chars = str.maketrans('/: ', '---')
166
167 BASE_CONFIG_FILENAMES = [
168 'u-boot.cfg', 'u-boot-spl.cfg', 'u-boot-tpl.cfg'
169@@ -122,8 +121,8 @@ class Config:
170 def __hash__(self):
171 val = 0
172 for fname in self.config:
173- for key, value in self.config[fname].iteritems():
174- print key, value
175+ for key, value in self.config[fname].items():
176+ print(key, value)
177 val = val ^ hash(key) & hash(value)
178 return val
179
180@@ -293,8 +292,8 @@ class Builder:
181 self._re_dtb_warning = re.compile('(.*): Warning .*')
182 self._re_note = re.compile('(.*):(\d*):(\d*): note: this is the location of the previous.*')
183
184- self.queue = Queue.Queue()
185- self.out_queue = Queue.Queue()
186+ self.queue = queue.Queue()
187+ self.out_queue = queue.Queue()
188 for i in range(self.num_threads):
189 t = builderthread.BuilderThread(self, i, incremental,
190 per_board_out_dir)
191@@ -781,7 +780,7 @@ class Builder:
192 config = {}
193 environment = {}
194
195- for board in boards_selected.itervalues():
196+ for board in boards_selected.values():
197 outcome = self.GetBuildOutcome(commit_upto, board.target,
198 read_func_sizes, read_config,
199 read_environment)
200@@ -814,13 +813,13 @@ class Builder:
201 tconfig = Config(self.config_filenames, board.target)
202 for fname in self.config_filenames:
203 if outcome.config:
204- for key, value in outcome.config[fname].iteritems():
205+ for key, value in outcome.config[fname].items():
206 tconfig.Add(fname, key, value)
207 config[board.target] = tconfig
208
209 tenvironment = Environment(board.target)
210 if outcome.environment:
211- for key, value in outcome.environment.iteritems():
212+ for key, value in outcome.environment.items():
213 tenvironment.Add(key, value)
214 environment[board.target] = tenvironment
215
216@@ -1040,12 +1039,12 @@ class Builder:
217
218 # We now have a list of image size changes sorted by arch
219 # Print out a summary of these
220- for arch, target_list in arch_list.iteritems():
221+ for arch, target_list in arch_list.items():
222 # Get total difference for each type
223 totals = {}
224 for result in target_list:
225 total = 0
226- for name, diff in result.iteritems():
227+ for name, diff in result.items():
228 if name.startswith('_'):
229 continue
230 total += diff
231@@ -1250,7 +1249,7 @@ class Builder:
232 if self._show_unknown:
233 self.AddOutcome(board_selected, arch_list, unknown_boards, '?',
234 self.col.MAGENTA)
235- for arch, target_list in arch_list.iteritems():
236+ for arch, target_list in arch_list.items():
237 Print('%10s: %s' % (arch, target_list))
238 self._error_lines += 1
239 if better_err:
240@@ -1283,13 +1282,13 @@ class Builder:
241 environment_minus = {}
242 environment_change = {}
243 base = tbase.environment
244- for key, value in tenvironment.environment.iteritems():
245+ for key, value in tenvironment.environment.items():
246 if key not in base:
247 environment_plus[key] = value
248- for key, value in base.iteritems():
249+ for key, value in base.items():
250 if key not in tenvironment.environment:
251 environment_minus[key] = value
252- for key, value in base.iteritems():
253+ for key, value in base.items():
254 new_value = tenvironment.environment.get(key)
255 if new_value and value != new_value:
256 desc = '%s -> %s' % (value, new_value)
257@@ -1342,15 +1341,15 @@ class Builder:
258 config_minus = {}
259 config_change = {}
260 base = tbase.config[name]
261- for key, value in tconfig.config[name].iteritems():
262+ for key, value in tconfig.config[name].items():
263 if key not in base:
264 config_plus[key] = value
265 all_config_plus[key] = value
266- for key, value in base.iteritems():
267+ for key, value in base.items():
268 if key not in tconfig.config[name]:
269 config_minus[key] = value
270 all_config_minus[key] = value
271- for key, value in base.iteritems():
272+ for key, value in base.items():
273 new_value = tconfig.config.get(key)
274 if new_value and value != new_value:
275 desc = '%s -> %s' % (value, new_value)
276@@ -1368,7 +1367,7 @@ class Builder:
277 summary[target] = '\n'.join(lines)
278
279 lines_by_target = {}
280- for target, lines in summary.iteritems():
281+ for target, lines in summary.items():
282 if lines in lines_by_target:
283 lines_by_target[lines].append(target)
284 else:
285@@ -1392,7 +1391,7 @@ class Builder:
286 Print('%s:' % arch)
287 _OutputConfigInfo(lines)
288
289- for lines, targets in lines_by_target.iteritems():
290+ for lines, targets in lines_by_target.items():
291 if not lines:
292 continue
293 Print('%s :' % ' '.join(sorted(targets)))
294@@ -1463,7 +1462,7 @@ class Builder:
295 commits: Selected commits to build
296 """
297 # First work out how many commits we will build
298- count = (self.commit_count + self._step - 1) / self._step
299+ count = (self.commit_count + self._step - 1) // self._step
300 self.count = len(board_selected) * count
301 self.upto = self.warned = self.fail = 0
302 self._timestamps = collections.deque()
303@@ -1566,7 +1565,7 @@ class Builder:
304 self.ProcessResult(None)
305
306 # Create jobs to build all commits for each board
307- for brd in board_selected.itervalues():
308+ for brd in board_selected.values():
309 job = builderthread.BuilderJob()
310 job.board = brd
311 job.commits = commits
312diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py
313index 8a9d47cd5e..570c1f6595 100644
314--- a/tools/buildman/builderthread.py
315+++ b/tools/buildman/builderthread.py
316@@ -28,7 +28,7 @@ def Mkdir(dirname, parents = False):
317 except OSError as err:
318 if err.errno == errno.EEXIST:
319 if os.path.realpath('.') == os.path.realpath(dirname):
320- print "Cannot create the current working directory '%s'!" % dirname
321+ print("Cannot create the current working directory '%s'!" % dirname)
322 sys.exit(1)
323 pass
324 else:
325@@ -291,15 +291,13 @@ class BuilderThread(threading.Thread):
326 outfile = os.path.join(build_dir, 'log')
327 with open(outfile, 'w') as fd:
328 if result.stdout:
329- # We don't want unicode characters in log files
330- fd.write(result.stdout.decode('UTF-8').encode('ASCII', 'replace'))
331+ fd.write(result.stdout)
332
333 errfile = self.builder.GetErrFile(result.commit_upto,
334 result.brd.target)
335 if result.stderr:
336 with open(errfile, 'w') as fd:
337- # We don't want unicode characters in log files
338- fd.write(result.stderr.decode('UTF-8').encode('ASCII', 'replace'))
339+ fd.write(result.stderr)
340 elif os.path.exists(errfile):
341 os.remove(errfile)
342
343@@ -314,17 +312,17 @@ class BuilderThread(threading.Thread):
344 else:
345 fd.write('%s' % result.return_code)
346 with open(os.path.join(build_dir, 'toolchain'), 'w') as fd:
347- print >>fd, 'gcc', result.toolchain.gcc
348- print >>fd, 'path', result.toolchain.path
349- print >>fd, 'cross', result.toolchain.cross
350- print >>fd, 'arch', result.toolchain.arch
351+ print('gcc', result.toolchain.gcc, file=fd)
352+ print('path', result.toolchain.path, file=fd)
353+ print('cross', result.toolchain.cross, file=fd)
354+ print('arch', result.toolchain.arch, file=fd)
355 fd.write('%s' % result.return_code)
356
357 # Write out the image and function size information and an objdump
358 env = result.toolchain.MakeEnvironment(self.builder.full_path)
359 with open(os.path.join(build_dir, 'env'), 'w') as fd:
360 for var in sorted(env.keys()):
361- print >>fd, '%s="%s"' % (var, env[var])
362+ print('%s="%s"' % (var, env[var]), file=fd)
363 lines = []
364 for fname in ['u-boot', 'spl/u-boot-spl']:
365 cmd = ['%snm' % self.toolchain.cross, '--size-sort', fname]
366@@ -335,7 +333,7 @@ class BuilderThread(threading.Thread):
367 nm = self.builder.GetFuncSizesFile(result.commit_upto,
368 result.brd.target, fname)
369 with open(nm, 'w') as fd:
370- print >>fd, nm_result.stdout,
371+ print(nm_result.stdout, end=' ', file=fd)
372
373 cmd = ['%sobjdump' % self.toolchain.cross, '-h', fname]
374 dump_result = command.RunPipe([cmd], capture=True,
375@@ -346,7 +344,7 @@ class BuilderThread(threading.Thread):
376 objdump = self.builder.GetObjdumpFile(result.commit_upto,
377 result.brd.target, fname)
378 with open(objdump, 'w') as fd:
379- print >>fd, dump_result.stdout,
380+ print(dump_result.stdout, end=' ', file=fd)
381 for line in dump_result.stdout.splitlines():
382 fields = line.split()
383 if len(fields) > 5 and fields[1] == '.rodata':
384@@ -378,7 +376,7 @@ class BuilderThread(threading.Thread):
385 sizes = self.builder.GetSizesFile(result.commit_upto,
386 result.brd.target)
387 with open(sizes, 'w') as fd:
388- print >>fd, '\n'.join(lines)
389+ print('\n'.join(lines), file=fd)
390
391 # Write out the configuration files, with a special case for SPL
392 for dirname in ['', 'spl', 'tpl']:
393diff --git a/tools/buildman/buildman.py b/tools/buildman/buildman.py
394index f17aa15e7c..30a8690f93 100755
395--- a/tools/buildman/buildman.py
396+++ b/tools/buildman/buildman.py
397@@ -1,4 +1,4 @@
398-#!/usr/bin/env python2
399+#!/usr/bin/env python3
400 # SPDX-License-Identifier: GPL-2.0+
401 #
402 # Copyright (c) 2012 The Chromium OS Authors.
403@@ -6,6 +6,8 @@
404
405 """See README for more information"""
406
407+from __future__ import print_function
408+
409 import multiprocessing
410 import os
411 import re
412@@ -46,11 +48,11 @@ def RunTests(skip_net_tests):
413 suite = unittest.TestLoader().loadTestsFromTestCase(module)
414 suite.run(result)
415
416- print result
417+ print(result)
418 for test, err in result.errors:
419- print err
420+ print(err)
421 for test, err in result.failures:
422- print err
423+ print(err)
424
425
426 options, args = cmdline.ParseArgs()
427diff --git a/tools/buildman/control.py b/tools/buildman/control.py
428index 9787b86747..216012d001 100644
429--- a/tools/buildman/control.py
430+++ b/tools/buildman/control.py
431@@ -30,7 +30,7 @@ def GetActionSummary(is_summary, commits, selected, options):
432 """
433 if commits:
434 count = len(commits)
435- count = (count + options.step - 1) / options.step
436+ count = (count + options.step - 1) // options.step
437 commit_str = '%d commit%s' % (count, GetPlural(count))
438 else:
439 commit_str = 'current source'
440@@ -59,31 +59,31 @@ def ShowActions(series, why_selected, boards_selected, builder, options,
441 board_warnings: List of warnings obtained from board selected
442 """
443 col = terminal.Color()
444- print 'Dry run, so not doing much. But I would do this:'
445- print
446+ print('Dry run, so not doing much. But I would do this:')
447+ print()
448 if series:
449 commits = series.commits
450 else:
451 commits = None
452- print GetActionSummary(False, commits, boards_selected,
453- options)
454- print 'Build directory: %s' % builder.base_dir
455+ print(GetActionSummary(False, commits, boards_selected,
456+ options))
457+ print('Build directory: %s' % builder.base_dir)
458 if commits:
459 for upto in range(0, len(series.commits), options.step):
460 commit = series.commits[upto]
461- print ' ', col.Color(col.YELLOW, commit.hash[:8], bright=False),
462- print commit.subject
463- print
464+ print(' ', col.Color(col.YELLOW, commit.hash[:8], bright=False), end=' ')
465+ print(commit.subject)
466+ print()
467 for arg in why_selected:
468 if arg != 'all':
469- print arg, ': %d boards' % len(why_selected[arg])
470+ print(arg, ': %d boards' % len(why_selected[arg]))
471 if options.verbose:
472- print ' %s' % ' '.join(why_selected[arg])
473- print ('Total boards to build for each commit: %d\n' %
474- len(why_selected['all']))
475+ print(' %s' % ' '.join(why_selected[arg]))
476+ print(('Total boards to build for each commit: %d\n' %
477+ len(why_selected['all'])))
478 if board_warnings:
479 for warning in board_warnings:
480- print col.Color(col.YELLOW, warning)
481+ print(col.Color(col.YELLOW, warning))
482
483 def CheckOutputDir(output_dir):
484 """Make sure that the output directory is not within the current directory
485@@ -146,17 +146,17 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
486 if options.fetch_arch:
487 if options.fetch_arch == 'list':
488 sorted_list = toolchains.ListArchs()
489- print col.Color(col.BLUE, 'Available architectures: %s\n' %
490- ' '.join(sorted_list))
491+ print(col.Color(col.BLUE, 'Available architectures: %s\n' %
492+ ' '.join(sorted_list)))
493 return 0
494 else:
495 fetch_arch = options.fetch_arch
496 if fetch_arch == 'all':
497 fetch_arch = ','.join(toolchains.ListArchs())
498- print col.Color(col.CYAN, '\nDownloading toolchains: %s' %
499- fetch_arch)
500+ print(col.Color(col.CYAN, '\nDownloading toolchains: %s' %
501+ fetch_arch))
502 for arch in fetch_arch.split(','):
503- print
504+ print()
505 ret = toolchains.FetchAndInstall(arch)
506 if ret:
507 return ret
508@@ -167,7 +167,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
509 toolchains.Scan(options.list_tool_chains and options.verbose)
510 if options.list_tool_chains:
511 toolchains.List()
512- print
513+ print()
514 return 0
515
516 # Work out how many commits to build. We want to build everything on the
517@@ -191,7 +191,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
518 sys.exit(col.Color(col.RED, "Range '%s' has no commits" %
519 options.branch))
520 if msg:
521- print col.Color(col.YELLOW, msg)
522+ print(col.Color(col.YELLOW, msg))
523 count += 1 # Build upstream commit also
524
525 if not count:
526@@ -268,7 +268,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
527 options.threads = min(multiprocessing.cpu_count(), len(selected))
528 if not options.jobs:
529 options.jobs = max(1, (multiprocessing.cpu_count() +
530- len(selected) - 1) / len(selected))
531+ len(selected) - 1) // len(selected))
532
533 if not options.step:
534 options.step = len(series.commits) - 1
535diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py
536index f90b8ea7f5..4c3d497294 100644
537--- a/tools/buildman/func_test.py
538+++ b/tools/buildman/func_test.py
539@@ -270,7 +270,7 @@ class TestFunctional(unittest.TestCase):
540 stdout=''.join(commit_log[:count]))
541
542 # Not handled, so abort
543- print 'git log', args
544+ print('git log', args)
545 sys.exit(1)
546
547 def _HandleCommandGitConfig(self, args):
548@@ -286,7 +286,7 @@ class TestFunctional(unittest.TestCase):
549 stdout='refs/heads/master\n')
550
551 # Not handled, so abort
552- print 'git config', args
553+ print('git config', args)
554 sys.exit(1)
555
556 def _HandleCommandGit(self, in_args):
557@@ -320,7 +320,7 @@ class TestFunctional(unittest.TestCase):
558 return command.CommandResult(return_code=0)
559
560 # Not handled, so abort
561- print 'git', git_args, sub_cmd, args
562+ print('git', git_args, sub_cmd, args)
563 sys.exit(1)
564
565 def _HandleCommandNm(self, args):
566@@ -351,7 +351,7 @@ class TestFunctional(unittest.TestCase):
567 if pipe_list[1] == ['wc', '-l']:
568 wc = True
569 else:
570- print 'invalid pipe', kwargs
571+ print('invalid pipe', kwargs)
572 sys.exit(1)
573 cmd = pipe_list[0][0]
574 args = pipe_list[0][1:]
575@@ -371,7 +371,7 @@ class TestFunctional(unittest.TestCase):
576
577 if not result:
578 # Not handled, so abort
579- print 'unknown command', kwargs
580+ print('unknown command', kwargs)
581 sys.exit(1)
582
583 if wc:
584@@ -404,14 +404,14 @@ class TestFunctional(unittest.TestCase):
585 return command.CommandResult(return_code=0)
586
587 # Not handled, so abort
588- print 'make', stage
589+ print('make', stage)
590 sys.exit(1)
591
592 # Example function to print output lines
593 def print_lines(self, lines):
594- print len(lines)
595+ print(len(lines))
596 for line in lines:
597- print line
598+ print(line)
599 #self.print_lines(terminal.GetPrintTestLines())
600
601 def testNoBoards(self):
602diff --git a/tools/buildman/test.py b/tools/buildman/test.py
603index ed99b9375c..b4e28d6867 100644
604--- a/tools/buildman/test.py
605+++ b/tools/buildman/test.py
606@@ -212,11 +212,11 @@ class TestBuild(unittest.TestCase):
607 self.assertEqual(lines[1].text, '02: %s' % commits[1][1])
608
609 col = terminal.Color()
610- self.assertSummary(lines[2].text, 'sandbox', 'w+', ['board4'],
611+ self.assertSummary(lines[2].text, 'arm', 'w+', ['board1'],
612 outcome=OUTCOME_WARN)
613- self.assertSummary(lines[3].text, 'arm', 'w+', ['board1'],
614+ self.assertSummary(lines[3].text, 'powerpc', 'w+', ['board2', 'board3'],
615 outcome=OUTCOME_WARN)
616- self.assertSummary(lines[4].text, 'powerpc', 'w+', ['board2', 'board3'],
617+ self.assertSummary(lines[4].text, 'sandbox', 'w+', ['board4'],
618 outcome=OUTCOME_WARN)
619
620 # Second commit: The warnings should be listed
621@@ -226,10 +226,10 @@ class TestBuild(unittest.TestCase):
622
623 # Third commit: Still fails
624 self.assertEqual(lines[6].text, '03: %s' % commits[2][1])
625- self.assertSummary(lines[7].text, 'sandbox', '+', ['board4'])
626- self.assertSummary(lines[8].text, 'arm', '', ['board1'],
627+ self.assertSummary(lines[7].text, 'arm', '', ['board1'],
628 outcome=OUTCOME_OK)
629- self.assertSummary(lines[9].text, 'powerpc', '+', ['board2', 'board3'])
630+ self.assertSummary(lines[8].text, 'powerpc', '+', ['board2', 'board3'])
631+ self.assertSummary(lines[9].text, 'sandbox', '+', ['board4'])
632
633 # Expect a compiler error
634 self.assertEqual(lines[10].text, '+%s' %
635@@ -237,8 +237,6 @@ class TestBuild(unittest.TestCase):
636
637 # Fourth commit: Compile errors are fixed, just have warning for board3
638 self.assertEqual(lines[11].text, '04: %s' % commits[3][1])
639- self.assertSummary(lines[12].text, 'sandbox', 'w+', ['board4'],
640- outcome=OUTCOME_WARN)
641 expect = '%10s: ' % 'powerpc'
642 expect += ' ' + col.Color(col.GREEN, '')
643 expect += ' '
644@@ -246,7 +244,9 @@ class TestBuild(unittest.TestCase):
645 expect += ' ' + col.Color(col.YELLOW, 'w+')
646 expect += ' '
647 expect += col.Color(col.YELLOW, ' %s' % 'board3')
648- self.assertEqual(lines[13].text, expect)
649+ self.assertEqual(lines[12].text, expect)
650+ self.assertSummary(lines[13].text, 'sandbox', 'w+', ['board4'],
651+ outcome=OUTCOME_WARN)
652
653 # Compile error fixed
654 self.assertEqual(lines[14].text, '-%s' %
655@@ -259,9 +259,9 @@ class TestBuild(unittest.TestCase):
656
657 # Fifth commit
658 self.assertEqual(lines[16].text, '05: %s' % commits[4][1])
659- self.assertSummary(lines[17].text, 'sandbox', '+', ['board4'])
660- self.assertSummary(lines[18].text, 'powerpc', '', ['board3'],
661+ self.assertSummary(lines[17].text, 'powerpc', '', ['board3'],
662 outcome=OUTCOME_OK)
663+ self.assertSummary(lines[18].text, 'sandbox', '+', ['board4'])
664
665 # The second line of errors[3] is a duplicate, so buildman will drop it
666 expect = errors[3].rstrip().split('\n')
667diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py
668index a65737fdf8..cc26e2ede5 100644
669--- a/tools/buildman/toolchain.py
670+++ b/tools/buildman/toolchain.py
671@@ -4,18 +4,19 @@
672
673 import re
674 import glob
675-from HTMLParser import HTMLParser
676+from html.parser import HTMLParser
677 import os
678 import sys
679 import tempfile
680-import urllib2
681+import urllib.request, urllib.error, urllib.parse
682
683 import bsettings
684 import command
685 import terminal
686+import tools
687
688 (PRIORITY_FULL_PREFIX, PRIORITY_PREFIX_GCC, PRIORITY_PREFIX_GCC_PATH,
689- PRIORITY_CALC) = range(4)
690+ PRIORITY_CALC) = list(range(4))
691
692 # Simple class to collect links from a page
693 class MyHTMLParser(HTMLParser):
694@@ -100,15 +101,15 @@ class Toolchain:
695 raise_on_error=False)
696 self.ok = result.return_code == 0
697 if verbose:
698- print 'Tool chain test: ',
699+ print('Tool chain test: ', end=' ')
700 if self.ok:
701- print "OK, arch='%s', priority %d" % (self.arch,
702- self.priority)
703+ print("OK, arch='%s', priority %d" % (self.arch,
704+ self.priority))
705 else:
706- print 'BAD'
707- print 'Command: ', cmd
708- print result.stdout
709- print result.stderr
710+ print('BAD')
711+ print('Command: ', cmd)
712+ print(result.stdout)
713+ print(result.stderr)
714 else:
715 self.ok = True
716
717@@ -138,7 +139,7 @@ class Toolchain:
718 value = ''
719 for name, value in bsettings.GetItems('toolchain-wrapper'):
720 if not value:
721- print "Warning: Wrapper not found"
722+ print("Warning: Wrapper not found")
723 if value:
724 value = value + ' '
725
726@@ -227,11 +228,11 @@ class Toolchains:
727 """
728 toolchains = bsettings.GetItems('toolchain')
729 if show_warning and not toolchains:
730- print ("Warning: No tool chains. Please run 'buildman "
731+ print(("Warning: No tool chains. Please run 'buildman "
732 "--fetch-arch all' to download all available toolchains, or "
733 "add a [toolchain] section to your buildman config file "
734 "%s. See README for details" %
735- bsettings.config_fname)
736+ bsettings.config_fname))
737
738 paths = []
739 for name, value in toolchains:
740@@ -272,10 +273,10 @@ class Toolchains:
741 if add_it:
742 self.toolchains[toolchain.arch] = toolchain
743 elif verbose:
744- print ("Toolchain '%s' at priority %d will be ignored because "
745+ print(("Toolchain '%s' at priority %d will be ignored because "
746 "another toolchain for arch '%s' has priority %d" %
747 (toolchain.gcc, toolchain.priority, toolchain.arch,
748- self.toolchains[toolchain.arch].priority))
749+ self.toolchains[toolchain.arch].priority)))
750
751 def ScanPath(self, path, verbose):
752 """Scan a path for a valid toolchain
753@@ -289,9 +290,9 @@ class Toolchains:
754 fnames = []
755 for subdir in ['.', 'bin', 'usr/bin']:
756 dirname = os.path.join(path, subdir)
757- if verbose: print " - looking in '%s'" % dirname
758+ if verbose: print(" - looking in '%s'" % dirname)
759 for fname in glob.glob(dirname + '/*gcc'):
760- if verbose: print " - found '%s'" % fname
761+ if verbose: print(" - found '%s'" % fname)
762 fnames.append(fname)
763 return fnames
764
765@@ -321,9 +322,9 @@ class Toolchains:
766 Args:
767 verbose: True to print out progress information
768 """
769- if verbose: print 'Scanning for tool chains'
770+ if verbose: print('Scanning for tool chains')
771 for name, value in self.prefixes:
772- if verbose: print " - scanning prefix '%s'" % value
773+ if verbose: print(" - scanning prefix '%s'" % value)
774 if os.path.exists(value):
775 self.Add(value, True, verbose, PRIORITY_FULL_PREFIX, name)
776 continue
777@@ -335,10 +336,10 @@ class Toolchains:
778 for f in fname_list:
779 self.Add(f, True, verbose, PRIORITY_PREFIX_GCC_PATH, name)
780 if not fname_list:
781- raise ValueError, ("No tool chain found for prefix '%s'" %
782+ raise ValueError("No tool chain found for prefix '%s'" %
783 value)
784 for path in self.paths:
785- if verbose: print " - scanning path '%s'" % path
786+ if verbose: print(" - scanning path '%s'" % path)
787 fnames = self.ScanPath(path, verbose)
788 for fname in fnames:
789 self.Add(fname, True, verbose)
790@@ -346,13 +347,13 @@ class Toolchains:
791 def List(self):
792 """List out the selected toolchains for each architecture"""
793 col = terminal.Color()
794- print col.Color(col.BLUE, 'List of available toolchains (%d):' %
795- len(self.toolchains))
796+ print(col.Color(col.BLUE, 'List of available toolchains (%d):' %
797+ len(self.toolchains)))
798 if len(self.toolchains):
799- for key, value in sorted(self.toolchains.iteritems()):
800- print '%-10s: %s' % (key, value.gcc)
801+ for key, value in sorted(self.toolchains.items()):
802+ print('%-10s: %s' % (key, value.gcc))
803 else:
804- print 'None'
805+ print('None')
806
807 def Select(self, arch):
808 """Returns the toolchain for a given architecture
809@@ -370,7 +371,7 @@ class Toolchains:
810 return self.toolchains[alias]
811
812 if not arch in self.toolchains:
813- raise ValueError, ("No tool chain found for arch '%s'" % arch)
814+ raise ValueError("No tool chain found for arch '%s'" % arch)
815 return self.toolchains[arch]
816
817 def ResolveReferences(self, var_dict, args):
818@@ -464,9 +465,9 @@ class Toolchains:
819 links = []
820 for version in versions:
821 url = '%s/%s/%s/' % (base, arch, version)
822- print 'Checking: %s' % url
823- response = urllib2.urlopen(url)
824- html = response.read()
825+ print('Checking: %s' % url)
826+ response = urllib.request.urlopen(url)
827+ html = tools.ToString(response.read())
828 parser = MyHTMLParser(fetch_arch)
829 parser.feed(html)
830 if fetch_arch == 'list':
831@@ -488,14 +489,14 @@ class Toolchains:
832 Full path to the downloaded archive file in that directory,
833 or None if there was an error while downloading
834 """
835- print 'Downloading: %s' % url
836+ print('Downloading: %s' % url)
837 leaf = url.split('/')[-1]
838 tmpdir = tempfile.mkdtemp('.buildman')
839- response = urllib2.urlopen(url)
840+ response = urllib.request.urlopen(url)
841 fname = os.path.join(tmpdir, leaf)
842 fd = open(fname, 'wb')
843 meta = response.info()
844- size = int(meta.getheaders('Content-Length')[0])
845+ size = int(meta.get('Content-Length'))
846 done = 0
847 block_size = 1 << 16
848 status = ''
849@@ -504,19 +505,19 @@ class Toolchains:
850 while True:
851 buffer = response.read(block_size)
852 if not buffer:
853- print chr(8) * (len(status) + 1), '\r',
854+ print(chr(8) * (len(status) + 1), '\r', end=' ')
855 break
856
857 done += len(buffer)
858 fd.write(buffer)
859- status = r'%10d MiB [%3d%%]' % (done / 1024 / 1024,
860- done * 100 / size)
861+ status = r'%10d MiB [%3d%%]' % (done // 1024 // 1024,
862+ done * 100 // size)
863 status = status + chr(8) * (len(status) + 1)
864- print status,
865+ print(status, end=' ')
866 sys.stdout.flush()
867 fd.close()
868 if done != size:
869- print 'Error, failed to download'
870+ print('Error, failed to download')
871 os.remove(fname)
872 fname = None
873 return tmpdir, fname
874@@ -565,11 +566,11 @@ class Toolchains:
875 """
876 # Fist get the URL for this architecture
877 col = terminal.Color()
878- print col.Color(col.BLUE, "Downloading toolchain for arch '%s'" % arch)
879+ print(col.Color(col.BLUE, "Downloading toolchain for arch '%s'" % arch))
880 url = self.LocateArchUrl(arch)
881 if not url:
882- print ("Cannot find toolchain for arch '%s' - use 'list' to list" %
883- arch)
884+ print(("Cannot find toolchain for arch '%s' - use 'list' to list" %
885+ arch))
886 return 2
887 home = os.environ['HOME']
888 dest = os.path.join(home, '.buildman-toolchains')
889@@ -580,28 +581,28 @@ class Toolchains:
890 tmpdir, tarfile = self.Download(url)
891 if not tarfile:
892 return 1
893- print col.Color(col.GREEN, 'Unpacking to: %s' % dest),
894+ print(col.Color(col.GREEN, 'Unpacking to: %s' % dest), end=' ')
895 sys.stdout.flush()
896 path = self.Unpack(tarfile, dest)
897 os.remove(tarfile)
898 os.rmdir(tmpdir)
899- print
900+ print()
901
902 # Check that the toolchain works
903- print col.Color(col.GREEN, 'Testing')
904+ print(col.Color(col.GREEN, 'Testing'))
905 dirpath = os.path.join(dest, path)
906 compiler_fname_list = self.ScanPath(dirpath, True)
907 if not compiler_fname_list:
908- print 'Could not locate C compiler - fetch failed.'
909+ print('Could not locate C compiler - fetch failed.')
910 return 1
911 if len(compiler_fname_list) != 1:
912- print col.Color(col.RED, 'Warning, ambiguous toolchains: %s' %
913- ', '.join(compiler_fname_list))
914+ print(col.Color(col.RED, 'Warning, ambiguous toolchains: %s' %
915+ ', '.join(compiler_fname_list)))
916 toolchain = Toolchain(compiler_fname_list[0], True, True)
917
918 # Make sure that it will be found by buildman
919 if not self.TestSettingsHasPath(dirpath):
920- print ("Adding 'download' to config file '%s'" %
921- bsettings.config_fname)
922+ print(("Adding 'download' to config file '%s'" %
923+ bsettings.config_fname))
924 bsettings.SetItem('toolchain', 'download', '%s/*/*' % dest)
925 return 0
926--
9272.24.0
928
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Adjust-command-to-return-strings-instead-of-b.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Adjust-command-to-return-strings-instead-of-b.patch
deleted file mode 100644
index 4c4f7acb..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Adjust-command-to-return-strings-instead-of-b.patch
+++ /dev/null
@@ -1,228 +0,0 @@
1From 3b3e3c0f6c261a8c9f989d437dc261ba84467d4f Mon Sep 17 00:00:00 2001
2From: Simon Glass <sjg@chromium.org>
3Date: Thu, 31 Oct 2019 07:42:50 -0600
4Subject: [PATCH] patman: Adjust 'command' to return strings instead of bytes
5
6At present all the 'command' methods return bytes. Most of the time we
7actually want strings, so change this. We still need to keep the internal
8representation as bytes since otherwise unicode strings might break over
9a read() boundary (e.g. 4KB), causing errors. But we can convert the end
10result to strings.
11
12Add a 'binary' parameter to cover the few cases where bytes are needed.
13
14Upstream-Status: Backport
15
16Signed-off-by: Simon Glass <sjg@chromium.org>
17---
18 tools/binman/cbfs_util_test.py | 2 +-
19 tools/binman/ftest.py | 2 +-
20 tools/patman/command.py | 31 +++++++++++++++++++++++--------
21 tools/patman/tools.py | 29 +++++++++++++++++++++--------
22 4 files changed, 46 insertions(+), 18 deletions(-)
23
24diff --git a/tools/binman/cbfs_util_test.py b/tools/binman/cbfs_util_test.py
25index 772c794ece..ddc2e09e35 100755
26--- a/tools/binman/cbfs_util_test.py
27+++ b/tools/binman/cbfs_util_test.py
28@@ -56,7 +56,7 @@ class TestCbfs(unittest.TestCase):
29 cls.have_lz4 = True
30 try:
31 tools.Run('lz4', '--no-frame-crc', '-c',
32- tools.GetInputFilename('u-boot.bin'))
33+ tools.GetInputFilename('u-boot.bin'), binary=True)
34 except:
35 cls.have_lz4 = False
36
37--- a/tools/binman/ftest.py
38+++ b/tools/binman/ftest.py
39@@ -151,7 +151,7 @@ class TestFunctional(unittest.TestCase):
40 self.have_lz4 = True
41 try:
42 tools.Run('lz4', '--no-frame-crc', '-c',
43- os.path.join(self._indir, 'u-boot.bin'))
44+ os.path.join(self._indir, 'u-boot.bin'), binary=True)
45 except:
46 self.have_lz4 = False
47
48diff --git a/tools/patman/command.py b/tools/patman/command.py
49index 16299f3f5b..5fbd2c4a3e 100644
50--- a/tools/patman/command.py
51+++ b/tools/patman/command.py
52@@ -4,6 +4,7 @@
53
54 import os
55 import cros_subprocess
56+import tools
57
58 """Shell command ease-ups for Python."""
59
60@@ -31,6 +32,13 @@ class CommandResult:
61 self.return_code = return_code
62 self.exception = exception
63
64+ def ToOutput(self, binary):
65+ if not binary:
66+ self.stdout = tools.ToString(self.stdout)
67+ self.stderr = tools.ToString(self.stderr)
68+ self.combined = tools.ToString(self.combined)
69+ return self
70+
71
72 # This permits interception of RunPipe for test purposes. If it is set to
73 # a function, then that function is called with the pipe list being
74@@ -41,7 +49,7 @@ test_result = None
75
76 def RunPipe(pipe_list, infile=None, outfile=None,
77 capture=False, capture_stderr=False, oneline=False,
78- raise_on_error=True, cwd=None, **kwargs):
79+ raise_on_error=True, cwd=None, binary=False, **kwargs):
80 """
81 Perform a command pipeline, with optional input/output filenames.
82
83@@ -67,7 +75,7 @@ def RunPipe(pipe_list, infile=None, outfile=None,
84 else:
85 return test_result
86 # No result: fall through to normal processing
87- result = CommandResult()
88+ result = CommandResult(b'', b'', b'')
89 last_pipe = None
90 pipeline = list(pipe_list)
91 user_pipestr = '|'.join([' '.join(pipe) for pipe in pipe_list])
92@@ -93,29 +101,36 @@ def RunPipe(pipe_list, infile=None, outfile=None,
93 if raise_on_error:
94 raise Exception("Error running '%s': %s" % (user_pipestr, str))
95 result.return_code = 255
96- return result
97+ return result.ToOutput(binary)
98
99 if capture:
100 result.stdout, result.stderr, result.combined = (
101 last_pipe.CommunicateFilter(None))
102 if result.stdout and oneline:
103- result.output = result.stdout.rstrip('\r\n')
104+ result.output = result.stdout.rstrip(b'\r\n')
105 result.return_code = last_pipe.wait()
106 else:
107 result.return_code = os.waitpid(last_pipe.pid, 0)[1]
108 if raise_on_error and result.return_code:
109 raise Exception("Error running '%s'" % user_pipestr)
110- return result
111+ return result.ToOutput(binary)
112
113 def Output(*cmd, **kwargs):
114 kwargs['raise_on_error'] = kwargs.get('raise_on_error', True)
115 return RunPipe([cmd], capture=True, **kwargs).stdout
116
117 def OutputOneLine(*cmd, **kwargs):
118+ """Run a command and output it as a single-line string
119+
120+ The command us expected to produce a single line of output
121+
122+ Returns:
123+ String containing output of command
124+ """
125 raise_on_error = kwargs.pop('raise_on_error', True)
126- return (RunPipe([cmd], capture=True, oneline=True,
127- raise_on_error=raise_on_error,
128- **kwargs).stdout.strip())
129+ result = RunPipe([cmd], capture=True, oneline=True,
130+ raise_on_error=raise_on_error, **kwargs).stdout.strip()
131+ return result
132
133 def Run(*cmd, **kwargs):
134 return RunPipe([cmd], **kwargs).stdout
135diff --git a/tools/patman/tools.py b/tools/patman/tools.py
136index 4a7fcdad21..3feddb292f 100644
137--- a/tools/patman/tools.py
138+++ b/tools/patman/tools.py
139@@ -186,7 +186,7 @@ def PathHasFile(path_spec, fname):
140 return True
141 return False
142
143-def Run(name, *args):
144+def Run(name, *args, **kwargs):
145 """Run a tool with some arguments
146
147 This runs a 'tool', which is a program used by binman to process files and
148@@ -201,13 +201,14 @@ def Run(name, *args):
149 CommandResult object
150 """
151 try:
152+ binary = kwargs.get('binary')
153 env = None
154 if tool_search_paths:
155 env = dict(os.environ)
156 env['PATH'] = ':'.join(tool_search_paths) + ':' + env['PATH']
157 all_args = (name,) + args
158 result = command.RunPipe([all_args], capture=True, capture_stderr=True,
159- env=env, raise_on_error=False)
160+ env=env, raise_on_error=False, binary=binary)
161 if result.return_code:
162 raise Exception("Error %d running '%s': %s" %
163 (result.return_code,' '.join(all_args),
164@@ -375,7 +376,7 @@ def ToBytes(string):
165 """Convert a str type into a bytes type
166
167 Args:
168- string: string to convert value
169+ string: string to convert
170
171 Returns:
172 Python 3: A bytes type
173@@ -385,6 +386,18 @@ def ToBytes(string):
174 return string.encode('utf-8')
175 return string
176
177+def ToString(bval):
178+ """Convert a bytes type into a str type
179+
180+ Args:
181+ bval: bytes value to convert
182+
183+ Returns:
184+ Python 3: A bytes type
185+ Python 2: A string type
186+ """
187+ return bval.decode('utf-8')
188+
189 def Compress(indata, algo, with_header=True):
190 """Compress some data using a given algorithm
191
192@@ -406,14 +419,14 @@ def Compress(indata, algo, with_header=True):
193 fname = GetOutputFilename('%s.comp.tmp' % algo)
194 WriteFile(fname, indata)
195 if algo == 'lz4':
196- data = Run('lz4', '--no-frame-crc', '-c', fname)
197+ data = Run('lz4', '--no-frame-crc', '-c', fname, binary=True)
198 # cbfstool uses a very old version of lzma
199 elif algo == 'lzma':
200 outfname = GetOutputFilename('%s.comp.otmp' % algo)
201 Run('lzma_alone', 'e', fname, outfname, '-lc1', '-lp0', '-pb0', '-d8')
202 data = ReadFile(outfname)
203 elif algo == 'gzip':
204- data = Run('gzip', '-c', fname)
205+ data = Run('gzip', '-c', fname, binary=True)
206 else:
207 raise ValueError("Unknown algorithm '%s'" % algo)
208 if with_header:
209@@ -446,13 +459,13 @@ def Decompress(indata, algo, with_header=True):
210 with open(fname, 'wb') as fd:
211 fd.write(indata)
212 if algo == 'lz4':
213- data = Run('lz4', '-dc', fname)
214+ data = Run('lz4', '-dc', fname, binary=True)
215 elif algo == 'lzma':
216 outfname = GetOutputFilename('%s.decomp.otmp' % algo)
217 Run('lzma_alone', 'd', fname, outfname)
218- data = ReadFile(outfname)
219+ data = ReadFile(outfname, binary=True)
220 elif algo == 'gzip':
221- data = Run('gzip', '-cd', fname)
222+ data = Run('gzip', '-cd', fname, binary=True)
223 else:
224 raise ValueError("Unknown algorithm '%s'" % algo)
225 return data
226--
2272.24.0
228
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Drop-binary-parameter.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Drop-binary-parameter.patch
deleted file mode 100644
index cee88472..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Drop-binary-parameter.patch
+++ /dev/null
@@ -1,105 +0,0 @@
1From 3b1c0b09c99bfd30355a6ba87a15e9d408a51109 Mon Sep 17 00:00:00 2001
2From: Simon Glass <sjg@chromium.org>
3Date: Sat, 24 Aug 2019 07:22:41 -0600
4Subject: [PATCH] patman: Drop binary parameter
5
6Since cros_subprocess use bytestrings now, this feature not needed. Drop
7it.
8
9Upstream-Status: Backport
10
11Signed-off-by: Simon Glass <sjg@chromium.org>
12---
13 tools/patman/cros_subprocess.py | 3 +--
14 tools/patman/tools.py | 15 +++++++--------
15 2 files changed, 8 insertions(+), 10 deletions(-)
16
17diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py
18index 06be64cc2c..0f0d60dfb7 100644
19--- a/tools/patman/cros_subprocess.py
20+++ b/tools/patman/cros_subprocess.py
21@@ -54,7 +54,7 @@ class Popen(subprocess.Popen):
22 """
23
24 def __init__(self, args, stdin=None, stdout=PIPE_PTY, stderr=PIPE_PTY,
25- shell=False, cwd=None, env=None, binary=False, **kwargs):
26+ shell=False, cwd=None, env=None, **kwargs):
27 """Cut-down constructor
28
29 Args:
30@@ -72,7 +72,6 @@ class Popen(subprocess.Popen):
31 """
32 stdout_pty = None
33 stderr_pty = None
34- self.binary = binary
35
36 if stdout == PIPE_PTY:
37 stdout_pty = pty.openpty()
38diff --git a/tools/patman/tools.py b/tools/patman/tools.py
39index 0d4705db76..97441ca796 100644
40--- a/tools/patman/tools.py
41+++ b/tools/patman/tools.py
42@@ -186,7 +186,7 @@ def PathHasFile(path_spec, fname):
43 return True
44 return False
45
46-def Run(name, *args, **kwargs):
47+def Run(name, *args):
48 """Run a tool with some arguments
49
50 This runs a 'tool', which is a program used by binman to process files and
51@@ -196,7 +196,6 @@ def Run(name, *args, **kwargs):
52 Args:
53 name: Command name to run
54 args: Arguments to the tool
55- kwargs: Options to pass to command.run()
56
57 Returns:
58 CommandResult object
59@@ -206,8 +205,8 @@ def Run(name, *args, **kwargs):
60 if tool_search_paths:
61 env = dict(os.environ)
62 env['PATH'] = ':'.join(tool_search_paths) + ':' + env['PATH']
63- return command.Run(name, *args, capture=True,
64- capture_stderr=True, env=env, **kwargs)
65+ return command.Run(name, *args, capture=True, capture_stderr=True,
66+ env=env)
67 except:
68 if env and not PathHasFile(env['PATH'], name):
69 msg = "Please install tool '%s'" % name
70@@ -401,14 +400,14 @@ def Compress(indata, algo, with_header=True):
71 fname = GetOutputFilename('%s.comp.tmp' % algo)
72 WriteFile(fname, indata)
73 if algo == 'lz4':
74- data = Run('lz4', '--no-frame-crc', '-c', fname, binary=True)
75+ data = Run('lz4', '--no-frame-crc', '-c', fname)
76 # cbfstool uses a very old version of lzma
77 elif algo == 'lzma':
78 outfname = GetOutputFilename('%s.comp.otmp' % algo)
79 Run('lzma_alone', 'e', fname, outfname, '-lc1', '-lp0', '-pb0', '-d8')
80 data = ReadFile(outfname)
81 elif algo == 'gzip':
82- data = Run('gzip', '-c', fname, binary=True)
83+ data = Run('gzip', '-c', fname)
84 else:
85 raise ValueError("Unknown algorithm '%s'" % algo)
86 if with_header:
87@@ -441,13 +440,13 @@ def Decompress(indata, algo, with_header=True):
88 with open(fname, 'wb') as fd:
89 fd.write(indata)
90 if algo == 'lz4':
91- data = Run('lz4', '-dc', fname, binary=True)
92+ data = Run('lz4', '-dc', fname)
93 elif algo == 'lzma':
94 outfname = GetOutputFilename('%s.decomp.otmp' % algo)
95 Run('lzma_alone', 'd', fname, outfname)
96 data = ReadFile(outfname)
97 elif algo == 'gzip':
98- data = Run('gzip', '-cd', fname, binary=True)
99+ data = Run('gzip', '-cd', fname)
100 else:
101 raise ValueError("Unknown algorithm '%s'" % algo)
102 return data
103--
1042.24.0
105
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Update-command.Run-to-handle-failure-better.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Update-command.Run-to-handle-failure-better.patch
deleted file mode 100644
index bd23c458..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-patman-Update-command.Run-to-handle-failure-better.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From 6eace398072a62e74f10f412ffadfe51b7402395 Mon Sep 17 00:00:00 2001
2From: Simon Glass <sjg@chromium.org>
3Date: Sat, 24 Aug 2019 07:22:42 -0600
4Subject: [PATCH] patman: Update command.Run() to handle failure better
5
6At present tools are not expected to fail. If they do an exception is
7raised but there is no detail about what went wrong. This makes it hard
8to debug if something does actually go wrong.
9
10Fix this by outputting both stderr and stdout on failure.
11
12Upstream-Status: Backport
13
14Signed-off-by: Simon Glass <sjg@chromium.org>
15---
16 tools/patman/tools.py | 10 ++++++++--
17 1 file changed, 8 insertions(+), 2 deletions(-)
18
19diff --git a/tools/patman/tools.py b/tools/patman/tools.py
20index 97441ca796..0952681579 100644
21--- a/tools/patman/tools.py
22+++ b/tools/patman/tools.py
23@@ -205,8 +205,14 @@ def Run(name, *args):
24 if tool_search_paths:
25 env = dict(os.environ)
26 env['PATH'] = ':'.join(tool_search_paths) + ':' + env['PATH']
27- return command.Run(name, *args, capture=True, capture_stderr=True,
28- env=env)
29+ all_args = (name,) + args
30+ result = command.RunPipe([all_args], capture=True, capture_stderr=True,
31+ env=env, raise_on_error=False)
32+ if result.return_code:
33+ raise Exception("Error %d running '%s': %s" %
34+ (result.return_code,' '.join(all_args),
35+ result.stderr))
36+ return result.stdout
37 except:
38 if env and not PathHasFile(env['PATH'], name):
39 msg = "Please install tool '%s'" % name
40--
412.24.0
42
diff --git a/recipes-bsp/u-boot/u-boot-qoriq/0001-pylibfdt-Convert-to-Python-3.patch b/recipes-bsp/u-boot/u-boot-qoriq/0001-pylibfdt-Convert-to-Python-3.patch
deleted file mode 100644
index e74609de..00000000
--- a/recipes-bsp/u-boot/u-boot-qoriq/0001-pylibfdt-Convert-to-Python-3.patch
+++ /dev/null
@@ -1,117 +0,0 @@
1From b4cf5f1df741e8781bed6149291823cd1a4b8baa Mon Sep 17 00:00:00 2001
2From: Simon Glass <sjg@chromium.org>
3Date: Thu, 31 Oct 2019 07:42:59 -0600
4Subject: [PATCH] pylibfdt: Convert to Python 3
5
6Build this swig module with Python 3.
7
8Upstream-Status: Backport
9
10Signed-off-by: Simon Glass <sjg@chromium.org>
11---
12 scripts/dtc/pylibfdt/Makefile | 2 +-
13 scripts/dtc/pylibfdt/libfdt.i_shipped | 2 +-
14 scripts/dtc/pylibfdt/setup.py | 2 +-
15 tools/binman/entry.py | 16 ++--------------
16 tools/binman/entry_test.py | 15 ---------------
17 5 files changed, 5 insertions(+), 32 deletions(-)
18
19diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
20index 15e66ad44d..42342c75bb 100644
21--- a/scripts/dtc/pylibfdt/Makefile
22+++ b/scripts/dtc/pylibfdt/Makefile
23@@ -21,7 +21,7 @@ quiet_cmd_pymod = PYMOD $@
24 CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
25 SOURCES="$(PYLIBFDT_srcs)" \
26 SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \
27- $(PYTHON2) $< --quiet build_ext --inplace
28+ $(PYTHON3) $< --quiet build_ext --inplace
29
30 $(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE
31 $(call if_changed,pymod)
32diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped
33index 76e61e98bd..53b70f8f5e 100644
34--- a/scripts/dtc/pylibfdt/libfdt.i_shipped
35+++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
36@@ -624,7 +624,7 @@ class Fdt(FdtRo):
37 Raises:
38 FdtException if no parent found or other error occurs
39 """
40- val = val.encode('utf-8') + '\0'
41+ val = val.encode('utf-8') + b'\0'
42 return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name,
43 val, len(val)), quiet)
44
45diff --git a/scripts/dtc/pylibfdt/setup.py b/scripts/dtc/pylibfdt/setup.py
46index 4f7cf042bf..992cdec30f 100755
47--- a/scripts/dtc/pylibfdt/setup.py
48+++ b/scripts/dtc/pylibfdt/setup.py
49@@ -1,4 +1,4 @@
50-#!/usr/bin/env python2
51+#!/usr/bin/env python3
52
53 """
54 setup.py file for SWIG libfdt
55diff --git a/tools/binman/entry.py b/tools/binman/entry.py
56index 409c0dca93..5bf5be4794 100644
57--- a/tools/binman/entry.py
58+++ b/tools/binman/entry.py
59@@ -7,16 +7,7 @@
60 from __future__ import print_function
61
62 from collections import namedtuple
63-
64-# importlib was introduced in Python 2.7 but there was a report of it not
65-# working in 2.7.12, so we work around this:
66-# http://lists.denx.de/pipermail/u-boot/2016-October/269729.html
67-try:
68- import importlib
69- have_importlib = True
70-except:
71- have_importlib = False
72-
73+import importlib
74 import os
75 import sys
76
77@@ -119,10 +110,7 @@ class Entry(object):
78 old_path = sys.path
79 sys.path.insert(0, os.path.join(our_path, 'etype'))
80 try:
81- if have_importlib:
82- module = importlib.import_module(module_name)
83- else:
84- module = __import__(module_name)
85+ module = importlib.import_module(module_name)
86 except ImportError as e:
87 raise ValueError("Unknown entry type '%s' in node '%s' (expected etype/%s.py, error '%s'" %
88 (etype, node_path, module_name, e))
89diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
90index 13f5864516..277e10b585 100644
91--- a/tools/binman/entry_test.py
92+++ b/tools/binman/entry_test.py
93@@ -39,21 +39,6 @@ class TestEntry(unittest.TestCase):
94 else:
95 import entry
96
97- def test1EntryNoImportLib(self):
98- """Test that we can import Entry subclassess successfully"""
99- sys.modules['importlib'] = None
100- global entry
101- self._ReloadEntry()
102- entry.Entry.Create(None, self.GetNode(), 'u-boot')
103- self.assertFalse(entry.have_importlib)
104-
105- def test2EntryImportLib(self):
106- del sys.modules['importlib']
107- global entry
108- self._ReloadEntry()
109- entry.Entry.Create(None, self.GetNode(), 'u-boot-spl')
110- self.assertTrue(entry.have_importlib)
111-
112 def testEntryContents(self):
113 """Test the Entry bass class"""
114 import entry
115--
1162.24.0
117
diff --git a/recipes-bsp/u-boot/u-boot-qoriq_2019.10.bb b/recipes-bsp/u-boot/u-boot-qoriq_2020.04.bb
index 571fadb7..57f27803 100644
--- a/recipes-bsp/u-boot/u-boot-qoriq_2019.10.bb
+++ b/recipes-bsp/u-boot/u-boot-qoriq_2020.04.bb
@@ -14,17 +14,8 @@ LIC_FILES_CHKSUM = " \
14 file://Licenses/lgpl-2.1.txt;md5=4fbd65380cdd255951079008b364516c \ 14 file://Licenses/lgpl-2.1.txt;md5=4fbd65380cdd255951079008b364516c \
15" 15"
16 16
17SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/u-boot;nobranch=1 \ 17SRC_URI = "git://source.codeaurora.org/external/qoriq/qoriq-components/u-boot;nobranch=1"
18 file://0001-patman-Drop-binary-parameter.patch \ 18SRCREV= "f46a944f715f284aff1d42c009680ffe0be4058f"
19 file://0001-patman-Update-command.Run-to-handle-failure-better.patch \
20 file://0001-patman-Adjust-command-to-return-strings-instead-of-b.patch \
21 file://0001-pylibfdt-Convert-to-Python-3.patch \
22 file://0001-binman-Convert-a-few-tests-to-Python-3.patch \
23 file://0001-binman-Move-to-use-Python-3.patch \
24 file://0001-buildman-Convert-to-Python-3.patch \
25 file://0001-Remove-redundant-YYLOC-global-declaration.patch \
26"
27SRCREV= "1e55b2f9e7f56b76569089b9e950f49c1579580e"
28 19
29S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"
30B = "${WORKDIR}/build" 21B = "${WORKDIR}/build"