diff -Naur grub-0.5.94/stage2/boot.c grub-0.5.94.modaddr/stage2/boot.c --- grub-0.5.94/stage2/boot.c Thu Dec 30 15:32:02 1999 +++ grub-0.5.94.modaddr/stage2/boot.c Thu Feb 7 10:04:07 2002 @@ -556,6 +556,12 @@ return 1; } +void +set_load_addr (int addr) +{ + printf ("Setting module load address to 0x%x\n", addr); + cur_addr = addr; +} #ifdef GRUB_UTIL /* Dummy function to fake the *BSD boot. */ diff -Naur grub-0.5.94/stage2/builtins.c grub-0.5.94.modaddr/stage2/builtins.c --- grub-0.5.94/stage2/builtins.c Wed Mar 1 06:47:48 2000 +++ grub-0.5.94.modaddr/stage2/builtins.c Thu Feb 7 11:04:41 2002 @@ -1953,7 +1953,41 @@ " when you chain-load some operating systems, such as DOS, if such an" " OS resides at a non-first drive." }; - + +/* modaddr */ +static int +modaddr_func (char *arg, int flags) +{ + int addr; + + switch (kernel_type) + { + case KERNEL_TYPE_MULTIBOOT: + if (safe_parse_maxint(&arg, &addr)) + { + set_load_addr(addr); + break; + } + + /* else fallthrough */ + + default: + errnum = ERR_NEED_MB_KERNEL; + return 1; + } + + return 0; +} + +static struct builtin builtin_modaddr = +{ + "modaddr", + modaddr_func, + BUILTIN_CMDLINE, + "modaddr ADDRESS", + "Set the load address for the next Multiboot module to ADDRESS" +}; + /* module */ static int @@ -2955,6 +2989,7 @@ &builtin_kernel, &builtin_makeactive, &builtin_map, + &builtin_modaddr, &builtin_module, &builtin_modulenounzip, &builtin_password, diff -Naur grub-0.5.94/stage2/shared.h grub-0.5.94.modaddr/stage2/shared.h --- grub-0.5.94/stage2/shared.h Tue Feb 22 16:25:17 2000 +++ grub-0.5.94.modaddr/stage2/shared.h Thu Feb 7 10:05:04 2002 @@ -784,6 +784,7 @@ kernel_t load_image (char *kernel, char *arg); int load_module (char *module, char *arg); int load_initrd (char *initrd); +void set_load_addr (int addr); #endif void init_bios_info (void);