From 1c1261d985a938e7f525287fd8b50e78bbebeaaf Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 6 Feb 2010 14:29:42 +0530 Subject: [PATCH 01/14] fixed grub-install.in --- util/grub-install.in | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/util/grub-install.in b/util/grub-install.in index bb323d706..5016a2a17 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -105,7 +105,11 @@ EOF } # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -113,33 +117,62 @@ for option in "$@"; do -v | --version) echo "grub-install (GNU GRUB ${PACKAGE_VERSION})" exit 0 ;; + + --modules) + modules=$1; shift;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --font) + font=$1; shift;; --font=*) font=`echo "$option" | sed 's/--font=//'` ;; + + --root-directory) + rootdir=$1; shift;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + + --grub-setup) + grub_setup=$1; shift;; --grub-setup=*) grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;; + + --grub-mkimage) + grub_mkimage=$1; shift;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + + --grub-mkdevicemap) + grub_mkdevicemap=$1; shift;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; + + --grub-probe) + grub_probe=$1; shift;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; + --no-floppy) no_floppy="--no-floppy" ;; --recheck) recheck=yes ;; + + --disk-module) + if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then + disk_module=$1; shift; + fi ;; --disk-module=*) if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then disk_module=`echo "$option" | sed 's/--disk-module=//'` fi ;; + # This is an undocumented feature... --debug) debug=yes ;; -f | --force) setup_force="--force" ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage From 7a64e28d0e1726f539041bc7562ff9498554f333 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sun, 7 Feb 2010 10:14:50 +0530 Subject: [PATCH 02/14] fixed mkconfig and mkrescue scripts --- util/grub-mkconfig.in | 10 +++++++--- util/grub-mkrescue.in | 21 +++++++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 49e52b313..34e46605c 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -50,7 +50,11 @@ EOF } # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -58,9 +62,9 @@ for option in "$@"; do -v | --version) echo "$0 (GNU GRUB ${package_version})" exit 0 ;; - -o) - shift + -o | --output) grub_cfg=$1 + shift ;; --output=*) grub_cfg=`echo "$option" | sed 's/--output=//'` diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 6b3c9ecb8..b9ef3219b 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -42,8 +42,8 @@ Make GRUB rescue image. -h, --help print this message and exit -v, --version print the version information and exit + -o, --output=FILE save output in FILE [required] --modules=MODULES pre-load specified modules MODULES - --output=FILE save output in FILE [required] $0 generates a bootable rescue image with specified source files or directories. @@ -52,7 +52,11 @@ EOF } # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -60,11 +64,24 @@ for option in "$@"; do -v | --version) echo "$0 (GNU GRUB ${PACKAGE_VERSION})" exit 0 ;; + + --modules) + modules=$1; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + -o | --output) + output_image=$1; shift ;; --output=*) output_image=`echo "$option" | sed 's/--output=//'` ;; + # Intentionally undocumented + --override-directory) + override_dir=$1 + shift + PATH=${override_dir}:$PATH + export PATH + ;; --override-directory=*) override_dir=`echo "${option}/" | sed 's/--override-directory=//'` PATH=${override_dir}:$PATH From 09f38ecd5a8dcd5e7cde3640e3355aaac766a5de Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sun, 7 Feb 2010 10:31:04 +0530 Subject: [PATCH 03/14] fix remaining scripts --- util/grub-reboot.in | 10 +++++++++- util/grub-set-default.in | 10 +++++++++- util/i386/efi/grub-install.in | 22 +++++++++++++++++++++- util/ieee1275/grub-install.in | 22 +++++++++++++++++++++- util/powerpc/ieee1275/grub-mkrescue.in | 16 +++++++++++++++- 5 files changed, 75 insertions(+), 5 deletions(-) diff --git a/util/grub-reboot.in b/util/grub-reboot.in index 20f2b10bc..eb7073e02 100644 --- a/util/grub-reboot.in +++ b/util/grub-reboot.in @@ -45,7 +45,11 @@ EOF } # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -53,8 +57,12 @@ for option in "$@"; do -v | --version) echo "grub-reboot (GNU GRUB ${PACKAGE_VERSION})" exit 0 ;; + + --root-directory) + rootdir=$1; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage diff --git a/util/grub-set-default.in b/util/grub-set-default.in index 4d7c10e8e..2636543c3 100644 --- a/util/grub-set-default.in +++ b/util/grub-set-default.in @@ -45,7 +45,11 @@ EOF } # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -53,8 +57,12 @@ for option in "$@"; do -v | --version) echo "grub-set-default (GNU GRUB ${PACKAGE_VERSION})" exit 0 ;; + + --root-directory) + rootdir=$1; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage diff --git a/util/i386/efi/grub-install.in b/util/i386/efi/grub-install.in index caa7be7e4..b93525e3e 100644 --- a/util/i386/efi/grub-install.in +++ b/util/i386/efi/grub-install.in @@ -71,7 +71,11 @@ EOF } # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -79,16 +83,32 @@ for option in "$@"; do -v | --version) echo "grub-install (GNU GRUB ${PACKAGE_VERSION})" exit 0 ;; + + --modules) + modules=$1; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --root-directory) + rootdir=$1; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + + --grub-mkimage) + grub_mkimage=$1; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + + --grub-mkdevicemap) + grub_mkdevicemap=$1; shift ;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; + + --grub-probe) + grub_probe=$1; shift ;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; + --no-floppy) no_floppy="--no-floppy" ;; --recheck) diff --git a/util/ieee1275/grub-install.in b/util/ieee1275/grub-install.in index 97c485d55..63dde62b3 100644 --- a/util/ieee1275/grub-install.in +++ b/util/ieee1275/grub-install.in @@ -75,7 +75,11 @@ EOF } # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -83,16 +87,32 @@ for option in "$@"; do -v | --version) echo "grub-install (GNU GRUB ${PACKAGE_VERSION})" exit 0 ;; + + --modules) + modules=$1; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --root-directory) + rootdir=$1; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; + + --grub-mkdevicemap) + grub_mkdevicemap=$1; shift ;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; + + --grub-mkimage) + grub_mkimage=$1; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + + --grub-probe) + grub_probe=$1; shift ;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; + --no-nvram) update_nvram=no ;; # This is an undocumented feature... diff --git a/util/powerpc/ieee1275/grub-mkrescue.in b/util/powerpc/ieee1275/grub-mkrescue.in index 0110e799c..375adb0cb 100644 --- a/util/powerpc/ieee1275/grub-mkrescue.in +++ b/util/powerpc/ieee1275/grub-mkrescue.in @@ -55,7 +55,11 @@ EOF input_dir=${pkglibdir} # Check the arguments. -for option in "$@"; do +while test $# -gt 0 +do + option=$1 + shift + case "$option" in -h | --help) usage @@ -63,12 +67,22 @@ for option in "$@"; do -v | --version) echo "grub-mkrescue (GNU GRUB ${PACKAGE_VERSION})" exit 0 ;; + + --modules) + modules=$1; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; + + --pkglibdir) + input_dir=$1; shift ;; --pkglibdir=*) input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;; + + --grub-mkimage) + grub_mkimage=$1; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; + -*) echo "Unrecognized option \`$option'" 1>&2 usage From b02c7c8fb57a92cd04a84d32bb67c6142980f144 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 12 Apr 2010 21:33:03 +0530 Subject: [PATCH 04/14] added getopt like error for missing option parameters --- util/grub-install.in | 27 ++++++++++++++++++-------- util/grub-mkconfig.in | 19 +++++++++++++++--- util/grub-mkrescue.in | 19 ++++++++++++++---- util/grub-reboot.in | 13 ++++++++++++- util/grub-set-default.in | 13 ++++++++++++- util/i386/efi/grub-install.in | 21 +++++++++++++++----- util/ieee1275/grub-install.in | 21 +++++++++++++++----- util/powerpc/ieee1275/grub-mkrescue.in | 17 +++++++++++++--- 8 files changed, 120 insertions(+), 30 deletions(-) diff --git a/util/grub-install.in b/util/grub-install.in index 7b9c04913..e5ed9dcd5 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -105,6 +105,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. while test $# -gt 0 do @@ -120,37 +131,37 @@ do exit 0 ;; --modules) - modules=$1; shift;; + modules=`argument $option "$@"`; shift;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; --font) - font=$1; shift;; + font=`argument $option "$@"`; shift;; --font=*) font=`echo "$option" | sed 's/--font=//'` ;; --root-directory) - rootdir=$1; shift;; + rootdir=`argument $option "$@"`; shift;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; --grub-setup) - grub_setup=$1; shift;; + grub_setup=`argument $option "$@"`; shift;; --grub-setup=*) grub_setup=`echo "$option" | sed 's/--grub-setup=//'` ;; --grub-mkimage) - grub_mkimage=$1; shift;; + grub_mkimage=`argument $option "$@"`; shift;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; --grub-mkdevicemap) - grub_mkdevicemap=$1; shift;; + grub_mkdevicemap=`argument $option "$@"`; shift;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; --grub-probe) - grub_probe=$1; shift;; + grub_probe=`argument $option "$@"`; shift;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; @@ -161,7 +172,7 @@ do --disk-module) if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then - disk_module=$1; shift; + disk_module=`argument $option "$@"`; shift; fi ;; --disk-module=*) if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 82964836b..c3aa57723 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -49,6 +49,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. while test $# -gt 0 do @@ -63,9 +74,7 @@ do echo "$0 (GNU GRUB ${package_version})" exit 0 ;; -o | --output) - grub_cfg=$1 - shift - ;; + grub_cfg=`argument $option "$@"`; shift;; --output=*) grub_cfg=`echo "$option" | sed 's/--output=//'` ;; @@ -74,6 +83,10 @@ do usage exit 1 ;; + *) + echo "Invalid parameter, $option" 1>&2 + exit 1 + ;; esac done diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 64ccd6ae8..ffb987718 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -51,6 +51,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. while test $# -gt 0 do @@ -66,18 +77,18 @@ do exit 0 ;; --modules) - modules=$1; shift ;; + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; -o | --output) - output_image=$1; shift ;; + output_image=`argument $option "$@"`; shift ;; --output=*) output_image=`echo "$option" | sed 's/--output=//'` ;; # Intentionally undocumented --override-directory) - override_dir=$1 + override_dir=`argument $option "$@"` shift PATH=${override_dir}:$PATH export PATH @@ -93,7 +104,7 @@ do exit 1 ;; *) - source="${source} ${option}" ;; + source="${source} ${option} $@"; break ;; esac done diff --git a/util/grub-reboot.in b/util/grub-reboot.in index eb7073e02..48e3ae243 100644 --- a/util/grub-reboot.in +++ b/util/grub-reboot.in @@ -44,6 +44,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. while test $# -gt 0 do @@ -59,7 +70,7 @@ do exit 0 ;; --root-directory) - rootdir=$1; shift ;; + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; diff --git a/util/grub-set-default.in b/util/grub-set-default.in index 2636543c3..a4739f95f 100644 --- a/util/grub-set-default.in +++ b/util/grub-set-default.in @@ -44,6 +44,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. while test $# -gt 0 do @@ -59,7 +70,7 @@ do exit 0 ;; --root-directory) - rootdir=$1; shift ;; + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; diff --git a/util/i386/efi/grub-install.in b/util/i386/efi/grub-install.in index 097519d50..54c190678 100644 --- a/util/i386/efi/grub-install.in +++ b/util/i386/efi/grub-install.in @@ -71,6 +71,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. while test $# -gt 0 do @@ -86,27 +97,27 @@ do exit 0 ;; --modules) - modules=$1; shift ;; + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; --root-directory) - rootdir=$1; shift ;; + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; --grub-mkimage) - grub_mkimage=$1; shift ;; + grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; --grub-mkdevicemap) - grub_mkdevicemap=$1; shift ;; + grub_mkdevicemap=`argument $option "$@"`; shift ;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; --grub-probe) - grub_probe=$1; shift ;; + grub_probe=`argument $option "$@"`; shift ;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; diff --git a/util/ieee1275/grub-install.in b/util/ieee1275/grub-install.in index 4a5403c18..dde275c2a 100644 --- a/util/ieee1275/grub-install.in +++ b/util/ieee1275/grub-install.in @@ -74,6 +74,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + # Check the arguments. while test $# -gt 0 do @@ -89,27 +100,27 @@ do exit 0 ;; --modules) - modules=$1; shift ;; + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; --root-directory) - rootdir=$1; shift ;; + rootdir=`argument $option "$@"`; shift ;; --root-directory=*) rootdir=`echo "$option" | sed 's/--root-directory=//'` ;; --grub-mkdevicemap) - grub_mkdevicemap=$1; shift ;; + grub_mkdevicemap=`argument $option "$@"`; shift ;; --grub-mkdevicemap=*) grub_mkdevicemap=`echo "$option" | sed 's/--grub-mkdevicemap=//'` ;; --grub-mkimage) - grub_mkimage=$1; shift ;; + grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; --grub-probe) - grub_probe=$1; shift ;; + grub_probe=`argument $option "$@"`; shift ;; --grub-probe=*) grub_probe=`echo "$option" | sed 's/--grub-probe=//'` ;; diff --git a/util/powerpc/ieee1275/grub-mkrescue.in b/util/powerpc/ieee1275/grub-mkrescue.in index 375adb0cb..1adc149ae 100644 --- a/util/powerpc/ieee1275/grub-mkrescue.in +++ b/util/powerpc/ieee1275/grub-mkrescue.in @@ -52,6 +52,17 @@ Report bugs to . EOF } +argument () { + opt=$1 + shift + + if test $# -eq 0; then + echo "$0: option requires an argument -- '$opt'" 1>&2 + exit 1 + fi + echo $1 +} + input_dir=${pkglibdir} # Check the arguments. @@ -69,17 +80,17 @@ do exit 0 ;; --modules) - modules=$1; shift ;; + modules=`argument $option "$@"`; shift ;; --modules=*) modules=`echo "$option" | sed 's/--modules=//'` ;; --pkglibdir) - input_dir=$1; shift ;; + input_dir=`argument $option "$@"`; shift ;; --pkglibdir=*) input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;; --grub-mkimage) - grub_mkimage=$1; shift ;; + grub_mkimage=`argument $option "$@"`; shift ;; --grub-mkimage=*) grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; From ce08a9fb28c3f66accaf8ddc8c48e5052b484582 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 12 Jun 2010 16:03:34 +0200 Subject: [PATCH 05/14] * util/grub-mkrescue.in: Pass unrecognized options to xorriso. --- ChangeLog | 4 ++++ util/grub-mkrescue.in | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index aababc845..34823d8b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-06-12 Thomas Schmitt + + * util/grub-mkrescue.in: Pass unrecognized options to xorriso. + 2010-06-12 Colin Watson Avoid false positives in fs.lst, partmap.lst, and video.lst due to diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 90c031882..f8445a1e3 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -59,9 +59,12 @@ Make GRUB rescue image. --xorriso=FILE use FILE as xorriso [optional] --grub-mkimage=FILE use FILE as grub-mkimage -$self generates a bootable rescue image with specified source files or directories. +$self generates a bootable rescue image with specified source files, source +directories, or mkisofs options listed by: xorriso -as mkisofs -help +Option -- switches to native xorriso command mode. or directories. Report bugs to . +Mail xorriso support requests to . EOF } @@ -90,11 +93,6 @@ for option in "$@"; do grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; --xorriso=*) xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;; - -*) - echo "Unrecognized option \`$option'" 1>&2 - usage - exit 1 - ;; *) source="${source} ${option}" ;; esac From c16be99ba318a111592c63e6419215a4d16965df Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sat, 12 Jun 2010 15:09:38 +0100 Subject: [PATCH 06/14] * .bzrignore: Ignore 41_custom. --- .bzrignore | 1 + ChangeLog | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.bzrignore b/.bzrignore index aa9c4ff84..c124c9280 100644 --- a/.bzrignore +++ b/.bzrignore @@ -2,6 +2,7 @@ 10_* 30_os-prober 40_custom +41_custom aclocal.m4 ascii.bitmaps ascii.h diff --git a/ChangeLog b/ChangeLog index 34823d8b8..7a564fb14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-06-12 Colin Watson + + * .bzrignore: Ignore 41_custom. + 2010-06-12 Thomas Schmitt * util/grub-mkrescue.in: Pass unrecognized options to xorriso. From fcb2d0901143232e084878bbf97fb941a2f20052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= Date: Sun, 13 Jun 2010 02:36:39 +0200 Subject: [PATCH 07/14] New partition naming style in grub-probe for Linux and NetBSD. --- ChangeLog | 6 ++++++ kern/emu/hostdisk.c | 30 +++++++++++++----------------- util/grub-install.in | 4 ++-- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15856dc57..766a5053f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-06-13 Grégoire Sutre + + * kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Use the + new partition naming style. + * util/grub-install.in: Adapt sed subtitutions in grub-probe calls. + 2010-06-12 BVK Chaitanya Add "-o grub.iso" like cmdline options support. diff --git a/kern/emu/hostdisk.c b/kern/emu/hostdisk.c index 47389195c..bc37e9949 100644 --- a/kern/emu/hostdisk.c +++ b/kern/emu/hostdisk.c @@ -992,6 +992,11 @@ grub_util_biosdisk_fini (void) grub_disk_dev_unregister (&grub_util_biosdisk_dev); } +/* + * Note: we do not use the new partition naming scheme as dos_part does not + * necessarily correspond to an msdos partition. See e.g. the FreeBSD code + * in function grub_util_biosdisk_get_grub_dev. + */ static char * make_device_name (int drive, int dos_part, int bsd_part) { @@ -1400,11 +1405,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) For NetBSD, proceed as for Linux, except that the start sector is obtained from the disk label. */ { - char *name; + char *name, *partname; grub_disk_t disk; grub_disk_addr_t start; - int dos_part = -1; - int bsd_part = -1; auto int find_partition (grub_disk_t dsk, const grub_partition_t partition); @@ -1419,17 +1422,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) if (start == part_start) { - if (partition->parent) - { - dos_part = partition->parent->number; - bsd_part = partition->number; - } - else - { - dos_part = partition->number; - bsd_part = -1; - } - + partname = grub_partition_get_name (partition); return 1; } @@ -1465,6 +1458,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) if (! disk) return 0; + partname = NULL; grub_partition_iterate (disk, find_partition); if (grub_errno != GRUB_ERR_NONE) { @@ -1472,7 +1466,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) return 0; } - if (dos_part < 0) + if (partname == NULL) { grub_disk_close (disk); grub_error (GRUB_ERR_BAD_DEVICE, @@ -1480,7 +1474,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) return 0; } - return make_device_name (drive, dos_part, bsd_part); + name = grub_xasprintf ("%s,%s", disk->name, partname); + free (partname); + return name; } #elif defined(__GNU__) @@ -1525,7 +1521,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev) for (p = os_dev + 5; *p; ++p) if (grub_isdigit(*p)) { - p = strchr (p, 's'); + p = strchr (p, 's'); /* msdos or apple (or ... ?) partition map */ if (p) { p++; diff --git a/util/grub-install.in b/util/grub-install.in index e580ac819..c7e087dd0 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -356,12 +356,12 @@ if [ "x${devabstraction_module}" = "x" ] ; then else install_drive="`$grub_probe --target=drive --device ${install_device}`" || exit 1 fi - install_drive="`echo ${install_drive} | sed -e s/,[0-9]*[a-z]*//g`" + install_drive="`echo ${install_drive} | sed -e s/,[a-z0-9,]*//g`" fi grub_drive="`$grub_probe --target=drive --device ${grub_device}`" || exit 1 # Strip partition number - grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*[a-z]*//g`" + grub_drive="`echo ${grub_drive} | sed -e s/,[a-z0-9,]*//g`" if [ "$disk_module" = ata ] ; then # generic method (used on coreboot and ata mod) uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`" From b5309cc1b2c6c7a45911134f341c81534819fec4 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 13 Jun 2010 13:17:23 +0100 Subject: [PATCH 08/14] * docs/grub.texi (Commands): Document reduced command set in rescue mode. (cpuid): New section. --- ChangeLog | 6 ++++++ docs/grub.texi | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 766a5053f..9ca80ac6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-06-13 Colin Watson + + * docs/grub.texi (Commands): Document reduced command set in rescue + mode. + (cpuid): New section. + 2010-06-13 Grégoire Sutre * kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Use the diff --git a/docs/grub.texi b/docs/grub.texi index 9fe197da2..714145807 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -1378,6 +1378,10 @@ the global section of the configuration file (or ``menu''); most of them can be entered on the command-line and can be used either anywhere in the menu or specifically in the menu entries. +In rescue mode, only the @command{insmod} (@pxref{insmod}), @command{ls} +(@pxref{ls}), @command{set} (@pxref{set}), and @command{unset} +(@pxref{unset}) commands are normally available. + @menu * Menu-specific commands:: * General commands:: @@ -1538,6 +1542,7 @@ you forget a command, you can run the command @command{help} * chainloader:: Chain-load another boot loader * cmp:: Compare two files * configfile:: Load a configuration file +* cpuid:: Check for CPU features * crc:: Calculate CRC32 checksums * date:: Display or set current date and time * drivemap:: Map a drive to another @@ -1659,6 +1664,20 @@ Load @var{file} as a configuration file. @end deffn +@node cpuid +@subsection cpuid + +@deffn Command cpuid [-l] +Check for CPU features. This command is only available on x86 systems. + +With the @option{-l} option, return true if the CPU supports long mode +(64-bit). + +If invoked without options, this command currently behaves as if it had been +invoked with @option{-l}. This may change in the future. +@end deffn + + @node crc @subsection crc From 41160e2e6f529ef96cfbfb0f1961753439d285f2 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 14 Jun 2010 15:08:02 +0100 Subject: [PATCH 09/14] * docs/man/grub-emu.h2m: New file. --- ChangeLog | 4 ++++ docs/man/grub-emu.h2m | 2 ++ 2 files changed, 6 insertions(+) create mode 100644 docs/man/grub-emu.h2m diff --git a/ChangeLog b/ChangeLog index 9ca80ac6f..6d8133fbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-06-14 Colin Watson + + * docs/man/grub-emu.h2m: New file. + 2010-06-13 Colin Watson * docs/grub.texi (Commands): Document reduced command set in rescue diff --git a/docs/man/grub-emu.h2m b/docs/man/grub-emu.h2m new file mode 100644 index 000000000..09a1f88c1 --- /dev/null +++ b/docs/man/grub-emu.h2m @@ -0,0 +1,2 @@ +[NAME] +grub-emu \- GRUB emulator From 8d70754eed95ce1bdf10a21dc10f6400153f0835 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 14 Jun 2010 15:34:47 +0100 Subject: [PATCH 10/14] * util/grub-mkconfig.in: Remove vestige of old argument parsing that left this script non-functional. --- ChangeLog | 5 +++++ util/grub-mkconfig.in | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d8133fbf..6833765ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-06-14 Colin Watson + + * util/grub-mkconfig.in: Remove vestige of old argument parsing that + left this script non-functional. + 2010-06-14 Colin Watson * docs/man/grub-emu.h2m: New file. diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index 0c17d07f6..c9a6df417 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -92,11 +92,6 @@ do ;; esac done -if $next_grub_cfg; then - echo "Missing argument to \`-o'" 1>&2 - usage - exit 1 -fi . ${libdir}/grub/grub-mkconfig_lib From 662e24d5f39d50a163a27133e6d3ee360eb0c94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= Date: Mon, 14 Jun 2010 20:27:25 +0200 Subject: [PATCH 11/14] Remove leftover commands/handler.c in POTFILES. --- ChangeLog | 4 ++++ po/POTFILES | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6833765ac..5dff53209 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-06-14 Grégoire Sutre + + * po/POTFILES: Remove leftover commands/handler.c. + 2010-06-14 Colin Watson * util/grub-mkconfig.in: Remove vestige of old argument parsing that diff --git a/po/POTFILES b/po/POTFILES index d2c579edb..cfa1e33cb 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -12,7 +12,6 @@ commands/efi/fixvideo.c commands/efi/loadbios.c commands/gptsync.c commands/halt.c -commands/handler.c commands/hdparm.c commands/help.c commands/hexdump.c From 5591324fc6707df39d8dd87f9e654ca016bcd784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Sutre?= Date: Mon, 14 Jun 2010 21:26:48 +0200 Subject: [PATCH 12/14] Fix help2man failure with program name transformation. --- ChangeLog | 5 +++++ Makefile.in | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5dff53209..977c33306 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-06-14 Grégoire Sutre + + * Makefile.in (install-local): Use $$file.h2m instead of $$dest.h2m + for manual page generation. + 2010-06-14 Grégoire Sutre * po/POTFILES: Remove leftover commands/handler.c. diff --git a/Makefile.in b/Makefile.in index afe4beb6e..b9b7f3d08 100644 --- a/Makefile.in +++ b/Makefile.in @@ -323,26 +323,26 @@ install-local: all if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ - $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ + $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ done $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 @list='$(sbin_UTILITIES)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ - $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ + $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ done @list='$(bin_SCRIPTS)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \ - $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ + $(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \ done @list='$(sbin_SCRIPTS)'; for file in $$list; do \ if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \ dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \ $(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \ - $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ + $(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \ done $(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d @list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \ From 044e2e60bed2f7f6e0495cb0b51137376179a788 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 16 Jun 2010 12:51:26 +0100 Subject: [PATCH 13/14] * util/grub-mkconfig.in: Ignore non-option arguments, for compatibility with older versions (before 2010-06-12) which did the same. In particular, this makes it easier to ship an update-grub wrapper which is compatible with that used with GRUB Legacy (Debian bug #586056). --- ChangeLog | 8 ++++++++ util/grub-mkconfig.in | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 977c33306..88e1e43d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-16 Colin Watson + + * util/grub-mkconfig.in: Ignore non-option arguments, for + compatibility with older versions (before 2010-06-12) which did the + same. In particular, this makes it easier to ship an update-grub + wrapper which is compatible with that used with GRUB Legacy (Debian + bug #586056). + 2010-06-14 Grégoire Sutre * Makefile.in (install-local): Use $$file.h2m instead of $$dest.h2m diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index c9a6df417..726423590 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -86,10 +86,7 @@ do usage exit 1 ;; - *) - echo "Invalid parameter, $option" 1>&2 - exit 1 - ;; + # Explicitly ignore non-option arguments, for compatibility. esac done From 2164da6b25efcc410b9624c8b95aaabd7340b82e Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 17 Jun 2010 12:15:37 +0100 Subject: [PATCH 14/14] Fix i386-pc prefix handling with nested partitions (Debian bug #585068). Note that the case where the core image is booted using multiboot and relocated from its original location still requires more work. * kern/i386/pc/init.c (make_install_device): If the prefix starts with "(,", fill the boot drive in between those two characters, but expect that a full partition specification including partition map names will follow. * util/i386/pc/grub-setup.c (setup): Unless an explicit prefix was specified, write a prefix without the drive name but including a full partition specification. --- ChangeLog | 15 +++++++++++++++ kern/i386/pc/init.c | 8 ++++++++ util/i386/pc/grub-setup.c | 15 +++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index 88e1e43d6..e2f240f40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-06-17 Colin Watson + + Fix i386-pc prefix handling with nested partitions (Debian bug + #585068). Note that the case where the core image is booted using + multiboot and relocated from its original location still requires + more work. + + * kern/i386/pc/init.c (make_install_device): If the prefix starts + with "(,", fill the boot drive in between those two characters, but + expect that a full partition specification including partition map + names will follow. + * util/i386/pc/grub-setup.c (setup): Unless an explicit prefix was + specified, write a prefix without the drive name but including a + full partition specification. + 2010-06-16 Colin Watson * util/grub-mkconfig.in: Ignore non-option arguments, for diff --git a/kern/i386/pc/init.c b/kern/i386/pc/init.c index d81b1e117..8cbc757b2 100644 --- a/kern/i386/pc/init.c +++ b/kern/i386/pc/init.c @@ -83,6 +83,14 @@ make_install_device (void) grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ")%s", grub_prefix); grub_strcpy (grub_prefix, dev); } + else if (grub_prefix[1] == ',' || grub_prefix[1] == ')') + { + /* We have a prefix, but still need to fill in the boot drive. */ + grub_snprintf (dev, sizeof (dev), + "(%cd%u%s", (grub_boot_drive & 0x80) ? 'h' : 'f', + grub_boot_drive & 0x7f, grub_prefix + 1); + grub_strcpy (grub_prefix, dev); + } return grub_prefix; } diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index f0baf1c89..454fba9fa 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -99,6 +99,7 @@ setup (const char *dir, struct grub_boot_blocklist *first_block, *block; grub_int32_t *install_dos_part, *install_bsd_part; grub_int32_t dos_part, bsd_part; + char *prefix; char *tmp_img; int i; grub_disk_addr_t first_sector; @@ -230,6 +231,8 @@ setup (const char *dir, + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART); install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART); + prefix = (char *) (core_img + GRUB_DISK_SECTOR_SIZE + + GRUB_KERNEL_MACHINE_PREFIX); /* Open the root device and the destination device. */ root_dev = grub_device_open (root); @@ -305,6 +308,18 @@ setup (const char *dir, dos_part = root_dev->disk->partition->number; bsd_part = -1; } + + if (prefix[0] != '(') + { + char *root_part_name, *new_prefix; + + root_part_name = + grub_partition_get_name (root_dev->disk->partition); + new_prefix = xasprintf ("(,%s)%s", root_part_name, prefix); + strcpy (prefix, new_prefix); + free (new_prefix); + free (root_part_name); + } } else dos_part = bsd_part = -1;