aboutsummaryrefslogtreecommitdiff
path: root/slof
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2017-09-26 09:12:32 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2017-09-26 17:54:00 +1000
commit3beb9c32d45fc4a0d69e6c84911c4521be272f18 (patch)
treeaf49e108b18178ceae99561998d420b009dedc07 /slof
parent6f4ed1c01c5b2c0f347870ccefba514eac10234c (diff)
downloadSLOF-3beb9c32d45fc4a0d69e6c84911c4521be272f18.zip
SLOF-3beb9c32d45fc4a0d69e6c84911c4521be272f18.tar.gz
SLOF-3beb9c32d45fc4a0d69e6c84911c4521be272f18.tar.bz2
netboot: Create bootp-response when bootp is used
According to TFTP Booting extension, after the success of BOOTP, BOOTREPLY packet should be copied to bootp-response property under "/chosen" While in current case, even when DHCP was used, bootp-response was being set. So set bootp-response when BOOTP is used and dhcp-response for DHCP Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'slof')
-rw-r--r--slof/fs/packages/obp-tftp.fs13
-rw-r--r--slof/helpers.c20
2 files changed, 21 insertions, 12 deletions
diff --git a/slof/fs/packages/obp-tftp.fs b/slof/fs/packages/obp-tftp.fs
index 63171d0..17fb980 100644
--- a/slof/fs/packages/obp-tftp.fs
+++ b/slof/fs/packages/obp-tftp.fs
@@ -28,24 +28,13 @@ VARIABLE huge-tftp-load 1 huge-tftp-load !
60000000 ( addr maxlen )
- \ Allocate 1720 bytes to store the BOOTP-REPLY packet
- 6B8 alloc-mem dup >r ( addr maxlen replybuf )
- huge-tftp-load @ d# 1428 ( addr maxlen replybuf hugetftp blocksize )
+ huge-tftp-load @ d# 1428 ( addr maxlen hugetftp blocksize )
\ Add OBP-TFTP Bootstring argument, e.g. "10.128.0.1,bootrom.bin,10.128.40.1"
my-args
net-load dup 0< IF drop 0 THEN
- \ Recover buffer address of BOOTP-REPLY packet
- r>
-
r> r> over IF s" bootpath" set-chosen ELSE 2drop THEN
r> r> over IF s" bootargs" set-chosen ELSE 2drop THEN
-
- \ Store BOOTP-REPLY packet as property
- dup 6B8 encode-bytes s" bootp-response" s" /chosen" find-node set-property
-
- \ free buffer
- 6B8 free-mem
;
: close ( -- )
diff --git a/slof/helpers.c b/slof/helpers.c
index d074178..a8d575c 100644
--- a/slof/helpers.c
+++ b/slof/helpers.c
@@ -180,3 +180,23 @@ int write_mm_log(char *data, unsigned int len, unsigned short type)
return forth_eval_pop("write-mm-log");
}
+
+static void SLOF_encode_response(void *addr, size_t size,char *s)
+{
+ forth_push((unsigned long)addr);
+ forth_push(size);
+ forth_eval("encode-bytes");
+ forth_push((unsigned long)s);
+ forth_push(strlen(s));
+ forth_eval("set-chosen");
+}
+
+void SLOF_encode_bootp_response(void *addr, size_t size)
+{
+ SLOF_encode_response(addr, size, "bootp-response");
+}
+
+void SLOF_encode_dhcp_response(void *addr, size_t size)
+{
+ SLOF_encode_response(addr, size, "dhcp-response");
+}