Merge mainline into usb
This commit is contained in:
commit
4f034dd24d
15 changed files with 690 additions and 58 deletions
103
ChangeLog
103
ChangeLog
|
@ -117,6 +117,109 @@
|
||||||
* include/grub/smbus.h: New file.
|
* include/grub/smbus.h: New file.
|
||||||
* include/grub/cs5536.h: New file.
|
* include/grub/cs5536.h: New file.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub.d/00_header.in: Add safety check to make sure that
|
||||||
|
${locale_dir} exists before trying to probe it.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* docs/grub.texi (SCO UnixWare): Remove, at Vladimir's request and
|
||||||
|
per the GNU Coding Standards; this is now too obscure to be worth
|
||||||
|
documenting.
|
||||||
|
(QNX): Likewise.
|
||||||
|
(chainloader): Remove cross-reference to `SCO UnixWare'.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* docs/grub.texi (Chain-loading): New section.
|
||||||
|
(DOS/Windows): New section, borrowed from GRUB Legacy with details
|
||||||
|
adjusted for GRUB 2.
|
||||||
|
(SCO UnixWare): Likewise.
|
||||||
|
(QNX): Likewise.
|
||||||
|
(chainloader): Add reference to `Block list syntax'.
|
||||||
|
(drivemap): New section.
|
||||||
|
(parttool): New section.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* docs/grub.texi (GNU GRUB manual): Remove reference to `Invoking
|
||||||
|
the grub shell'.
|
||||||
|
(Installation): Add reference to `Making a GRUB bootable CD-ROM'.
|
||||||
|
(Installing GRUB using grub-install): Remove reference to the grub
|
||||||
|
shell; mention `grub-mkimage' and `grub-setup' instead.
|
||||||
|
(Invoking grub-install): Likewise.
|
||||||
|
(Interface): Add reference to `Menu entry editor'.
|
||||||
|
(serial): Remove `--device' option.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* docs/grub.texi (Configuration): New section, documenting
|
||||||
|
configuration file generation using grub-mkconfig. I've left a slot
|
||||||
|
for documenting the full shell scripting format but have not yet
|
||||||
|
started on writing that up.
|
||||||
|
(Invoking grub-mkconfig): New section.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* docs/grub.texi (direntry): Remove grub-terminfo reference.
|
||||||
|
(GNU GRUB manual): Likewise.
|
||||||
|
(General commands): Update description of `terminfo' for GRUB 2.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* commands/gptsync.c (grub_cmd_gptsync): Fix typos.
|
||||||
|
(GRUB_MOD_INIT): Fix capitalisation.
|
||||||
|
* docs/grub.texi (Command-line and menu entry commands): Document
|
||||||
|
gettext and gptsync commands.
|
||||||
|
|
||||||
|
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* conf/any-emu.rmk (kernel_img_SOURCES) [!x86]: Include
|
||||||
|
kern/$(target_cpu)/cache.S even if TARGET_NO_MODULES = yes.
|
||||||
|
|
||||||
|
2010-06-01 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
Add btrfs probing support, currently only in the single-device case.
|
||||||
|
|
||||||
|
* kern/emu/getroot.c (find_root_device_from_mountinfo): New
|
||||||
|
function.
|
||||||
|
(grub_guess_root_device): Call find_root_device_from_mountinfo
|
||||||
|
before looking in /dev.
|
||||||
|
|
||||||
|
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Use
|
||||||
|
GRUB_DISK_SIZE_UNKNOWN.
|
||||||
|
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Likewise.
|
||||||
|
|
||||||
|
2010-05-31 Jiro SEKIBA <jir@unicus.jp>
|
||||||
|
|
||||||
|
* include/grub/disk.h (GRUB_DISK_SIZE_UNKNOWN): New macro.
|
||||||
|
* fs/nilfs.c: Support 2nd super block in case 1st one is accidently
|
||||||
|
corrupted or not synced properly.
|
||||||
|
|
||||||
|
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* normal/main.c (grub_normal_add_menu_entry): Avoid going out of args.
|
||||||
|
Reported by: Seth Goldberg.
|
||||||
|
|
||||||
|
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* loader/multiboot_mbi2.c (grub_multiboot_make_mbi): Fix incorrect
|
||||||
|
addition of dest.
|
||||||
|
Reported by: Seth Goldberg.
|
||||||
|
|
||||||
|
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* commands/setpci.c (grub_setpci_iter): Fix an incorrect function check.
|
||||||
|
Reported by: Seth Goldberg.
|
||||||
|
|
||||||
|
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* loader/multiboot_elfxx.c (grub_multiboot_load_elfXX) [__mips]: Check
|
||||||
|
64-bit address as signed on MIPS.
|
||||||
|
|
||||||
2010-05-28 Colin Watson <cjwatson@ubuntu.com>
|
2010-05-28 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
* configure.ac: AC_PROG_LEX sets LEX to ":" if lex is missing, not
|
* configure.ac: AC_PROG_LEX sets LEX to ":" if lex is missing, not
|
||||||
|
|
|
@ -59,7 +59,7 @@ grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
||||||
grub_uint32_t
|
grub_uint32_t
|
||||||
grub_dma_get_phys (struct grub_pci_dma_chunk *ch)
|
grub_dma_get_phys (struct grub_pci_dma_chunk *ch)
|
||||||
{
|
{
|
||||||
return (grub_uint32_t) ch;
|
return (grub_uint32_t) (grub_addr_t) ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -138,8 +138,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
grub_device_close (dev);
|
grub_device_close (dev);
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||||
"only partitions resding in the first 2TB "
|
"only partitions residing in the first 2TB "
|
||||||
"can be presen in hybrid MBR");
|
"can be present in hybrid MBR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,8 +243,8 @@ GRUB_MOD_INIT(gptsync)
|
||||||
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
||||||
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
||||||
N_("Fill hybrid MBR of GPT drive DEVICE. "
|
N_("Fill hybrid MBR of GPT drive DEVICE. "
|
||||||
"specified partitions will be a part "
|
"Specified partitions will be a part "
|
||||||
"of hybrid mbr. Up to 3 partitions are "
|
"of hybrid MBR. Up to 3 partitions are "
|
||||||
"allowed. TYPE is an MBR type. "
|
"allowed. TYPE is an MBR type. "
|
||||||
"+ means that partition is active. "
|
"+ means that partition is active. "
|
||||||
"Only one partition can be active."));
|
"Only one partition can be active."));
|
||||||
|
|
|
@ -96,7 +96,7 @@ grub_setpci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
if (check_device && grub_pci_get_device (dev) != device)
|
if (check_device && grub_pci_get_device (dev) != device)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (check_function && grub_pci_get_function (dev) != device)
|
if (check_function && grub_pci_get_function (dev) != function)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, regaddr);
|
addr = grub_pci_make_address (dev, regaddr);
|
||||||
|
|
|
@ -20,14 +20,14 @@ TARGET_NO_STRIP = yes
|
||||||
|
|
||||||
ifneq ($(TARGET_NO_MODULES), yes)
|
ifneq ($(TARGET_NO_MODULES), yes)
|
||||||
kernel_img_SOURCES += symlist.c kern/$(target_cpu)/dl.c
|
kernel_img_SOURCES += symlist.c kern/$(target_cpu)/dl.c
|
||||||
|
else
|
||||||
|
kernel_img_SOURCES += grub_emu_init.c
|
||||||
|
endif
|
||||||
ifneq ($(target_cpu), i386)
|
ifneq ($(target_cpu), i386)
|
||||||
ifneq ($(target_cpu), x86_64)
|
ifneq ($(target_cpu), x86_64)
|
||||||
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
|
||||||
kernel_img_SOURCES += grub_emu_init.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
pkglib_MODULES += halt.mod
|
pkglib_MODULES += halt.mod
|
||||||
|
|
|
@ -120,7 +120,8 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
|
||||||
{
|
{
|
||||||
data->flags = GRUB_BIOSDISK_FLAG_LBA | GRUB_BIOSDISK_FLAG_CDROM;
|
data->flags = GRUB_BIOSDISK_FLAG_LBA | GRUB_BIOSDISK_FLAG_CDROM;
|
||||||
data->sectors = 32;
|
data->sectors = 32;
|
||||||
total_sectors = GRUB_ULONG_MAX; /* TODO: get the correct size. */
|
/* TODO: get the correct size. */
|
||||||
|
total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||||
}
|
}
|
||||||
else if (drive & 0x80)
|
else if (drive & 0x80)
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,7 +204,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
||||||
/* XXX: There is no property to read the number of blocks. There
|
/* XXX: There is no property to read the number of blocks. There
|
||||||
should be a property `#blocks', but it is not there. Perhaps it
|
should be a property `#blocks', but it is not there. Perhaps it
|
||||||
is possible to use seek for this. */
|
is possible to use seek for this. */
|
||||||
disk->total_sectors = 0xFFFFFFFFUL;
|
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||||
|
|
||||||
disk->id = (unsigned long) op;
|
disk->id = (unsigned long) op;
|
||||||
|
|
||||||
|
|
454
docs/grub.texi
454
docs/grub.texi
|
@ -20,7 +20,7 @@
|
||||||
This manual is for GNU GRUB (version @value{VERSION},
|
This manual is for GNU GRUB (version @value{VERSION},
|
||||||
@value{UPDATED}).
|
@value{UPDATED}).
|
||||||
|
|
||||||
Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009 Free Software Foundation, Inc.
|
Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
@quotation
|
@quotation
|
||||||
Permission is granted to copy, distribute and/or modify this document
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
@ -34,9 +34,7 @@ Invariant Sections.
|
||||||
@direntry
|
@direntry
|
||||||
* GRUB: (grub). The GRand Unified Bootloader
|
* GRUB: (grub). The GRand Unified Bootloader
|
||||||
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
|
* grub-install: (grub)Invoking grub-install. Install GRUB on your drive
|
||||||
* grub-terminfo: (grub)Invoking grub-terminfo. Generate a terminfo
|
* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
|
||||||
command from a
|
|
||||||
terminfo name
|
|
||||||
@end direntry
|
@end direntry
|
||||||
|
|
||||||
@setchapternewpage odd
|
@setchapternewpage odd
|
||||||
|
@ -87,9 +85,8 @@ This edition documents version @value{VERSION}.
|
||||||
* Interface:: The menu and the command-line
|
* Interface:: The menu and the command-line
|
||||||
* Commands:: The list of available builtin commands
|
* Commands:: The list of available builtin commands
|
||||||
* Troubleshooting:: Error messages produced by GRUB
|
* Troubleshooting:: Error messages produced by GRUB
|
||||||
* Invoking the grub shell:: How to use the grub shell
|
|
||||||
* Invoking grub-install:: How to use the GRUB installer
|
* Invoking grub-install:: How to use the GRUB installer
|
||||||
* Invoking grub-terminfo:: How to generate a terminfo command
|
* Invoking grub-mkconfig:: Generate a GRUB configuration file
|
||||||
* Obtaining and Building GRUB:: How to obtain and build GRUB
|
* Obtaining and Building GRUB:: How to obtain and build GRUB
|
||||||
* Reporting bugs:: Where you should send a bug report
|
* Reporting bugs:: Where you should send a bug report
|
||||||
* Future:: Some future plans on GRUB
|
* Future:: Some future plans on GRUB
|
||||||
|
@ -453,6 +450,7 @@ the @dfn{boot directory}.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Installing GRUB using grub-install::
|
* Installing GRUB using grub-install::
|
||||||
|
* Making a GRUB bootable CD-ROM::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
|
@ -532,11 +530,11 @@ quite careful. If the output is wrong, it is unlikely that your
|
||||||
computer will be able to boot with no problem.
|
computer will be able to boot with no problem.
|
||||||
|
|
||||||
Note that @command{grub-install} is actually just a shell script and the
|
Note that @command{grub-install} is actually just a shell script and the
|
||||||
real task is done by the grub shell @command{grub} (@pxref{Invoking the
|
real task is done by @command{grub-mkimage} and @command{grub-setup}.
|
||||||
grub shell}). Therefore, you may run @command{grub} directly to install
|
Therefore, you may run those commands directly to install GRUB, without
|
||||||
GRUB, without using @command{grub-install}. Don't do that, however,
|
using @command{grub-install}. Don't do that, however, unless you are very
|
||||||
unless you are very familiar with the internals of GRUB. Installing a
|
familiar with the internals of GRUB. Installing a boot loader on a running
|
||||||
boot loader on a running OS may be extremely dangerous.
|
OS may be extremely dangerous.
|
||||||
|
|
||||||
|
|
||||||
@node Making a GRUB bootable CD-ROM
|
@node Making a GRUB bootable CD-ROM
|
||||||
|
@ -649,6 +647,35 @@ use more complicated instructions. @xref{DOS/Windows}, for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
|
|
||||||
|
@node Chain-loading
|
||||||
|
@subsection Chain-loading an OS
|
||||||
|
|
||||||
|
Operating systems that do not support Multiboot and do not have specific
|
||||||
|
support in GRUB (specific support is available for Linux, FreeBSD, NetBSD
|
||||||
|
and OpenBSD) must be chain-loaded, which involves loading another boot
|
||||||
|
loader and jumping to it in real mode.
|
||||||
|
|
||||||
|
The @command{chainloader} command (@pxref{chainloader}) is used to set this
|
||||||
|
up. It is normally also necessary to load some GRUB modules and set the
|
||||||
|
appropriate root device. Putting this together, we get something like this,
|
||||||
|
for a Windows system on the first partition of the first hard disk:
|
||||||
|
|
||||||
|
@verbatim
|
||||||
|
menuentry "Windows" {
|
||||||
|
insmod chain
|
||||||
|
insmod ntfs
|
||||||
|
set root=(hd0,1)
|
||||||
|
chainloader +1
|
||||||
|
}
|
||||||
|
@end verbatim
|
||||||
|
@c FIXME: document UUIDs.
|
||||||
|
|
||||||
|
On systems with multiple hard disks, an additional workaround may be
|
||||||
|
required. @xref{DOS/Windows}.
|
||||||
|
|
||||||
|
Chain-loading is only supported on PC BIOS and EFI platforms.
|
||||||
|
|
||||||
|
|
||||||
@node OS-specific notes
|
@node OS-specific notes
|
||||||
@section Some caveats on OS-specific issues
|
@section Some caveats on OS-specific issues
|
||||||
|
|
||||||
|
@ -657,6 +684,7 @@ Here, we describe some caveats on several operating systems.
|
||||||
@menu
|
@menu
|
||||||
* GNU/Hurd::
|
* GNU/Hurd::
|
||||||
* GNU/Linux::
|
* GNU/Linux::
|
||||||
|
* DOS/Windows::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
|
@ -698,6 +726,246 @@ the size, run the command @command{uppermem} @emph{before} loading the
|
||||||
kernel. @xref{uppermem}, for more information.
|
kernel. @xref{uppermem}, for more information.
|
||||||
|
|
||||||
|
|
||||||
|
@node DOS/Windows
|
||||||
|
@subsection DOS/Windows
|
||||||
|
|
||||||
|
GRUB cannot boot DOS or Windows directly, so you must chain-load them
|
||||||
|
(@pxref{Chain-loading}). However, their boot loaders have some critical
|
||||||
|
deficiencies, so it may not work to just chain-load them. To overcome
|
||||||
|
the problems, GRUB provides you with two helper functions.
|
||||||
|
|
||||||
|
If you have installed DOS (or Windows) on a non-first hard disk, you
|
||||||
|
have to use the disk swapping technique, because that OS cannot boot
|
||||||
|
from any disks but the first one. The workaround used in GRUB is the
|
||||||
|
command @command{drivemap} (@pxref{drivemap}), like this:
|
||||||
|
|
||||||
|
@example
|
||||||
|
drivemap -s (hd0) (hd1)
|
||||||
|
@end example
|
||||||
|
|
||||||
|
This performs a @dfn{virtual} swap between your first and second hard
|
||||||
|
drive.
|
||||||
|
|
||||||
|
@strong{Caution:} This is effective only if DOS (or Windows) uses BIOS
|
||||||
|
to access the swapped disks. If that OS uses a special driver for the
|
||||||
|
disks, this probably won't work.
|
||||||
|
|
||||||
|
Another problem arises if you installed more than one set of DOS/Windows
|
||||||
|
onto one disk, because they could be confused if there are more than one
|
||||||
|
primary partitions for DOS/Windows. Certainly you should avoid doing
|
||||||
|
this, but there is a solution if you do want to do so. Use the partition
|
||||||
|
hiding/unhiding technique.
|
||||||
|
|
||||||
|
If GRUB @dfn{hides} a DOS (or Windows) partition (@pxref{parttool}), DOS (or
|
||||||
|
Windows) will ignore the partition. If GRUB @dfn{unhides} a DOS (or Windows)
|
||||||
|
partition, DOS (or Windows) will detect the partition. Thus, if you have
|
||||||
|
installed DOS (or Windows) on the first and the second partition of the
|
||||||
|
first hard disk, and you want to boot the copy on the first partition, do
|
||||||
|
the following:
|
||||||
|
|
||||||
|
@example
|
||||||
|
@group
|
||||||
|
parttool (hd0,1) hidden-
|
||||||
|
parttool (hd0,2) hidden+
|
||||||
|
set root=(hd0,1)
|
||||||
|
chainloader +1
|
||||||
|
parttool @verb{'${root}'} boot+
|
||||||
|
boot
|
||||||
|
@end group
|
||||||
|
@end example
|
||||||
|
|
||||||
|
|
||||||
|
@node Configuration
|
||||||
|
@chapter Writing your own configuration file
|
||||||
|
|
||||||
|
GRUB is configured using @file{grub.cfg}, usually located under
|
||||||
|
@file{/boot/grub}. This file is quite flexible, but most users will not
|
||||||
|
need to write the whole thing by hand.
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Simple configuration:: Recommended for most users
|
||||||
|
* Shell-like scripting:: For power users and developers
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
|
@node Simple configuration
|
||||||
|
@section Simple configuration handling
|
||||||
|
|
||||||
|
The program @command{grub-mkconfig} (@pxref{Invoking grub-mkconfig})
|
||||||
|
generates @file{grub.cfg} files suitable for most cases. It is suitable for
|
||||||
|
use when upgrading a distribution, and will discover available kernels and
|
||||||
|
attempt to generate menu entries for them.
|
||||||
|
|
||||||
|
The file @file{/etc/default/grub} controls the operation of
|
||||||
|
@command{grub-mkconfig}. It is sourced by a shell script, and so must be
|
||||||
|
valid POSIX shell input; normally, it will just be a sequence of
|
||||||
|
@samp{KEY=value} lines, but if the value contains spaces or other special
|
||||||
|
characters then it must be quoted. For example:
|
||||||
|
|
||||||
|
@example
|
||||||
|
GRUB_TERMINAL_INPUT="console serial"
|
||||||
|
@end example
|
||||||
|
|
||||||
|
Valid keys in @file{/etc/default/grub} are as follows:
|
||||||
|
|
||||||
|
@table @samp
|
||||||
|
@item GRUB_DEFAULT
|
||||||
|
The default menu entry. This may be a number, in which case it identifies
|
||||||
|
the Nth entry in the generated menu counted from zero, or the full name of a
|
||||||
|
menu entry, or the special string @samp{saved}. Using the full name may be
|
||||||
|
useful if you want to set a menu entry as the default even though there may
|
||||||
|
be a variable number of entries before it.
|
||||||
|
|
||||||
|
If you set this to @samp{saved}, then the default menu entry will be that
|
||||||
|
saved by @samp{GRUB_SAVEDEFAULT}, @command{grub-set-default}, or
|
||||||
|
@command{grub-reboot}.
|
||||||
|
|
||||||
|
The default is @samp{0}.
|
||||||
|
|
||||||
|
@item GRUB_SAVEDEFAULT
|
||||||
|
If this option is set to @samp{true}, then, when an entry is selected, save
|
||||||
|
it as a new default entry for use by future runs of GRUB. This is only
|
||||||
|
useful if @samp{GRUB_DEFAULT=saved}; it is a separate option because
|
||||||
|
@samp{GRUB_DEFAULT=saved} is useful without this option, in conjunction with
|
||||||
|
@command{grub-set-default} or @command{grub-reboot}. Unset by default.
|
||||||
|
|
||||||
|
@item GRUB_TIMEOUT
|
||||||
|
Boot the default entry this many seconds after the menu is displayed, unless
|
||||||
|
a key is pressed. The default is @samp{5}. Set to @samp{0} to boot
|
||||||
|
immediately without displaying the menu, or to @samp{-1} to wait
|
||||||
|
indefinitely.
|
||||||
|
|
||||||
|
@item GRUB_HIDDEN_TIMEOUT
|
||||||
|
Wait this many seconds for a key to be pressed before displaying the menu.
|
||||||
|
If no key is pressed during that time, boot immediately. Unset by default.
|
||||||
|
|
||||||
|
@item GRUB_HIDDEN_TIMEOUT_QUIET
|
||||||
|
In conjunction with @samp{GRUB_HIDDEN_TIMEOUT}, set this to @samp{true} to
|
||||||
|
suppress the verbose countdown while waiting for a key to be pressed before
|
||||||
|
displaying the menu. Unset by default.
|
||||||
|
|
||||||
|
@item GRUB_DEFAULT_BUTTON
|
||||||
|
@itemx GRUB_TIMEOUT_BUTTON
|
||||||
|
@itemx GRUB_HIDDEN_TIMEOUT_BUTTON
|
||||||
|
@itemx GRUB_BUTTON_CMOS_ADDRESS
|
||||||
|
Variants of the corresponding variables without the @samp{_BUTTON} suffix,
|
||||||
|
used to support vendor-specific power buttons. @xref{Vendor power-on keys}.
|
||||||
|
|
||||||
|
@item GRUB_DISTRIBUTOR
|
||||||
|
Set by distributors of GRUB to their identifying name. This is used to
|
||||||
|
generate more informative menu entry titles.
|
||||||
|
|
||||||
|
@item GRUB_TERMINAL_INPUT
|
||||||
|
Select the terminal input device. You may select multiple devices here,
|
||||||
|
separated by spaces.
|
||||||
|
|
||||||
|
Valid terminal input names depend on the platform, but may include
|
||||||
|
@samp{console} (PC BIOS and EFI consoles), @samp{serial} (serial terminal),
|
||||||
|
@samp{ofconsole} (Open Firmware console), @samp{at_keyboard} (PC AT
|
||||||
|
keyboard, mainly useful with Coreboot), or @samp{usb_keyboard} (USB keyboard
|
||||||
|
using the HID Boot Protocol, for cases where the firmware does not handle
|
||||||
|
this).
|
||||||
|
|
||||||
|
The default is to use the platform's native terminal input.
|
||||||
|
|
||||||
|
@item GRUB_TERMINAL_OUTPUT
|
||||||
|
Select the terminal output device. You may select multiple devices here,
|
||||||
|
separated by spaces.
|
||||||
|
|
||||||
|
Valid terminal output names depend on the platform, but may include
|
||||||
|
@samp{console} (PC BIOS and EFI consoles), @samp{serial} (serial terminal),
|
||||||
|
@samp{gfxterm} (graphics-mode output), @samp{ofconsole} (Open Firmware
|
||||||
|
console), or @samp{vga_text} (VGA text output, mainly useful with Coreboot).
|
||||||
|
|
||||||
|
The default is to use the platform's native terminal input.
|
||||||
|
|
||||||
|
@item GRUB_TERMINAL
|
||||||
|
If this option is set, it overrides both @samp{GRUB_TERMINAL_INPUT} and
|
||||||
|
@samp{GRUB_TERMINAL_OUTPUT} to the same value.
|
||||||
|
|
||||||
|
@item GRUB_SERIAL_COMMAND
|
||||||
|
A command to configure the serial port when using the serial console.
|
||||||
|
@xref{serial}. Defaults to @samp{serial}.
|
||||||
|
|
||||||
|
@item GRUB_CMDLINE_LINUX
|
||||||
|
Command-line arguments to add to menu entries for the Linux kernel.
|
||||||
|
|
||||||
|
@item GRUB_CMDLINE_LINUX_DEFAULT
|
||||||
|
Unless @samp{GRUB_DISABLE_LINUX_RECOVERY} is set, two menu entries will be
|
||||||
|
generated for each Linux kernel: one default entry and one entry for
|
||||||
|
recovery mode. This option lists command-line arguments to add only to the
|
||||||
|
default menu entry, after those listed in @samp{GRUB_CMDLINE_LINUX}.
|
||||||
|
|
||||||
|
@item GRUB_CMDLINE_NETBSD
|
||||||
|
@itemx GRUB_CMDLINE_NETBSD_DEFAULT
|
||||||
|
As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
|
||||||
|
NetBSD.
|
||||||
|
|
||||||
|
@item GRUB_DISABLE_LINUX_UUID
|
||||||
|
Normally, @command{grub-mkconfig} will generate menu entries that use
|
||||||
|
universally-unique identifiers (UUIDs) to identify the root filesystem to
|
||||||
|
the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is
|
||||||
|
usually more reliable, but in some cases it may not be appropriate. To
|
||||||
|
disable the use of UUIDs, set this option to @samp{true}.
|
||||||
|
|
||||||
|
@item GRUB_DISABLE_LINUX_RECOVERY
|
||||||
|
Disable the generation of recovery mode menu entries for Linux.
|
||||||
|
|
||||||
|
@item GRUB_DISABLE_NETBSD_RECOVERY
|
||||||
|
Disable the generation of recovery mode menu entries for NetBSD.
|
||||||
|
|
||||||
|
@item GRUB_GFXMODE
|
||||||
|
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
|
||||||
|
you can only use modes which your graphics card supports via VESA BIOS
|
||||||
|
Extensions (VBE), so for example native LCD panel resolutions may not be
|
||||||
|
available. The default is @samp{640x480}.
|
||||||
|
|
||||||
|
@item GRUB_BACKGROUND
|
||||||
|
Set a background image for use with the @samp{gfxterm} graphical terminal.
|
||||||
|
The value of this option must be a file readable by GRUB at boot time, and
|
||||||
|
it must end with @file{.png}, @file{.tga}, @file{.jpg}, or @file{.jpeg}.
|
||||||
|
The image will be scaled if necessary to fit the screen.
|
||||||
|
|
||||||
|
@item GRUB_THEME
|
||||||
|
Set a theme for use with the @samp{gfxterm} graphical terminal.
|
||||||
|
@xref{Themes}.
|
||||||
|
|
||||||
|
@item GRUB_GFXPAYLOAD_LINUX
|
||||||
|
Set to @samp{text} to force the Linux kernel to boot in normal text mode,
|
||||||
|
@samp{keep} to preserve the graphics mode set using @samp{GRUB_GFXMODE},
|
||||||
|
@samp{@var{width}x@var{height}}[@samp{x@var{depth}}] to set a particular
|
||||||
|
graphics mode, or a sequence of these separated by commas or semicolons to
|
||||||
|
try several modes in sequence.
|
||||||
|
|
||||||
|
Depending on your kernel, your distribution, your graphics card, and the
|
||||||
|
phase of the moon, note that using this option may cause GNU/Linux to suffer
|
||||||
|
from various display problems, particularly during the early part of the
|
||||||
|
boot sequence. If you have problems, simply unset this option and GRUB will
|
||||||
|
tell Linux to boot in normal text mode.
|
||||||
|
|
||||||
|
@item GRUB_DISABLE_OS_PROBER
|
||||||
|
Normally, @command{grub-mkconfig} will try to use the external
|
||||||
|
@command{os-prober} program, if installed, to discover other operating
|
||||||
|
systems installed on the same system and generate appropriate menu entries
|
||||||
|
for them. Set this option to @samp{true} to disable this.
|
||||||
|
|
||||||
|
@item GRUB_INIT_TUNE
|
||||||
|
Play a tune on the speaker when GRUB starts. This is particularly useful
|
||||||
|
for users unable to see the screen. The value of this option is passed
|
||||||
|
directly to @ref{play}.
|
||||||
|
@end table
|
||||||
|
|
||||||
|
For more detailed customisation of @command{grub-mkconfig}'s output, you may
|
||||||
|
edit the scripts in @file{/etc/grub.d} directly.
|
||||||
|
@file{/etc/grub.d/40_custom} is particularly useful for adding entire custom
|
||||||
|
menu entries; simply type the menu entries you want to add at the end of
|
||||||
|
that file, making sure to leave at least the first two lines intact.
|
||||||
|
|
||||||
|
|
||||||
|
@node Shell-like scripting
|
||||||
|
@section Writing full configuration files directly
|
||||||
|
|
||||||
|
|
||||||
@node Serial terminal
|
@node Serial terminal
|
||||||
@chapter Using GRUB via a serial line
|
@chapter Using GRUB via a serial line
|
||||||
|
|
||||||
|
@ -884,6 +1152,7 @@ the command-line interface.
|
||||||
@menu
|
@menu
|
||||||
* Command-line interface:: The flexible command-line interface
|
* Command-line interface:: The flexible command-line interface
|
||||||
* Menu interface:: The simple menu interface
|
* Menu interface:: The simple menu interface
|
||||||
|
* Menu entry editor:: Editing a menu entry
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
|
@ -1076,14 +1345,14 @@ Commands usable anywhere in the menu and in the command-line.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* serial:: Set up a serial device
|
* serial:: Set up a serial device
|
||||||
* terminfo:: Define escape sequences for a terminal
|
* terminfo:: Define terminal type
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
|
|
||||||
@node serial
|
@node serial
|
||||||
@subsection serial
|
@subsection serial
|
||||||
|
|
||||||
@deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}] [@option{--device=dev}]
|
@deffn Command serial [@option{--unit=unit}] [@option{--port=port}] [@option{--speed=speed}] [@option{--word=word}] [@option{--parity=parity}] [@option{--stop=stop}]
|
||||||
Initialize a serial device. @var{unit} is a number in the range 0-3
|
Initialize a serial device. @var{unit} is a number in the range 0-3
|
||||||
specifying which serial port to use; default is 0, which corresponds to
|
specifying which serial port to use; default is 0, which corresponds to
|
||||||
the port often called COM1. @var{port} is the I/O port where the UART
|
the port often called COM1. @var{port} is the I/O port where the UART
|
||||||
|
@ -1092,10 +1361,7 @@ is to be found; if specified it takes precedence over @var{unit}.
|
||||||
@var{stop} are the number of data bits and stop bits. Data bits must
|
@var{stop} are the number of data bits and stop bits. Data bits must
|
||||||
be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
|
be in the range 5-8 and stop bits must be 1 or 2. Default is 8 data
|
||||||
bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd},
|
bits and one stop bit. @var{parity} is one of @samp{no}, @samp{odd},
|
||||||
@samp{even} and defaults to @samp{no}. The option @option{--device}
|
@samp{even} and defaults to @samp{no}.
|
||||||
can only be used in the grub shell and is used to specify the
|
|
||||||
tty device to be used in the host operating system (@pxref{Invoking the
|
|
||||||
grub shell}).
|
|
||||||
|
|
||||||
The serial port is not used as a communication channel unless the
|
The serial port is not used as a communication channel unless the
|
||||||
@command{terminal} command is used (@pxref{terminal}).
|
@command{terminal} command is used (@pxref{terminal}).
|
||||||
|
@ -1108,15 +1374,16 @@ support. See also @ref{Serial terminal}.
|
||||||
@node terminfo
|
@node terminfo
|
||||||
@subsection terminfo
|
@subsection terminfo
|
||||||
|
|
||||||
@deffn Command terminfo @option{--name=name} @option{--cursor-address=seq} [@option{--clear-screen=seq}] [@option{--enter-standout-mode=seq}] [@option{--exit-standout-mode=seq}]
|
@deffn Command terminfo [term]
|
||||||
Define the capabilities of your terminal. Use this command to define
|
Define the capabilities of your terminal by giving the name of an entry in
|
||||||
escape sequences, if it is not vt100-compatible. You may use @samp{\e}
|
the terminfo database, which should correspond roughly to a @samp{TERM}
|
||||||
for @key{ESC} and @samp{^X} for a control character.
|
environment variable in Unix.
|
||||||
|
|
||||||
You can use the utility @command{grub-terminfo} to generate
|
At the moment, only @samp{vt100} is supported in GRUB 2. If you need other
|
||||||
appropriate arguments to this command. @xref{Invoking grub-terminfo}.
|
terminal types, please contact us to discuss the best way to include support
|
||||||
|
for these in GRUB.
|
||||||
|
|
||||||
If no option is specified, the current settings are printed.
|
If no option is specified, the current terminal type is printed.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
@ -1137,13 +1404,17 @@ you forget a command, you can run the command @command{help}
|
||||||
* configfile:: Load a configuration file
|
* configfile:: Load a configuration file
|
||||||
* crc:: Calculate CRC32 checksums
|
* crc:: Calculate CRC32 checksums
|
||||||
* date:: Display or set current date and time
|
* date:: Display or set current date and time
|
||||||
|
* drivemap:: Map a drive to another
|
||||||
* echo:: Display a line of text
|
* echo:: Display a line of text
|
||||||
* export:: Export an environment variable
|
* export:: Export an environment variable
|
||||||
|
* gettext:: Translate a string
|
||||||
|
* gptsync:: Fill an MBR based on GPT entries
|
||||||
* halt:: Shut down your computer
|
* halt:: Shut down your computer
|
||||||
* help:: Show help messages
|
* help:: Show help messages
|
||||||
* insmod:: Insert a module
|
* insmod:: Insert a module
|
||||||
* keystatus:: Check key modifier status
|
* keystatus:: Check key modifier status
|
||||||
* ls:: List devices or files
|
* ls:: List devices or files
|
||||||
|
* parttool:: Modify partition table entries
|
||||||
* play:: Play a tune
|
* play:: Play a tune
|
||||||
* reboot:: Reboot your computer
|
* reboot:: Reboot your computer
|
||||||
* set:: Set an environment variable
|
* set:: Set an environment variable
|
||||||
|
@ -1209,11 +1480,11 @@ grub> @kbd{cat /etc/fstab}
|
||||||
|
|
||||||
@deffn Command chainloader [@option{--force}] file
|
@deffn Command chainloader [@option{--force}] file
|
||||||
Load @var{file} as a chain-loader. Like any other file loaded by the
|
Load @var{file} as a chain-loader. Like any other file loaded by the
|
||||||
filesystem code, it can use the blocklist notation to grab the first
|
filesystem code, it can use the blocklist notation (@pxref{Block list
|
||||||
sector of the current partition with @samp{+1}. If you specify the
|
syntax}) to grab the first sector of the current partition with @samp{+1}.
|
||||||
option @option{--force}, then load @var{file} forcibly, whether it has a
|
If you specify the option @option{--force}, then load @var{file} forcibly,
|
||||||
correct signature or not. This is required when you want to load a
|
whether it has a correct signature or not. This is required when you want to
|
||||||
defective boot loader, such as SCO UnixWare 7.1 (@pxref{SCO UnixWare}).
|
load a defective boot loader, such as SCO UnixWare 7.1.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
@ -1268,6 +1539,32 @@ hour, minute, and second unchanged.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
@node drivemap
|
||||||
|
@subsection drivemap
|
||||||
|
|
||||||
|
@deffn Command drivemap @option{-l}|@option{-r}|[@option{-s}] @
|
||||||
|
from_drive to_drive
|
||||||
|
Without options, map the drive @var{from_drive} to the drive @var{to_drive}.
|
||||||
|
This is necessary when you chain-load some operating systems, such as DOS,
|
||||||
|
if such an OS resides at a non-first drive. For convenience, any partition
|
||||||
|
suffix on the drive is ignored, so you can safely use @verb{'${root}'} as a
|
||||||
|
drive specification.
|
||||||
|
|
||||||
|
With the @option{-s} option, perform the reverse mapping as well, swapping
|
||||||
|
the two drives.
|
||||||
|
|
||||||
|
With the @option{-l} option, list the current mappings.
|
||||||
|
|
||||||
|
With the @option{-r} option, reset all mappings to the default values.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
@example
|
||||||
|
drivemap -s (hd0) (hd1)
|
||||||
|
@end example
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
@node echo
|
@node echo
|
||||||
@subsection echo
|
@subsection echo
|
||||||
|
|
||||||
|
@ -1320,6 +1617,38 @@ to subsidiary configuration files loaded using @command{configfile}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
@node gettext
|
||||||
|
@subsection gettext
|
||||||
|
|
||||||
|
@deffn Command gettext string
|
||||||
|
Translate @var{string} into the current language.
|
||||||
|
|
||||||
|
The current language code is stored in the @samp{lang} variable in GRUB's
|
||||||
|
environment. Translation files in MO format are read from
|
||||||
|
@samp{locale_dir}, usually @file{/boot/grub/locale}.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
@node gptsync
|
||||||
|
@subsection gptsync
|
||||||
|
|
||||||
|
@deffn Command gptsync device [partition[+/-[type]]] @dots{}
|
||||||
|
Disks using the GUID Partition Table (GPT) also have a legacy Master Boot
|
||||||
|
Record (MBR) partition table for compatibility with the BIOS and with older
|
||||||
|
operating systems. The legacy MBR can only represent a limited subset of
|
||||||
|
GPT partition entries.
|
||||||
|
|
||||||
|
This command populates the legacy MBR with the specified @var{partition}
|
||||||
|
entries on @var{device}. Up to three partitions may be used.
|
||||||
|
|
||||||
|
@var{type} is an MBR partition type code; prefix with @samp{0x} if you want
|
||||||
|
to enter this in hexadecimal. The separator between @var{partition} and
|
||||||
|
@var{type} may be @samp{+} to make the partition active, or @samp{-} to make
|
||||||
|
it inactive; only one partition may be active. If both the separator and
|
||||||
|
type are omitted, then the partition will be inactive.
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
@node halt
|
@node halt
|
||||||
@subsection halt
|
@subsection halt
|
||||||
|
|
||||||
|
@ -1383,6 +1712,41 @@ name syntax}), then list the contents of that directory.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
@node parttool
|
||||||
|
@subsection parttool
|
||||||
|
|
||||||
|
@deffn Command parttool partition commands
|
||||||
|
Make various modifications to partition table entries.
|
||||||
|
|
||||||
|
Each @var{command} is either a boolean option, in which case it must be
|
||||||
|
followed with @samp{+} or @samp{-} (with no intervening space) to enable or
|
||||||
|
disable that option, or else it takes a value in the form
|
||||||
|
@samp{@var{command}=@var{value}}.
|
||||||
|
|
||||||
|
Currently, @command{parttool} is only useful on DOS partition tables (also
|
||||||
|
known as Master Boot Record, or MBR). On these partition tables, the
|
||||||
|
following commands are available:
|
||||||
|
|
||||||
|
@table @asis
|
||||||
|
@item @samp{boot} (boolean)
|
||||||
|
When enabled, this makes the selected partition be the active (bootable)
|
||||||
|
partition on its disk, clearing the active flag on all other partitions.
|
||||||
|
This command is limited to @emph{primary} partitions.
|
||||||
|
|
||||||
|
@item @samp{type} (value)
|
||||||
|
Change the type of an existing partition. The value must be a number in the
|
||||||
|
range 0-0xFF (prefix with @samp{0x} to enter it in hexadecimal).
|
||||||
|
|
||||||
|
@item @samp{hidden} (boolean)
|
||||||
|
When enabled, this hides the selected partition by setting the @dfn{hidden}
|
||||||
|
bit in its partition type code; when disabled, unhides the selected
|
||||||
|
partition by clearing this bit. This is useful only when booting DOS or
|
||||||
|
Wwindows and multiple primary FAT partitions exist in one disk. See also
|
||||||
|
@ref{DOS/Windows}.
|
||||||
|
@end table
|
||||||
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
@node play
|
@node play
|
||||||
@subsection play
|
@subsection play
|
||||||
|
|
||||||
|
@ -1430,9 +1794,9 @@ Unset the environment variable @var{envvar}.
|
||||||
@node Invoking grub-install
|
@node Invoking grub-install
|
||||||
@chapter Invoking grub-install
|
@chapter Invoking grub-install
|
||||||
|
|
||||||
The program @command{grub-install} installs GRUB on your drive using the
|
The program @command{grub-install} installs GRUB on your drive using
|
||||||
grub shell (@pxref{Invoking the grub shell}). You must specify the
|
@command{grub-mkimage} and (on some platforms) @command{grub-setup}. You
|
||||||
device name on which you want to install GRUB, like this:
|
must specify the device name on which you want to install GRUB, like this:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
grub-install @var{install_device}
|
grub-install @var{install_device}
|
||||||
|
@ -1468,6 +1832,32 @@ into/from your computer.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
|
||||||
|
@node Invoking grub-mkconfig
|
||||||
|
@chapter Invoking grub-mkconfig
|
||||||
|
|
||||||
|
The program @command{grub-mkconfig} generates a configuration file for GRUB
|
||||||
|
(@pxref{Simple configuration}).
|
||||||
|
|
||||||
|
@example
|
||||||
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
@end example
|
||||||
|
|
||||||
|
@command{grub-mkconfig} accepts the following options:
|
||||||
|
|
||||||
|
@table @option
|
||||||
|
@item --help
|
||||||
|
Print a summary of the command-line options and exit.
|
||||||
|
|
||||||
|
@item --version
|
||||||
|
Print the version number of GRUB and exit.
|
||||||
|
|
||||||
|
@item -o @var{file}
|
||||||
|
@itemx --output=@var{file}
|
||||||
|
Send the generated configuration file to @var{file}. The default is to send
|
||||||
|
it to standard output.
|
||||||
|
@end table
|
||||||
|
|
||||||
|
|
||||||
@node Obtaining and Building GRUB
|
@node Obtaining and Building GRUB
|
||||||
@appendix How to obtain and build GRUB
|
@appendix How to obtain and build GRUB
|
||||||
|
|
||||||
|
|
67
fs/nilfs2.c
67
fs/nilfs2.c
|
@ -49,6 +49,13 @@
|
||||||
#define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
|
#define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
|
||||||
#define NILFS_BTREE_LEVEL_MAX 14
|
#define NILFS_BTREE_LEVEL_MAX 14
|
||||||
|
|
||||||
|
/* nilfs 1st super block posission from beginning of the partition
|
||||||
|
in 512 block size */
|
||||||
|
#define NILFS_1ST_SUPER_BLOCK 2
|
||||||
|
/* nilfs 2nd super block posission from end of the partition
|
||||||
|
in 512 block size */
|
||||||
|
#define NILFS_2ND_SUPER_BLOCK 8
|
||||||
|
|
||||||
struct grub_nilfs2_inode
|
struct grub_nilfs2_inode
|
||||||
{
|
{
|
||||||
grub_uint64_t i_blocks;
|
grub_uint64_t i_blocks;
|
||||||
|
@ -703,6 +710,52 @@ grub_nilfs2_valid_sb (struct grub_nilfs2_super_block *sbp)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_nilfs2_load_sb (struct grub_nilfs2_data *data)
|
||||||
|
{
|
||||||
|
grub_disk_t disk = data->disk;
|
||||||
|
struct grub_nilfs2_super_block sb2;
|
||||||
|
grub_uint64_t partition_size;
|
||||||
|
int valid[2];
|
||||||
|
int swp = 0;
|
||||||
|
|
||||||
|
/* Read first super block. */
|
||||||
|
grub_disk_read (disk, NILFS_1ST_SUPER_BLOCK, 0,
|
||||||
|
sizeof (struct grub_nilfs2_super_block), &data->sblock);
|
||||||
|
/* Make sure if 1st super block is valid. */
|
||||||
|
valid[0] = grub_nilfs2_valid_sb (&data->sblock);
|
||||||
|
|
||||||
|
partition_size = grub_disk_get_size (disk);
|
||||||
|
if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
|
||||||
|
{
|
||||||
|
/* Read second super block. */
|
||||||
|
grub_disk_read (disk, partition_size - NILFS_2ND_SUPER_BLOCK, 0,
|
||||||
|
sizeof (struct grub_nilfs2_super_block), &sb2);
|
||||||
|
/* Make sure if 2nd super block is valid. */
|
||||||
|
valid[1] = grub_nilfs2_valid_sb (&sb2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* 2nd super block may not exist, so it's invalid. */
|
||||||
|
valid[1] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!valid[0] && !valid[1])
|
||||||
|
return grub_error (GRUB_ERR_BAD_FS, "not a nilfs2 filesystem");
|
||||||
|
|
||||||
|
swp = valid[1] && (!valid[0] ||
|
||||||
|
grub_le_to_cpu64 (data->sblock.s_last_cno) <
|
||||||
|
grub_le_to_cpu64 (sb2.s_last_cno));
|
||||||
|
|
||||||
|
/* swap if first super block is invalid or older than second one. */
|
||||||
|
if (swp)
|
||||||
|
grub_memcpy (&data->sblock, &sb2,
|
||||||
|
sizeof (struct grub_nilfs2_super_block));
|
||||||
|
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
static struct grub_nilfs2_data *
|
static struct grub_nilfs2_data *
|
||||||
grub_nilfs2_mount (grub_disk_t disk)
|
grub_nilfs2_mount (grub_disk_t disk)
|
||||||
{
|
{
|
||||||
|
@ -717,19 +770,13 @@ grub_nilfs2_mount (grub_disk_t disk)
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
data->disk = disk;
|
||||||
|
|
||||||
/* Read the superblock. */
|
/* Read the superblock. */
|
||||||
grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_nilfs2_super_block),
|
grub_nilfs2_load_sb (data);
|
||||||
&data->sblock);
|
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Make sure this is an nilfs2 filesystem. */
|
|
||||||
if (!grub_nilfs2_valid_sb (&data->sblock))
|
|
||||||
{
|
|
||||||
grub_error (GRUB_ERR_BAD_FS, "not a nilfs2 filesystem");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
nilfs2_block_count = (1 << LOG2_NILFS2_BLOCK_SIZE (data));
|
nilfs2_block_count = (1 << LOG2_NILFS2_BLOCK_SIZE (data));
|
||||||
|
|
||||||
/* Read the last segment summary. */
|
/* Read the last segment summary. */
|
||||||
|
@ -748,8 +795,6 @@ grub_nilfs2_mount (grub_disk_t disk)
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
data->disk = disk;
|
|
||||||
|
|
||||||
grub_nilfs2_read_last_checkpoint (data, &last_checkpoint);
|
grub_nilfs2_read_last_checkpoint (data, &last_checkpoint);
|
||||||
|
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
|
|
|
@ -138,6 +138,9 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
||||||
#define GRUB_DISK_CACHE_SIZE 8
|
#define GRUB_DISK_CACHE_SIZE 8
|
||||||
#define GRUB_DISK_CACHE_BITS 3
|
#define GRUB_DISK_CACHE_BITS 3
|
||||||
|
|
||||||
|
/* Return value of grub_disk_get_size() in case disk size is unknown. */
|
||||||
|
#define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||||
|
|
||||||
/* This is called from the memory manager. */
|
/* This is called from the memory manager. */
|
||||||
void grub_disk_cache_invalidate_all (void);
|
void grub_disk_cache_invalidate_all (void);
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,86 @@ xgetcwd (void)
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
|
/* Statting something on a btrfs filesystem always returns a virtual device
|
||||||
|
major/minor pair rather than the real underlying device, because btrfs
|
||||||
|
can span multiple underlying devices (and even if it's currently only
|
||||||
|
using a single device it can be dynamically extended onto another). We
|
||||||
|
can't deal with the multiple-device case yet, but in the meantime, we can
|
||||||
|
at least cope with the single-device case by scanning
|
||||||
|
/proc/self/mountinfo. */
|
||||||
|
static char *
|
||||||
|
find_root_device_from_mountinfo (const char *dir)
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char *buf = NULL;
|
||||||
|
size_t len = 0;
|
||||||
|
char *ret = NULL;
|
||||||
|
|
||||||
|
fp = fopen ("/proc/self/mountinfo", "r");
|
||||||
|
if (! fp)
|
||||||
|
return NULL; /* fall through to other methods */
|
||||||
|
|
||||||
|
while (getline (&buf, &len, fp) > 0)
|
||||||
|
{
|
||||||
|
int mnt_id, parent_mnt_id;
|
||||||
|
unsigned int major, minor;
|
||||||
|
char enc_root[PATH_MAX], enc_path[PATH_MAX];
|
||||||
|
int count;
|
||||||
|
size_t enc_path_len;
|
||||||
|
const char *sep;
|
||||||
|
char fstype[PATH_MAX], device[PATH_MAX];
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
if (sscanf (buf, "%d %d %u:%u %s %s%n",
|
||||||
|
&mnt_id, &parent_mnt_id, &major, &minor, enc_root, enc_path,
|
||||||
|
&count) < 6)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strcmp (enc_root, "/") != 0)
|
||||||
|
continue; /* only a subtree is mounted */
|
||||||
|
|
||||||
|
enc_path_len = strlen (enc_path);
|
||||||
|
if (strncmp (dir, enc_path, enc_path_len) != 0 ||
|
||||||
|
(dir[enc_path_len] && dir[enc_path_len] != '/'))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* This is a parent of the requested directory. /proc/self/mountinfo
|
||||||
|
is in mount order, so it must be the closest parent we've
|
||||||
|
encountered so far. If it's virtual, return its device node;
|
||||||
|
otherwise, carry on to try to find something closer. */
|
||||||
|
|
||||||
|
free (ret);
|
||||||
|
ret = NULL;
|
||||||
|
|
||||||
|
if (major != 0)
|
||||||
|
continue; /* not a virtual device */
|
||||||
|
|
||||||
|
sep = strstr (buf + count, " - ");
|
||||||
|
if (!sep)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sep += sizeof (" - ") - 1;
|
||||||
|
if (sscanf (sep, "%s %s", fstype, device) != 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (stat (device, &st) < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!S_ISBLK (st.st_mode))
|
||||||
|
continue; /* not a block device */
|
||||||
|
|
||||||
|
ret = strdup (device);
|
||||||
|
}
|
||||||
|
|
||||||
|
free (buf);
|
||||||
|
fclose (fp);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __linux__ */
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -366,6 +446,12 @@ grub_guess_root_device (const char *dir)
|
||||||
#else /* !__GNU__ */
|
#else /* !__GNU__ */
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
os_dev = find_root_device_from_mountinfo (dir);
|
||||||
|
if (os_dev)
|
||||||
|
return os_dev;
|
||||||
|
#endif /* __linux__ */
|
||||||
|
|
||||||
if (stat (dir, &st) < 0)
|
if (stat (dir, &st) < 0)
|
||||||
grub_util_error ("cannot stat `%s'", dir);
|
grub_util_error ("cannot stat `%s'", dir);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,11 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
|
||||||
if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > MULTIBOOT_SEARCH)
|
if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > MULTIBOOT_SEARCH)
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "program header at a too high offset");
|
return grub_error (GRUB_ERR_BAD_OS, "program header at a too high offset");
|
||||||
|
|
||||||
#ifdef MULTIBOOT_LOAD_ELF64
|
#if defined (MULTIBOOT_LOAD_ELF64) && defined (__mips)
|
||||||
|
/* We still in 32-bit mode. */
|
||||||
|
if (ehdr->e_entry < 0xffffffff80000000ULL)
|
||||||
|
return grub_error (GRUB_ERR_BAD_OS, "invalid entry point for ELF64");
|
||||||
|
#else
|
||||||
/* We still in 32-bit mode. */
|
/* We still in 32-bit mode. */
|
||||||
if (ehdr->e_entry > 0xffffffff)
|
if (ehdr->e_entry > 0xffffffff)
|
||||||
return grub_error (GRUB_ERR_BAD_OS, "invalid entry point for ELF64");
|
return grub_error (GRUB_ERR_BAD_OS, "invalid entry point for ELF64");
|
||||||
|
|
|
@ -496,7 +496,7 @@ grub_multiboot_make_mbi (void *orig, grub_uint32_t dest, grub_off_t buf_off,
|
||||||
= (struct multiboot_tag_module *) ptrorig;
|
= (struct multiboot_tag_module *) ptrorig;
|
||||||
tag->type = MULTIBOOT_TAG_TYPE_MODULE;
|
tag->type = MULTIBOOT_TAG_TYPE_MODULE;
|
||||||
tag->size = sizeof (struct multiboot_tag_module) + cur->cmdline_size;
|
tag->size = sizeof (struct multiboot_tag_module) + cur->cmdline_size;
|
||||||
tag->mod_start = dest + cur->start;
|
tag->mod_start = cur->start;
|
||||||
tag->mod_end = tag->mod_start + cur->size;
|
tag->mod_end = tag->mod_start + cur->size;
|
||||||
grub_memcpy (tag->cmdline, cur->cmdline, cur->cmdline_size);
|
grub_memcpy (tag->cmdline, cur->cmdline, cur->cmdline_size);
|
||||||
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN);
|
||||||
|
|
|
@ -204,7 +204,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
/* Capture arguments. */
|
/* Capture arguments. */
|
||||||
if (grub_strncmp ("--", args[i], 2) == 0)
|
if (grub_strncmp ("--", args[i], 2) == 0 && i + 1 < argc)
|
||||||
{
|
{
|
||||||
const char *arg = &args[i][2];
|
const char *arg = &args[i][2];
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ EOF
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Gettext variables and module
|
# Gettext variables and module
|
||||||
if [ "x${LANG}" != "xC" ] ; then
|
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
|
||||||
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})
|
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir})
|
||||||
cat << EOF
|
cat << EOF
|
||||||
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
|
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
|
||||||
|
|
Loading…
Reference in a new issue