Re: A thread on grub-bug could need attention
Hi there, Le 29/01/2018 à 19:53, Thomas Schmitt a écrit : > > Does this mean that the decisive trick is to use GPT with EFI partition > instead of a MBR partition of type 0xEF ? > > Or is there something missing in the FAT filesystem images of e.g. > Debian installation ISOs like > > https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso > > ? It's probably not related to any specific images, as I could boot no standard Linux USB install stick made from an ISO image on this machine, besides Knoppix or Tails. I have installed a Manjaro with grub onto a blank USB stick, in EFI mode, and it would boot perfectly on other machines, but not on affected machine. But AFAIR the USB partition table was DOS, not GPT. So might this machine boot only from GPT disks ? Well, then it would'tn boot a Knoppix ISO image stick. But it does... > Michel: Does a simple ISO "output.iso" work, when made by > > mkdir ./minimal > echo dummy >./minimal/dummy > grub-mkrescue -o output.iso ./minimal > > and then copied onto the plain USB stick device (e.g. /dev/sdc) ? > grub-mkrescue produces valid GPT in ISO 9660. > I've produced an USB stick per your instructions above and tested it OK on another machine. I will try to test it tonight on the affected machine and let you know. Thanks for your help. Kind regards. ॐ -- Michel Bouissou OpenPGP ID 0xEB04D09C ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: A thread on grub-bug could need attention
Hi, I wrote: > > Does this mean that the decisive trick is to use GPT with EFI partition > > instead of a MBR partition of type 0xEF ? Michel Bouissou wrote: > So might this machine boot only from GPT disks ? Well, then it would'tn > boot a Knoppix ISO image stick. But it does... Yes, i proposed to Klaus Knopper to deviate from Matthew J. Garrett's layout which is used by Fedora, Debian, and others. So Knoppix 8.1 has the EFI partition appended outside the ISO 9660 filesystem range, with a neat MBR partition table without nested partitions. No GPT gets written, because it would be invalid. Nevertheless, Knoppix uses SYSLINUX which could be less dependent on a neat GPT than GRUB2 could be ... theoretically guessing ... > I have installed a Manjaro with grub onto a blank USB stick, in EFI > mode, and it would boot perfectly on other machines, but not on affected > machine. It would be interesting to compare the particular actions of the installation with the procedure proposed by Daniel Kiper which works. > I could boot no > standard Linux USB install stick made from an ISO image on this machine, > besides Knoppix or Tails. Oh. I forgot your success with Tails. My mailbox says i inspected 3.3 and that it was BIOS-only with ISOLINUX as bootloader. Just to be sure: http://dl.amnesia.boum.org/tails/stable/tails-amd64-3.5/tails-amd64-3.5.iso No EFI partition at all. And no GRUB. This corresponds to the "mac" ISOs of Debian, which are BIOS-only because some MacIntoshs are said to take offense on the EFI equipment. E.g. this 293 MB image: https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-mac-9.3.0-amd64-netinst.iso > > grub-mkrescue -o output.iso ./minimal > I will try to test it tonight on the affected machine and let you know. I am curious what will happen. Have a nice day :) Thomas ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: A thread on grub-bug could need attention
Le 30/01/2018 à 17:33, Thomas Schmitt a écrit : >> I will try to test it tonight on the affected machine and let you know. > I am curious what will happen. It boots into grub properly. ॐ -- Michel Bouissou OpenPGP ID 0xEB04D09C ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH] Make grub-install check for errors from efibootmgr
On Mon, Jan 29, 2018 at 06:54:23PM +, Steve McIntyre wrote: > Code is currently ignoring errors from efibootmgr, giving users > clearly bogus output like: > > Setting up grub-efi-amd64 (2.02~beta3-4) ... > Installing for x86_64-efi platform. > Could not delete variable: No space left on device > Could not prepare Boot variable: No space left on device > Installation finished. No error reported. > > and then potentially unbootable systems. If efibootmgr fails, > grub-install should know that and report it! > > We've been using this patch in Debian now for some time, with no ill > effects. > > Signed-off-by: Steve McIntyre <93...@debian.org> > --- > grub-core/osdep/unix/platform.c | 25 +++-- > include/grub/util/install.h | 2 +- > util/grub-install.c | 18 +- > 3 files changed, 29 insertions(+), 16 deletions(-) > > diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c > index a3fcfcaca..b3a617e44 100644 > --- a/grub-core/osdep/unix/platform.c > +++ b/grub-core/osdep/unix/platform.c > @@ -78,19 +78,20 @@ get_ofpathname (const char *dev) > dev); > } > > -static void > +static int > grub_install_remove_efi_entries_by_distributor (const char *efi_distributor) > { >int fd; >pid_t pid = grub_util_exec_pipe ((const char * []){ "efibootmgr", NULL }, > &fd); >char *line = NULL; >size_t len = 0; > + int ret; > >if (!pid) > { >grub_util_warn (_("Unable to open stream from %s: %s"), > "efibootmgr", strerror (errno)); > - return; > + return errno; > } > >FILE *fp = fdopen (fd, "r"); > @@ -98,14 +99,13 @@ grub_install_remove_efi_entries_by_distributor (const > char *efi_distributor) > { >grub_util_warn (_("Unable to open stream from %s: %s"), > "efibootmgr", strerror (errno)); > - return; > + return errno; > } > >line = xmalloc (80); >len = 80; >while (1) > { > - int ret; Oh, no, please do not do that here. If my first proposal conflicts with existing variables use second one. If second is bad please choose third. The rest of the patch LGTM. Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: A thread on grub-bug could need attention
On Mon, Jan 29, 2018 at 07:20:25PM +0100, Michel Bouissou wrote: > Hi again, > > Le 29/01/2018 ?? 16:29, Michel Bouissou a ??crit??: > > I created the USB stick per your instructions. I will try to give it a > > shot tonight on my son's machine. > > I tested the USB stick on my son's machine, and I do get a grub prompt. > > >From there, if I type "help", I get a list of grub shell commands. > > And if I type "reboot", the machine reboots. > > So tha'ts a progress. Great! > Thanks for the suggestion. You are welcome! IIRC you see blank screen after installing some distros. Right? Could you send me grub.cfg/grub2.cfg generated by the installer? It should be somewhere in /boot/grub or /boot/grub2 or even on EFI System Partition. Daniel ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
Re: A thread on grub-bug could need attention
Hi, Daniel Kiper wrote: > IIRC you see blank screen after installing some distros. Right? It also does not work when booting the ISO images which shall install the systems. E.g. debian-9.3.0-amd64-netinst.iso : mount debian-9.3.0-amd64-netinst.iso /mnt/iso mount /mnt/iso/boot/grub/efi.img /mnt/fat At the end of the binary /mnt/fat/efi/boot/bootx64.efi, "strings" sees: search --file --set=root /.disk/info set prefix=($root)/boot/grub source $prefix/x86_64-efi/grub.cfg (memdisk)/boot/grub The search leads to the ISO 9660 filesystem. /mnt/iso/boot/grub/x86_64-efi/grub.cfg has insmod part_acorn insmod part_amiga insmod part_apple insmod part_bsd insmod part_dfly insmod part_dvh insmod part_gpt insmod part_msdos insmod part_plan insmod part_sun insmod part_sunpc source /boot/grub/grub.cfg /mnt/iso/boot/grub/grub.cfg has if loadfont $prefix/font.pf2 ; then set gfxmode=800x600 insmod efi_gop insmod efi_uga insmod video_bochs insmod video_cirrus insmod gfxterm insmod png terminal_output gfxterm fi if background_image /isolinux/splash.png; then set color_normal=light-gray/black set color_highlight=white/black else set menu_color_normal=cyan/blue set menu_color_highlight=white/blue fi insmod play play 960 440 1 0 4 440 1 set theme=/boot/grub/theme/1 menuentry --hotkey=g 'Graphical install' { set background_color=black linux/install.amd/vmlinuz vga=788 --- quiet initrd /install.amd/gtk/initrd.gz } menuentry --hotkey=i 'Install' { set background_color=black linux/install.amd/vmlinuz vga=788 --- quiet initrd /install.amd/initrd.gz } submenu --hotkey=a 'Advanced options ...' { set menu_color_normal=cyan/blue set menu_color_highlight=white/blue set theme=/boot/grub/theme/1-1 menuentry '... Graphical expert install' { set background_color=black linux/install.amd/vmlinuz priority=low vga=788 --- initrd /install.amd/gtk/initrd.gz } menuentry '... Graphical rescue mode' { set background_color=black linux/install.amd/vmlinuz vga=788 rescue/enable=true --- quiet initrd /install.amd/gtk/initrd.gz } menuentry '... Graphical automated install' { set background_color=black linux/install.amd/vmlinuz auto=true priority=critical vga=788 --- quiet initrd /install.amd/gtk/initrd.gz } menuentry --hotkey=x '... Expert install' { set background_color=black linux/install.amd/vmlinuz priority=low vga=788 --- initrd /install.amd/initrd.gz } menuentry --hotkey=r '... Rescue mode' { set background_color=black linux/install.amd/vmlinuz vga=788 rescue/enable=true --- quiet initrd /install.amd/initrd.gz } menuentry --hotkey=a '... Automated install' { set background_color=black linux/install.amd/vmlinuz auto=true priority=critical vga=788 --- quiet initrd /install.amd/initrd.gz } submenu --hotkey=s '... Speech-enabled advanced options ...' { set menu_color_normal=cyan/blue set menu_color_highlight=white/blue set theme=/boot/grub/theme/1-1-1 menuentry --hotkey=x '... Expert speech install' { set background_color=black linux/install.amd/vmlinuz priority=low vga=788 speakup.synth=soft --- initrd /install.amd/gtk/initrd.gz } menuentry --hotkey=r '... Rescue speech mode' { set background_color=black linux/install.amd/vmlinuz vga=788 rescue/enable=true speakup.synth=soft --- quiet initrd /install.amd/gtk/initrd.gz } menuentry --hotkey=a '... Automated speech install' { set background_color=black linux/install.amd/vmlinuz auto=true priority=critical vga=788 speakup.synth=soft --- quiet initrd /install.amd/gtk/initrd.gz } } } menuentry --hotkey=s 'Install with speech synthesis' { set background_color=black linux/install.amd/vmlinuz vga=788 speakup.synth=soft --- quiet initrd /install.amd/gtk/initrd.gz } Well, my MBR versus GPT theory fades away by Daniel Kiper's above question. The next step would have been to build a grub-mkrescue image with a partition layout like Knoppix 8.1. You'd take script xorriso-1.4.8/frontend/grub-mkrescue-sed.sh from a GNU xorriso source installation or from https://dev.lovelyhq.com/libburnia/libisoburn/raw/master/frontend/grub-mkrescue-sed.sh and use it as "xorriso" for the grub-mkrescue run. It re-arranges the options for the xorriso run to achieve other partition layouts and/or positions
Re: [PATCH] build: Use pkg-config to find Freetype
On Mon, Jan 29, 2018 at 06:35:11PM +0100, Daniel Kiper wrote: > On Thu, Jan 25, 2018 at 12:23:58PM +, Colin Watson wrote: > > @@ -1542,8 +1539,6 @@ else > > enable_grub_mkfont=no > > fi > > AC_SUBST([enable_grub_mkfont]) > > -AC_SUBST([freetype_cflags]) > > -AC_SUBST([freetype_libs]) > > Could you explain why do you drop this... PKG_CHECK_MODULES does this (and is documented to do so), so there's no need to do it manually. Same for BUILD_FREETYPE_{CFLAGS,LIBS}. Thanks for your other comments; I'll follow up in a moment with corrected patches. -- Colin Watson [cjwat...@ubuntu.com] ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel
[PATCH v2 2/2] build: Use pkg-config to find FreeType
pkg-config is apparently preferred over freetype-config these days (see the BUGS section of freetype-config(1)). pkg-config support was added to FreeType in version 2.1.5, which was released in 2003, so it should comfortably be available everywhere by now. We no longer need to explicitly substitute FREETYPE_CFLAGS and FREETYPE_LIBS, since PKG_CHECK_MODULES does that automatically. Fixes Debian bug #887721. Reported-by: Hugh McMaster Signed-off-by: Colin Watson --- INSTALL | 11 + configure.ac | 74 +--- 2 files changed, 37 insertions(+), 48 deletions(-) diff --git a/INSTALL b/INSTALL index f3c20ed..b370d77 100644 --- a/INSTALL +++ b/INSTALL @@ -37,6 +37,7 @@ configuring the GRUB. * GNU gettext 0.17 or later * GNU binutils 2.9.1.0.23 or later * Flex 2.5.35 or later +* pkg-config * Other standard GNU/Unix tools * a libc with large file support (e.g. glibc 2.1 or later) @@ -52,7 +53,7 @@ For optional grub-emu features, you need: To build GRUB's graphical terminal (gfxterm), you need: -* FreeType 2 or later +* FreeType 2.1.5 or later * GNU Unifont If you use a development snapshot or want to hack on GRUB you may @@ -158,8 +159,8 @@ For this example the configure line might look like (more details below) (some options are optional and included here for completeness but some rarely used options are omitted): -./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu -CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config +./configure BUILD_CC=gcc BUILD_PKG_CONFIG=pkg-config --host=amd64-linux-gnu +CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" PKG_CONFIG=amd64-linux-gnu-pkg-config --target=arm --with-platform=uboot TARGET_CC=arm-elf-gcc TARGET_CFLAGS="-Os -march=armv6" TARGET_CCASFLAGS="-march=armv6" TARGET_OBJCOPY="arm-elf-objcopy" TARGET_STRIP="arm-elf-strip" @@ -176,7 +177,7 @@ corresponding platform are not needed for the platform in question. 2. BUILD_CFLAGS= for C options for build. 3. BUILD_CPPFLAGS= for C preprocessor options for build. 4. BUILD_LDFLAGS= for linker options for build. -5. BUILD_FREETYPE= for freetype-config for build (optional). +5. BUILD_PKG_CONFIG= for pkg-config for build (optional). - For host 1. --host= to autoconf name of host. @@ -184,7 +185,7 @@ corresponding platform are not needed for the platform in question. 3. HOST_CFLAGS= for C options for host. 4. HOST_CPPFLAGS= for C preprocessor options for host. 5. HOST_LDFLAGS= for linker options for host. -6. FREETYPE= for freetype-config for host (optional). +6. PKG_CONFIG= for pkg-config for host (optional). 7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional). 8. Libfuse if any must be in standard linker folders (-lfuse) (optional). 9. Libzfs if any must be in standard linker folders (-lzfs) (optional). diff --git a/configure.ac b/configure.ac index 095b0de..6f1adf4 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,10 @@ AC_PREREQ(2.60) AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_HEADER([config-util.h]) +# Explicitly check for pkg-config early on, since otherwise conditional +# calls are problematic. +PKG_PROG_PKG_CONFIG + # Program name transformations AC_ARG_PROGRAM grub_TRANSFORM([grub-bios-setup]) @@ -1508,29 +1512,22 @@ if test x"$enable_grub_mkfont" = xno ; then grub_mkfont_excuse="explicitly disabled" fi -if test x"$grub_mkfont_excuse" = x ; then - # Check for freetype libraries. - AC_CHECK_TOOLS([FREETYPE], [freetype-config]) - if test "x$FREETYPE" = x ; then -grub_mkfont_excuse=["need freetype2 library"] - fi -fi - unset ac_cv_header_ft2build_h if test x"$grub_mkfont_excuse" = x ; then # Check for freetype libraries. - FREETYPE_CFLAGS=`$FREETYPE --cflags` - FREETYPE_LIBS=`$FREETYPE --libs` - SAVED_CPPFLAGS="$CPPFLAGS" - SAVED_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS" - LIBS="$LIBS $FREETYPE_LIBS" - AC_CHECK_HEADERS([ft2build.h], [], - [grub_mkfont_excuse=["need freetype2 headers"]]) - AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]]) - CPPFLAGS="$SAVED_CPPFLAGS" - LIBS="$SAVED_LIBS" + PKG_CHECK_MODULES([FREETYPE], [freetype2], [ +SAVED_CPPFLAGS="$CPPFLAGS" +SAVED_LIBS="$LIBS" +CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS" +LIBS="$LIBS $FREETYPE_LIBS" +AC_CHECK_HEADERS([ft2build.h], [], + [grub_mkfont_excuse=["need freetype2 headers"]]) +AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], + [grub_mkfont_excuse=["freetype2 library unusable"]]) +CPPFLAGS="$SAVED_CPPFLAGS" +LIBS="$SAVED_LIBS" + ], [grub_mkfont_excuse=["need freetype2 library"]]) fi if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then @@ -1542,8 +1539,6 @@ else enable_grub_mkfont=no fi AC_SUBST([enable_grub_mkfont]) -AC_SUBS
[PATCH v2 1/2] build: Capitalise *freetype_* variables
Using FREETYPE_CFLAGS and FREETYPE_LIBS is more in line with the naming scheme used by pkg-config macros. --- Makefile.am | 6 +++--- Makefile.util.def | 4 ++-- configure.ac | 24 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7795bae..a52a998 100644 --- a/Makefile.am +++ b/Makefile.am @@ -71,7 +71,7 @@ endif starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0 build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) + $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT) garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c @@ -80,11 +80,11 @@ CLEANFILES += garbage-gen$(BUILD_EXEEXT) EXTRA_DIST += util/garbage-gen.c build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror + $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT) build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c - $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror + $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(BUILD_FREETYPE_CFLAGS) $(BUILD_FREETYPE_LIBS) -Wall -Werror CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT) if COND_STARFIELD diff --git a/Makefile.util.def b/Makefile.util.def index f9caccb..aac14b7 100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@ -302,14 +302,14 @@ program = { common = grub-core/kern/emu/argp_common.c; common = grub-core/osdep/init.c; - cflags = '$(freetype_cflags)'; + cflags = '$(FREETYPE_CFLAGS)'; cppflags = '-DGRUB_MKFONT=1'; ldadd = libgrubmods.a; ldadd = libgrubgcry.a; ldadd = libgrubkern.a; ldadd = grub-core/gnulib/libgnu.a; - ldadd = '$(freetype_libs)'; + ldadd = '$(FREETYPE_LIBS)'; ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)'; condition = COND_GRUB_MKFONT; }; diff --git a/configure.ac b/configure.ac index c7888e4..095b0de 100644 --- a/configure.ac +++ b/configure.ac @@ -1520,12 +1520,12 @@ unset ac_cv_header_ft2build_h if test x"$grub_mkfont_excuse" = x ; then # Check for freetype libraries. - freetype_cflags=`$FREETYPE --cflags` - freetype_libs=`$FREETYPE --libs` + FREETYPE_CFLAGS=`$FREETYPE --cflags` + FREETYPE_LIBS=`$FREETYPE --libs` SAVED_CPPFLAGS="$CPPFLAGS" SAVED_LIBS="$LIBS" - CPPFLAGS="$CPPFLAGS $freetype_cflags" - LIBS="$LIBS $freetype_libs" + CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS" + LIBS="$LIBS $FREETYPE_LIBS" AC_CHECK_HEADERS([ft2build.h], [], [grub_mkfont_excuse=["need freetype2 headers"]]) AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]]) @@ -1542,8 +1542,8 @@ else enable_grub_mkfont=no fi AC_SUBST([e
[PATCH V2] sparc64: fix OF path names for sun4v systems
Fix the Open Firmware (OF) path property for sun4v SPARC systems. These platforms do not have a /sas/ within their path. Over time different OF addressing schemes have been supported. There is no generic addressing scheme that works across every HBA. Signed-off-by: Eric Snowberg --- V2: - Requested coding style changes --- grub-core/osdep/linux/ofpath.c | 148 +++- 1 files changed, 145 insertions(+), 3 deletions(-) diff --git a/grub-core/osdep/linux/ofpath.c b/grub-core/osdep/linux/ofpath.c index dce4e59..5369508 100644 --- a/grub-core/osdep/linux/ofpath.c +++ b/grub-core/osdep/linux/ofpath.c @@ -38,6 +38,46 @@ #include #include +#ifdef __sparc__ +typedef enum + { +GRUB_OFPATH_SPARC_WWN_ADDR = 1, +GRUB_OFPATH_SPARC_TGT_LUN, + } ofpath_sparc_addressing; + +struct ofpath_sparc_hba +{ + grub_uint32_t device_id; + ofpath_sparc_addressing addressing; +}; + +static struct ofpath_sparc_hba sparc_lsi_hba[] = { + /* Rhea, Jasper 320, LSI53C1020/1030. */ + {0x30, GRUB_OFPATH_SPARC_TGT_LUN}, + /* SAS-1068E. */ + {0x50, GRUB_OFPATH_SPARC_TGT_LUN}, + /* SAS-1064E. */ + {0x56, GRUB_OFPATH_SPARC_TGT_LUN}, + /* Pandora SAS-1068E. */ + {0x58, GRUB_OFPATH_SPARC_TGT_LUN}, + /* Aspen, Invader, LSI SAS-3108. */ + {0x5d, GRUB_OFPATH_SPARC_TGT_LUN}, + /* Niwot, SAS 2108. */ + {0x79, GRUB_OFPATH_SPARC_TGT_LUN}, + /* Erie, Falcon, LSI SAS 2008. */ + {0x72, GRUB_OFPATH_SPARC_WWN_ADDR}, + /* LSI WarpDrive 6203. */ + {0x7e, GRUB_OFPATH_SPARC_WWN_ADDR}, + /* LSI SAS 2308. */ + {0x87, GRUB_OFPATH_SPARC_WWN_ADDR}, + /* LSI SAS 3008. */ + {0x97, GRUB_OFPATH_SPARC_WWN_ADDR}, + {0, 0} +}; + +static const int LSI_VENDOR_ID = 0x1000; +#endif + #ifdef OFPATH_STANDALONE #define xmalloc malloc void @@ -338,6 +378,67 @@ vendor_is_ATA(const char *path) return (memcmp(bufcont, "ATA", 3) == 0); } +#ifdef __sparc__ +static void +check_hba_identifiers (const char *sysfs_path, int *vendor, int *device_id) +{ + char *ed = strstr (sysfs_path, "host"); + size_t path_size; + char *p, *path; + char buf[8]; + int fd; + + if (!ed) +return; + + p = xstrdup (sysfs_path); + ed = strstr (p, "host"); + + if (!ed) +goto out; + + *ed = '\0'; + + path_size = (strlen (p) + sizeof ("vendor")); + path = xmalloc (path_size); + + if (!path) +goto out; + + snprintf (path, path_size, "%svendor", p); + fd = open (path, O_RDONLY); + + if (fd < 0) +goto out; + + memset (buf, 0, sizeof (buf)); + + if (read (fd, buf, sizeof (buf) - 1) < 0) +goto out; + + close (fd); + sscanf (buf, "%x", vendor); + + snprintf (path, path_size, "%sdevice", p); + fd = open (path, O_RDONLY); + + if (fd < 0) +goto out; + + memset (buf, 0, sizeof (buf)); + + if (read (fd, buf, sizeof (buf) - 1) < 0) +goto out; + + close (fd); + sscanf (buf, "%x", device_id); + + out: + free (path); + free (p); +} +#endif + static void check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address) { @@ -399,7 +500,7 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev { const char *p, *digit_string, *disk_name; int host, bus, tgt, lun; - unsigned long int sas_address; + unsigned long int sas_address = 0; char *sysfs_path, disk[MAX_DISK_CAT - sizeof ("/fp@0,0")]; char *of_path; @@ -416,9 +517,8 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev } of_path = find_obppath(sysfs_path); - free (sysfs_path); if (!of_path) -return NULL; +goto out; if (strstr (of_path, "qlc")) strcat (of_path, "/fp@0,0"); @@ -447,6 +547,44 @@ of_path_of_scsi(const char *sys_devname __attribute__((unused)), const char *dev } else { +#ifdef __sparc__ + ofpath_sparc_addressing addressing = GRUB_OFPATH_SPARC_TGT_LUN; + int vendor = 0, device_id = 0; + char *optr = disk; + + check_hba_identifiers (sysfs_path, &vendor, &device_id); + + if (vendor == LSI_VENDOR_ID) +{ + struct ofpath_sparc_hba *lsi_hba; + + /* Over time different OF addressing schemes have been supported. + There is no generic addressing scheme that works across + every HBA. */ + for (lsi_hba = sparc_lsi_hba; lsi_hba->device_id; lsi_hba++) +if (lsi_hba->device_id == device_id) + { +addressing = lsi_hba->addressing; +break; + } +} + + if (addressing == GRUB_OFPATH_SPARC_WWN_ADDR) +optr += snprintf (disk, sizeof (disk), "/%s@w%lx,%x", disk_name, + sas_address, lun); + else +optr += snprintf (disk, sizeof (disk), "/%s@%x,%x", disk_name, tgt, + lun); + + if (*digit_string != '\0') +{ + int part; + + sscanf (digit_string, "%d", &part); + snprintf (optr, sizeof (disk) - (optr - disk - 1), ":%c", 'a' ++ (part