diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2012-02-01 10:36:12 +0100 |
---|---|---|
committer | Thomas Huth <thuth@linux.vnet.ibm.com> | 2012-02-14 09:01:46 +0100 |
commit | 2eed580261248f900571cab1d1f0c14c3ccc233a (patch) | |
tree | b58f784498e67098910f156792ffabe3ac47b7c8 | |
parent | 0bede83ced7963a1732b72f77bd2850bcdfa064e (diff) | |
download | SLOF-2eed580261248f900571cab1d1f0c14c3ccc233a.zip SLOF-2eed580261248f900571cab1d1f0c14c3ccc233a.tar.gz SLOF-2eed580261248f900571cab1d1f0c14c3ccc233a.tar.bz2 |
Fixed disk-label partition parsing to also work with single partition arguments
The parse-partition function was not able to deal with arguments that only
contained a partition number (without comma), e.g. "boot disk:1" failed.
Also limited the size that we load from a PReP partition in case the hard disk
is smaller than max-prep-partition-blocks.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
-rw-r--r-- | slof/fs/base.fs | 4 | ||||
-rw-r--r-- | slof/fs/envvar.fs | 4 | ||||
-rw-r--r-- | slof/fs/packages/disk-label.fs | 27 |
3 files changed, 26 insertions, 9 deletions
diff --git a/slof/fs/base.fs b/slof/fs/base.fs index 4bd0b4d..da990f3 100644 --- a/slof/fs/base.fs +++ b/slof/fs/base.fs @@ -156,6 +156,10 @@ CONSTANT <2constant> \ Duplicate string and replace \ with / : \-to-/ ( str len -- str' len ) strdup 2dup [char] \ [char] / replace-char ; +: isdigit ( char -- true | false ) + 30 39 between +; + : // dup >r 1- + r> / ; \ division, round up : c@+ ( adr -- c adr' ) dup c@ swap char+ ; diff --git a/slof/fs/envvar.fs b/slof/fs/envvar.fs index 70223cc..f8d7946 100644 --- a/slof/fs/envvar.fs +++ b/slof/fs/envvar.fs @@ -66,10 +66,6 @@ wordlist CONSTANT envvars string=ci or or ; -: isdigit ( char -- true | false ) - 30 39 between -; - : test-int ( param len -- true | false ) drop c@ isdigit if true else false then ; diff --git a/slof/fs/packages/disk-label.fs b/slof/fs/packages/disk-label.fs index 065f32c..236be87 100644 --- a/slof/fs/packages/disk-label.fs +++ b/slof/fs/packages/disk-label.fs @@ -247,7 +247,8 @@ CONSTANT /partition-entry partition find-dos-partition IF ( offset count active? id ) - 2drop drop + 2drop + to part-size block-size * to part-offset true ELSE @@ -394,14 +395,25 @@ CONSTANT /partition-entry : parse-partition ( -- okay? ) 0 to partition 0 to part-offset + 0 to part-size my-args to args-len to args - \ Fix up the "0" thing yaboot does. - args-len 1 = IF args c@ [char] 0 = IF 0 to args-len THEN THEN + debug-disk-label? IF + cr ." disk-label parse-partition: my-args=" my-args type cr + THEN + + \ Called without arguments? + args-len 0 = IF true EXIT THEN \ Check for "full disk" arguments. - my-args [char] , findchar 0= IF true EXIT THEN drop \ no comma + my-args [char] , findchar 0= IF \ no comma? + args c@ isdigit not IF \ ... and not a partition number? + true EXIT \ ... then it's not a partition we can parse + THEN + ELSE + drop + THEN my-args [char] , split to args-len to args dup 0= IF 2drop true EXIT THEN \ no first argument @@ -509,7 +521,12 @@ CONSTANT /partition-entry ELSE partition IF 0 0 seek drop - max-prep-partition-blocks 200 * read + part-size IF + part-size max-prep-partition-blocks min \ Load size + ELSE + max-prep-partition-blocks + THEN + 200 * read ELSE has-iso9660-filesystem IF dup load-chrp-boot-file ?dup 0 > IF nip EXIT THEN |