From a797824f1236786ab3104f92a05baea579beef9a Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Fri, 20 Nov 2009 21:08:29 +0100 Subject: [PATCH 1/9] 2009-11-20 Felix Zielcke * configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz' to the list of unifont files to look for. --- ChangeLog | 5 +++++ configure.ac | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2aaa65eaa..acd740fd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-20 Felix Zielcke + + * configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz' + to the list of unifont files to look for. + 2009-11-19 Robert Millan Patch from Joe Auricchio diff --git a/configure.ac b/configure.ac index 587f2118d..2ffb548c0 100644 --- a/configure.ac +++ b/configure.ac @@ -136,9 +136,9 @@ if test "x$YACC" = x; then AC_MSG_ERROR([bison is not found]) fi -for file in /usr/src/unifont.bdf ; do +for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do if test -e $file ; then - AC_SUBST([UNIFONT_BDF], [$file]) + AC_SUBST([UNIFONT_INPUTFILE], [$file]) break fi done From 68b44b1d2d455a238e4e1bf4085fd6cab15354b0 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Fri, 20 Nov 2009 21:13:50 +0100 Subject: [PATCH 2/9] Revert accidently renaming of UNIFONT_BDF in configure.ac --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2ffb548c0..a5f1d60a5 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ fi for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do if test -e $file ; then - AC_SUBST([UNIFONT_INPUTFILE], [$file]) + AC_SUBST([UNIFONT_BDF], [$file]) break fi done From 6c09890c87a9dd3426e3be1bf7f93e7dd48bc008 Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Fri, 20 Nov 2009 22:39:07 +0100 Subject: [PATCH 3/9] 2009-11-20 Felix Zielcke * configure.ac (UNIFONT_BDF): Rename to ... (FONT_SOURCE): ... this. Update all users. --- ChangeLog | 5 +++++ Makefile.in | 12 ++++++------ configure.ac | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index acd740fd1..61bcfc1fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-20 Felix Zielcke + + * configure.ac (UNIFONT_BDF): Rename to ... + (FONT_SOURCE): ... this. Update all users. + 2009-11-20 Felix Zielcke * configure.ac: Add `/usr/share/fonts/X11/misc/unifont.pcf.gz' diff --git a/Makefile.in b/Makefile.in index 7706cd26b..43528c534 100644 --- a/Makefile.in +++ b/Makefile.in @@ -108,7 +108,7 @@ AWK = @AWK@ LIBCURSES = @LIBCURSES@ LIBUSB = @LIBUSB@ YACC = @YACC@ -UNIFONT_BDF = @UNIFONT_BDF@ +FONT_SOURCE = @FONT_SOURCE@ # Options. enable_grub_emu = @enable_grub_emu@ @@ -207,7 +207,7 @@ docs/grub.info: docs/grub.texi docs/version.texi docs/fdl.texi $(MKDIR_P) docs -$(MAKEINFO) -P $(builddir)/docs --no-split --force $< -o $@ -ifeq (, $(UNIFONT_BDF)) +ifeq (, $(FONT_SOURCE)) else ifeq ($(enable_grub_mkfont),yes) @@ -218,11 +218,11 @@ pkgdata_DATA += unicode.pf2 ascii.pf2 UNICODE_ARROWS=0x2190-0x2193 UNICODE_LINES=0x2501-0x251B -unicode.pf2: $(UNIFONT_BDF) grub-mkfont - $(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF) +unicode.pf2: $(FONT_SOURCE) grub-mkfont + $(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -ascii.pf2: $(UNIFONT_BDF) grub-mkfont - $(builddir)/grub-mkfont -o $@ $(UNIFONT_BDF) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) +ascii.pf2: $(FONT_SOURCE) grub-mkfont + $(builddir)/grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) endif endif diff --git a/configure.ac b/configure.ac index a5f1d60a5..383cb67a3 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,7 @@ fi for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do if test -e $file ; then - AC_SUBST([UNIFONT_BDF], [$file]) + AC_SUBST([FONT_SOURCE], [$file]) break fi done From efda854e68b1736b623bfd27dd6297bf6a1f8c64 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 21 Nov 2009 13:11:38 +0000 Subject: [PATCH 4/9] 2009-11-21 Carles Pina i Estany 2009-11-21 Robert Millan * util/grub-mkrescue.in: Recognize `--override-directory' option. (process_input_dir): New function. Process an arbitrary input directory. Misc adjustments to support both "override mode" and system-wide mode. --- ChangeLog | 8 ++++++ util/grub-mkrescue.in | 61 ++++++++++++++++++++++++++++++------------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 61bcfc1fc..34518b011 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-11-21 Carles Pina i Estany +2009-11-21 Robert Millan + + * util/grub-mkrescue.in: Recognize `--override-directory' option. + (process_input_dir): New function. Process an arbitrary input + directory. + Misc adjustments to support both "override mode" and system-wide mode. + 2009-11-20 Felix Zielcke * configure.ac (UNIFONT_BDF): Rename to ... diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 5db287a38..23ac4e1e8 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -27,10 +27,10 @@ PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_TARNAME=@PACKAGE_TARNAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ target_cpu=@target_cpu@ +native_platform=@platform@ coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc -grub_mkisofs="grub-mkisofs" # Usage: usage # Print the usage. @@ -63,6 +63,12 @@ for option in "$@"; do modules=`echo "$option" | sed 's/--modules=//'` ;; --output=*) output_image=`echo "$option" | sed 's/--output=//'` ;; + # Intentionally undocumented + --override-directory=*) + override_dir=`echo "${option}/" | sed 's/--override-directory=//'` + PATH=${override_dir}:$PATH + export PATH + ;; -*) echo "Unrecognized option \`$option'" 1>&2 usage @@ -76,22 +82,40 @@ done iso9660_dir=`mktemp -d` mkdir -p ${iso9660_dir}/boot/grub -for platform in pc coreboot ; do - input_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-${platform} - if test -e ${input_dir} ; then - mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform} - for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \ - ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \ - ${input_dir}/handler.lst ${input_dir}/parttool.lst; do - if test -f "$file"; then - cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/ - fi - done +process_input_dir () +{ + input_dir="$1" + platform="$2" + mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform} + for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \ + ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \ + ${input_dir}/handler.lst ${input_dir}/parttool.lst; do + if test -f "$file"; then + cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/ + fi + done +} + +if [ "${override_dir}" = "" ] ; then + if test -e "${coreboot_dir}" ; then + process_input_dir ${coreboot_dir} coreboot fi -done + if test -e "${pc_dir}" ; then + process_input_dir ${pc_dir} pc + fi +else + process_input_dir ${override_dir} ${native_platform} + coreboot_dir= + pc_dir= + case "${native_platform}" in + coreboot) coreboot_dir=${override_dir} ;; + pc) pc_dir=${override_dir} ;; + esac +fi # build coreboot core.img -if test -e ${coreboot_dir} ; then +if test -e "${coreboot_dir}" ; then + echo "Generates coreboot" memdisk_img=`mktemp` memdisk_dir=`mktemp -d` mkdir -p ${memdisk_dir}/boot/grub @@ -115,7 +139,7 @@ EOF memdisk tar search iso9660 configfile sh \ ata at_keyboard rm -f ${memdisk_img} - grub_mkisofs="${grub_mkisofs} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)" + grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)" fi if [ "${source}" != "" ] ; then @@ -126,7 +150,8 @@ if [ "${source}" != "" ] ; then fi # build eltorito core.img -if test -e ${pc_dir} ; then +if test -e "${pc_dir}" ; then + echo "Generates eltorito" core_img=`mktemp` grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \ memdisk tar search iso9660 configfile sh \ @@ -141,11 +166,11 @@ if test -e ${pc_dir} ; then echo "source /boot/grub/grub.cfg") \ > ${iso9660_dir}/boot/grub/i386-pc/grub.cfg - grub_mkisofs="${grub_mkisofs} -b boot/grub/i386-pc/eltorito.img -boot-info-table" + grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table" fi # build iso image -${grub_mkisofs} -o ${output_image} -r -J ${iso9660_dir} +grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r -J ${iso9660_dir} rm -rf ${iso9660_dir} exit 0 From 13774a2f941452fe3bf15fd3e202373df08a1fd7 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 21 Nov 2009 13:22:41 +0000 Subject: [PATCH 5/9] 2009-11-21 Robert Millan * util/grub-mkrescue.in: Use source directory direcly (without copiing or hardlinking it). Remove -J option, Joliet is not compatible with multiple source directories. --- ChangeLog | 6 ++++++ util/grub-mkrescue.in | 9 +-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34518b011..64ea5f7b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-21 Robert Millan + + * util/grub-mkrescue.in: Use source directory direcly (without copiing + or hardlinking it). Remove -J option, Joliet is not compatible with + multiple source directories. + 2009-11-21 Carles Pina i Estany 2009-11-21 Robert Millan diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 23ac4e1e8..6f7d3338c 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -142,13 +142,6 @@ EOF grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)" fi -if [ "${source}" != "" ] ; then - for d in ${source}; do - echo "Processing $d" - cp -dpRl "${d}" ${iso9660_dir}/ - done -fi - # build eltorito core.img if test -e "${pc_dir}" ; then echo "Generates eltorito" @@ -170,7 +163,7 @@ if test -e "${pc_dir}" ; then fi # build iso image -grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r -J ${iso9660_dir} +grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r ${iso9660_dir} ${source} rm -rf ${iso9660_dir} exit 0 From 1164b2708e11564acd8b1e372b49dbd021930b31 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sat, 21 Nov 2009 13:48:15 +0000 Subject: [PATCH 6/9] 2009-11-21 Robert Millan Fix build for srcdir != objdir. * Makefile.in (po/$(PACKAGE).pot): Rename to ... ($(srcdir)/po/$(PACKAGE).pot): ... this. Run $(XGETTEXT) from $(srcdir). ($(foreach lang, $(LINGUAS), po/$(lang).po)): Rename to ... ($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): ... this. Use $^ reference for input. --- ChangeLog | 11 +++++++++++ Makefile.in | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64ea5f7b8..42ab8b8b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-11-21 Robert Millan + + Fix build for srcdir != objdir. + + * Makefile.in (po/$(PACKAGE).pot): Rename to ... + ($(srcdir)/po/$(PACKAGE).pot): ... this. Run $(XGETTEXT) from + $(srcdir). + ($(foreach lang, $(LINGUAS), po/$(lang).po)): Rename to ... + ($(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): ... this. Use $^ + reference for input. + 2009-11-21 Robert Millan * util/grub-mkrescue.in: Use source directory direcly (without copiing diff --git a/Makefile.in b/Makefile.in index 43528c534..edc6c3853 100644 --- a/Makefile.in +++ b/Makefile.in @@ -472,12 +472,12 @@ gensymlist.sh: gensymlist.sh.in config.status genkernsyms.sh: genkernsyms.sh.in config.status $(SHELL) ./config.status -po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell - $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ - $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell +$(srcdir)/po/$(PACKAGE).pot: po/POTFILES po/POTFILES-shell + cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f $< --keyword=_ + cd $(srcdir) && $(XGETTEXT) --from-code=utf-8 -o $@ -f po/POTFILES-shell -j --language=Shell -$(foreach lang, $(LINGUAS), po/$(lang).po): po/$(PACKAGE).pot - $(MSGMERGE) -U $@ po/$(PACKAGE).pot +$(foreach lang, $(LINGUAS), $(srcdir)/po/$(lang).po): po/$(PACKAGE).pot + $(MSGMERGE) -U $@ $^ po/%.mo: po/%.po $(MKDIR_P) $$(dirname $@) From 0b787d0e99c7835d401d1f4af2a8fd161763922b Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Sat, 21 Nov 2009 15:41:46 +0100 Subject: [PATCH 7/9] 2009-11-21 Felix Zielcke MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch from Loïc Minier . * util/grub.d/30_os-prober.in: Cope with Linux entries where root and /boot are on different devices. --- ChangeLog | 6 ++++++ util/grub.d/30_os-prober.in | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34518b011..345ea8ae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-21 Felix Zielcke + + Patch from Loïc Minier . + * util/grub.d/30_os-prober.in: Cope with Linux entries where + root and /boot are on different devices. + 2009-11-21 Carles Pina i Estany 2009-11-21 Robert Millan diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index c5728866c..7301bbedb 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -88,11 +88,16 @@ EOF LLABEL="${LONGNAME}" fi + if [ "${LROOT}" != "${LBOOT}" ]; then + LKERNEL="${LKERNEL#/boot}" + LINITRD="${LINITRD#/boot}" + fi + cat << EOF menuentry "${LLABEL} (on ${DEVICE})" { EOF if [ -z "${prepare_boot_cache}" ]; then - prepare_boot_cache="$(prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/")" + prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")" fi printf '%s\n' "${prepare_boot_cache}" cat << EOF From 74ff1dd52bb2f6f79b73898d50c26009ef25176c Mon Sep 17 00:00:00 2001 From: Felix Zielcke Date: Sat, 21 Nov 2009 17:40:55 +0100 Subject: [PATCH 8/9] 2009-11-21 Felix Zielcke * util/grub-mkrescue.in: Print an error and usage if output option has not been given. --- ChangeLog | 5 +++++ util/grub-mkrescue.in | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 868fd5c13..2e6ab2bdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-11-21 Felix Zielcke + + * util/grub-mkrescue.in: Print an error and usage if output option + has not been given. + 2009-11-21 Felix Zielcke Patch from Loïc Minier . diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 6f7d3338c..51639ccb1 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -42,7 +42,7 @@ Make GRUB rescue image. -h, --help print this message and exit -v, --version print the version information and exit --modules=MODULES pre-load specified modules MODULES - --output=FILE save output in FILE + --output=FILE save output in FILE [required] $0 generates a bootable rescue image with specified source files or directories. @@ -79,6 +79,12 @@ for option in "$@"; do esac done +if [ "x${output_image}" = x ] ; then + echo "output file must be given" >&2 + usage + exit 1 +fi + iso9660_dir=`mktemp -d` mkdir -p ${iso9660_dir}/boot/grub From 994cc3a308a4451ef3b6db289a7a7dc1e298c90a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 21 Nov 2009 18:00:23 +0100 Subject: [PATCH 9/9] 2009-11-21 Samuel Thibault * util/getroot.c [__GNU__]: Include , , and [__GNU__] (grub_guess_root_device): Call file_name_lookup and file_get_storage_info to implement grub_guess_root_device. --- ChangeLog | 7 ++++++ util/getroot.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2e6ab2bdc..243a92c4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-11-21 Samuel Thibault + + * util/getroot.c [__GNU__]: Include , , and + + [__GNU__] (grub_guess_root_device): Call file_name_lookup and + file_get_storage_info to implement grub_guess_root_device. + 2009-11-21 Felix Zielcke * util/grub-mkrescue.in: Print an error and usage if output option diff --git a/util/getroot.c b/util/getroot.c index 120ab13b1..2915ab4f2 100644 --- a/util/getroot.c +++ b/util/getroot.c @@ -30,6 +30,12 @@ # define DEV_CYGDRIVE_MAJOR 98 #endif +#ifdef __GNU__ +#include +#include +#include +#endif + #include #include #include @@ -378,8 +384,65 @@ find_cygwin_root_device (const char *path, dev_t dev) char * grub_guess_root_device (const char *dir) { - struct stat st; char *os_dev; +#ifdef __GNU__ + file_t file; + mach_port_t *ports; + int *ints; + loff_t *offsets; + char *data; + error_t err; + mach_msg_type_number_t num_ports = 0, num_ints = 0, num_offsets = 0, data_len = 0; + size_t name_len; + + file = file_name_lookup (dir, 0, 0); + if (file == MACH_PORT_NULL) + return 0; + + err = file_get_storage_info (file, + &ports, &num_ports, + &ints, &num_ints, + &offsets, &num_offsets, + &data, &data_len); + + if (num_ints < 1) + grub_util_error ("Storage info for `%s' does not include type", dir); + if (ints[0] != STORAGE_DEVICE) + grub_util_error ("Filesystem of `%s' is not stored on local disk", dir); + + if (num_ints < 5) + grub_util_error ("Storage info for `%s' does not include name", dir); + name_len = ints[4]; + if (name_len < data_len) + grub_util_error ("Bogus name length for storage info for `%s'", dir); + if (data[name_len - 1] != '\0') + grub_util_error ("Storage name for `%s' not NUL-terminated", dir); + + os_dev = xmalloc (strlen ("/dev/") + data_len); + memcpy (os_dev, "/dev/", strlen ("/dev/")); + memcpy (os_dev + strlen ("/dev/"), data, data_len); + + if (ports && num_ports > 0) + { + mach_msg_type_number_t i; + for (i = 0; i < num_ports; i++) + { + mach_port_t port = ports[i]; + if (port != MACH_PORT_NULL) + mach_port_deallocate (mach_task_self(), port); + } + munmap ((caddr_t) ports, num_ports * sizeof (*ports)); + } + + if (ints && num_ints > 0) + munmap ((caddr_t) ints, num_ints * sizeof (*ints)); + if (offsets && num_offsets > 0) + munmap ((caddr_t) offsets, num_offsets * sizeof (*offsets)); + if (data && data_len > 0) + munmap (data, data_len); + mach_port_deallocate (mach_task_self (), file); +#else /* !__GNU__ */ + struct stat st; if (stat (dir, &st) < 0) grub_util_error ("Cannot stat `%s'", dir); @@ -393,6 +456,7 @@ grub_guess_root_device (const char *dir) /* This might be truly slow, but is there any better way? */ os_dev = find_root_device ("/dev", st.st_dev); #endif +#endif /* !__GNU__ */ return os_dev; }