summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2017-08-18 11:36:12 +0200
committerHelge Deller <deller@gmx.de>2017-08-18 11:36:12 +0200
commitd8bafb72b1b8a9365905a9b26e6933b1d63857cd (patch)
treebfba557bead783c88ebb3b65b63fc5c0a1bf9285
parentc30ddf1757be7dbd356162c3b3535ccdde6c1fe2 (diff)
downloadpalo-d8bafb72b1b8a9365905a9b26e6933b1d63857cd.tar.gz
Improve warnings when failing to read kernel via TFTP
It seems the firmware boot loader code isn't able to load images via TFTP if those are bigger than 30MB. Instead it runs into timeouts and reports errors back to the palo bootloader. This patch detects such situations and prints a useful warning before rebooting. Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--ipl/pdc_bootio.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/ipl/pdc_bootio.c b/ipl/pdc_bootio.c
index 496f117..52fe1de 100644
--- a/ipl/pdc_bootio.c
+++ b/ipl/pdc_bootio.c
@@ -62,7 +62,12 @@ static int pdc_bootdev_read(int fd,
if ((count = pdc_iodc_bootin(devaddr, dest, nseek)) < 0)
{
die("pdc_iodc_bootin() died during seekread\r\n");
+ devaddr += nseek;
+abort_with_warning:
+ if (devaddr > 30*1024*1024) /* 30MB */
+ puts("If you boot via tftp you probably reached the 32MB limit.\n");
pdc_do_reset();
+ return -1;
}
devaddr += count;
}
@@ -72,11 +77,17 @@ static int pdc_bootdev_read(int fd,
{
int count;
- if (Debug) printf("pdc_iodc_bootin(dev:0x%x, buf:0x%p, count:%u)\r\n",
- devaddr, dest+nbytes, n - nbytes);
- count = pdc_iodc_bootin(devaddr, dest + nbytes, n - nbytes);
+ /* how many bytes should be read? */
+ count = n - nbytes;
- if (Debug)
+ if (Debug) printf("pdc_iodc_bootin(dev:0x%x, buf:0x%p, count:%u) = ",
+ devaddr, dest+nbytes, count);
+
+ count = pdc_iodc_bootin(devaddr, dest + nbytes, count);
+
+ if (Debug) printf("%d\r\n", count);
+
+ if (0 && Debug)
{
printf("%d@0x%x ", count, devaddr);
{
@@ -106,8 +117,9 @@ static int pdc_bootdev_read(int fd,
/* essentially be lost right now */
printf("\nERROR: Read from boot device failed (status = %d).\n",
count);
- nbytes = -1;
- break;
+
+ devaddr += (n - nbytes);
+ goto abort_with_warning;
}
}