aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/boot
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2019-04-07 01:09:23 +0200
committerHelge Deller <deller@gmx.de>2019-05-03 23:47:39 +0200
commit82d96bf68e6c2101dfbba2984cd9565643f5d8cb (patch)
tree4334e5f50d7a9bec606f298245326343d8b6cbec /arch/parisc/boot
parentparisc: Skip registering LED when running in QEMU (diff)
downloadlinux-dev-82d96bf68e6c2101dfbba2984cd9565643f5d8cb.tar.xz
linux-dev-82d96bf68e6c2101dfbba2984cd9565643f5d8cb.zip
parisc: PA-Linux requires at least 32 MB RAM
Even a 32-bit kernel requires at least 27 MB to decompress itself, so halt the system with a message if the system has less memory than 32 MB. Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc/boot')
-rw-r--r--arch/parisc/boot/compressed/misc.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/arch/parisc/boot/compressed/misc.c b/arch/parisc/boot/compressed/misc.c
index 2556bb181813..2d395998f524 100644
--- a/arch/parisc/boot/compressed/misc.c
+++ b/arch/parisc/boot/compressed/misc.c
@@ -145,14 +145,13 @@ static int putchar(int c)
void __noreturn error(char *x)
{
- puts("\n\n");
- puts(x);
- puts("\n\n -- System halted");
+ if (x) puts(x);
+ puts("\n -- System halted\n");
while (1) /* wait forever */
;
}
-static int print_hex(unsigned long num)
+static int print_num(unsigned long num, int base)
{
const char hex[] = "0123456789abcdef";
char str[40];
@@ -160,12 +159,14 @@ static int print_hex(unsigned long num)
str[i--] = '\0';
do {
- str[i--] = hex[num & 0x0f];
- num >>= 4;
+ str[i--] = hex[num % base];
+ num = num / base;
} while (num);
- str[i--] = 'x';
- str[i] = '0';
+ if (base == 16) {
+ str[i--] = 'x';
+ str[i] = '0';
+ } else i++;
puts(&str[i]);
return 0;
@@ -187,8 +188,9 @@ put:
if (fmt[++i] == '%')
goto put;
+ print_num(va_arg(args, unsigned long),
+ fmt[i] == 'x' ? 16:10);
++i;
- print_hex(va_arg(args, unsigned long));
}
va_end(args);
@@ -327,8 +329,15 @@ unsigned long decompress_kernel(unsigned int started_wide,
free_mem_end_ptr = rd_start;
#endif
- if (free_mem_ptr >= free_mem_end_ptr)
- error("Kernel too big for machine.");
+ if (free_mem_ptr >= free_mem_end_ptr) {
+ int free_ram;
+ free_ram = (free_mem_ptr >> 20) + 1;
+ if (free_ram < 32)
+ free_ram = 32;
+ printf("\nKernel requires at least %d MB RAM.\n",
+ free_ram);
+ error(NULL);
+ }
#ifdef DEBUG
printf("\n");