Allow to define particular stop character for autoboot
authorPiotr Dymacz <pepe2k@gmail.com>
Tue, 15 Dec 2015 11:45:53 +0000 (12:45 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Tue, 15 Dec 2015 11:45:53 +0000 (12:45 +0100)
This would be useful for boards which share serial console with some
other device, like MCU, which may unintentionally interrupt boot process.

It is fast and simple solution, for future we should restore functionality
from original U-Boot code, with string stop sequences.

u-boot/common/main.c

index d5ff9509184d0c1ca95ba6594a6584ea85f076dc..42f3d57d2d37e859b37aa0bb1cfb8cb153063058 100644 (file)
@@ -58,6 +58,9 @@ static char tab_seq[] = "        "; /* used to expand TABs    */
  */
 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
 static __inline__ int abortboot(int bootdelay){
+#ifdef CONFIG_AUTOBOOT_STOP_CHAR
+       char stopc;
+#endif
        int abort = 0;
 
 #ifdef CONFIG_SILENT_CONSOLE
@@ -85,6 +88,15 @@ static __inline__ int abortboot(int bootdelay){
 
                                /* we got a key press   */
                                if(tstc()){
+#ifdef CONFIG_AUTOBOOT_STOP_CHAR
+                                       stopc = getc();
+                                       if (stopc == CONFIG_AUTOBOOT_STOP_CHAR) {
+                                               abort = 1;
+                                               bootdelay = 0;
+
+                                               break;
+                                       }
+#else
                                        /* don't auto boot      */
                                        abort = 1;
                                        /* no more delay        */
@@ -92,6 +104,7 @@ static __inline__ int abortboot(int bootdelay){
                                        /* consume input        */
                                        (void) getc();
                                        break;
+#endif /* CONFIG_AUTOBOOT_STOP_CHAR */
                                }
                                udelay(10000);
                        }