From 6ec8139b7518fadbabf70cd0780b081fabf5f374 Mon Sep 17 00:00:00 2001 From: okuji Date: Mon, 6 Sep 1999 12:36:01 +0000 Subject: [PATCH] Eliminate unnecessary code and add the command configfile. --- ChangeLog | 21 +++++++++++++++++++++ NEWS | 1 + TODO | 2 -- stage2/asm.S | 6 +++++- stage2/builtins.c | 43 ++++++++++++++++++++++++++++++++++++++++--- stage2/char_io.c | 5 +++-- stage2/common.c | 4 ++++ stage2/shared.h | 2 ++ stage2/smp-imps.c | 14 ++++++++------ 9 files changed, 84 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b3faf81d..65bb1b2d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +1999-09-06 OKUJI Yoshinori + + * stage2/builtins.c (configfile_func): New function. + (builtin_configfile): New variable. + (builtin_table): Added the pointer to BUILTIN_CONFIGFILE. + +1999-09-06 OKUJI Yoshinori + + From Pavel Roskin: + * stage2/asm.S [!STAGE1_5] (chain_stage2): Deleted. + [STAGE1_5] (get_code_end): Likewise. + * stage2/char_io.c (grub_strncat): Likewise. + * stage2/common.c [STAGE1_5] (saved_mem_upper): Likewise. + * stage2/smp-imps.c (imps_release_cpus): Likewise. + (imps_any_new_apics): Made static. + (imps_enabled): Likewise. + (imps_num_cpus): Likewise. + (imps_lapic_addr): Likewise. + (imps_cpu_apic_map): Likewise. + (imps_apic_cpu_map): Likewise. + 1999-09-06 OKUJI Yoshinori * stage2/builtins.c (testload_func): Fix the typos: 0x2000000 -> diff --git a/NEWS b/NEWS index a790d8637..7574f8043 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ New in 0.5.93: * The command "help" displays helpful information about builtin commands. * The command "geometry" displays the information of a drive specified. +* The command "configfile" loads a configuration file interactively. New in 0.5.92 - 1999-07-26: * Bug fixes (i.e. Stage 1.5 can work fine again). diff --git a/TODO b/TODO index 597d263d3..006ac0354 100644 --- a/TODO +++ b/TODO @@ -27,8 +27,6 @@ larger than 16MB can be read. Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot parameters -Add ``configfile'' command, in a clean way. - Add keyboard layout configuration support. Clean up and enhance the manuals, especially concept indexes. diff --git a/stage2/asm.S b/stage2/asm.S index 2e48369fd..6a23c6e1e 100644 --- a/stage2/asm.S +++ b/stage2/asm.S @@ -175,6 +175,7 @@ ENTRY(chain_stage1) #endif /* STAGE1_5 */ +#ifdef STAGE1_5 /* * chain_stage2(segment, offset) * @@ -212,7 +213,8 @@ ENTRY(chain_stage2) DATA32 ADDR32 ljmp (offset) .code32 - +#endif /* STAGE1_5 */ + /* * These next two routines, "real_to_prot" and "prot_to_real" are structured * in a very specific way. Be very careful when changing them. @@ -766,6 +768,7 @@ pc_notnewline: pop %ebp ret +#ifndef STAGE1_5 /* get_code_end() : return the address of the end of the code * This is here so that it can be replaced by asmstub.c. */ @@ -775,6 +778,7 @@ ENTRY(get_code_end) incl %eax shll $2, %eax ret +#endif /* ! STAGE1_5 */ /* * diff --git a/stage2/builtins.c b/stage2/builtins.c index f734d94e0..d253c84d8 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -197,6 +197,42 @@ static struct builtin builtin_color = " blinks." }; + +/* configfile */ +static int +configfile_func (char *arg, int flags) +{ + char *new_config = config_file; + + /* Check if the file ARG is present. */ + if (! grub_open (arg)) + return 1; + + /* Copy ARG to CONFIG_FILE. */ + while ((*new_config++ = *arg++) != 0) + ; + +#ifdef GRUB_UTIL + /* Force to load the configuration file. */ + use_config_file = 1; +#endif + + /* Restart cmain. */ + cmain (); + + /* Never reach here. */ + return 0; +} + +static struct builtin builtin_configfile = +{ + "configfile", + configfile_func, + BUILTIN_CMDLINE, + "configfile FILE", + "Load the file FILE as the configuration file." +}; + /* debug */ static int @@ -1173,7 +1209,7 @@ static struct builtin builtin_rootnoverify = "rootnoverify", rootnoverify_func, BUILTIN_CMDLINE, - "rootnoverify device [hdbias]", + "rootnoverify DEVICE [HDBIAS]", "Similar to `root=', but don't attempt to mount the partition. This" " is useful for when an OS is outside of the area of the disk that" " GRUB can read, but setting the correct root partition is still" @@ -1333,7 +1369,7 @@ static struct builtin builtin_unhide = "unhide", unhide_func, BUILTIN_CMDLINE | BUILTIN_MENU, - "unhide drive", + "unhide DRIVE", "Unhide the drive DRIVE by subtracting 0x10 from the partition type." }; @@ -1354,7 +1390,7 @@ static struct builtin builtin_uppermem = "uppermem", uppermem_func, BUILTIN_CMDLINE, - "uppermem kbytes", + "uppermem KBYTES", "Force GRUB to ignore what it found during the autoprobe of the" " memory available to the system, and to use KBYTES as the number of" " kilobytes of upper memory installed. Any address range maps of the" @@ -1368,6 +1404,7 @@ struct builtin *builtin_table[] = &builtin_boot, &builtin_chainloader, &builtin_color, + &builtin_configfile, &builtin_debug, &builtin_default, &builtin_displaymem, diff --git a/stage2/char_io.c b/stage2/char_io.c index 6cb75e9ae..cfeaa9f02 100644 --- a/stage2/char_io.c +++ b/stage2/char_io.c @@ -521,7 +521,7 @@ grub_isspace (int c) } -#ifndef STAGE1_5 +#if 0 int grub_strncat (char *s1, const char *s2, int n) { @@ -540,8 +540,9 @@ grub_strncat (char *s1, const char *s2, int n) return 1; } +#endif - +#ifndef STAGE1_5 int grub_strcmp (const char *s1, const char *s2) { diff --git a/stage2/common.c b/stage2/common.c index 31720a0e4..6003ad07b 100644 --- a/stage2/common.c +++ b/stage2/common.c @@ -28,7 +28,9 @@ struct multiboot_info mbi; unsigned long saved_drive; unsigned long saved_partition; +#ifndef STAGE1_5 unsigned long saved_mem_upper; +#endif /* * Error code stuff. @@ -194,7 +196,9 @@ init_bios_info (void) mbi.mem_upper = memtmp; } +#ifndef STAGE1_5 saved_mem_upper = mbi.mem_upper; +#endif /* * Initialize other Multiboot Info flags. diff --git a/stage2/shared.h b/stage2/shared.h index 81a6c7ce4..fe85ed0a9 100644 --- a/stage2/shared.h +++ b/stage2/shared.h @@ -407,7 +407,9 @@ extern int filemax; extern struct multiboot_info mbi; extern unsigned long saved_drive; extern unsigned long saved_partition; +#ifndef STAGE1_5 extern unsigned long saved_mem_upper; +#endif /* * Error variables. diff --git a/stage2/smp-imps.c b/stage2/smp-imps.c index 3298c3580..b033feb8b 100644 --- a/stage2/smp-imps.c +++ b/stage2/smp-imps.c @@ -249,13 +249,15 @@ defconfig = * Exported globals here. */ -int imps_any_new_apics = 0; +static int imps_any_new_apics = 0; +#if 0 volatile int imps_release_cpus = 0; -int imps_enabled = 0; -int imps_num_cpus = 1; -unsigned imps_lapic_addr = ((unsigned) (&lapic_dummy)) - LAPIC_ID; -unsigned char imps_cpu_apic_map[IMPS_MAX_CPUS]; -unsigned char imps_apic_cpu_map[IMPS_MAX_CPUS]; +#endif +static int imps_enabled = 0; +static int imps_num_cpus = 1; +static unsigned imps_lapic_addr = ((unsigned) (&lapic_dummy)) - LAPIC_ID; +static unsigned char imps_cpu_apic_map[IMPS_MAX_CPUS]; +static unsigned char imps_apic_cpu_map[IMPS_MAX_CPUS]; /*