[SLOF] [PATCH v2] qemu-bootlist: Take the "-boot strict=off" setting properly into account

Thomas Huth thuth at redhat.com
Wed Mar 1 19:56:13 AEDT 2017


SLOF currently completely ignores the "-boot strict=off" setting from
QEMU as soon as the user specified one of the devices with a "bootindex"
parameter. We should continue booting from other devices if strict
booting is disabled.

Signed-off-by: Thomas Huth <thuth at redhat.com>
---
 v2: Moved the code for the check into a separate word, as suggested
     by Segher.

 board-qemu/slof/qemu-bootlist.fs | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/board-qemu/slof/qemu-bootlist.fs b/board-qemu/slof/qemu-bootlist.fs
index 4778e16..60dd29d 100644
--- a/board-qemu/slof/qemu-bootlist.fs
+++ b/board-qemu/slof/qemu-bootlist.fs
@@ -25,15 +25,25 @@ defer add-boot-device
     2drop
 ;
 
+\ strict boot order is enabled if the last word in qemu,boot-list is "HALT".
+: is-strict-boot?  ( bl-str bl-len -- strict? )
+    dup 4 > IF
+        + 5 - 5 s"  HALT" str=
+    ELSE
+        s" HALT" str=
+    THEN
+;
+
 : qemu-read-bootlist ( -- )
    \ See if QEMU has set exact boot device list
    " qemu,boot-list" get-chosen IF
-        s" boot-device" $setenv
-        EXIT
+      1-                                 \ Ignore the trailing NUL character
+      2dup set-boot-device
+      is-strict-boot? IF EXIT THEN
+   ELSE
+      0 0 set-boot-device
    THEN
 
-   0 0 set-boot-device
-
    " qemu,boot-device" get-chosen not IF
       \ No boot list set from qemu, so check nvram
       " boot-device" evaluate swap drop 0= IF
-- 
1.8.3.1



More information about the SLOF mailing list