Use root.fs on qemu as well

We had lots of duplication of code between root.fs and fdt.fs

The reason we didn't use root.fs in the first place is that it tried
to create the root node and the chosen node which we already have via
the fdt.

Instead, modify root.fs to check for their presence and only "extend"
them in that case.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Benjamin Herrenschmidt 2013-08-05 10:52:29 +10:00
parent 2ecfaa4a86
commit ec5c9e8bf4
3 changed files with 38 additions and 56 deletions

View File

@ -109,10 +109,14 @@ d# 512000000 VALUE tb-frequency \ default value - needed for "ms" to work
#include <scsi-loader.fs>
360 cp
340 cp
#include "fdt.fs"
360 cp
#include <root.fs>
370 cp
\ Grab rtas from qemu

View File

@ -361,43 +361,3 @@ fdt-claim-reserve
;
s" /" find-node fdt-fix-phandles
\ Remaining bits from root.fs
defer (client-exec)
defer client-exec
\ defined in slof/fs/client.fs
defer callback
defer continue-client
: set-chosen ( prop len name len -- )
s" /chosen" find-node set-property ;
: get-chosen ( name len -- [ prop len ] success )
s" /chosen" find-node get-property 0= ;
" /" find-device
new-device
s" aliases" device-name
finish-device
new-device
s" options" device-name
finish-device
new-device
s" openprom" device-name
s" BootROM" device-type
finish-device
new-device
#include <packages.fs>
finish-device
: open true ;
: close ;
device-end

View File

@ -25,33 +25,51 @@ defer continue-client
: get-chosen ( name len -- [ prop len ] success )
s" /chosen" find-node get-property 0= ;
new-device
s" /" device-name
new-device
\ Look for an exising root, create one if needed
" /" find-node dup 0= IF
drop
new-device
s" /" device-name
ELSE
extend-device
THEN
\ Create /chosen if it doesn't exist
" /chosen" find-node dup 0= IF
drop
new-device
s" chosen" device-name
s" " encode-string s" bootargs" property
s" " encode-string s" bootpath" property
finish-device
ELSE
extend-device
THEN
s" " encode-string s" bootargs" property
s" " encode-string s" bootpath" property
finish-device
new-device
\ Create /aliases
new-device
s" aliases" device-name
finish-device
finish-device
new-device
\ Create /options
new-device
s" options" device-name
finish-device
finish-device
new-device
\ Create /openprom
new-device
s" openprom" device-name
s" BootROM" device-type
finish-device
finish-device
new-device
\ Create /packages
new-device
#include <packages.fs>
finish-device
finish-device
: open true ;
: close ;
\ Finish root
finish-device