diff mbox

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

Message ID 1488358573-23718-1-git-send-email-thuth@redhat.com
State Rejected
Headers show

Commit Message

Thomas Huth March 1, 2017, 8:56 a.m. UTC
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@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(-)

Comments

Alexey Kardashevskiy March 3, 2017, 2:22 a.m. UTC | #1
On 01/03/17 19:56, Thomas Huth wrote:
> 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@redhat.com>

Thanks, applied.

> ---
>  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
>
diff mbox

Patch

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