diff -Nru slof-20151103+dfsg/debian/changelog slof-20151103+dfsg/debian/changelog --- slof-20151103+dfsg/debian/changelog 2016-01-29 18:39:21.000000000 +0000 +++ slof-20151103+dfsg/debian/changelog 2017-12-18 13:13:05.000000000 +0000 @@ -1,3 +1,11 @@ +slof (20151103+dfsg-1ubuntu1.1) xenial; urgency=medium + + * Fix boot with more than 16 disks (LP: #1734856) + - d/p/0001-boot-do-not-concatenate-bootdev.patch + - d/p/0002-boot-use-a-temporary-bootdev-buf.patch + + -- Christian Ehrhardt Mon, 18 Dec 2017 14:12:32 +0100 + slof (20151103+dfsg-1ubuntu1) xenial; urgency=low * Merge from Debian unstable. Remaining changes: diff -Nru slof-20151103+dfsg/debian/patches/0001-boot-do-not-concatenate-bootdev.patch slof-20151103+dfsg/debian/patches/0001-boot-do-not-concatenate-bootdev.patch --- slof-20151103+dfsg/debian/patches/0001-boot-do-not-concatenate-bootdev.patch 1970-01-01 00:00:00.000000000 +0000 +++ slof-20151103+dfsg/debian/patches/0001-boot-do-not-concatenate-bootdev.patch 2017-12-18 13:11:52.000000000 +0000 @@ -0,0 +1,53 @@ +From 1e8f6e68d28132e70898bd4bd6f799b591c3bf2b Mon Sep 17 00:00:00 2001 +From: Nikunj A Dadhania +Date: Tue, 12 Dec 2017 11:07:12 +0530 +Subject: [PATCH 1/2] boot: do not concatenate bootdev + +We were concatenating the word " parse-load" and $bootdev list that was input to +evaluate. Open code EVALUATE work such that concatenation is not required. +"load" and "load-next" does not use $cat anymore. + +Reported here: https://github.com/qemu/SLOF/issues/3 + +Signed-off-by: Nikunj A Dadhania +Signed-off-by: Alexey Kardashevskiy + +Forwarded: no (backport) +Author: Christian Ehrhardt +Original-Author: Nikunj A Dadhania +Origin: upstream, https://git.qemu.org/?p=SLOF.git;a=commit;h=1e8f6e68d28132e70898bd4bd6f799b591c3bf2b +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1734856 +Last-Update: 2017-12-13 +--- + slof/fs/boot.fs | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/slof/fs/boot.fs b/slof/fs/boot.fs +index 1fd7439..5d41a0e 100644 +--- a/slof/fs/boot.fs ++++ b/slof/fs/boot.fs +@@ -221,11 +221,19 @@ defer go ( -- ) + ELSE + drop + THEN +- set-boot-args s" parse-load " $bootdev $cat strdup evaluate ++ set-boot-args ++ save-source -1 to source-id ++ $bootdev dup #ib ! span ! to ib ++ 0 >in ! ++ ['] parse-load catch restore-source throw + ; + + : load-next ( -- success ) \ Continue after go failed +- load-list 2@ ?dup IF s" parse-load " 2swap $cat strdup evaluate ++ load-list 2@ ?dup IF ++ save-source -1 to source-id ++ dup #ib ! span ! to ib ++ 0 >in ! ++ ['] parse-load catch restore-source throw + ELSE drop false THEN + ; + +-- +2.7.4 + diff -Nru slof-20151103+dfsg/debian/patches/0002-boot-use-a-temporary-bootdev-buf.patch slof-20151103+dfsg/debian/patches/0002-boot-use-a-temporary-bootdev-buf.patch --- slof-20151103+dfsg/debian/patches/0002-boot-use-a-temporary-bootdev-buf.patch 1970-01-01 00:00:00.000000000 +0000 +++ slof-20151103+dfsg/debian/patches/0002-boot-use-a-temporary-bootdev-buf.patch 2017-12-18 13:11:52.000000000 +0000 @@ -0,0 +1,102 @@ +From 80f74b855f2f67ae5ed45b0d32c57dce46585da7 Mon Sep 17 00:00:00 2001 +From: Nikunj A Dadhania +Date: Tue, 12 Dec 2017 11:07:13 +0530 +Subject: [PATCH 2/2] boot: use a temporary bootdev-buf + +The catpad size is 1K size, which can overflow easily with around 20 devices +having bootindex. Replace usage of $cat with a dynamically allocated buffer(16K) +here. Introduce new words to work on the buffer (allocate, free and +concatenate) + +Reported here: https://github.com/qemu/SLOF/issues/3 + +Signed-off-by: Nikunj A Dadhania +Signed-off-by: Alexey Kardashevskiy + +Forwarded: no (backport) +Author: Christian Ehrhardt +Original-Author: Nikunj A Dadhania +Origin: upstream, https://git.qemu.org/?p=SLOF.git;a=commit;h=80f74b855f2f67ae5ed45b0d32c57dce46585da7 +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1734856 +Last-Update: 2017-12-13 +--- + slof/fs/boot.fs | 41 ++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 38 insertions(+), 3 deletions(-) + +diff --git a/slof/fs/boot.fs b/slof/fs/boot.fs +index 5d41a0e..6d16c54 100644 +--- a/slof/fs/boot.fs ++++ b/slof/fs/boot.fs +@@ -15,8 +15,27 @@ + VARIABLE state-valid false state-valid ! + CREATE go-args 2 cells allot go-args 2 cells erase + ++4000 CONSTANT bootdev-size ++0 VALUE bootdev-buf ++ + \ \\\\\\\\\\\\\\ Structure/Implementation Dependent Methods + ++: alloc-bootdev-buf ( -- ) ++ bootdev-size alloc-mem ?dup 0= ABORT" Unable to allocate bootdev buffer!" ++ dup bootdev-size erase ++ to bootdev-buf ++; ++ ++: free-bootdev-buf ( -- ) ++ bootdev-buf bootdev-size free-mem ++ 0 to bootdev-buf ++; ++ ++: bootdev-string-cat ( addr1 len1 addr2 len2 -- addr1 len1+len2 ) ++ dup 3 pick + bootdev-size > ABORT" bootdev size too big!" ++ string-cat ++; ++ + : $bootargs + bootargs 2@ ?dup IF + ELSE s" diagnostic-mode?" evaluate and IF s" diag-file" evaluate +@@ -24,14 +43,23 @@ CREATE go-args 2 cells allot go-args 2 cells erase + ; + + : $bootdev ( -- device-name len ) +- bootdevice 2@ dup IF s" " $cat THEN ++ alloc-bootdev-buf ++ bootdevice 2@ ?dup IF ++ swap bootdev-buf 2 pick move ++ bootdev-buf swap s" " bootdev-string-cat ++ ELSE ++ \ use bootdev-buf for concatenating diag mode/boot-device if any ++ drop bootdev-buf 0 ++ THEN + s" diagnostic-mode?" evaluate IF + s" diag-device" evaluate + ELSE + s" boot-device" evaluate + THEN +- $cat \ prepend bootdevice setting from vpd-bootlist ++ ( bootdev len str len1 ) ++ bootdev-string-cat \ concatenate both + strdup ++ free-bootdev-buf + ?dup 0= IF + disable-watchdog + drop true ABORT" No boot device!" +@@ -51,7 +79,14 @@ CREATE go-args 2 cells allot go-args 2 cells erase + ' (set-boot-device) to set-boot-device + + : (add-boot-device) ( str len -- ) \ Concatenate " str" to "bootdevice" +- bootdevice 2@ ?dup IF $cat-space ELSE drop THEN set-boot-device ++ bootdevice 2@ ?dup IF ++ alloc-bootdev-buf ++ swap bootdev-buf 2 pick move ++ bootdev-buf swap s" " bootdev-string-cat ++ 2swap bootdev-string-cat ++ ELSE drop THEN ++ set-boot-device ++ bootdev-buf 0 <> IF free-bootdev-buf THEN + ; + + ' (add-boot-device) to add-boot-device +-- +2.7.4 + diff -Nru slof-20151103+dfsg/debian/patches/series slof-20151103+dfsg/debian/patches/series --- slof-20151103+dfsg/debian/patches/series 2016-01-09 04:42:24.000000000 +0000 +++ slof-20151103+dfsg/debian/patches/series 2017-12-18 13:11:52.000000000 +0000 @@ -0,0 +1,2 @@ +0001-boot-do-not-concatenate-bootdev.patch +0002-boot-use-a-temporary-bootdev-buf.patch