From 7aab173af2151843199dc229641f643538c8c161 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 30 Jul 2001 13:28:18 +0000 Subject: have a memory limit also for Rescue (different one) --- mdk-stage1/config-stage1.h | 3 +++ mdk-stage1/stage1.c | 7 +++++++ mdk-stage1/tools.c | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mdk-stage1/config-stage1.h b/mdk-stage1/config-stage1.h index 9ade3816d..3af38a446 100644 --- a/mdk-stage1/config-stage1.h +++ b/mdk-stage1/config-stage1.h @@ -21,6 +21,9 @@ /* If we have more than that amount of memory (in Mbytes), we assume we can load the second stage as a ramdisk */ #define MEM_LIMIT_RAMDISK 52 +/* If we have more than that amount of memory (in Mbytes), we assume we can load the rescue as a ramdisk */ +#define MEM_LIMIT_RESCUE 40 + #define DISTRIB_NAME "Mandrake Linux" #define RAMDISK_COMPRESSION_RATIO 1.95 diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index e06bf99a1..df297ead8 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -388,6 +388,13 @@ int main(int argc, char **argv, char **env) stg1_info_message("You are starting the installation with an alternate booting method. " "Please change your disk, and insert the Installation disk."); + if (IS_RESCUE && total_memory() < MEM_LIMIT_RESCUE) { + stg1_error_message("You are starting the rescue with a low memory configuration. " + "From that point, experience showed us that the program may stop " + "or crash at any point without immediate proper reason. Continue at " + "your own risk. Alternatively, you may reboot your system now."); + } + ret = method_select_and_prepare(); finish_frontend(); diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c index a60c53404..49a70a494 100644 --- a/mdk-stage1/tools.c +++ b/mdk-stage1/tools.c @@ -201,7 +201,7 @@ int total_memory(void) int ramdisk_possible(void) { - if (total_memory() > MEM_LIMIT_RAMDISK) + if (total_memory() > (IS_RESCUE ? MEM_LIMIT_RESCUE : MEM_LIMIT_RAMDISK)) return 1; else { log_message("warning, ramdisk is not possible due to low mem!"); @@ -247,7 +247,7 @@ enum return_type load_ramdisk_fd(int ramdisk_fd, int size) BZFILE * st2; char * ramdisk = "/dev/ram3"; /* warning, verify that this file exists in the initrd, and that root=/dev/ram3 is actually passed to the kernel at boot time */ int ram_fd; - char buffer[4096]; + char buffer[32768]; int z_errnum; char * wait_msg = "Loading program into memory..."; int bytes_read = 0; -- cgit v1.2.1