merge trunk
This commit is contained in:
commit
709e61a55f
19 changed files with 386 additions and 47 deletions
99
ChangeLog
99
ChangeLog
|
@ -1,3 +1,102 @@
|
|||
2011-10-01 Ales Nesrsta <starous@volny.cz>
|
||||
|
||||
* grub-core/bus/usb/uhci.c: Changes made by Rock Cui - thanks!
|
||||
(fixed problem related to using UHCI with coreboot).
|
||||
|
||||
2011-08-25 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
* gentpl.py: Use Autogen macros so that the output template file
|
||||
(Makefile.tpl) size is reduced.
|
||||
|
||||
2011-09-29 Mads Kiilerich <mads@kiilerich.com>
|
||||
|
||||
* grub-core/Makefile.core.def (kernel): Add kern/i386/int.S to
|
||||
extra_dist.
|
||||
|
||||
2011-09-29 Mario Limonciello <mario_limonciello@dell.com>
|
||||
|
||||
* util/misc.c (grub_util_get_disk_size) [__MINGW32__]: Strip trailing
|
||||
slashes on PHYSICALDRIVE%d paths when making Windows CreateFile calls.
|
||||
|
||||
2011-09-29 Mario Limonciello <mario_limonciello@dell.com>
|
||||
|
||||
* grub-core/kern/emu/misc.c (canonicalize_file_name) [__MINGW32__]: Use
|
||||
_fullpath.
|
||||
|
||||
2011-09-29 Mario Limonciello <mario_limonciello@dell.com>
|
||||
|
||||
Remove extra declaration of sleep for mingw32.
|
||||
|
||||
* util/misc.c (sleep) [__MINGW32__]: Removed.
|
||||
* include/grub/util/misc.h (sleep) [__MINGW32__]: Likewise.
|
||||
|
||||
2011-09-28 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* include/grub/bsdlabel.h (grub_partition_bsd_disk_label): Add fields
|
||||
type and packname.
|
||||
* include/grub/i386/netbsd_bootinfo.h (NETBSD_BTINFO_BOOTDISK):
|
||||
Resurrected.
|
||||
(NETBSD_BTINFO_BOOTWEDGE): New definition.
|
||||
(grub_netbsd_btinfo_bootwedge): New struct.
|
||||
* grub-core/loader/i386/bsd.c (grub_netbsd_add_boot_disk_and_wedge):
|
||||
New function.
|
||||
(grub_cmd_netbsd): Call grub_netbsd_add_boot_disk_and_wedge.
|
||||
|
||||
2011-09-28 Thomas Haller <thomas.haller@fen-net.de>
|
||||
|
||||
* grub-core/loader/multiboot_elfxx.c (Elf_Shdr): Set according to
|
||||
loader.
|
||||
|
||||
2011-09-28 Andreas Born <futur.andy@googlemail.com>
|
||||
|
||||
Fix incorrect identifiers in bash-completion.
|
||||
|
||||
* util/bash-completion.d/grub-completion.bash.in
|
||||
(_grub_mkpasswd-pbkdf2): Rename to ...
|
||||
(_grub_mkpasswd_pbkdf2): ... this. All users updated.
|
||||
(_grub_script-check): Rename to ...
|
||||
(_grub_script_check): ... this. All users updated.
|
||||
|
||||
2011-09-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy):
|
||||
Return 0 if disk isn't biosdisk.
|
||||
|
||||
2011-09-17 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* Makefile.util.def (grub-mkrelpath): Add LIBUTIL for getrawpartition(3)
|
||||
on NetBSD.
|
||||
* Makefile.util.def (grub-fstest): Likewise.
|
||||
|
||||
2011-09-17 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors) [__NetBSD__]:
|
||||
Get sector size from disk label.
|
||||
|
||||
2011-09-05 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig_lib.in (grub_file_is_not_garbage): Return 1 for
|
||||
*/README* as well as README*.
|
||||
Reported by: Axel Beckert.
|
||||
|
||||
2011-08-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/mips/loongson/init.c (grub_machine_init): Handle the
|
||||
case of less than 256 MiB of RAM.
|
||||
|
||||
2011-08-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/commands/wildcard.c (make_regex): Handle @.
|
||||
|
||||
2011-08-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-install.in: Move cryptodisk logic to appropriate place.
|
||||
|
||||
2011-08-21 Szymon Janc <szymon@janc.net.pl>
|
||||
|
||||
* acinclude.m4: Use AC_LANG_PROGRAM macro to generate source code for
|
||||
AC_LANG_CONFTEST macros.
|
||||
|
||||
2011-08-20 Szymon Janc <szymon@janc.net.pl>
|
||||
|
||||
Add grub-fstest option to uncompress data for commands.
|
||||
|
|
|
@ -152,7 +152,7 @@ program = {
|
|||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
|
@ -231,7 +231,7 @@ program = {
|
|||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
|
|
16
acinclude.m4
16
acinclude.m4
|
@ -316,14 +316,14 @@ fi
|
|||
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
||||
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
|
||||
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
||||
AC_LANG_CONFTEST([[
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void f (int (*p) (void));
|
||||
void g (int i)
|
||||
{
|
||||
int nestedfunc (void) { return i; }
|
||||
f (nestedfunc);
|
||||
}
|
||||
]])
|
||||
]])])
|
||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then
|
||||
true
|
||||
else
|
||||
|
@ -346,7 +346,9 @@ AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
|||
ssp_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
]])])
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
|
||||
|
@ -364,7 +366,9 @@ AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
|
|||
[# Smashing stack arg probe.
|
||||
sap_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
]])])
|
||||
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
|
||||
AC_MSG_RESULT([yes])
|
||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
|
@ -399,7 +403,7 @@ AC_DEFUN([grub_CHECK_PIE],[
|
|||
pie_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([[
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
#ifdef __PIE__
|
||||
int main() {
|
||||
return 0;
|
||||
|
@ -407,7 +411,7 @@ int main() {
|
|||
#else
|
||||
#error NO __PIE__ DEFINED
|
||||
#endif
|
||||
]])
|
||||
]])])
|
||||
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
|
|
114
gentpl.py
114
gentpl.py
|
@ -183,6 +183,17 @@ def foreach_platform_specific_value(platform, suffix, nonetag, closure):
|
|||
r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]"
|
||||
return r
|
||||
|
||||
#
|
||||
# Returns autogen code that defines an autogen macro using the
|
||||
# definition given in the 'snippet'.
|
||||
#
|
||||
def define_autogen_macro(name, snippet):
|
||||
r = ""
|
||||
r += "[+ DEFINE " + name + " +]"
|
||||
r += snippet
|
||||
r += "[+ ENDDEF +]\n"
|
||||
return r
|
||||
|
||||
#
|
||||
# Template for handling values from sum of all groups for a platform,
|
||||
# for example:
|
||||
|
@ -245,10 +256,18 @@ def foreach_enabled_platform(closure):
|
|||
# emu_condition = COND_GRUB_EMU_USB;
|
||||
# };
|
||||
#
|
||||
def define_macro_for_platform_conditionals_if_statement(p):
|
||||
return define_autogen_macro(
|
||||
"if_" + p + "_conditionals",
|
||||
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n"))
|
||||
def define_macro_for_platform_conditionals_endif_statement(p):
|
||||
return define_autogen_macro(
|
||||
"endif_" + p + "_conditionals",
|
||||
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n"))
|
||||
def under_platform_specific_conditionals(platform, snippet):
|
||||
r = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n")
|
||||
r = "[+ if_" + platform + "_conditionals +]"
|
||||
r += snippet
|
||||
r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n")
|
||||
r += "[+ endif_" + platform + "_conditionals +]"
|
||||
return r
|
||||
|
||||
def platform_specific_values(platform, suffix, nonetag):
|
||||
|
@ -261,18 +280,69 @@ def platform_values(platform, suffix):
|
|||
def extra_dist():
|
||||
return foreach_value("extra_dist", lambda value: value + " ")
|
||||
|
||||
def platform_sources(p): return platform_values(p, "")
|
||||
def platform_nodist_sources(p): return platform_values(p, "_nodist")
|
||||
def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies")
|
||||
def define_macro_for_platform_sources(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_sources",
|
||||
platform_values(p, ""))
|
||||
def define_macro_for_platform_nodist_sources(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_nodist_sources",
|
||||
platform_values(p, "_nodist"))
|
||||
def define_macro_for_platform_dependencies(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_dependencies",
|
||||
platform_values(p, "dependencies", "_dependencies"))
|
||||
def platform_sources(p): return "[+ get_" + p + "_sources +]"
|
||||
def platform_nodist_sources(p): return "[+ get_" + p + "_nodist_sources +]"
|
||||
def platform_dependencies(p): return "[+ get_" + p + "_dependencies +]"
|
||||
|
||||
def platform_startup(p): return platform_specific_values(p, "_startup", "startup")
|
||||
def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd")
|
||||
def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags")
|
||||
def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags")
|
||||
def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags")
|
||||
def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags")
|
||||
def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
|
||||
def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
|
||||
#
|
||||
# Returns Autogen code which defines the autogen macros that collect
|
||||
# platform specific values for cflags, ldflags, etc. tags.
|
||||
#
|
||||
def define_macro_for_platform_startup(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_startup",
|
||||
platform_specific_values(p, "_startup", "startup"))
|
||||
def define_macro_for_platform_cflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_cflags",
|
||||
platform_specific_values(p, "_cflags", "cflags"))
|
||||
def define_macro_for_platform_ldadd(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_ldadd",
|
||||
platform_specific_values(p, "_ldadd", "ldadd"))
|
||||
def define_macro_for_platform_ldflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_ldflags",
|
||||
platform_specific_values(p, "_ldflags", "ldflags"))
|
||||
def define_macro_for_platform_cppflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_cppflags",
|
||||
platform_specific_values(p, "_cppflags", "cppflags"))
|
||||
def define_macro_for_platform_ccasflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_ccasflags",
|
||||
platform_specific_values(p, "_ccasflags", "ccasflags"))
|
||||
def define_macro_for_platform_stripflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_stripflags",
|
||||
platform_specific_values(p, "_stripflags", "stripflags"))
|
||||
def define_macro_for_platform_objcopyflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_objcopyflags",
|
||||
platform_specific_values(p, "_objcopyflags", "objcopyflags"))
|
||||
#
|
||||
# Autogen calls to invoke the above macros.
|
||||
#
|
||||
def platform_startup(p): return "[+ get_" + p + "_startup +]"
|
||||
def platform_ldadd(p): return "[+ get_" + p + "_ldadd +]"
|
||||
def platform_cflags(p): return "[+ get_" + p + "_cflags +]"
|
||||
def platform_ldflags(p): return "[+ get_" + p + "_ldflags +]"
|
||||
def platform_cppflags(p): return "[+ get_" + p + "_cppflags +]"
|
||||
def platform_ccasflags(p): return "[+ get_" + p + "_ccasflags +]"
|
||||
def platform_stripflags(p): return "[+ get_" + p + "_stripflags +]"
|
||||
def platform_objcopyflags(p): return "[+ get_" + p + "_objcopyflags +]"
|
||||
|
||||
#
|
||||
# Emit snippet only the first time through for the current name.
|
||||
|
@ -489,7 +559,6 @@ def script_rules():
|
|||
def data_rules():
|
||||
return rules("data", data)
|
||||
|
||||
print "[+ AutoGen5 template +]\n"
|
||||
a = module_rules()
|
||||
b = kernel_rules()
|
||||
c = image_rules()
|
||||
|
@ -499,6 +568,23 @@ f = script_rules()
|
|||
g = data_rules()
|
||||
z = global_variable_initializers()
|
||||
|
||||
print "[+ AutoGen5 template +]\n"
|
||||
for p in GRUB_PLATFORMS:
|
||||
print define_macro_for_platform_sources(p)
|
||||
print define_macro_for_platform_nodist_sources(p)
|
||||
# print define_macro_for_platform_dependencies(p)
|
||||
|
||||
print define_macro_for_platform_startup(p)
|
||||
print define_macro_for_platform_cflags(p)
|
||||
print define_macro_for_platform_ldadd(p)
|
||||
print define_macro_for_platform_ldflags(p)
|
||||
print define_macro_for_platform_cppflags(p)
|
||||
print define_macro_for_platform_ccasflags(p)
|
||||
print define_macro_for_platform_stripflags(p)
|
||||
print define_macro_for_platform_objcopyflags(p)
|
||||
|
||||
print define_macro_for_platform_conditionals_if_statement(p)
|
||||
print define_macro_for_platform_conditionals_endif_statement(p)
|
||||
# print z # initializer for all vars
|
||||
print a
|
||||
print b
|
||||
|
|
|
@ -219,6 +219,7 @@ kernel = {
|
|||
|
||||
videoinkernel = commands/boot.c;
|
||||
|
||||
extra_dist = kern/i386/int.S;
|
||||
extra_dist = kern/i386/realmode.S;
|
||||
extra_dist = kern/i386/pc/lzma_decode.S;
|
||||
extra_dist = kern/mips/cache_flush.S;
|
||||
|
|
|
@ -36,11 +36,33 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
typedef enum
|
||||
{
|
||||
GRUB_UHCI_REG_USBCMD = 0x00,
|
||||
GRUB_UHCI_REG_USBINTR = 0x04,
|
||||
GRUB_UHCI_REG_FLBASEADD = 0x08,
|
||||
GRUB_UHCI_REG_PORTSC1 = 0x10,
|
||||
GRUB_UHCI_REG_PORTSC2 = 0x12
|
||||
GRUB_UHCI_REG_PORTSC2 = 0x12,
|
||||
GRUB_UHCI_REG_USBLEGSUP = 0xc0
|
||||
} grub_uhci_reg_t;
|
||||
|
||||
/* R/WC legacy support bits */
|
||||
#define GRUB_UHCI_LEGSUP_END_A20GATE (1 << 15)
|
||||
#define GRUB_UHCI_TRAP_BY_64H_WSTAT (1 << 11)
|
||||
#define GRUB_UHCI_TRAP_BY_64H_RSTAT (1 << 10)
|
||||
#define GRUB_UHCI_TRAP_BY_60H_WSTAT (1 << 9)
|
||||
#define GRUB_UHCI_TRAP_BY_60H_RSTAT (1 << 8)
|
||||
|
||||
/* Reset all legacy support - clear all R/WC bits and all R/W bits */
|
||||
#define GRUB_UHCI_RESET_LEGSUP_SMI ( GRUB_UHCI_LEGSUP_END_A20GATE \
|
||||
| GRUB_UHCI_TRAP_BY_64H_WSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_64H_RSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_60H_WSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_60H_RSTAT )
|
||||
|
||||
/* Some UHCI commands */
|
||||
#define GRUB_UHCI_CMD_RUN_STOP (1 << 0)
|
||||
#define GRUB_UHCI_CMD_HCRESET (1 << 1)
|
||||
#define GRUB_UHCI_CMD_MAXP (1 << 7)
|
||||
|
||||
/* Important bits in structures */
|
||||
#define GRUB_UHCI_LINK_TERMINATE 1
|
||||
#define GRUB_UHCI_LINK_QUEUE_HEAD 2
|
||||
|
||||
|
@ -181,6 +203,11 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
if (class != 0x0c || subclass != 0x03 || interf != 0x00)
|
||||
return 0;
|
||||
|
||||
/* Set bus master - needed for coreboot or broken BIOSes */
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||||
grub_pci_write_word(addr,
|
||||
GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr));
|
||||
|
||||
/* Determine IO base address. */
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
||||
base = grub_pci_read (addr);
|
||||
|
@ -195,6 +222,19 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
|
||||
u->iobase = base & GRUB_UHCI_IOMASK;
|
||||
|
||||
/* Reset PIRQ and SMI */
|
||||
addr = grub_pci_make_address (dev, GRUB_UHCI_REG_USBLEGSUP);
|
||||
grub_pci_write_word(addr, GRUB_UHCI_RESET_LEGSUP_SMI);
|
||||
/* Reset the HC */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, GRUB_UHCI_CMD_HCRESET);
|
||||
grub_millisleep(5);
|
||||
/* Disable interrupts and commands (just to be safe) */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBINTR, 0);
|
||||
/* Finish HC reset, HC remains disabled */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, 0);
|
||||
/* Read back to be sure PCI write is done */
|
||||
grub_uhci_readreg16(u, GRUB_UHCI_REG_USBCMD);
|
||||
|
||||
/* Reserve a page for the frame list. */
|
||||
u->framelist = grub_memalign (4096, 4096);
|
||||
if (! u->framelist)
|
||||
|
@ -252,9 +292,6 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
u->td[N_TD - 2].linkptr = 0;
|
||||
u->tdfree = u->td;
|
||||
|
||||
/* Make sure UHCI is disabled! */
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0);
|
||||
|
||||
/* Setup the frame list pointers. Since no isochronous transfers
|
||||
are and will be supported, they all point to the (same!) queue
|
||||
head. */
|
||||
|
@ -285,7 +322,8 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
|||
u->qh[N_QH - 1].linkptr = 1;
|
||||
|
||||
/* Enable UHCI again. */
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 1 | (1 << 7));
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD,
|
||||
GRUB_UHCI_CMD_RUN_STOP | GRUB_UHCI_CMD_MAXP);
|
||||
|
||||
/* UHCI is initialized and ready for transfers. */
|
||||
grub_dprintf ("uhci", "UHCI initialized\n");
|
||||
|
|
|
@ -139,6 +139,7 @@ make_regex (const char *start, const char *end, regex_t *regexp)
|
|||
case '.':
|
||||
case '(':
|
||||
case ')':
|
||||
case '@':
|
||||
buffer[i++] = '\\';
|
||||
buffer[i++] = ch;
|
||||
break;
|
||||
|
|
|
@ -265,10 +265,13 @@ grub_util_get_fd_sectors (int fd, unsigned *log_secsize)
|
|||
|
||||
# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (ioctl (fd, DIOCGSECTORSIZE, §or_size))
|
||||
goto fail;
|
||||
# elif defined(__NetBSD__)
|
||||
sector_size = label.d_secsize;
|
||||
# else
|
||||
if (ioctl (fd, BLKSSZGET, §or_size))
|
||||
# endif
|
||||
goto fail;
|
||||
# endif
|
||||
|
||||
if (sector_size & (sector_size - 1) || !sector_size)
|
||||
goto fail;
|
||||
|
@ -1838,6 +1841,9 @@ grub_util_biosdisk_is_floppy (grub_disk_t disk)
|
|||
struct stat st;
|
||||
int fd;
|
||||
|
||||
if (disk->dev != &grub_util_biosdisk_dev)
|
||||
return 0;
|
||||
|
||||
fd = open (map[disk->id].device, O_RDONLY);
|
||||
/* Shouldn't happen. */
|
||||
if (fd == -1)
|
||||
|
|
|
@ -224,7 +224,11 @@ char *
|
|||
canonicalize_file_name (const char *path)
|
||||
{
|
||||
char *ret;
|
||||
#ifdef PATH_MAX
|
||||
#ifdef __MINGW32__
|
||||
ret = xmalloc (PATH_MAX);
|
||||
if (!_fullpath (ret, path, PATH_MAX))
|
||||
return NULL;
|
||||
#elif defined (PATH_MAX)
|
||||
ret = xmalloc (PATH_MAX);
|
||||
if (!realpath (path, ret))
|
||||
return NULL;
|
||||
|
|
|
@ -188,7 +188,7 @@ grub_machine_init (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
grub_arch_memsize = (totalmem >> 20);
|
||||
grub_arch_memsize = totalmem;
|
||||
grub_arch_highmemsize = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/ns8250.h>
|
||||
#include <grub/bsdlabel.h>
|
||||
#include <grub/crypto.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
@ -946,6 +948,86 @@ grub_netbsd_add_modules (void)
|
|||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds NetBSD bootinfo bootdisk and bootwedge. The partition identified
|
||||
* in these bootinfo fields is the root device.
|
||||
*/
|
||||
static void
|
||||
grub_netbsd_add_boot_disk_and_wedge (void)
|
||||
{
|
||||
grub_device_t dev;
|
||||
grub_disk_t disk;
|
||||
grub_partition_t part;
|
||||
grub_uint32_t biosdev;
|
||||
grub_uint32_t partmapsector;
|
||||
struct grub_partition_bsd_disk_label *label;
|
||||
grub_uint64_t buf[GRUB_DISK_SECTOR_SIZE / 8];
|
||||
grub_uint8_t *hash;
|
||||
grub_uint64_t ctx[(GRUB_MD_MD5->contextsize + 7) / 8];
|
||||
|
||||
dev = grub_device_open (0);
|
||||
if (! (dev && dev->disk && dev->disk->partition))
|
||||
goto fail;
|
||||
|
||||
disk = dev->disk;
|
||||
part = disk->partition;
|
||||
|
||||
if (disk->dev && disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
|
||||
biosdev = (grub_uint32_t) disk->id & 0xff;
|
||||
else
|
||||
biosdev = 0xff;
|
||||
|
||||
/* Absolute sector of the partition map describing this partition. */
|
||||
partmapsector = grub_partition_get_start (part->parent) + part->offset;
|
||||
|
||||
disk->partition = part->parent;
|
||||
if (grub_disk_read (disk, part->offset, 0, GRUB_DISK_SECTOR_SIZE, buf) != GRUB_ERR_NONE)
|
||||
goto fail;
|
||||
disk->partition = part;
|
||||
|
||||
/* Fill bootwedge. */
|
||||
{
|
||||
struct grub_netbsd_btinfo_bootwedge biw;
|
||||
|
||||
grub_memset (&biw, 0, sizeof (biw));
|
||||
biw.biosdev = biosdev;
|
||||
biw.startblk = grub_partition_get_start (part);
|
||||
biw.nblks = part->len;
|
||||
biw.matchblk = partmapsector;
|
||||
biw.matchnblks = 1;
|
||||
|
||||
GRUB_MD_MD5->init (&ctx);
|
||||
GRUB_MD_MD5->write (&ctx, buf, GRUB_DISK_SECTOR_SIZE);
|
||||
GRUB_MD_MD5->final (&ctx);
|
||||
hash = GRUB_MD_MD5->read (&ctx);
|
||||
memcpy (biw.matchhash, hash, 16);
|
||||
|
||||
grub_bsd_add_meta (NETBSD_BTINFO_BOOTWEDGE, &biw, sizeof (biw));
|
||||
}
|
||||
|
||||
/* Fill bootdisk if this a NetBSD disk label. */
|
||||
label = (struct grub_partition_bsd_disk_label *) &buf;
|
||||
if (part->partmap != NULL &&
|
||||
(grub_strcmp (part->partmap->name, "netbsd") == 0) &&
|
||||
label->magic == grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
|
||||
{
|
||||
struct grub_netbsd_btinfo_bootdisk bid;
|
||||
|
||||
grub_memset (&bid, 0, sizeof (bid));
|
||||
bid.labelsector = partmapsector;
|
||||
bid.label.type = label->type;
|
||||
bid.label.checksum = label->checksum;
|
||||
memcpy (bid.label.packname, label->packname, 16);
|
||||
bid.biosdev = biosdev;
|
||||
bid.partition = part->number;
|
||||
grub_bsd_add_meta (NETBSD_BTINFO_BOOTDISK, &bid, sizeof (bid));
|
||||
}
|
||||
|
||||
fail:
|
||||
if (dev)
|
||||
grub_device_close (dev);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_netbsd_boot (void)
|
||||
{
|
||||
|
@ -1607,6 +1689,8 @@ grub_cmd_netbsd (grub_extcmd_context_t ctxt, int argc, char *argv[])
|
|||
grub_bsd_add_meta (NETBSD_BTINFO_CONSOLE, &cons, sizeof (cons));
|
||||
}
|
||||
|
||||
grub_netbsd_add_boot_disk_and_wedge ();
|
||||
|
||||
grub_loader_set (grub_netbsd_boot, grub_bsd_unload, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,14 @@
|
|||
# define ELFCLASSXX ELFCLASS32
|
||||
# define Elf_Ehdr Elf32_Ehdr
|
||||
# define Elf_Phdr Elf32_Phdr
|
||||
# define Elf_Shdr Elf32_Shdr
|
||||
#elif defined(MULTIBOOT_LOAD_ELF64)
|
||||
# define XX 64
|
||||
# define E_MACHINE MULTIBOOT_ELF64_MACHINE
|
||||
# define ELFCLASSXX ELFCLASS64
|
||||
# define Elf_Ehdr Elf64_Ehdr
|
||||
# define Elf_Phdr Elf64_Phdr
|
||||
# define Elf_Shdr Elf64_Shdr
|
||||
#else
|
||||
#error "I'm confused"
|
||||
#endif
|
||||
|
@ -223,3 +225,4 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
|
|||
#undef ELFCLASSXX
|
||||
#undef Elf_Ehdr
|
||||
#undef Elf_Phdr
|
||||
#undef Elf_Shdr
|
||||
|
|
|
@ -80,7 +80,10 @@ struct grub_partition_bsd_entry
|
|||
struct grub_partition_bsd_disk_label
|
||||
{
|
||||
grub_uint32_t magic;
|
||||
grub_uint8_t padding[128];
|
||||
grub_uint16_t type;
|
||||
grub_uint8_t unused1[18];
|
||||
grub_uint8_t packname[16];
|
||||
grub_uint8_t unused2[92];
|
||||
grub_uint32_t magic2;
|
||||
grub_uint16_t checksum;
|
||||
grub_uint16_t num_partitions;
|
||||
|
|
|
@ -51,9 +51,11 @@
|
|||
|
||||
#define NETBSD_BTINFO_BOOTPATH 0
|
||||
#define NETBSD_BTINFO_ROOTDEVICE 1
|
||||
#define NETBSD_BTINFO_BOOTDISK 3
|
||||
#define NETBSD_BTINFO_CONSOLE 6
|
||||
#define NETBSD_BTINFO_SYMTAB 8
|
||||
#define NETBSD_BTINFO_MEMMAP 9
|
||||
#define NETBSD_BTINFO_BOOTWEDGE 10
|
||||
#define NETBSD_BTINFO_MODULES 11
|
||||
#define NETBSD_BTINFO_FRAMEBUF 12
|
||||
|
||||
|
@ -83,6 +85,15 @@ struct grub_netbsd_btinfo_bootdisk
|
|||
grub_uint32_t partition;
|
||||
};
|
||||
|
||||
struct grub_netbsd_btinfo_bootwedge {
|
||||
grub_uint32_t biosdev;
|
||||
grub_disk_addr_t startblk;
|
||||
grub_uint64_t nblks;
|
||||
grub_disk_addr_t matchblk;
|
||||
grub_uint64_t matchnblks;
|
||||
grub_uint8_t matchhash[16]; /* MD5 hash */
|
||||
} __packed;
|
||||
|
||||
struct grub_netbsd_btinfo_symtab
|
||||
{
|
||||
grub_uint32_t nsyms;
|
||||
|
|
|
@ -47,7 +47,6 @@ void grub_util_write_image_at (const void *img, size_t size, off_t offset,
|
|||
|
||||
void sync (void);
|
||||
int fsync (int fno);
|
||||
void sleep(int s);
|
||||
|
||||
grub_int64_t grub_util_get_disk_size (char *name);
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@ unset __grub_mkimage_program
|
|||
#
|
||||
# grub-mkpasswd-pbkdf2
|
||||
#
|
||||
_grub_mkpasswd-pbkdf2 () {
|
||||
_grub_mkpasswd_pbkdf2 () {
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
|
@ -417,7 +417,7 @@ _grub_mkpasswd-pbkdf2 () {
|
|||
}
|
||||
__grub_mkpasswd_pbkdf2_program=$( echo grub-mkpasswd-pbkdf2 | sed "@program_transform_name@" )
|
||||
have ${__grub_mkpasswd_pbkdf2_program} && \
|
||||
complete -F _grub_mkpasswd-pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
|
||||
complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
|
||||
unset __grub_mkpasswd_pbkdf2_program
|
||||
|
||||
|
||||
|
@ -462,7 +462,7 @@ unset __grub_probe_program
|
|||
#
|
||||
# grub-script-check
|
||||
#
|
||||
_grub_script-check () {
|
||||
_grub_script_check () {
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
|
@ -477,7 +477,7 @@ _grub_script-check () {
|
|||
}
|
||||
__grub_script_check_program=$( echo grub-script-check | sed "@program_transform_name@" )
|
||||
have ${__grub_script_check_program} && \
|
||||
complete -F _grub_script-check -o filenames ${__grub_script_check_program}
|
||||
complete -F _grub_script_check -o filenames ${__grub_script_check_program}
|
||||
|
||||
|
||||
# Local variables:
|
||||
|
|
|
@ -558,11 +558,6 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
|||
|
||||
exit 1
|
||||
fi
|
||||
if [ x$GRUB_CRYPTODISK_ENABLE = xy ]; then
|
||||
for uuid in "`"${grub_probe}" --device "${device}" --target=cryptodisk_uuid`"; do
|
||||
echo "cryptomount -u $uuid"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "search.fs_uuid ${uuid} root " >> "${grubdir}/load.cfg"
|
||||
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
|
||||
|
@ -577,6 +572,14 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
|||
fi
|
||||
fi
|
||||
else
|
||||
if [ x$GRUB_CRYPTODISK_ENABLE = xy ]; then
|
||||
for uuid in "`"${grub_probe}" --device "${grub_device}" --target=cryptodisk_uuid`"; do
|
||||
echo "cryptomount -u $uuid" >> "${grubdir}/load.cfg"
|
||||
done
|
||||
fi
|
||||
|
||||
config_opt="-c ${grubdir}/load.cfg "
|
||||
|
||||
prefix_drive=`"$grub_probe" --device-map="${device_map}" --target=drive --device "${grub_device}"` || exit 1
|
||||
fi
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ grub_file_is_not_garbage ()
|
|||
if test -f "$1" ; then
|
||||
case "$1" in
|
||||
*.dpkg-*) return 1 ;; # debian dpkg
|
||||
README*) return 1 ;; # documentation
|
||||
README*|*/README*) return 1 ;; # documentation
|
||||
esac
|
||||
else
|
||||
return 1
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#ifdef __MINGW32__
|
||||
#include <windows.h>
|
||||
#include <winioctl.h>
|
||||
#include "dirname.h"
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
|
@ -316,17 +317,13 @@ int fsync (int fno __attribute__ ((unused)))
|
|||
return 0;
|
||||
}
|
||||
|
||||
void sleep (int s)
|
||||
{
|
||||
Sleep (s * 1000);
|
||||
}
|
||||
|
||||
grub_int64_t
|
||||
grub_util_get_disk_size (char *name)
|
||||
{
|
||||
HANDLE hd;
|
||||
grub_int64_t size = -1LL;
|
||||
|
||||
strip_trailing_slashes(name);
|
||||
hd = CreateFile (name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
0, OPEN_EXISTING, 0, 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue