diff --git a/ChangeLog b/ChangeLog index 217a433fa..feb735cb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,62 @@ -2009-08-28 Vladimir Serbinenko +2009-09-02 Vladimir Serbinenko + + * efiemu/loadcore.c (SUFFIX (grub_efiemu_loadcore_load)): Fix style + according to GCS. + +2009-09-02 Colin Watson + + * docs/grub.texi (Naming convention): Describe one-based partition + numbering. + (Device syntax): Likewise. + (File name syntax): Likewise. + (Block list syntax): Likewise. + (Making a GRUB bootable CD-ROM): Talk about grub.cfg rather than + menu.lst. + (File name syntax): Likewise. + (Command-line and menu entry commands): Document acpi, blocklist, + crc, export, insmod, keystatus, ls, set, and unset commands. + +2009-09-02 Colin Watson + + * commands/keystatus.c (GRUB_MOD_INIT (keystatus)): Adjust summary + to avoid implying that only one of --shift, --ctrl, or --alt may be + used. + +2009-09-02 Colin Watson + + * util/grub-probe.c (probe): Test st.st_mode using S_ISREG macro + rather than comparing against S_IFREG, which will almost never work. + +2009-09-01 Vladimir Serbinenko + + * commands/loadenv.c (check_blocklists): Fix off-by-one error. + (write_blocklists): Likewise. + +2009-09-01 Colin Watson + + * script/lua/grub_lua.h (fputs): Supply a format string as the first + argument to grub_printf. + +2009-09-01 Felix Zielcke + + * genmk.rb: Add quotes around $(TARGET_OBJ2ELF) to cope with + non GNU test. + +2009-08-30 Vladimir Serbinenko + + * kern/file.c (grub_file_read): Spelling fix + +2009-08-30 Vladimir Serbinenko + + * loader/i386/bsdXX.c (SUFFIX (grub_freebsd_load_elfmodule)): Fix + loading of headers in some cases. + +2009-08-30 Robert Millan + + * configure.ac: Bump version to 1.97~beta1. + * docs/version.texi: Likewise. + +2009-08-29 Vladimir Serbinenko * include/grub/i386/xnu.h: Add license header. include grub/err.h explicitly. @@ -102,7 +160,6 @@ * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise. * conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise. - * DISTLIST: Add commands/keystatus.c. 2009-08-28 Vladimir Serbinenko diff --git a/commands/keystatus.c b/commands/keystatus.c index cecbba504..28ceb2d0b 100644 --- a/commands/keystatus.c +++ b/commands/keystatus.c @@ -70,7 +70,7 @@ GRUB_MOD_INIT(keystatus) { cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus, GRUB_COMMAND_FLAG_BOTH, - "keystatus [--shift|--ctrl|--alt]", + "keystatus [--shift] [--ctrl] [--alt]", "Check key modifier status", options); } diff --git a/commands/loadenv.c b/commands/loadenv.c index 22665f9fe..c60eb835c 100644 --- a/commands/loadenv.c +++ b/commands/loadenv.c @@ -242,7 +242,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists, part_start = 0; buf = grub_envblk_buffer (envblk); - for (p = blocklists, index = 0; p; p = p->next, index += p->length) + for (p = blocklists, index = 0; p; index += p->length, p = p->next) { char blockbuf[GRUB_DISK_SECTOR_SIZE]; @@ -278,7 +278,7 @@ write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists, part_start = 0; index = 0; - for (p = blocklists; p; p = p->next, index += p->length) + for (p = blocklists; p; index += p->length, p = p->next) { if (grub_disk_write (disk, p->sector - part_start, p->offset, p->length, buf + index)) diff --git a/configure.ac b/configure.ac index 549b35c9b..cddd9fe2d 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target dnl type. -AC_INIT([GRUB],[1.96],[bug-grub@gnu.org]) +AC_INIT([GRUB],[1.97~beta1],[bug-grub@gnu.org]) AC_PREREQ(2.59) AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_HEADER([config.h]) diff --git a/docs/grub.texi b/docs/grub.texi index e3f412565..06059df4d 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -20,7 +20,7 @@ This manual is for GNU GRUB (version @value{VERSION}, @value{UPDATED}). -Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008 Free Software Foundation, Inc. +Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -356,25 +356,25 @@ disk. The number @samp{0} is the drive number, which is counted from disk. @example -(hd0,1) +(hd0,2) @end example Here, @samp{hd} means it is a hard disk drive. The first integer @samp{0} indicates the drive number, that is, the first hard disk, while the second integer, @samp{1}, indicates the partition number (or the -@sc{pc} slice number in the BSD terminology). Once again, please note -that the partition numbers are counted from @emph{zero}, not from -one. This expression means the second partition of the first hard disk -drive. In this case, GRUB uses one partition of the disk, instead of the -whole disk. +@sc{pc} slice number in the BSD terminology). The partition numbers are +counted from @emph{one}, not from zero (as was the case in previous +versions of GRUB). This expression means the second partition of the +first hard disk drive. In this case, GRUB uses one partition of the +disk, instead of the whole disk. @example -(hd0,4) +(hd0,5) @end example This specifies the first @dfn{extended partition} of the first hard disk drive. Note that the partition numbers for extended partitions are -counted from @samp{4}, regardless of the actual number of primary +counted from @samp{5}, regardless of the actual number of primary partitions on your hard disk. @example @@ -383,13 +383,13 @@ partitions on your hard disk. This means the BSD @samp{a} partition of the second hard disk. If you need to specify which @sc{pc} slice number should be used, use something -like this: @samp{(hd1,0,a)}. If the @sc{pc} slice number is omitted, +like this: @samp{(hd1,1,a)}. If the @sc{pc} slice number is omitted, GRUB searches for the first @sc{pc} slice which has a BSD @samp{a} partition. Of course, to actually access the disks or partitions with GRUB, you need to use the device specification in a command, like @samp{root -(fd0)} or @samp{unhide (hd0,2)}. To help you find out which number +(fd0)} or @samp{unhide (hd0,3)}. To help you find out which number specifies a partition you want, the GRUB command-line (@pxref{Command-line interface}) options have argument completion. This means that, for example, you only need to type @@ -413,7 +413,7 @@ Now the question is, how to specify a file? Again, consider an example: @example -(hd0,0)/vmlinuz +(hd0,1)/vmlinuz @end example This specifies the file named @samp{vmlinuz}, found on the first @@ -550,7 +550,7 @@ which can cause compatibility problems. For booting from a CD-ROM, GRUB uses a special Stage 2 called @file{stage2_eltorito}. The only GRUB files you need to have in your bootable CD-ROM are this @file{stage2_eltorito} and optionally a config file -@file{menu.lst}. You don't need to use @file{stage1} or @file{stage2}, +@file{grub.cfg}. You don't need to use @file{stage1} or @file{stage2}, because El Torito is quite different from the standard boot process. Here is an example of procedures to make a bootable CD-ROM @@ -573,7 +573,7 @@ Copy the file @file{stage2_eltorito}: $ @kbd{cp /usr/lib/grub/i386-pc/stage2_eltorito iso/boot/grub} @end example -If desired, make the config file @file{menu.lst} under @file{iso/boot/grub} +If desired, make the config file @file{grub.cfg} under @file{iso/boot/grub} (@pxref{Configuration}), and copy any files and directories for the disc to the directory @file{iso/}. @@ -786,7 +786,7 @@ which is a BIOS drive number, so the following are equivalent: @end example @var{part-num} represents the partition number of @var{device}, starting -from zero for primary partitions and from four for extended partitions, +from one for primary partitions and from five for extended partitions, and @var{bsd-subpart-letter} represents the BSD disklabel subpartition, such as @samp{a} or @samp{e}. @@ -800,7 +800,7 @@ finds the subpartition @var{bsd-subpart-letter}. Here is an example: @end example The syntax @samp{(hd0)} represents using the entire disk (or the -MBR when installing GRUB), while the syntax @samp{(hd0,0)} +MBR when installing GRUB), while the syntax @samp{(hd0,1)} represents using the first partition of the disk (or the boot sector of the partition when installing GRUB). @@ -820,12 +820,12 @@ There are two ways to specify files, by @dfn{absolute file name} and by An absolute file name resembles a Unix absolute file name, using @samp{/} for the directory separator (not @samp{\} as in DOS). One -example is @samp{(hd0,0)/boot/grub/menu.lst}. This means the file -@file{/boot/grub/menu.lst} in the first partition of the first hard +example is @samp{(hd0,1)/boot/grub/grub.cfg}. This means the file +@file{/boot/grub/grub.cfg} in the first partition of the first hard disk. If you omit the device name in an absolute file name, GRUB uses GRUB's @dfn{root device} implicitly. So if you set the root device to, -say, @samp{(hd1,0)} by the command @command{root} (@pxref{root}), then -@code{/boot/kernel} is the same as @code{(hd1,0)/boot/kernel}. +say, @samp{(hd1,1)} by the command @command{root} (@pxref{root}), then +@code{/boot/kernel} is the same as @code{(hd1,1)/boot/kernel}. @node Block list syntax @@ -846,8 +846,8 @@ the offset is zero. Like the file name syntax (@pxref{File name syntax}), if a blocklist does not contain a device name, then GRUB uses GRUB's @dfn{root -device}. So @code{(hd0,1)+1} is the same as @code{+1} when the root -device is @samp{(hd0,1)}. +device}. So @code{(hd0,2)+1} is the same as @code{+1} when the root +device is @samp{(hd0,2)}. @node Interface @@ -1110,17 +1110,56 @@ you forget a command, you can run the command @command{help} (@pxref{help}). @menu +* acpi:: Load ACPI tables +* blocklist:: Print a block list * boot:: Start up your operating system * cat:: Show the contents of a file * chainloader:: Chain-load another boot loader * cmp:: Compare two files * configfile:: Load a configuration file +* crc:: Calculate CRC32 checksums +* export:: Export an environment variable * halt:: Shut down your computer * help:: Show help messages +* insmod:: Insert a module +* keystatus:: Check key modifier status +* ls:: List devices or files * reboot:: Reboot your computer +* set:: Set an environment variable +* unset:: Unset an environment variable @end menu +@node acpi +@subsection acpi + +@deffn Command acpi [@option{-1}|@option{-2}] @ + [@option{--exclude=table1,@dots{}}|@option{--load-only=table1,@dots{}}] @ + [@option{--oemid=id}] [@option{--oemtable=table}] @ + [@option{--oemtablerev=rev}] [@option{--oemtablecreator=creator}] @ + [@option{--oemtablecreatorrev=rev}] [@option{--no-ebda}] @ + filename @dots{} +Modern BIOS systems normally implement the Advanced Configuration and Power +Interface (ACPI), and define various tables that describe the interface +between an ACPI-compliant operating system and the firmware. In some cases, +the tables provided by default only work well with certain operating +systems, and it may be necessary to replace some of them. + +Normally, this command will replace the Root System Description Pointer +(RSDP) in the Extended BIOS Data Area to point to the new tables. If the +@option{--no-ebda} option is used, the new tables will be known only to +GRUB, but may be used by GRUB's EFI emulation. +@end deffn + + +@node blocklist +@subsection blocklist + +@deffn Command blocklist file +Print a block list (@pxref{Block list syntax}) for @var{file}. +@end deffn + + @node boot @subsection boot @@ -1187,6 +1226,23 @@ Load @var{file} as a configuration file. @end deffn +@node crc +@subsection crc + +@deffn Command crc file +Display the CRC32 checksum of @var{file}. +@end deffn + + +@node export +@subsection export + +@deffn Command export envvar +Export the environment variable @var{envvar}. Exported variables are visible +to subsidiary configuration files loaded using @command{configfile}. +@end deffn + + @node halt @subsection halt @@ -1212,6 +1268,44 @@ about each of the commands which match those @var{patterns}. @end deffn +@node insmod +@subsection insmod + +@deffn Command insmod module +Insert the dynamic GRUB module called @var{module}. +@end deffn + + +@node keystatus +@subsection keystatus + +@deffn Command keystatus [@option{--shift}] [@option{--ctrl}] [@option{--alt}] +Return true if the Shift, Control, or Alt modifier keys are held down, as +requested by options. This is useful in scripting, to allow some user +control over behaviour without having to wait for a keypress. + +Checking key modifier status is only supported on some platforms. If invoked +without any options, the @command{keystatus} command returns true if and +only if checking key modifier status is supported. +@end deffn + + +@node ls +@subsection ls + +@deffn Command ls [arg] +List devices or files. + +With no arguments, print all devices known to GRUB. + +If the argument is a device name enclosed in parentheses (@pxref{Device +syntax}), then list all files at the root directory of that device. + +If the argument is a directory given as an absolute file name (@pxref{File +name syntax}), then list the contents of that directory. +@end deffn + + @node reboot @subsection reboot @@ -1220,6 +1314,23 @@ Reboot the computer. @end deffn +@node set +@subsection set + +@deffn Command set [envvar=value] +Set the environment variable @var{envvar} to @var{value}. If invoked with no +arguments, print all environment variables with their values. +@end deffn + + +@node unset +@subsection unset + +@deffn Command unset envvar +Unset the environment variable @var{envvar}. +@end deffn + + @node Invoking grub-install @chapter Invoking grub-install diff --git a/docs/version.texi b/docs/version.texi index 5a03fa3c9..4528c7b2e 100644 --- a/docs/version.texi +++ b/docs/version.texi @@ -1,4 +1,4 @@ @set UPDATED 7 Ago 2009 @set UPDATED-MONTH Ago 2009 -@set EDITION 1.97~snapshot -@set VERSION 1.97~snapshot +@set EDITION 1.97~beta1 +@set VERSION 1.97~beta1 diff --git a/efiemu/loadcore.c b/efiemu/loadcore.c index ee4c80649..4bf26ee44 100644 --- a/efiemu/loadcore.c +++ b/efiemu/loadcore.c @@ -352,13 +352,18 @@ SUFFIX (grub_efiemu_loadcore_load) (void *core, grub_efiemu_segment_t segments) { grub_err_t err; - if ((err = grub_efiemu_load_segments (segments, core))) + err = grub_efiemu_load_segments (segments, core); + if (err) return err; - if ((err = grub_efiemu_resolve_symbols (segments, core))) + + err = grub_efiemu_resolve_symbols (segments, core); + if (err) return err; - if ((err = SUFFIX (grub_arch_efiemu_relocate_symbols) (segments, - grub_efiemu_elfsyms, - core))) + + err = SUFFIX (grub_arch_efiemu_relocate_symbols) (segments, + grub_efiemu_elfsyms, + core); + if (err) return err; return GRUB_ERR_NONE; diff --git a/genmk.rb b/genmk.rb index 9574ce98d..4aedb25c4 100644 --- a/genmk.rb +++ b/genmk.rb @@ -126,7 +126,7 @@ ifneq ($(TARGET_APPLE_CC),1) #{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF) -rm -f $@ $(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj} - if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi + if test ! -z \"$(TARGET_OBJ2ELF)\"; then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@ else #{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF) diff --git a/kern/file.c b/kern/file.c index 22f2f6093..f713acbca 100644 --- a/kern/file.c +++ b/kern/file.c @@ -115,7 +115,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len) if (file->offset > file->size) { grub_error (GRUB_ERR_OUT_OF_RANGE, - "Attempt to read pat the end of file."); + "Attempt to read past the end of file."); return -1; } diff --git a/loader/i386/bsdXX.c b/loader/i386/bsdXX.c index 3f15579dd..aedc204b2 100644 --- a/loader/i386/bsdXX.c +++ b/loader/i386/bsdXX.c @@ -197,15 +197,15 @@ SUFFIX (grub_freebsd_load_elfmodule) (grub_file_t file, int argc, char *argv[], if (curload < module + sizeof (e)) curload = module + sizeof (e); - load (file, UINT_TO_PTR (module + e.e_shoff), e.e_shoff, + load (file, UINT_TO_PTR (curload), e.e_shoff, e.e_shnum * e.e_shentsize); - if (curload < module + e.e_shoff + e.e_shnum * e.e_shentsize) - curload = module + e.e_shoff + e.e_shnum * e.e_shentsize; + e.e_shoff = curload - module; + curload += e.e_shnum * e.e_shentsize; - load (file, UINT_TO_PTR (module + e.e_phoff), e.e_phoff, + load (file, UINT_TO_PTR (curload), e.e_phoff, e.e_phnum * e.e_phentsize); - if (curload < module + e.e_phoff + e.e_phnum * e.e_phentsize) - curload = module + e.e_phoff + e.e_phnum * e.e_phentsize; + e.e_phoff = curload - module; + curload += e.e_phnum * e.e_phentsize; *kern_end = curload; diff --git a/script/lua/grub_lua.h b/script/lua/grub_lua.h index d5181f147..78e6546c7 100644 --- a/script/lua/grub_lua.h +++ b/script/lua/grub_lua.h @@ -58,7 +58,7 @@ #define setjmp grub_setjmp #define longjmp grub_longjmp -#define fputs(s,f) grub_printf(s) +#define fputs(s,f) grub_printf("%s", s) #define isdigit grub_isdigit #define isalpha grub_isalpha diff --git a/util/grub-probe.c b/util/grub-probe.c index 1710ec51b..3c54408c3 100644 --- a/util/grub-probe.c +++ b/util/grub-probe.c @@ -239,7 +239,7 @@ probe (const char *path, char *device_name) stat (path, &st); - if (st.st_mode == S_IFREG) + if (S_ISREG (st.st_mode)) { /* Regular file. Verify that we can read it properly. */