From 3b2fe8c2857f9753ce072639c8a547d6c41bce61 Mon Sep 17 00:00:00 2001 From: robertmh Date: Tue, 20 Oct 2009 11:30:37 +0000 Subject: [PATCH 01/37] 2009-10-20 Robert Millan Fix build on sparc64. * configure.ac: Perform checks for libgcc symbols before adding `-nostdlib' to LDFLAGS. --- ChangeLog | 7 +++++++ configure.ac | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 960fc067e..a14da7a14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-10-20 Robert Millan + + Fix build on sparc64. + + * configure.ac: Perform checks for libgcc symbols before + adding `-nostdlib' to LDFLAGS. + 2009-10-16 Vladimir Serbinenko Let user specify OpenBSD root device. diff --git a/configure.ac b/configure.ac index ca837b6e5..bf113ba68 100644 --- a/configure.ac +++ b/configure.ac @@ -411,6 +411,9 @@ AC_SUBST(TARGET_ASFLAGS) AC_SUBST(TARGET_CPPFLAGS) AC_SUBST(TARGET_LDFLAGS) +# Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS) +AC_CHECK_FUNCS(__bswapsi2 __bswapdi2) + # Set them to their new values for the tests below. CC="$TARGET_CC" if test "x$TARGET_APPLE_CC" = x1 ; then @@ -421,9 +424,6 @@ fi CPPFLAGS="$TARGET_CPPFLAGS" LDFLAGS="$TARGET_LDFLAGS" -# Check for target functions. -AC_CHECK_FUNCS(__bswapsi2 __bswapdi2) - # Defined in aclocal.m4. grub_PROG_TARGET_CC if test "x$TARGET_APPLE_CC" != x1 ; then From 0933cdc0ab2789eda662dbd6418f92f21d05bd39 Mon Sep 17 00:00:00 2001 From: fzielcke Date: Wed, 21 Oct 2009 12:22:05 +0000 Subject: [PATCH 02/37] 2009-10-21 Felix Zielcke * config.guess: Update to latest version from config git repository. * config.sub: Likewise. --- ChangeLog | 6 +++ config.guess | 111 +++++++++++++++++---------------------------------- config.sub | 9 +++-- 3 files changed, 47 insertions(+), 79 deletions(-) diff --git a/ChangeLog b/ChangeLog index a14da7a14..2dd370aca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-21 Felix Zielcke + + * config.guess: Update to latest version from config git + repository. + * config.sub: Likewise. + 2009-10-20 Robert Millan Fix build on sparc64. diff --git a/config.guess b/config.guess index bb0b03ea1..e792aac60 100644 --- a/config.guess +++ b/config.guess @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-08-19' +timestamp='2009-09-18' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -854,6 +854,20 @@ EOF i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -876,6 +890,9 @@ EOF frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-gnu + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; @@ -911,29 +928,12 @@ EOF or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -942,8 +942,11 @@ EOF *) echo hppa-unknown-linux-gnu ;; esac exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux @@ -966,58 +969,6 @@ EOF xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both @@ -1247,6 +1198,16 @@ EOF *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} diff --git a/config.sub b/config.sub index 8ca084bf3..5ecc18b6a 100644 --- a/config.sub +++ b/config.sub @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2009-08-19' +timestamp='2009-10-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -287,6 +287,7 @@ case $basic_machine in | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ + | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ @@ -300,7 +301,7 @@ case $basic_machine in | z8k | z80) basic_machine=$basic_machine-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12) + m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none @@ -371,7 +372,7 @@ case $basic_machine in | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ - | romp-* | rs6000-* \ + | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ @@ -1296,7 +1297,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) From f66938909063bff27fc2c3cb5e8e6063f6d0175f Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 24 Oct 2009 23:03:02 +0000 Subject: [PATCH 03/37] 2009-10-25 Robert Millan Patch from Samuel Thibault * docs/grub.cfg: Compensate for recent change in multiboot loader (since 2009-08-14 it won't pass filename to payload). * util/grub.d/10_hurd.in: Likewise. --- ChangeLog | 7 +++++++ docs/grub.cfg | 4 ++-- util/grub.d/10_hurd.in | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2dd370aca..26a2c8f7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-10-25 Robert Millan + + Patch from Samuel Thibault + * docs/grub.cfg: Compensate for recent change in multiboot + loader (since 2009-08-14 it won't pass filename to payload). + * util/grub.d/10_hurd.in: Likewise. + 2009-10-21 Felix Zielcke * config.guess: Update to latest version from config git diff --git a/docs/grub.cfg b/docs/grub.cfg index 4d1582a8e..0a9ab6bc7 100644 --- a/docs/grub.cfg +++ b/docs/grub.cfg @@ -15,13 +15,13 @@ set fallback=1 menuentry "GNU (aka GNU/Hurd)" { set root=(hd0,1) multiboot /boot/gnumach.gz root=device:hd0s1 - module /hurd/ext2fs.static --readonly \ + module /hurd/ext2fs.static ext2fs --readonly \ --multiboot-command-line='${kernel-command-line}' \ --host-priv-port='${host-port}' \ --device-master-port='${device-port}' \ --exec-server-task='${exec-task}' -T typed '${root}' \ '$(task-create)' '$(task-resume)' - module /lib/ld.so.1 /hurd/exec '$(exec-task=task-create)' + module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)' } # For booting GNU/Linux diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index ec78a3532..b52f37498 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -74,12 +74,12 @@ EOF prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" cat << EOF multiboot ${kernel} root=device:${GRUB_DEVICE} - module /hurd/${hurd_fs}.static --readonly \\ + module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\ --multiboot-command-line='\${kernel-command-line}' \\ --host-priv-port='\${host-port}' \\ --device-master-port='\${device-port}' \\ --exec-server-task='\${exec-task}' -T typed '\${root}' \\ '\$(task-create)' '\$(task-resume)' - module /lib/ld.so.1 /hurd/exec '\$(exec-task=task-create)' + module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)' } EOF From fb26abc22bece052526d65508944dffd0405fa02 Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 24 Oct 2009 23:15:48 +0000 Subject: [PATCH 04/37] 2009-10-25 Robert Millan * fs/cpio.c [MODE_USTAR]: Finish `tar' module instead of `cpio'. [! MODE_USTAR]: Finish `cpio' module instead of `tar'. --- ChangeLog | 6 ++++++ fs/cpio.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 26a2c8f7c..51e76499b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-25 Robert Millan + + * fs/cpio.c [MODE_USTAR]: Finish `tar' module instead of + `cpio'. + [! MODE_USTAR]: Finish `cpio' module instead of `tar'. + 2009-10-25 Robert Millan Patch from Samuel Thibault diff --git a/fs/cpio.c b/fs/cpio.c index 1ec4ebeaf..7c6ada9b3 100644 --- a/fs/cpio.c +++ b/fs/cpio.c @@ -362,9 +362,9 @@ GRUB_MOD_INIT (tar) } #ifdef MODE_USTAR -GRUB_MOD_FINI (cpio) -#else GRUB_MOD_FINI (tar) +#else +GRUB_MOD_FINI (cpio) #endif { grub_fs_unregister (&grub_cpio_fs); From cdb308b0e156f2081c77e30b92bad5ebac4fdf11 Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 24 Oct 2009 23:26:42 +0000 Subject: [PATCH 05/37] 2009-10-25 Robert Millan * include/grub/powerpc/libgcc.h (memset): Remove function prototype. * include/grub/sparc64/libgcc.h (memset): Likewise. * include/grub/misc.h (memset, memcmp): New function prototypes. --- ChangeLog | 6 ++++++ include/grub/misc.h | 2 ++ include/grub/powerpc/libgcc.h | 1 - include/grub/sparc64/libgcc.h | 2 -- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51e76499b..9df444755 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-25 Robert Millan + + * include/grub/powerpc/libgcc.h (memset): Remove function prototype. + * include/grub/sparc64/libgcc.h (memset): Likewise. + * include/grub/misc.h (memset, memcmp): New function prototypes. + 2009-10-25 Robert Millan * fs/cpio.c [MODE_USTAR]: Finish `tar' module instead of diff --git a/include/grub/misc.h b/include/grub/misc.h index a63a0b442..c7ff1e2d2 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -76,8 +76,10 @@ grub_strncat (char *dest, const char *src, int c) /* Prototypes for aliases. */ #if !defined (GRUB_UTIL) || !defined (APPLE_CC) +int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); +void EXPORT_FUNC (memset) (void); #endif int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n); diff --git a/include/grub/powerpc/libgcc.h b/include/grub/powerpc/libgcc.h index 0ff8964b7..c32fcd87f 100644 --- a/include/grub/powerpc/libgcc.h +++ b/include/grub/powerpc/libgcc.h @@ -16,7 +16,6 @@ * along with GRUB. If not, see . */ -void EXPORT_FUNC (memset) (void); void EXPORT_FUNC (__ashldi3) (void); void EXPORT_FUNC (__ashrdi3) (void); void EXPORT_FUNC (__lshrdi3) (void); diff --git a/include/grub/sparc64/libgcc.h b/include/grub/sparc64/libgcc.h index 4a6b6194d..008821d81 100644 --- a/include/grub/sparc64/libgcc.h +++ b/include/grub/sparc64/libgcc.h @@ -18,8 +18,6 @@ #include -void EXPORT_FUNC (memset) (void); - #ifdef HAVE___BSWAPSI2 typedef int SItype __attribute__ ((mode (SI))); SItype EXPORT_FUNC (__bswapsi2) (SItype); From 346e7fbedb8e728aea4c8400e2d94ba24208ed3b Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 24 Oct 2009 23:26:53 +0000 Subject: [PATCH 06/37] 2009-10-25 Robert Millan * configure.ac: Check for `__ashldi3', `__ashrdi3', `__lshrdi3', `__trampoline_setup' and `__ucmpdi2'. * include/grub/powerpc/libgcc.h: Only export symbols for functions that libgcc provides. --- ChangeLog | 7 +++++++ configure.ac | 2 +- include/grub/powerpc/libgcc.h | 14 +++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9df444755..ce28aed16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-10-25 Robert Millan + + * configure.ac: Check for `__ashldi3', `__ashrdi3', `__lshrdi3', + `__trampoline_setup' and `__ucmpdi2'. + * include/grub/powerpc/libgcc.h: Only export symbols for functions + that libgcc provides. + 2009-10-25 Robert Millan * include/grub/powerpc/libgcc.h (memset): Remove function prototype. diff --git a/configure.ac b/configure.ac index bf113ba68..048333ba5 100644 --- a/configure.ac +++ b/configure.ac @@ -412,7 +412,7 @@ AC_SUBST(TARGET_CPPFLAGS) AC_SUBST(TARGET_LDFLAGS) # Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS) -AC_CHECK_FUNCS(__bswapsi2 __bswapdi2) +AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2) # Set them to their new values for the tests below. CC="$TARGET_CC" diff --git a/include/grub/powerpc/libgcc.h b/include/grub/powerpc/libgcc.h index c32fcd87f..452ad4366 100644 --- a/include/grub/powerpc/libgcc.h +++ b/include/grub/powerpc/libgcc.h @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2004,2007 Free Software Foundation, Inc. + * Copyright (C) 2004,2007,2009 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,8 +16,20 @@ * along with GRUB. If not, see . */ +#include + +#ifdef HAVE___ASHLDI3 void EXPORT_FUNC (__ashldi3) (void); +#endif +#ifdef HAVE___ASHRDI3 void EXPORT_FUNC (__ashrdi3) (void); +#endif +#ifdef HAVE___LSHRDI3 void EXPORT_FUNC (__lshrdi3) (void); +#endif +#ifdef HAVE___TRAMPOLINE_SETUP void EXPORT_FUNC (__trampoline_setup) (void); +#endif +#ifdef HAVE___UCMPDI2 void EXPORT_FUNC (__ucmpdi2) (void); +#endif From b240e30c478d5665bba66794e9a1c8ccaefbb222 Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 24 Oct 2009 23:31:05 +0000 Subject: [PATCH 07/37] 2009-10-25 Robert Millan * fs/cpio.c [MODE_USTAR]: Initialize `tar' module instead of `cpio'. [! MODE_USTAR]: Initialize `cpio' module instead of `tar'. --- ChangeLog | 6 ++++++ fs/cpio.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce28aed16..380dacffd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-25 Robert Millan + + * fs/cpio.c [MODE_USTAR]: Initialize `tar' module instead of + `cpio'. + [! MODE_USTAR]: Initialize `cpio' module instead of `tar'. + 2009-10-25 Robert Millan * configure.ac: Check for `__ashldi3', `__ashrdi3', `__lshrdi3', diff --git a/fs/cpio.c b/fs/cpio.c index 7c6ada9b3..3f3a3d1a0 100644 --- a/fs/cpio.c +++ b/fs/cpio.c @@ -352,9 +352,9 @@ static struct grub_fs grub_cpio_fs = { }; #ifdef MODE_USTAR -GRUB_MOD_INIT (cpio) -#else GRUB_MOD_INIT (tar) +#else +GRUB_MOD_INIT (cpio) #endif { grub_fs_register (&grub_cpio_fs); From 508d42ec11bd3197bd6f3783a27f54ed6796eafd Mon Sep 17 00:00:00 2001 From: robertmh Date: Sat, 24 Oct 2009 23:36:00 +0000 Subject: [PATCH 08/37] 2009-10-25 Robert Millan 2009-10-25 Vasily Averin * fs/ext2.c (grub_ext2_iterate_dir): Avoid infinite loop when `dirent.direntlen == 0'. --- ChangeLog | 6 ++++++ fs/ext2.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 380dacffd..80c593e4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-25 Robert Millan +2009-10-25 Vasily Averin + + * fs/ext2.c (grub_ext2_iterate_dir): Avoid infinite loop when + `dirent.direntlen == 0'. + 2009-10-25 Robert Millan * fs/cpio.c [MODE_USTAR]: Initialize `tar' module instead of diff --git a/fs/ext2.c b/fs/ext2.c index 0341680ea..8d8c6939e 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -649,6 +649,9 @@ grub_ext2_iterate_dir (grub_fshelp_node_t dir, if (grub_errno) return 0; + if (dirent.direntlen == 0) + return 0; + if (dirent.namelen != 0) { char filename[dirent.namelen + 1]; From d64448a72c4d5015ab07c2197e7f1f11717e382a Mon Sep 17 00:00:00 2001 From: robertmh Date: Sun, 25 Oct 2009 15:14:25 +0000 Subject: [PATCH 09/37] 2009-10-25 Robert Millan * include/grub/misc.h: Fix wrong evaluation of APPLE_CC. (memset): Fix function prototype. --- ChangeLog | 5 +++++ include/grub/misc.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 80c593e4b..daee3ea4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-25 Robert Millan + + * include/grub/misc.h: Fix wrong evaluation of APPLE_CC. + (memset): Fix function prototype. + 2009-10-25 Robert Millan 2009-10-25 Vasily Averin diff --git a/include/grub/misc.h b/include/grub/misc.h index c7ff1e2d2..7589f43a2 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -75,11 +75,11 @@ grub_strncat (char *dest, const char *src, int c) } /* Prototypes for aliases. */ -#if !defined (GRUB_UTIL) || !defined (APPLE_CC) +#if !defined (GRUB_UTIL) && !defined (APPLE_CC) int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); -void EXPORT_FUNC (memset) (void); +void *EXPORT_FUNC(memset) (void *s, int c, grub_size_t n); #endif int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n); From 042484d78e5a12999aa956caa4feb55ac54a2a3a Mon Sep 17 00:00:00 2001 From: robertmh Date: Sun, 25 Oct 2009 15:23:48 +0000 Subject: [PATCH 10/37] 2009-10-25 Robert Millan * include/grub/fs.h [GRUB_UTIL] (struct grub_fs): Add `reserved_first_sector' member. * fs/ext2.c [GRUB_UTIL] (grub_ext2_fs): Initialize `reserved_first_sector' to 1. * fs/fat.c [GRUB_UTIL] (grub_fat_fs): Likewise. * fs/ntfs.c [GRUB_UTIL] (grub_ntfs_fs): Likewise. * fs/hfsplus.c [GRUB_UTIL] (grub_hfsplus_fs): Likewise. * util/i386/pc/grub-setup.c (setup): Add safety check that probes for filesystems which begin at first sector. (options): New option --skip-fs-probe. (main): Handle --skip-fs-probe and pass it to setup(). --- ChangeLog | 14 ++++++++++++++ fs/ext2.c | 3 +++ fs/fat.c | 3 +++ fs/hfsplus.c | 3 +++ fs/ntfs.c | 22 +++++++++++++--------- include/grub/fs.h | 5 +++++ util/i386/pc/grub-setup.c | 29 +++++++++++++++++++++++++---- 7 files changed, 66 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index daee3ea4c..81f3ba601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2009-10-25 Robert Millan + + * include/grub/fs.h [GRUB_UTIL] (struct grub_fs): Add + `reserved_first_sector' member. + * fs/ext2.c [GRUB_UTIL] (grub_ext2_fs): Initialize + `reserved_first_sector' to 1. + * fs/fat.c [GRUB_UTIL] (grub_fat_fs): Likewise. + * fs/ntfs.c [GRUB_UTIL] (grub_ntfs_fs): Likewise. + * fs/hfsplus.c [GRUB_UTIL] (grub_hfsplus_fs): Likewise. + * util/i386/pc/grub-setup.c (setup): Add safety check that probes for + filesystems which begin at first sector. + (options): New option --skip-fs-probe. + (main): Handle --skip-fs-probe and pass it to setup(). + 2009-10-25 Robert Millan * include/grub/misc.h: Fix wrong evaluation of APPLE_CC. diff --git a/fs/ext2.c b/fs/ext2.c index 8d8c6939e..e7a20a43b 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -927,6 +927,9 @@ static struct grub_fs grub_ext2_fs = .label = grub_ext2_label, .uuid = grub_ext2_uuid, .mtime = grub_ext2_mtime, +#ifdef GRUB_UTIL + .reserved_first_sector = 1, +#endif .next = 0 }; diff --git a/fs/fat.c b/fs/fat.c index 8440e43fa..e7f01629e 100644 --- a/fs/fat.c +++ b/fs/fat.c @@ -855,6 +855,9 @@ static struct grub_fs grub_fat_fs = .close = grub_fat_close, .label = grub_fat_label, .uuid = grub_fat_uuid, +#ifdef GRUB_UTIL + .reserved_first_sector = 1, +#endif .next = 0 }; diff --git a/fs/hfsplus.c b/fs/hfsplus.c index 5e0ab093f..b306e8d6a 100644 --- a/fs/hfsplus.c +++ b/fs/hfsplus.c @@ -1021,6 +1021,9 @@ static struct grub_fs grub_hfsplus_fs = .label = grub_hfsplus_label, .mtime = grub_hfsplus_mtime, .uuid = grub_hfsplus_uuid, +#ifdef GRUB_UTIL + .reserved_first_sector = 1, +#endif .next = 0 }; diff --git a/fs/ntfs.c b/fs/ntfs.c index f1d0a374e..163f3e0a8 100644 --- a/fs/ntfs.c +++ b/fs/ntfs.c @@ -1081,15 +1081,19 @@ grub_ntfs_uuid (grub_device_t device, char **uuid) return grub_errno; } -static struct grub_fs grub_ntfs_fs = { - .name = "ntfs", - .dir = grub_ntfs_dir, - .open = grub_ntfs_open, - .read = grub_ntfs_read, - .close = grub_ntfs_close, - .label = grub_ntfs_label, - .uuid = grub_ntfs_uuid, - .next = 0 +static struct grub_fs grub_ntfs_fs = + { + .name = "ntfs", + .dir = grub_ntfs_dir, + .open = grub_ntfs_open, + .read = grub_ntfs_read, + .close = grub_ntfs_close, + .label = grub_ntfs_label, + .uuid = grub_ntfs_uuid, +#ifdef GRUB_UTIL + .reserved_first_sector = 1, +#endif + .next = 0 }; GRUB_MOD_INIT (ntfs) diff --git a/include/grub/fs.h b/include/grub/fs.h index 41732e48d..132ab4755 100644 --- a/include/grub/fs.h +++ b/include/grub/fs.h @@ -68,6 +68,11 @@ struct grub_fs /* Get writing time of filesystem. */ grub_err_t (*mtime) (grub_device_t device, grub_int32_t *timebuf); +#ifdef GRUB_UTIL + /* Whether this filesystem reserves first sector for DOS-style boot. */ + int reserved_first_sector; +#endif + /* The next filesystem. */ struct grub_fs *next; }; diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index ccfbd1d25..5a46e9e24 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -86,7 +86,7 @@ grub_refresh (void) static void setup (const char *dir, const char *boot_file, const char *core_file, - const char *root, const char *dest, int must_embed, int force) + const char *root, const char *dest, int must_embed, int force, int fs_probe) { char *boot_path, *core_path, *core_path_dev; char *boot_img, *core_img; @@ -251,6 +251,21 @@ setup (const char *dir, if (grub_disk_read (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE, tmp_img)) grub_util_error ("%s", grub_errmsg); + if (dest_dev->disk->partition && fs_probe) + { + grub_fs_t fs; + fs = grub_fs_probe (dest_dev); + if (! fs) + grub_util_error ("Unable to identify a filesystem in %s; safety check can't be performed."); + + if (! fs->reserved_first_sector) + grub_util_error ("%s appears to contain a %s filesystem which isn't known to " + "reserve space for DOS-style boot. Installing GRUB there could " + "result in FILESYSTEM DESTRUCTION if valuable data is overwritten " + "by grub-setup (--skip-fs-probe disables this " + "check, use at your own risk).", dest_dev->disk->name, fs->name); + } + /* Copy the possible DOS BPB. */ memcpy (boot_img + GRUB_BOOT_MACHINE_BPB_START, tmp_img + GRUB_BOOT_MACHINE_BPB_START, @@ -556,6 +571,7 @@ static struct option options[] = {"device-map", required_argument, 0, 'm'}, {"root-device", required_argument, 0, 'r'}, {"force", no_argument, 0, 'f'}, + {"skip-fs-probe", no_argument, 0, 's'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, {"verbose", no_argument, 0, 'v'}, @@ -580,6 +596,7 @@ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\ -m, --device-map=FILE use FILE as the device map [default=%s]\n\ -r, --root-device=DEV use DEV as the root device [default=guessed]\n\ -f, --force install even if problems are detected\n\ + -s, --skip-fs-probe do not probe for filesystems in DEVICE\n\ -h, --help display this message and exit\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ @@ -613,7 +630,7 @@ main (int argc, char *argv[]) char *dev_map = 0; char *root_dev = 0; char *dest_dev; - int must_embed = 0, force = 0; + int must_embed = 0, force = 0, fs_probe = 1; progname = "grub-setup"; @@ -666,6 +683,10 @@ main (int argc, char *argv[]) force = 1; break; + case 's': + fs_probe = 0; + break; + case 'h': usage (0); break; @@ -767,7 +788,7 @@ main (int argc, char *argv[]) setup (dir ? : DEFAULT_DIRECTORY, boot_file ? : DEFAULT_BOOT_FILE, core_file ? : DEFAULT_CORE_FILE, - root_dev, grub_util_get_grub_dev (devicelist[i]), 1, force); + root_dev, grub_util_get_grub_dev (devicelist[i]), 1, force, fs_probe); } } else @@ -776,7 +797,7 @@ main (int argc, char *argv[]) setup (dir ? : DEFAULT_DIRECTORY, boot_file ? : DEFAULT_BOOT_FILE, core_file ? : DEFAULT_CORE_FILE, - root_dev, dest_dev, must_embed, force); + root_dev, dest_dev, must_embed, force, fs_probe); /* Free resources. */ grub_fini_all (); From 4dea1c6f063c5af8a50a8481c0e2ce713190897d Mon Sep 17 00:00:00 2001 From: robertmh Date: Sun, 25 Oct 2009 17:49:27 +0000 Subject: [PATCH 11/37] 2009-10-25 Robert Millan * util/i386/pc/grub-setup.c (setup): Add missing parameter to grub_util_error() call. --- ChangeLog | 5 +++++ util/i386/pc/grub-setup.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 81f3ba601..123a52cb6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-25 Robert Millan + + * util/i386/pc/grub-setup.c (setup): Add missing parameter to + grub_util_error() call. + 2009-10-25 Robert Millan * include/grub/fs.h [GRUB_UTIL] (struct grub_fs): Add diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index 5a46e9e24..c536be0c4 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -256,7 +256,8 @@ setup (const char *dir, grub_fs_t fs; fs = grub_fs_probe (dest_dev); if (! fs) - grub_util_error ("Unable to identify a filesystem in %s; safety check can't be performed."); + grub_util_error ("Unable to identify a filesystem in %s; safety check can't be performed.", + dest_dev->disk->name); if (! fs->reserved_first_sector) grub_util_error ("%s appears to contain a %s filesystem which isn't known to " From ee3756ccb3f14b7a3f7d5a967dea15b4104f97c5 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 00:38:26 +0000 Subject: [PATCH 12/37] 2009-10-26 Robert Millan * util/grub.d/10_freebsd.in: Remove. --- ChangeLog | 4 +++ util/grub.d/10_freebsd.in | 76 --------------------------------------- 2 files changed, 4 insertions(+), 76 deletions(-) delete mode 100644 util/grub.d/10_freebsd.in diff --git a/ChangeLog b/ChangeLog index 123a52cb6..597dcafcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-26 Robert Millan + + * util/grub.d/10_freebsd.in: Remove. + 2009-10-25 Robert Millan * util/i386/pc/grub-setup.c (setup): Add missing parameter to diff --git a/util/grub.d/10_freebsd.in b/util/grub.d/10_freebsd.in deleted file mode 100644 index 02694d3e7..000000000 --- a/util/grub.d/10_freebsd.in +++ /dev/null @@ -1,76 +0,0 @@ -#! /bin/sh -e - -# grub-mkconfig helper script. -# Copyright (C) 2008,2009 Free Software Foundation, Inc. -# -# GRUB is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# GRUB is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GRUB. If not, see . - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -. ${libdir}/grub/grub-mkconfig_lib - -case "${GRUB_DISTRIBUTOR}" in - Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;; - *) OS="FreeBSD" ;; -esac - -if test -e /boot/device.hints ; then - devices=/boot/device.hints -fi - -if test -e /boot/kernel/kernel ; then - kfreebsd=/boot/kernel/kernel -fi -if test -e /boot/kernel/kernel.gz ; then - kfreebsd=/boot/kernel/kernel.gz -fi - -if [ "x$kfreebsd" != "x" ] ; then - echo "Found kernel of FreeBSD: $kfreebsd" >&2 - - kfreebsd_basename=`basename $kfreebsd` - kfreebsd_dirname=`dirname $kfreebsd` - kfreebsd_rel_dirname=`make_system_path_relative_to_its_root $kfreebsd_dirname` - - if [ x"$devices" != "x" ] ; then - devices_basename=`basename $devices` - devices_dirname=`dirname $devices` - devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname` - fi - - case ${GRUB_FS} in - ufs1 | ufs2) kfreebsd_fs=ufs ;; - *) kfreebsd_fs=${GRUB_FS} ;; - esac - - cat << EOF -menuentry "${OS}" { -EOF - prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" - cat << EOF - kfreebsd ${kfreebsd_rel_dirname}/${kfreebsd_basename} -EOF - - if [ x"$devices" != "x" ] ; then - cat << EOF - kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename} -EOF - fi - cat << EOF - set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE} - set kFreeBSD.vfs.root.mountfrom.options=rw -} -EOF -fi From 5c35048e23a02f91b7b910645e8b80993b65eab3 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 00:38:38 +0000 Subject: [PATCH 13/37] 2009-10-26 Robert Millan * docs/grub.cfg: Fix example usage of *BSD loaders. --- ChangeLog | 2 +- docs/grub.cfg | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 597dcafcb..8a3c0dcb7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ 2009-10-26 Robert Millan - * util/grub.d/10_freebsd.in: Remove. + * docs/grub.cfg: Fix example usage of *BSD loaders. 2009-10-25 Robert Millan diff --git a/docs/grub.cfg b/docs/grub.cfg index 0a9ab6bc7..e14cdb776 100644 --- a/docs/grub.cfg +++ b/docs/grub.cfg @@ -34,26 +34,26 @@ menuentry "GNU/Linux" { # For booting FreeBSD menuentry "FreeBSD (or GNU/kFreeBSD), direct boot" { set root=(hd0,1,a) - freebsd /boot/kernel/kernel - freebsd_loadenv /boot/device.hints - freebsd_module /boot/splash.bmp type=splash_image_data - set FreeBSD.vfs.root.mountfrom=ufs:ad0s1a + kfreebsd /boot/kernel/kernel + kfreebsd_loadenv /boot/device.hints + kfreebsd_module /boot/splash.bmp type=splash_image_data + set kFreeBSD.vfs.root.mountfrom=ufs:ad0s1a } menuentry "FreeBSD (or GNU/kFreeBSD), via /boot/loader" { set root=(hd0,1,a) - freebsd /boot/loader + kfreebsd /boot/loader } # For booting NetBSD menuentry "NetBSD" { set root=(hd0,1,a) - netbsd /netbsd + knetbsd /netbsd } # For booting OpenBSD menuentry "OpenBSD" { set root=(hd0,1,a) - openbsd /bsd + kopenbsd /bsd } # For booting Microsoft Windows From 67937d4dca09e70d2d0a4ff72629ae1340355451 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 00:41:54 +0000 Subject: [PATCH 14/37] 2009-10-26 Robert Millan * util/grub.d/10_freebsd.in: Remove. * util/grub.d/10_kfreebsd.in: New file (based on 10_linux.in). * configure.ac: Set host_kernel=kfreebsd for FreeBSD and GNU/kFreeBSD. --- ChangeLog | 6 +++ configure.ac | 2 +- util/grub.d/10_kfreebsd.in | 102 +++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 util/grub.d/10_kfreebsd.in diff --git a/ChangeLog b/ChangeLog index 8a3c0dcb7..6ca49a0e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-26 Robert Millan + + * util/grub.d/10_freebsd.in: Remove. + * util/grub.d/10_kfreebsd.in: New file (based on 10_linux.in). + * configure.ac: Set host_kernel=kfreebsd for FreeBSD and GNU/kFreeBSD. + 2009-10-26 Robert Millan * docs/grub.cfg: Fix example usage of *BSD loaders. diff --git a/configure.ac b/configure.ac index 048333ba5..4bd28f2e8 100644 --- a/configure.ac +++ b/configure.ac @@ -107,7 +107,7 @@ esac case "$host_os" in gnu*) host_kernel=hurd ;; linux*) host_kernel=linux ;; - freebsd* | kfreebsd*-gnu) host_kernel=freebsd ;; + freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;; cygwin) host_kernel=windows ;; esac diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in new file mode 100644 index 000000000..1473a42a2 --- /dev/null +++ b/util/grub.d/10_kfreebsd.in @@ -0,0 +1,102 @@ +#! /bin/sh -e + +# grub-mkconfig helper script. +# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +. ${libdir}/grub/grub-mkconfig_lib + +if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then + OS=GNU/Linux +else + OS="${GRUB_DISTRIBUTOR} GNU/Linux" +fi + +# loop-AES arranges things so that /dev/loop/X can be our root device, but +# the initrds that Linux uses don't like that. +case ${GRUB_DEVICE} in + /dev/loop/*|/dev/loop[0-9]) + GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` + ;; +esac + +if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ + || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then + LINUX_ROOT_DEVICE=${GRUB_DEVICE} +else + LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} +fi + +linux_entry () +{ + cat << EOF +menuentry "$1" { +EOF + prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" + cat << EOF + linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2 +EOF + if test -n "${initrd}" ; then + cat << EOF + initrd ${rel_dirname}/${initrd} +EOF + fi + cat << EOF +} +EOF +} + +list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do + if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi + done` + +while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` + echo "Found linux image: $linux" >&2 + basename=`basename $linux` + dirname=`dirname $linux` + rel_dirname=`make_system_path_relative_to_its_root $dirname` + version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` + alt_version=`echo $version | sed -e "s,\.old$,,g"` + linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" + + initrd= + for i in "initrd.img-${version}" "initrd-${version}.img" \ + "initrd-${version}" "initrd.img-${alt_version}" \ + "initrd-${alt_version}.img" "initrd-${alt_version}"; do + if test -e "${dirname}/${i}" ; then + initrd="$i" + break + fi + done + if test -n "${initrd}" ; then + echo "Found initrd image: ${dirname}/${initrd}" >&2 + else + # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. + linux_root_device_thisversion=${GRUB_DEVICE} + fi + + linux_entry "${OS}, with Linux ${version}" \ + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" + if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then + linux_entry "${OS}, with Linux ${version} (recovery mode)" \ + "single ${GRUB_CMDLINE_LINUX}" + fi + + list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` +done From ba36be41191d89f225a4b981ffcad474955f48e6 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 00:41:58 +0000 Subject: [PATCH 15/37] 2009-10-26 Robert Millan * util/grub.d/10_freebsd.in: Remove. * util/grub.d/10_kfreebsd.in: New file (based on 10_linux.in). * configure.ac: Set host_kernel=kfreebsd for FreeBSD and GNU/kFreeBSD. --- util/grub.d/10_kfreebsd.in | 98 +++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index 1473a42a2..4fb704c49 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -21,82 +21,82 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ . ${libdir}/grub/grub-mkconfig_lib -if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then - OS=GNU/Linux -else - OS="${GRUB_DISTRIBUTOR} GNU/Linux" -fi - -# loop-AES arranges things so that /dev/loop/X can be our root device, but -# the initrds that Linux uses don't like that. -case ${GRUB_DEVICE} in - /dev/loop/*|/dev/loop[0-9]) - GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"` - ;; +case "${GRUB_DISTRIBUTOR}" in + Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;; + *) OS="FreeBSD" ;; esac -if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} -else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -fi - -linux_entry () +kfreebsd_entry () { cat << EOF menuentry "$1" { EOF prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" cat << EOF - linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2 + kfreebsd ${rel_dirname}/${basename} EOF - if test -n "${initrd}" ; then + + if test -n "${devices}" ; then cat << EOF - initrd ${rel_dirname}/${initrd} + kfreebsd_loadenv ${devices_rel_dirname}/${devices_basename} EOF fi + + if test -n "${acpi_ko}" ; then + cat << EOF + kfreebsd_module_elf ${acpi_ko_rel_dirname}/${acpi_ko_basename} +EOF + fi + cat << EOF + set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE} + set kFreeBSD.vfs.root.mountfrom.options=rw } EOF } -list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do +list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` while [ "x$list" != "x" ] ; do - linux=`version_find_latest $list` - echo "Found linux image: $linux" >&2 - basename=`basename $linux` - dirname=`dirname $linux` + kfreebsd=`version_find_latest $list` + echo "Found kernel of FreeBSD: $kfreebsd" >&2 + basename=`basename $kfreebsd` + dirname=`dirname $kfreebsd` rel_dirname=`make_system_path_relative_to_its_root $dirname` - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` - alt_version=`echo $version | sed -e "s,\.old$,,g"` - linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" - initrd= - for i in "initrd.img-${version}" "initrd-${version}.img" \ - "initrd-${version}" "initrd.img-${alt_version}" \ - "initrd-${alt_version}.img" "initrd-${alt_version}"; do - if test -e "${dirname}/${i}" ; then - initrd="$i" + if [ -f /boot/device.hints ] ; then + devices=/boot/device.hints + devices_basename=`basename $devices` + devices_dirname=`dirname $devices` + devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname` + fi + + case ${GRUB_FS} in + ufs1 | ufs2) kfreebsd_fs=ufs ;; + *) kfreebsd_fs=${GRUB_FS} ;; + esac + + version=`echo $basename | sed -e "s,^[^0-9]*-,,g;s/\.gz$//g"` + alt_version=`echo $version | sed -e "s,\.old$,,g"` + + acpi_ko= + for i in "/lib/modules/${version}/acpi.ko" "/lib/modules/${alt_version}/acpi.ko" \ + "/boot/kernel/acpi.ko"; do + if test -e "$i" ; then + acpi_ko="$i" break fi done - if test -n "${initrd}" ; then - echo "Found initrd image: ${dirname}/${initrd}" >&2 - else - # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. - linux_root_device_thisversion=${GRUB_DEVICE} + if test -n "${acpi_ko}" ; then + echo "Found ACPI module: ${acpi_ko}" >&2 + acpi_ko_basename=`basename ${acpi_ko}` + acpi_ko_dirname=`dirname ${acpi_ko}` + acpi_ko_rel_dirname=`make_system_path_relative_to_its_root $acpi_ko_dirname` fi - linux_entry "${OS}, with Linux ${version}" \ - "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" - if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then - linux_entry "${OS}, with Linux ${version} (recovery mode)" \ - "single ${GRUB_CMDLINE_LINUX}" - fi + kfreebsd_entry "${OS}, kFreeBSD ${version}" - list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` + list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '` done From e4f6809bbc51ceac3eea354a3f264b3cf0c483d3 Mon Sep 17 00:00:00 2001 From: cjwatson Date: Mon, 26 Oct 2009 16:28:04 +0000 Subject: [PATCH 16/37] 2009-10-26 Colin Watson Improve grub-mkconfig performance when there are several menu entries on a single filesystem. * util/grub.d/10_linux.in (linux_entry): Cache the output of prepare_grub_to_access_device. * util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise. * util/grub.d/30_os-prober.in: Likewise. --- ChangeLog | 10 ++++++++++ util/grub.d/10_kfreebsd.in | 6 +++++- util/grub.d/10_linux.in | 6 +++++- util/grub.d/30_os-prober.in | 6 +++++- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ca49a0e2..e7e01fa37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-10-26 Colin Watson + + Improve grub-mkconfig performance when there are several menu + entries on a single filesystem. + + * util/grub.d/10_linux.in (linux_entry): Cache the output of + prepare_grub_to_access_device. + * util/grub.d/10_kfreebsd.in (kfreebsd_entry): Likewise. + * util/grub.d/30_os-prober.in: Likewise. + 2009-10-26 Robert Millan * util/grub.d/10_freebsd.in: Remove. diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index 4fb704c49..cd8c186be 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -31,7 +31,10 @@ kfreebsd_entry () cat << EOF menuentry "$1" { EOF - prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" + if [ -z "${prepare_boot_cache}" ]; then + prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" + fi + printf '%s\n' "${prepare_boot_cache}" cat << EOF kfreebsd ${rel_dirname}/${basename} EOF @@ -58,6 +61,7 @@ EOF list=`for i in /boot/kfreebsd-* /boot/kernel/kernel ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` +prepare_boot_cache= while [ "x$list" != "x" ] ; do kfreebsd=`version_find_latest $list` diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index 1473a42a2..f17955846 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -47,7 +47,10 @@ linux_entry () cat << EOF menuentry "$1" { EOF - prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" + if [ -z "${prepare_boot_cache}" ]; then + prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" + fi + printf '%s\n' "${prepare_boot_cache}" cat << EOF linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2 EOF @@ -64,6 +67,7 @@ EOF list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi done` +prepare_boot_cache= while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 84e227ee7..6fd97fc4e 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -74,6 +74,7 @@ EOF ;; linux) LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`" + prepare_boot_cache= for LINUX in ${LINUXPROBED} ; do LROOT="`echo ${LINUX} | cut -d ':' -f 1`" @@ -90,7 +91,10 @@ EOF cat << EOF menuentry "${LLABEL} (on ${DEVICE})" { EOF - prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" + if [ -z "${prepare_boot_cache}" ]; then + prepare_boot_cache="$(prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/")" + fi + printf '%s\n' "${prepare_boot_cache}" cat << EOF linux ${LKERNEL} ${LPARAMS} EOF From 9031b03aaca8c601f60e13ab5cc9f032094cb119 Mon Sep 17 00:00:00 2001 From: cjwatson Date: Mon, 26 Oct 2009 16:33:13 +0000 Subject: [PATCH 17/37] 2009-10-26 Colin Watson * util/grub-editenv.c (main): If only a command is given, use DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG as a default file name. (usage): FILENAME is now optional and has a default. --- ChangeLog | 6 ++++++ util/grub-editenv.c | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7e01fa37..ab7ccf39c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-26 Colin Watson + + * util/grub-editenv.c (main): If only a command is given, use + DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG as a default file name. + (usage): FILENAME is now optional and has a default. + 2009-10-26 Colin Watson Improve grub-mkconfig performance when there are several menu diff --git a/util/grub-editenv.c b/util/grub-editenv.c index a8dc137c5..5b688d9cb 100644 --- a/util/grub-editenv.c +++ b/util/grub-editenv.c @@ -72,7 +72,7 @@ usage (int status) fprintf (stderr, "Try ``grub-editenv --help'' for more information.\n"); else printf ("\ -Usage: grub-editenv [OPTIONS] FILENAME COMMAND\n\ +Usage: grub-editenv [OPTIONS] [FILENAME] COMMAND\n\ \n\ Tool to edit environment block.\n\ \nCommands:\n\ @@ -85,7 +85,10 @@ Tool to edit environment block.\n\ -V, --version print version information and exit\n\ -v, --verbose print verbose messages\n\ \n\ -Report bugs to <%s>.\n", PACKAGE_BUGREPORT); +If not given explicitly, FILENAME defaults to %s.\n\ +\n\ +Report bugs to <%s>.\n", +DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG, PACKAGE_BUGREPORT); exit (status); } @@ -288,12 +291,14 @@ main (int argc, char *argv[]) if (optind + 1 >= argc) { - fprintf (stderr, "no command specified\n"); - usage (1); + filename = DEFAULT_DIRECTORY "/" GRUB_ENVBLK_DEFCFG; + command = argv[optind]; + } + else + { + filename = argv[optind]; + command = argv[optind + 1]; } - - filename = argv[optind]; - command = argv[optind + 1]; if (strcmp (command, "create") == 0) create_envblk_file (filename); From 94180ff6c7166b80ca18ef30587abc372e0e30fd Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 18:02:19 +0000 Subject: [PATCH 18/37] 2009-10-26 Robert Millan * conf/i386-coreboot.rmk (script/sh/lexer.c_DEPENDENCIES): Moved from here ... * conf/common.rmk (script/sh/lexer.c_DEPENDENCIES): ... to here. * conf/i386-efi.rmk (script/sh/lexer.c_DEPENDENCIES): Remove. * conf/i386-ieee1275.rmk: Likewise. * conf/i386-pc.rmk: Likewise. * conf/powerpc-ieee1275.rmk: Likewise. * conf/sparc64-ieee1275.rmk: Likewise. * conf/x86_64-efi.rmk: Likewise. --- ChangeLog | 12 ++++++++++++ conf/common.rmk | 2 ++ conf/i386-coreboot.rmk | 1 - conf/i386-efi.rmk | 1 - conf/i386-ieee1275.rmk | 1 - conf/i386-pc.rmk | 1 - conf/powerpc-ieee1275.rmk | 1 - conf/sparc64-ieee1275.rmk | 1 - conf/x86_64-efi.rmk | 1 - 9 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab7ccf39c..5a1a7b35e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2009-10-26 Robert Millan + + * conf/i386-coreboot.rmk (script/sh/lexer.c_DEPENDENCIES): Moved + from here ... + * conf/common.rmk (script/sh/lexer.c_DEPENDENCIES): ... to here. + * conf/i386-efi.rmk (script/sh/lexer.c_DEPENDENCIES): Remove. + * conf/i386-ieee1275.rmk: Likewise. + * conf/i386-pc.rmk: Likewise. + * conf/powerpc-ieee1275.rmk: Likewise. + * conf/sparc64-ieee1275.rmk: Likewise. + * conf/x86_64-efi.rmk: Likewise. + 2009-10-26 Colin Watson * util/grub-editenv.c (main): If only a command is given, use diff --git a/conf/common.rmk b/conf/common.rmk index c1f0bbdcf..ce7c33084 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -1,5 +1,7 @@ # -*- makefile -*- +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h + # For grub-mkelfimage. bin_UTILITIES += grub-mkelfimage grub_mkelfimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \ diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index 09ec7787c..3c2061b4e 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -5,7 +5,6 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 COMMON_LDFLAGS = -m32 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index 99ab06f64..0440359e5 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -5,7 +5,6 @@ COMMON_CFLAGS = -fno-builtin -m32 COMMON_LDFLAGS = -melf_i386 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index 4b640de49..c70ecf4dd 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -5,7 +5,6 @@ COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3 COMMON_LDFLAGS = -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_PROGRAMS = kernel.img diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index bf8fbfb9d..30847dfa7 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -7,7 +7,6 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 COMMON_LDFLAGS = -m32 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \ diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index ee7f9ec27..9165e4bc0 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -6,7 +6,6 @@ COMMON_CFLAGS = -ffreestanding COMMON_LDFLAGS += -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index 62e951a5e..1156fe2a9 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -6,7 +6,6 @@ COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_IMAGES = boot.img diskboot.img kernel.img diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index 5be1b404f..173227575 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -5,7 +5,6 @@ COMMON_CFLAGS = -fno-builtin -m64 COMMON_LDFLAGS = -melf_x86_64 -nostdlib # Used by various components. These rules need to precede them. -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage From 5947ae32f588d62077cbf341382a78fc9efc2f5b Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 18:02:30 +0000 Subject: [PATCH 19/37] 2009-10-26 Robert Millan * Makefile.in (docs/grub.info): Use make syntax to ignore errors in $(MAKEINFO) invocation. This makes it clear in output that errors are being ignored. --- ChangeLog | 6 ++++++ Makefile.in | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5a1a7b35e..2a9c04844 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-26 Robert Millan + + * Makefile.in (docs/grub.info): Use make syntax to ignore errors + in $(MAKEINFO) invocation. This makes it clear in output that + errors are being ignored. + 2009-10-26 Robert Millan * conf/i386-coreboot.rmk (script/sh/lexer.c_DEPENDENCIES): Moved diff --git a/Makefile.in b/Makefile.in index e0edbdb04..80ed07124 100644 --- a/Makefile.in +++ b/Makefile.in @@ -197,7 +197,7 @@ docs/stamp-vti: docs/grub.texi configure.ac # Use --force until such time as the documentation is cleaned up. docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi $(MKDIR_P) docs - $(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@ || : + -$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@ ifeq (, $(UNIFONT_BDF)) else From 083d16798e9ab51e3b2cd7fb94c7e960bb92f8de Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 18:04:37 +0000 Subject: [PATCH 20/37] 2009-10-26 Robert Millan * gensymlist.sh.in (COMPILE_TIME_ASSERT): Copy macro declaration from here ... * include/grub/misc.h (COMPILE_TIME_ASSERT): ... to here. --- ChangeLog | 6 ++++++ include/grub/misc.h | 1 + 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2a9c04844..afe67af2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-26 Robert Millan + + * gensymlist.sh.in (COMPILE_TIME_ASSERT): Copy macro declaration + from here ... + * include/grub/misc.h (COMPILE_TIME_ASSERT): ... to here. + 2009-10-26 Robert Millan * Makefile.in (docs/grub.info): Use make syntax to ignore errors diff --git a/include/grub/misc.h b/include/grub/misc.h index 7589f43a2..e3a062898 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -28,6 +28,7 @@ #define ALIGN_UP(addr, align) \ ((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1)) #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) +#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } #define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args) /* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ From 478df40933d8acb1e6cdae9af4b7eb70cb3ee983 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 18:06:23 +0000 Subject: [PATCH 21/37] 2009-10-26 Robert Millan * disk/scsi.c: Remove `' (not needed). --- ChangeLog | 4 ++++ disk/scsi.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index afe67af2b..769e4fb2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-26 Robert Millan + + * disk/scsi.c: Remove `' (not needed). + 2009-10-26 Robert Millan * gensymlist.sh.in (COMPILE_TIME_ASSERT): Copy macro declaration diff --git a/disk/scsi.c b/disk/scsi.c index 24ebdb6cd..d0e248511 100644 --- a/disk/scsi.c +++ b/disk/scsi.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include From 0579b753d611588a50604934253c32e4abb33455 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 18:25:02 +0000 Subject: [PATCH 22/37] 2009-10-26 Robert Millan * Makefile.in (RMKFILES): Rewrite using $(wildcard). --- ChangeLog | 4 ++++ Makefile.in | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 769e4fb2a..1e05f770e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-26 Robert Millan + + * Makefile.in (RMKFILES): Rewrite using $(wildcard). + 2009-10-26 Robert Millan * disk/scsi.c: Remove `' (not needed). diff --git a/Makefile.in b/Makefile.in index 80ed07124..bde80889b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -115,9 +115,7 @@ enable_efiemu = @enable_efiemu@ ### General variables. -RMKFILES = $(addprefix conf/,common.rmk i386-coreboot.rmk i386-efi.rmk \ - i386-qemu.rmk i386-ieee1275.rmk i386-pc.rmk i386.rmk powerpc-ieee1275.rmk \ - sparc64-ieee1275.rmk x86_64-efi.rmk) +RMKFILES = $(wildcard conf/*.rmk) MKFILES = $(patsubst %.rmk,%.mk,$(RMKFILES)) From ed96ab6d201e50fbeb7833f7d85e0a1182a62f40 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 19:39:35 +0000 Subject: [PATCH 23/37] 2009-10-26 Robert Millan * gendistlist.sh: Simplify .svn check. Skip .bzr as well. --- ChangeLog | 4 ++++ gendistlist.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1e05f770e..b59e2d945 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-26 Robert Millan + + * gendistlist.sh: Simplify .svn check. Skip .bzr as well. + 2009-10-26 Robert Millan * Makefile.in (RMKFILES): Rewrite using $(wildcard). diff --git a/gendistlist.sh b/gendistlist.sh index 7f6c32a44..36685a092 100644 --- a/gendistlist.sh +++ b/gendistlist.sh @@ -35,7 +35,7 @@ dir=`dirname $0` cd $dir for dir in $DISTDIRS; do - for d in `find $dir -type d | sed '/\/\.svn$/d;\/\.svn\//d' | sort`; do + for d in `find $dir -type d -not -name .svn -not -name .bzr | sort`; do find $d -maxdepth 1 -name '*.[chSy]' -o -name '*.mk' -o -name '*.rmk' \ -o -name '*.rb' -o -name '*.in' -o -name '*.tex' -o -name '*.texi' \ -o -name '*.info' -o -name 'grub.cfg' -o -name 'README' \ From cefabfe1c4fb58877770034db338d850d2e6f0b9 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 26 Oct 2009 20:04:43 +0000 Subject: [PATCH 24/37] 2009-10-26 Robert Millan * autogen.sh: Support addition of external modules via `GRUB_CONTRIB' variable. * Makefile.in: Likewise. --- ChangeLog | 6 ++++++ Makefile.in | 3 +++ autogen.sh | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b59e2d945..56ff263ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-26 Robert Millan + + * autogen.sh: Support addition of external modules via `GRUB_CONTRIB' + variable. + * Makefile.in: Likewise. + 2009-10-26 Robert Millan * gendistlist.sh: Simplify .svn check. Skip .bzr as well. diff --git a/Makefile.in b/Makefile.in index bde80889b..f99bc3c2a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -148,6 +148,9 @@ $(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb include $(srcdir)/conf/$(target_cpu)-$(platform).mk +# For external modules. +-include $(wildcard $(GRUB_CONTRIB)/*/conf/common.mk) + ### General targets. CLEANFILES += $(pkglib_DATA) $(pkgdata_DATA) diff --git a/autogen.sh b/autogen.sh index 6895de221..4fb6bf7db 100644 --- a/autogen.sh +++ b/autogen.sh @@ -5,8 +5,10 @@ set -e autoconf autoheader echo timestamp > stamp-h.in -for rmk in conf/*.rmk; do - ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'` +for rmk in conf/*.rmk ${GRUB_CONTRIB}/*/conf/*.rmk; do + if test -e $rmk ; then + ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'` + fi done ./gendistlist.sh > DISTLIST From fdcdde1905d36e3ff8283ae3c9b97ea1d37fde50 Mon Sep 17 00:00:00 2001 From: fzielcke Date: Wed, 28 Oct 2009 18:24:10 +0000 Subject: [PATCH 25/37] 2009-10-28 Felix Zielcke * commands/acpi.c (grub_cmd_acpi): Fix the out of memory error strings. --- ChangeLog | 5 +++++ commands/acpi.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56ff263ed..1a1be5746 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-28 Felix Zielcke + + * commands/acpi.c (grub_cmd_acpi): Fix the out of memory error + strings. + 2009-10-26 Robert Millan * autogen.sh: Support addition of external modules via `GRUB_CONTRIB' diff --git a/commands/acpi.c b/commands/acpi.c index e7cb9e6b4..9cfd8ef10 100644 --- a/commands/acpi.c +++ b/commands/acpi.c @@ -552,7 +552,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd, grub_free (exclude); grub_free (load_only); return grub_error (GRUB_ERR_OUT_OF_MEMORY, - "Could allocate table"); + "Couldn't allocate table"); } grub_memcpy (table_dsdt, dsdt, dsdt->length); } @@ -579,7 +579,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd, grub_free (exclude); grub_free (load_only); return grub_error (GRUB_ERR_OUT_OF_MEMORY, - "Could allocate table structure"); + "Couldn't allocate table structure"); } table->size = curtable->length; table->addr = grub_malloc (table->size); @@ -588,7 +588,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd, { free_tables (); return grub_error (GRUB_ERR_OUT_OF_MEMORY, - "Could allocate table"); + "Couldn't allocate table"); } table->next = acpi_tables; acpi_tables = table; @@ -675,7 +675,7 @@ grub_cmd_acpi (struct grub_extcmd *cmd, { free_tables (); return grub_error (GRUB_ERR_OUT_OF_MEMORY, - "Could allocate table structure"); + "Couldn't allocate table structure"); } table->size = size; From 2ed19dfdeda64c7319fde370b6e4e14f5ee85894 Mon Sep 17 00:00:00 2001 From: robertmh Date: Wed, 28 Oct 2009 22:02:54 +0000 Subject: [PATCH 26/37] 2009-10-28 Robert Millan * kern/i386/coreboot/init.c (grub_exit): Reimplement in a way that doesn't cause an infinite call loop. --- ChangeLog | 5 +++++ kern/i386/coreboot/init.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1a1be5746..a792f04e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-28 Robert Millan + + * kern/i386/coreboot/init.c (grub_exit): Reimplement in a way that + doesn't cause an infinite call loop. + 2009-10-28 Felix Zielcke * commands/acpi.c (grub_cmd_acpi): Fix the out of memory error diff --git a/kern/i386/coreboot/init.c b/kern/i386/coreboot/init.c index 1b9ca3815..0bf4934fb 100644 --- a/kern/i386/coreboot/init.c +++ b/kern/i386/coreboot/init.c @@ -62,7 +62,10 @@ grub_stop_floppy (void) void grub_exit (void) { - grub_fatal ("grub_exit() is not implemented.\n"); + /* We can't use grub_fatal() in this function. This would create an infinite + loop, since grub_fatal() calls grub_abort() which in turn calls grub_exit(). */ + while (1) + grub_cpu_idle (); } void From 95b9239e13de05188c989c1542b936a62b5e8c10 Mon Sep 17 00:00:00 2001 From: robertmh Date: Wed, 28 Oct 2009 22:55:27 +0000 Subject: [PATCH 27/37] 2009-10-28 Robert Millan * include/grub/misc.h: Stop checking for APPLE_CC. --- ChangeLog | 4 ++++ include/grub/misc.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a792f04e5..ff7098c58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-28 Robert Millan + + * include/grub/misc.h: Stop checking for APPLE_CC. + 2009-10-28 Robert Millan * kern/i386/coreboot/init.c (grub_exit): Reimplement in a way that diff --git a/include/grub/misc.h b/include/grub/misc.h index e3a062898..faa2d5c42 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -76,7 +76,7 @@ grub_strncat (char *dest, const char *src, int c) } /* Prototypes for aliases. */ -#if !defined (GRUB_UTIL) && !defined (APPLE_CC) +#ifndef GRUB_UTIL int EXPORT_FUNC(memcmp) (const void *s1, const void *s2, grub_size_t n); void *EXPORT_FUNC(memmove) (void *dest, const void *src, grub_size_t n); void *EXPORT_FUNC(memcpy) (void *dest, const void *src, grub_size_t n); From cee15086c312902c4e4bfe26829746b67cdd05d3 Mon Sep 17 00:00:00 2001 From: robertmh Date: Wed, 28 Oct 2009 23:16:32 +0000 Subject: [PATCH 28/37] 2009-10-28 Robert Millan * Makefile.in (TARGET_CPPFLAGS): Add `-nostdinc'. --- ChangeLog | 4 ++++ Makefile.in | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ff7098c58..12e8932e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-10-28 Robert Millan + + * Makefile.in (TARGET_CPPFLAGS): Add `-nostdinc'. + 2009-10-28 Robert Millan * include/grub/misc.h: Stop checking for APPLE_CC. diff --git a/Makefile.in b/Makefile.in index f99bc3c2a..103d2d3d2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -75,7 +75,7 @@ TARGET_ASFLAGS = @TARGET_ASFLAGS@ TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@ TARGET_APPLE_CC = @TARGET_APPLE_CC@ OBJCONV = @OBJCONV@ -TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \ +TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \ -Wall -W TARGET_LDFLAGS = @TARGET_LDFLAGS@ TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ From fa6e945f506c09046acebee1963398daca3b83fe Mon Sep 17 00:00:00 2001 From: robertmh Date: Thu, 29 Oct 2009 10:03:13 +0000 Subject: [PATCH 29/37] 2009-10-29 Robert Millan Revert SVN r2660. * conf/common.rmk (script/sh/lexer.c_DEPENDENCIES): Moved from here ... * conf/i386-coreboot.rmk (script/sh/lexer.c_DEPENDENCIES): ... to here. * conf/i386-efi.rmk (script/sh/lexer.c_DEPENDENCIES): ... and here. * conf/i386-ieee1275.rmk: Likewise. * conf/i386-pc.rmk: Likewise. * conf/powerpc-ieee1275.rmk: Likewise. * conf/sparc64-ieee1275.rmk: Likewise. * conf/x86_64-efi.rmk: Likewise. --- ChangeLog | 13 +++++++++++++ conf/common.rmk | 2 -- conf/i386-coreboot.rmk | 1 + conf/i386-efi.rmk | 1 + conf/i386-ieee1275.rmk | 1 + conf/i386-pc.rmk | 1 + conf/powerpc-ieee1275.rmk | 1 + conf/sparc64-ieee1275.rmk | 1 + conf/x86_64-efi.rmk | 1 + 9 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12e8932e7..1d504a2cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-10-29 Robert Millan + + Revert SVN r2660. + + * conf/common.rmk (script/sh/lexer.c_DEPENDENCIES): Moved from here ... + * conf/i386-coreboot.rmk (script/sh/lexer.c_DEPENDENCIES): ... to here. + * conf/i386-efi.rmk (script/sh/lexer.c_DEPENDENCIES): ... and here. + * conf/i386-ieee1275.rmk: Likewise. + * conf/i386-pc.rmk: Likewise. + * conf/powerpc-ieee1275.rmk: Likewise. + * conf/sparc64-ieee1275.rmk: Likewise. + * conf/x86_64-efi.rmk: Likewise. + 2009-10-28 Robert Millan * Makefile.in (TARGET_CPPFLAGS): Add `-nostdinc'. diff --git a/conf/common.rmk b/conf/common.rmk index ce7c33084..c1f0bbdcf 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -1,7 +1,5 @@ # -*- makefile -*- -script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h - # For grub-mkelfimage. bin_UTILITIES += grub-mkelfimage grub_mkelfimage_SOURCES = util/elf/grub-mkimage.c util/misc.c \ diff --git a/conf/i386-coreboot.rmk b/conf/i386-coreboot.rmk index 3c2061b4e..09ec7787c 100644 --- a/conf/i386-coreboot.rmk +++ b/conf/i386-coreboot.rmk @@ -5,6 +5,7 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 COMMON_LDFLAGS = -m32 -nostdlib # Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. diff --git a/conf/i386-efi.rmk b/conf/i386-efi.rmk index 0440359e5..99ab06f64 100644 --- a/conf/i386-efi.rmk +++ b/conf/i386-efi.rmk @@ -5,6 +5,7 @@ COMMON_CFLAGS = -fno-builtin -m32 COMMON_LDFLAGS = -melf_i386 -nostdlib # Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage diff --git a/conf/i386-ieee1275.rmk b/conf/i386-ieee1275.rmk index c70ecf4dd..4b640de49 100644 --- a/conf/i386-ieee1275.rmk +++ b/conf/i386-ieee1275.rmk @@ -5,6 +5,7 @@ COMMON_CFLAGS = -ffreestanding -mrtd -mregparm=3 COMMON_LDFLAGS = -nostdlib # Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_PROGRAMS = kernel.img diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index 30847dfa7..bf8fbfb9d 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -7,6 +7,7 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32 COMMON_LDFLAGS = -m32 -nostdlib # Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \ diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index 9165e4bc0..ee7f9ec27 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -6,6 +6,7 @@ COMMON_CFLAGS = -ffreestanding COMMON_LDFLAGS += -nostdlib # Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. diff --git a/conf/sparc64-ieee1275.rmk b/conf/sparc64-ieee1275.rmk index 1156fe2a9..62e951a5e 100644 --- a/conf/sparc64-ieee1275.rmk +++ b/conf/sparc64-ieee1275.rmk @@ -6,6 +6,7 @@ COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax # Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Images. pkglib_IMAGES = boot.img diskboot.img kernel.img diff --git a/conf/x86_64-efi.rmk b/conf/x86_64-efi.rmk index 173227575..5be1b404f 100644 --- a/conf/x86_64-efi.rmk +++ b/conf/x86_64-efi.rmk @@ -5,6 +5,7 @@ COMMON_CFLAGS = -fno-builtin -m64 COMMON_LDFLAGS = -melf_x86_64 -nostdlib # Used by various components. These rules need to precede them. +script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h # Utilities. bin_UTILITIES = grub-mkimage From 805111a4fd4183d134e5da13530b57fd0b3677b3 Mon Sep 17 00:00:00 2001 From: robertmh Date: Fri, 30 Oct 2009 22:37:38 +0000 Subject: [PATCH 30/37] 2009-10-30 Robert Millan * util/i386/pc/grub-install.in: Remove hint that device.map should be checked (grub-install doesn't currently rely on it). --- ChangeLog | 5 +++++ util/i386/pc/grub-install.in | 7 ------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1d504a2cc..26de80e89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-30 Robert Millan + + * util/i386/pc/grub-install.in: Remove hint that device.map should be + checked (grub-install doesn't currently rely on it). + 2009-10-29 Robert Millan Revert SVN r2660. diff --git a/util/i386/pc/grub-install.in b/util/i386/pc/grub-install.in index 69028b662..8a06213cb 100644 --- a/util/i386/pc/grub-install.in +++ b/util/i386/pc/grub-install.in @@ -319,14 +319,7 @@ else $grub_mkimage -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1 fi -# Prompt the user to check if the device map is correct. echo "Installation finished. No error reported." -echo "This is the contents of the device map $device_map." -echo "Check if this is correct or not. If any of the lines is incorrect," -echo "fix it and re-run the script \`grub-install'." -echo - -cat $device_map # Bye. exit 0 From d9e2cd701b71fd46a344f1e9b1075c8fe4499658 Mon Sep 17 00:00:00 2001 From: robertmh Date: Fri, 30 Oct 2009 22:51:52 +0000 Subject: [PATCH 31/37] 2009-10-30 Robert Millan Fix build problem. * Makefile.in (TARGET_CPPFLAGS): Replace `-nostdinc' with `-isystem=$(srcdir)/include'. --- ChangeLog | 7 +++++++ Makefile.in | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 26de80e89..25d7b753d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-10-30 Robert Millan + + Fix build problem. + + * Makefile.in (TARGET_CPPFLAGS): Replace `-nostdinc' with + `-isystem=$(srcdir)/include'. + 2009-10-30 Robert Millan * util/i386/pc/grub-install.in: Remove hint that device.map should be diff --git a/Makefile.in b/Makefile.in index 103d2d3d2..2776fff17 100644 --- a/Makefile.in +++ b/Makefile.in @@ -75,7 +75,7 @@ TARGET_ASFLAGS = @TARGET_ASFLAGS@ TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@ TARGET_APPLE_CC = @TARGET_APPLE_CC@ OBJCONV = @OBJCONV@ -TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -nostdinc -I$(builddir) -I$(builddir)/include -I$(srcdir)/include \ +TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(builddir) -I$(builddir)/include \ -Wall -W TARGET_LDFLAGS = @TARGET_LDFLAGS@ TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ From 5b1538672ef1c87b9fb88b43a46fb5c00b210630 Mon Sep 17 00:00:00 2001 From: fzielcke Date: Sun, 1 Nov 2009 18:19:04 +0000 Subject: [PATCH 32/37] 2009-11-01 Felix Zielcke * Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'. --- ChangeLog | 4 ++++ Makefile.in | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 25d7b753d..2e5c7484d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-11-01 Felix Zielcke + + * Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'. + 2009-10-30 Robert Millan Fix build problem. diff --git a/Makefile.in b/Makefile.in index 2776fff17..61b966995 100644 --- a/Makefile.in +++ b/Makefile.in @@ -75,7 +75,7 @@ TARGET_ASFLAGS = @TARGET_ASFLAGS@ TARGET_MODULE_FORMAT = @TARGET_MODULE_FORMAT@ TARGET_APPLE_CC = @TARGET_APPLE_CC@ OBJCONV = @OBJCONV@ -TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(builddir) -I$(builddir)/include \ +TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -isystem=$(srcdir)/include -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \ -Wall -W TARGET_LDFLAGS = @TARGET_LDFLAGS@ TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@ From a50569e135f5be747a5b66f63843c5e5eadf8022 Mon Sep 17 00:00:00 2001 From: robertmh Date: Sun, 1 Nov 2009 23:03:09 +0000 Subject: [PATCH 33/37] 2009-11-01 Robert Millan Based on patch from BVK Chaitanya * kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0' case. --- ChangeLog | 6 ++++++ kern/misc.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e5c7484d..5a3f80e05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-01 Robert Millan + + Based on patch from BVK Chaitanya + * kern/misc.c (grub_strchr, grub_strrchr): Fix to handle c == '\0' + case. + 2009-11-01 Felix Zielcke * Makefile.in (TARGET_CPPFLAGS): Add `-I$(srcdir)/include'. diff --git a/kern/misc.c b/kern/misc.c index 1c38fe661..cacfbc753 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -223,12 +223,12 @@ grub_strncmp (const char *s1, const char *s2, grub_size_t n) char * grub_strchr (const char *s, int c) { - while (*s) + do { if (*s == c) return (char *) s; - s++; } + while (*s++); return 0; } @@ -236,14 +236,14 @@ grub_strchr (const char *s, int c) char * grub_strrchr (const char *s, int c) { - char *p = 0; + char *p = NULL; - while (*s) + do { if (*s == c) p = (char *) s; - s++; } + while (*s++); return p; } From 61697d9c7017da7b84f760b4171144f167be32f4 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 2 Nov 2009 13:55:25 +0000 Subject: [PATCH 34/37] 2009-11-02 Samuel Thibault * util/grub.d/10_hurd.in: Call prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} before loading /boot kernel. --- ChangeLog | 5 +++++ util/grub.d/10_hurd.in | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5a3f80e05..24dbdbf31 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-02 Samuel Thibault + + * util/grub.d/10_hurd.in: Call prepare_grub_to_access_device + ${GRUB_DEVICE_BOOT} before loading /boot kernel. + 2009-11-01 Robert Millan Based on patch from BVK Chaitanya diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index b52f37498..fdfb7acb7 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -71,9 +71,12 @@ fi cat << EOF menuentry "${OS}" { EOF -prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" +prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" cat << EOF multiboot ${kernel} root=device:${GRUB_DEVICE} +EOF +prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" +cat << EOF module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\ --multiboot-command-line='\${kernel-command-line}' \\ --host-priv-port='\${host-port}' \\ From ff1a9bca3a3884a00b4156ffc4ea7f06b053c521 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 2 Nov 2009 19:14:00 +0000 Subject: [PATCH 35/37] 2009-11-02 Samuel Thibault * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from GNU partition number to get internal GRUB partition number. --- ChangeLog | 5 +++++ util/hostdisk.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 24dbdbf31..38b9ffed1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-02 Samuel Thibault + + * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from + GNU partition number to get internal GRUB partition number. + 2009-11-02 Samuel Thibault * util/grub.d/10_hurd.in: Call prepare_grub_to_access_device diff --git a/util/hostdisk.c b/util/hostdisk.c index 22b856e29..e1058a100 100644 --- a/util/hostdisk.c +++ b/util/hostdisk.c @@ -1057,7 +1057,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) n = strtol (p, &q, 10); if (p != q && n != GRUB_LONG_MIN && n != GRUB_LONG_MAX) { - dos_part = (int) n; + dos_part = (int) n - 1; if (*q >= 'a' && *q <= 'g') bsd_part = *q - 'a'; From b82bd5e192aa6776be2214b7d578d662a0a098a7 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 2 Nov 2009 19:32:12 +0000 Subject: [PATCH 36/37] 2009-11-02 Samuel Thibault * util/grub.d/10_hurd.in: Drop /dev/ prefix from root device path before giving it to GNU Mach. --- ChangeLog | 5 +++++ util/grub.d/10_hurd.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 38b9ffed1..e2aacd760 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-02 Samuel Thibault + + * util/grub.d/10_hurd.in: Drop /dev/ prefix from root device path before + giving it to GNU Mach. + 2009-11-02 Samuel Thibault * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index fdfb7acb7..e693c7dfa 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -73,7 +73,7 @@ menuentry "${OS}" { EOF prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" cat << EOF - multiboot ${kernel} root=device:${GRUB_DEVICE} + multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} EOF prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" cat << EOF From 4f9dfb3701f46297395151c1e57b3936f5ae1da7 Mon Sep 17 00:00:00 2001 From: robertmh Date: Mon, 2 Nov 2009 21:01:14 +0000 Subject: [PATCH 37/37] 2009-11-02 Samuel Thibault * util/grub.d/30_os-prober.in: Add GNU/Hurd support --- ChangeLog | 4 ++++ util/grub.d/30_os-prober.in | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e2aacd760..ea2145770 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2009-11-02 Samuel Thibault + + * util/grub.d/30_os-prober.in: Add GNU/Hurd support + 2009-11-02 Samuel Thibault * util/grub.d/10_hurd.in: Drop /dev/ prefix from root device path before diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 6fd97fc4e..e14a07316 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -159,7 +159,28 @@ EOF EOF ;; hurd|*) - echo " ${LONGNAME} is not yet supported by grub-mkconfig." >&2 + cat << EOF +menuentry "${LONGNAME} (on ${DEVICE})" { +EOF + prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" + grub_device="`${grub_probe} --device ${DEVICE} --target=drive`" + mach_device="`echo "${grub_device}" | tr -d '()' | tr , s`" + grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`" + case "${grub_fs}" in + *fs) hurd_fs="${grub_fs}" ;; + *) hurd_fs="${grub_fs}fs" ;; + esac + cat << EOF + multiboot /boot/gnumach.gz root=device:${mach_device} + module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\ + --multiboot-command-line='\${kernel-command-line}' \\ + --host-priv-port='\${host-port}' \\ + --device-master-port='\${device-port}' \\ + --exec-server-task='\${exec-task}' -T typed '\${root}' \\ + '\$(task-create)' '\$(task-resume)' + module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)' +} +EOF ;; esac done