Skip to contentSkip to conversation

search for fonts in /usr/share/fonts/uni

PATCH In review Jiri Slaby 4 participants 13 messages Jul 10, 2012 – Sep 13, 2012 Kbuild

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/5 search for fonts in /usr/share/fonts/uni

From: Jiri Slaby <[email protected]>

Location of the fonts in Suse is /usr/share/fonts/uni. We have to use this patch when packaging grub2. Instead, it would be great to have this upstream so others may leverage that.

---
 configure.ac |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index 3a95b04..5ea7ffe 100644
@@ -242,7 +242,7 @@ fi
 FONT_SOURCE=
 
 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
-  for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
+  for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni; do
     if test -f "$dir/unifont.$ext"; then
       FONT_SOURCE="$dir/unifont.$ext"
       break 2
Signature · 1 line
1.7.10.4
author
#1 lore raw

PATCH 2/5 grub-install: add --skip-fs-probe

From: Michael Chang <[email protected]>

To be able to install grub on an extended partition, user, if they are convinced it is a good idea, has to use --skip-fs-probe for grub-setup.

For convenience, let us support --skip-fs-probe directly in grub-install and pass it to grub-setup internally.

Otherwise with such a setup:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     4208639     2103296   82  Linux swap / Solaris
/dev/sda2   *     4208640   213921791   104856576    f  W95 Ext'd (LBA)
/dev/sda5         4210688    46153727    20971520   83  Linux

This fails:

$ grub2-install --force /dev/sda2
/usr/sbin/grub2-probe: error: cannot find a GRUB drive for /dev/sda2. Check your device.map.

References: https://bugzilla.novell.com/show_bug.cgi?id=750897

---
 util/grub-install.in |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
util/grub-install.in +4 -1
index e19f1cd..3a7d332 100644
@@ -253,6 +253,9 @@ do
     -f | --force)
         setup_force="--force" ;;
 
+    -s | --skip-fs-probe)
+        setup_skip_fs_probe="--skip-fs-probe" ;;
+
     -*)
 	gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
 	usage
@@ -738,7 +741,7 @@ fi
 # Perform the grub_modinfo_platform-dependent install
 if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ] ; then
     # Now perform the installation.
-    "$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} --directory="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" \
+    "$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} ${setup_skip_fs_probe} --directory="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" \
 	--device-map="${device_map}" "${install_device}" || exit 1
 elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "powerpc-ieee1275" ]; then
 
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 2/5] grub-install: add --skip-fs-probe

Quoted 5 lines · Jiri Slaby

From: Michael Chang <[email protected]>

To be able to install grub on an extended partition, user, if they are convinced it is a good idea, has to use --skip-fs-probe for grub-setup.

It needs to be documented in grub-install --help.

Quoted 42 lines

For convenience, let us support --skip-fs-probe directly in grub-install and pass it to grub-setup internally.

Otherwise with such a setup:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     4208639     2103296   82  Linux swap / Solaris
/dev/sda2   *     4208640   213921791   104856576    f  W95 Ext'd (LBA)
/dev/sda5         4210688    46153727    20971520   83  Linux

This fails:

$ grub2-install --force /dev/sda2
/usr/sbin/grub2-probe: error: cannot find a GRUB drive for /dev/sda2. Check your device.map.

References: https://bugzilla.novell.com/show_bug.cgi?id=750897

---
 util/grub-install.in |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
util/grub-install.in +4 -1
index e19f1cd..3a7d332 100644
@@ -253,6 +253,9 @@ do
     -f | --force)
         setup_force="--force" ;;
 
+    -s | --skip-fs-probe)
+        setup_skip_fs_probe="--skip-fs-probe" ;;
+
     -*)
 	gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
 	usage
@@ -738,7 +741,7 @@ fi
 # Perform the grub_modinfo_platform-dependent install
 if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ] ; then
     # Now perform the installation.
-    "$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} --directory="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" \
+    "$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} ${setup_skip_fs_probe} --directory="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" \
 	--device-map="${device_map}" "${install_device}" || exit 1
 elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "powerpc-ieee1275" ]; then
 
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
author
#3 lore raw

PATCH 3/5 msdos-part: allow embedding in extended partition

In reply to Jiri Slaby

From: Michael Chang <[email protected]>

The same as in the previous patch, add a support for installing grub into an extended partition.

Here, we do not ignore extended partitions anymore. Instead we call a hook that makes sure we have the partition when installing.

References: https://bugzilla.novell.com/show_bug.cgi?id=750897

---
 grub-core/partmap/msdos.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
grub-core/partmap/msdos.c +6 -2
index 6e54a74..17f712e 100644
@@ -181,11 +181,15 @@ grub_partition_msdos_iterate (grub_disk_t disk,
 			(unsigned long long) p.len);
 
 	  /* If this partition is a normal one, call the hook.  */
-	  if (! grub_msdos_partition_is_empty (e->type)
-	      && ! grub_msdos_partition_is_extended (e->type))
+	  if (! grub_msdos_partition_is_empty (e->type))
 	    {
 	      p.number++;
 
+	      /* prevent someone doing mkfs or mkswap on an
+		 extended partition, but leave room for LILO */
+	      if (grub_msdos_partition_is_extended (e->type))
+	          p.len = 2;
+
 	      if (hook (disk, &p))
 		return grub_errno;
 	    }
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [PATCH 3/5] msdos-part: allow embedding in extended partition

Quoted 7 lines · Jiri Slaby

From: Michael Chang <[email protected]>

The same as in the previous patch, add a support for installing grub into an extended partition.

Here, we do not ignore extended partitions anymore. Instead we call a hook that makes sure we have the partition when installing.

This is a kludge and extended partition is just a technical artifact. It needs a very good reason to allow installing on those.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#5 lore raw

Re: [PATCH 3/5] msdos-part: allow embedding in extended partition

2012/9/5 Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]>:

Quoted 7 lines · Jiri Slaby
Quoted 6 lines

From: Michael Chang <[email protected]>

The same as in the previous patch, add a support for installing grub into an extended partition.

Quoted 6 lines
Quoted 2 lines

Here, we do not ignore extended partitions anymore. Instead we call a hook that makes sure we have the partition when installing.

This is a kludge and extended partition is just a technical artifact. It needs a very good reason to allow installing on those.

Installing on extended partition is one of scenarios for SUSE and openSUSE installation. If the /boot resides in a logical partition, the installer would propose installing bootloader to extended partition. For historic reasons, we prefer partition bootsector than mbr, and use a generic mbr boot code to control the booting to active partition. This is good or bad depends on what's the your view point, but the point here is that for users who upgrade to grub2, we don't want to break his current setup and still offer him the same options he used to install grub. This is the major reason why we have to install grub2 to extended partition.

I could understand the patch is not good to be accepted , although it works to solve our problem for now. However we'd like to feedback our situation here and hope that grub2 could consider to support installing to extended partition (I believe there must be more people needs it) or point us a direction how to fix this problem cleanly.

Thanks,
Michael

Quoted 10 lines

--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#6 lore raw

Re: [PATCH 3/5] msdos-part: allow embedding in extended partition

Quoted 11 lines · Michael Chang

Installing on extended partition is one of scenarios for SUSE and openSUSE installation. If the /boot resides in a logical partition, the installer would propose installing bootloader to extended partition. For historic reasons, we prefer partition bootsector than mbr, and use a generic mbr boot code to control the booting to active partition. This is good or bad depends on what's the your view point, but the point here is that for users who upgrade to grub2, we don't want to break his current setup and still offer him the same options he used to install grub. This is the major reason why we have to install grub2 to extended partition.

Quoted 5 lines

I could understand the patch is not good to be accepted , although it works to solve our problem for now. However we'd like to feedback our situation here and hope that grub2 could consider to support installing to extended partition (I believe there must be more people needs it) or point us a direction how to fix this problem cleanly.

How much room is there in the filesystem for embedding the boot loader? It must depend on the filesystem in use too.

What do you do when the disk is over 2TB in SUSE? You must be using GPT instead for that. Do you still try to embed the bootloader into the filesystem rather than use a GPT boot partition?

After all getting rid of the block mapping in grub2 has made it a lot less fragile, although you can still do it if you force it.

Signature · 1 line
Len Sorensen
#7 lore raw

Re: [PATCH 3/5] msdos-part: allow embedding in extended partition

2012/9/13 Lennart Sorensen <[email protected]>:

Quoted 12 lines · Michael Chang
Quoted 11 lines

Installing on extended partition is one of scenarios for SUSE and openSUSE installation. If the /boot resides in a logical partition, the installer would propose installing bootloader to extended partition. For historic reasons, we prefer partition bootsector than mbr, and use a generic mbr boot code to control the booting to active partition. This is good or bad depends on what's the your view point, but the point here is that for users who upgrade to grub2, we don't want to break his current setup and still offer him the same options he used to install grub. This is the major reason why we have to install grub2 to extended partition.

Quoted 8 lines
Quoted 5 lines

I could understand the patch is not good to be accepted , although it works to solve our problem for now. However we'd like to feedback our situation here and hope that grub2 could consider to support installing to extended partition (I believe there must be more people needs it) or point us a direction how to fix this problem cleanly.

How much room is there in the filesystem for embedding the boot loader? It must depend on the filesystem in use too.

Yes. And thanks to the great grub2 would do the check for us. :)

For openSUSE supported filesystem, they're all allowing embedding and grub|grub2 works pretty well.

I understand the drawbacks and pitfalls that having bootloaders installed on a partition in use, it's fragile, file system dependent and not work on lvm partiton. The question here is that these maybe not enough to convince people to use mbr as default proposed location, especially to deal with multiboot setup. I illustrate some of the problems below:

1. Booting after bios is thus fully controlled by a distro loader and you couldn't boot into other distro once that *main* disto failed. The active partition no longer worked.

2. You can't use chainload if you're not installed to a partition. Grub2 has been done well to probe the foreign os config and knows how to load the kernel and initrd directly, thus the chainload seems not required. It's true but only if the foreign OS never changes his config. There's a problem reported that foregin os not booting after receiving kernel update. If using chainload then it would not have problem because it's no depend to config change.

So we are keeping the "boot from partition .." scenario although we know grub2 not encourage to do this. The question here is that we hope installing to extended partition could be supported, as unfortunately that's one of the scenario.

Quoted 4 lines

What do you do when the disk is over 2TB in SUSE? You must be using GPT instead for that. Do you still try to embed the bootloader into the filesystem rather than use a GPT boot partition?

I agree with you that for gpt on legacy bios scheme, we should embed bootloader to the boot partition. Given that generic(or standard) mbr boot code is no longer to work on gpt (it always shows error, no active partition ;), there's no good reason to embed bootloader on partitions in use, assuming that the gpt introduces concept of boot partition, and the old-day booting from msdos active partition no longer worked or favored.

However syslinux which prefers living in a partition has provided gptmbr, it maybe used to boot off a gpt partition. But IMHO for grub, we should go for the bios boot partition (as it's name says GRAND UNIFIED ..) and gptmbr might be optional for those still insist in legacy way.

Quoted 3 lines

After all getting rid of the block mapping in grub2 has made it a lot less fragile, although you can still do it if you force it.

Yes. Using block-list install is much more improved on 2.00. Thanks for working on that. :)

Regards,
Michael

Quoted 9 lines

--
Len Sorensen

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#8 lore raw

Re: [PATCH 3/5] msdos-part: allow embedding in extended partition

Quoted 12 lines · Michael Chang

Yes. And thanks to the great grub2 would do the check for us. :)

For openSUSE supported filesystem, they're all allowing embedding and grub|grub2 works pretty well.

I understand the drawbacks and pitfalls that having bootloaders installed on a partition in use, it's fragile, file system dependent and not work on lvm partiton. The question here is that these maybe not enough to convince people to use mbr as default proposed location, especially to deal with multiboot setup. I illustrate some of the problems below:

Quoted 3 lines

1. Booting after bios is thus fully controlled by a distro loader and you couldn't boot into other distro once that *main* disto failed. The active partition no longer worked.

Makes sense.

Quoted 7 lines

2. You can't use chainload if you're not installed to a partition. Grub2 has been done well to probe the foreign os config and knows how to load the kernel and initrd directly, thus the chainload seems not required. It's true but only if the foreign OS never changes his config. There's a problem reported that foregin os not booting after receiving kernel update. If using chainload then it would not have problem because it's no depend to config change.

I personally have never understood the desire for multiple linux installs on a machine, and hence have never had a reason to have more than one grub on the system. Any other OS for me has always been one windows install (and I don't have those very often either).

I used to install grub to the partition because whenever you reinstalled windows it would overwrite the MBR and being able to change the active partition to get back to linux was handy. But since windows 95/98 aren't common anymore, the need to reinstall windows every 3 to 6 months to keep it working seems to have gone away, so now I just have grub in the MBR. But that's just how I do things.

Quoted 4 lines

So we are keeping the "boot from partition .." scenario although we know grub2 not encourage to do this. The question here is that we hope installing to extended partition could be supported, as unfortunately that's one of the scenario.

As far as I am aware, you can tell grub to force using the blockmap, but it does require passing the appropriate force argument to do it.

Quoted 7 lines

I agree with you that for gpt on legacy bios scheme, we should embed bootloader to the boot partition. Given that generic(or standard) mbr boot code is no longer to work on gpt (it always shows error, no active partition ;), there's no good reason to embed bootloader on partitions in use, assuming that the gpt introduces concept of boot partition, and the old-day booting from msdos active partition no longer worked or favored.

gpt does have a specific partition type to use for bootloaders, and grub will use it automatically. It works great.

Of course that again gives you back the problem of chainloading, since there can be only one such partition on a given system I suspect. I could be wrong, perhaps you could have multiple, but keeping track of which is which sounds complicated.

Quoted 5 lines

However syslinux which prefers living in a partition has provided gptmbr, it maybe used to boot off a gpt partition. But IMHO for grub, we should go for the bios boot partition (as it's name says GRAND UNIFIED ..) and gptmbr might be optional for those still insist in legacy way.

I believe gptmbr is to allow a legacy bios system to load the mbr and execute code that will go do the right thing for a gpt disk (which a legacy bios doesn't understand of course).

Quoted 6 lines
Quoted 3 lines

After all getting rid of the block mapping in grub2 has made it a lot less fragile, although you can still do it if you force it.

Yes. Using block-list install is much more improved on 2.00. Thanks for working on that. :)

Well someone did. I mainly use grub, and report bugs when I find them (mostly on IBM powerpc since x86 generally just works). After much discovery of endianess bugs and other fun stuff grub2 actually works quite well on ibm powerpc machines now. The serial console display is a bit messed up for the menu still, although I haven't looked into why yet. Perhaps I should. I think they use ANSI rather than vt100 or something.

Signature · 1 line
Len Sorensen
author
#9 lore raw

PATCH 4/5 Migrate PPC from Yaboot to Grub2

In reply to Jiri Slaby

From: Mark Hamzy <[email protected]>

Add configuration support for serial terminal consoles. This will set the maximum screen size so that text is not overwritten.

---
 Makefile.util.def              |    7 +++
 util/grub.d/20_ppc_terminfo.in |  114 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+)
 create mode 100644 util/grub.d/20_ppc_terminfo.in
Makefile.util.def +7 -0
index b80187c..4a4f754 100644
@@ -434,6 +434,13 @@ script = {
 };
 
 script = {
+  name = '20_ppc_terminfo';
+  common = util/grub.d/20_ppc_terminfo.in;
+  installdir = grubconf;
+  condition = COND_HOST_LINUX;
+};
+
+script = {
   name = '30_os-prober';
   common = util/grub.d/30_os-prober.in;
   installdir = grubconf;
util/grub.d/20_ppc_terminfo.in new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#10 lore raw

Re: [PATCH 4/5] Migrate PPC from Yaboot to Grub2

Quoted 5 lines · Jiri Slaby

From: Mark Hamzy <[email protected]>

Add configuration support for serial terminal consoles. This will set the maximum screen size so that text is not overwritten.

This isn't needed with GRUB 2.00 since it automatically detects serial console and uses 80x24 in this case.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
author
#11 lore raw

PATCH 5/5 add GRUB_CMDLINE_LINUX_RECOVERY for recovery mode

In reply to Jiri Slaby

From: Michael Chang <[email protected]>

We, in suse, do not use single user mode but with specific kernel command line options decided in YaST. These command line could be applied to grub2's recovery mode via the new setting GRUB_CMDLINE_LINUX_RECOVERY.

The same holds for debian and the script is actually adapted from there.

---
 util/grub-mkconfig.in   |    6 +++++-
 util/grub.d/10_linux.in |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
util/grub-mkconfig.in +5 -1
index 516be86..82917d7 100644
@@ -140,6 +140,9 @@ GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_u
 # choosing Hurd filesystem module.
 GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
 
+# Not everyone uses single as recovery, let them override.
+GRUB_CMDLINE_LINUX_RECOVERY="single"
+
 if test -f ${sysconfdir}/default/grub ; then
   . ${sysconfdir}/default/grub
 fi
@@ -216,7 +219,8 @@ export GRUB_DEFAULT \
   GRUB_INIT_TUNE \
   GRUB_SAVEDEFAULT \
   GRUB_ENABLE_CRYPTODISK \
-  GRUB_BADRAM
+  GRUB_BADRAM \
+  GRUB_CMDLINE_LINUX_RECOVERY
 
 if test "x${grub_cfg}" != "x"; then
   rm -f "${grub_cfg}.new"
util/grub.d/10_linux.in +1 -1
index 14402e8..6066d32 100644
@@ -243,7 +243,7 @@ while [ "x$list" != "x" ] ; do
               "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
   if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
     linux_entry "${OS}" "${version}" recovery \
-                "single ${GRUB_CMDLINE_LINUX}"
+                "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_RECOVERY}"
   fi
 
   list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
Signature · 1 line
1.7.10.4
#12 lore raw
In reply to Jiri Slaby

Committed, thanks. Next time please attach ChangeLog entry. It will speed up the handling of your patch.

Quoted 13 lines · Jiri Slaby
configure.ac +1 -1
index 3a95b04..5ea7ffe 100644
@@ -242,7 +242,7 @@ fi
 FONT_SOURCE=
 
 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
-  for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
+  for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni; do
     if test -f "$dir/unifont.$ext"; then
       FONT_SOURCE="$dir/unifont.$ext"
       break 2
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko