[U-Boot] [PATCH 1/3] test/py: Handle the banner being printed after relocation

Simon Glass sjg at chromium.org
Thu Jul 27 15:31:02 UTC 2017


If CONFIG_DISPLAY_BOARDINFO_LATE is enabled, U-Boot displays the banner
again after relocation so that it is visible on the video display. Detect
this and allow it.

Note: This patch is only an interim fix. If it is applied we should
consider reverting it later since it is not needed if U-Boot is working
correctly.

Signed-off-by: Simon Glass <sjg at chromium.org>
Fixes: b089538 (Allow displaying the U-Boot banner on a video display)
---

 test/py/u_boot_console_base.py | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/test/py/u_boot_console_base.py b/test/py/u_boot_console_base.py
index b1f474236e..3ea6b6a5d0 100644
--- a/test/py/u_boot_console_base.py
+++ b/test/py/u_boot_console_base.py
@@ -355,12 +355,31 @@ class ConsoleBase(object):
             self.u_boot_version_string = self.p.after
             while True:
                 m = self.p.expect([self.prompt_compiled,
-                    pattern_stop_autoboot_prompt] + self.bad_patterns)
+                    pattern_stop_autoboot_prompt, pattern_u_boot_main_signon] +
+                    self.bad_patterns)
                 if m == 0:
                     break
                 if m == 1:
                     self.p.send(' ')
                     continue
+
+                # If CONFIG_DISPLAY_BOARDINFO_LATE is defined then we will
+                # display the banner again after relocation. See
+                # console_announce_r() for the implementation. The original
+                # banner has two blank lines before it but this one has none.
+                # We can use this to distinguish a repeat of the banner from
+                # a reset of the board. Here we fail if we see even a single
+                # empty line in the characters leading up to the banner.
+                if m == 2:
+                    before = self.p.before[-6:]
+                    blank_lines = 0
+                    for ch in before:
+                        if ch == '\n':
+                            blank_lines += 1
+                        elif ch != '\r':
+                            blank_lines = 0
+                    if blank_lines <= 1:
+                        continue
                 raise Exception('Bad pattern found on console: ' +
                                 self.bad_pattern_ids[m - 2])
             self.at_prompt = True
-- 
2.14.0.rc0.400.g1c36432dff-goog



More information about the U-Boot mailing list