:: commit 44a5f4751680794c659be2b16c44d71d43605013

mintsuki <mintsuki@protonmail.com> — 2020-03-28 01:52

parents: a234da8deb

Add timeout config option

diff --git a/src/main.c b/src/main.c
index 90557776..3b22f19a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -57,7 +57,7 @@ void main(int boot_drive) {
         }
     }
 
-    int drive, part;
+    int drive, part, timeout;
     char path[128], cmdline[128], proto[64];
 
     if (config_loaded) {
@@ -68,6 +68,11 @@ void main(int boot_drive) {
         } else {
             drive = (int)strtoui(buf);
         }
+        if (!config_get_value(buf, 64, (void*)0x100000, "TIMEOUT")) {
+            timeout = 5;
+        } else {
+            timeout = (int)strtoui(buf);
+        }
         config_get_value(buf, 32, (void*)0x100000, "KERNEL_PARTITION");
         part = (int)strtoui(buf);
         config_get_value(path, 128, (void*)0x100000, "KERNEL_PATH");
@@ -79,7 +84,7 @@ void main(int boot_drive) {
     }
 
     print("\n");
-    for (int i = 3; i; i--) {
+    for (int i = timeout; i; i--) {
         print("\rBooting in %d (press any key to edit command line)...", i);
         if (pit_sleep_and_quit_on_keypress(18)) {
             print("\n\n> ");
diff --git a/test/qloader2.cfg b/test/qloader2.cfg
index 8becf100..c8083102 100644
--- a/test/qloader2.cfg
+++ b/test/qloader2.cfg
@@ -2,3 +2,4 @@ KERNEL_PARTITION=0
 KERNEL_PATH=test.elf
 KERNEL_PROTO=stivale
 KERNEL_CMDLINE=none
+TIMEOUT=0
tab: 248 wrap: offon