~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to util/grub.d/10_kfreebsd.in

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson, Colin Watson, Evan Broder, Mario Limonciello
  • Date: 2010-11-24 13:59:55 UTC
  • mfrom: (1.17.6 upstream) (17.6.15 experimental)
  • Revision ID: james.westby@ubuntu.com-20101124135955-r6ii5sepayr7jt53
Tags: 1.99~20101124-1ubuntu1
[ Colin Watson ]
* Resynchronise with Debian experimental.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Program vesafb on BIOS systems rather than efifb.
  - Add a grub-rescue-efi-amd64 package containing a rescue CD-ROM image
    for EFI-AMD64.
  - On Wubi, don't ask for an install device, but just update wubildr
    using the diverted grub-install.
  - When embedding the core image in a post-MBR gap, check for and avoid
    sectors matching any of a list of known signatures.
  - Disable video_bochs and video_cirrus on PC BIOS systems, as probing
    PCI space seems to break on some systems.
* Downgrade "ACPI shutdown failed" error to a debug message, since it can
  cause spurious test failures.

[ Evan Broder ]
* Enable lua from grub-extras.
* Incorporate the bitop library into lua.
* Add enum_pci function to grub module in lua.
* Switch back to gfxpayload=keep by default, unless the video hardware
  is known to not support it.

[ Mario Limonciello ]
* Built part_msdos and vfat into bootx64.efi (LP: #677758)

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
  ;;
40
40
esac
41
41
 
 
42
load_kfreebsd_module ()
 
43
{
 
44
  mod="$1"
 
45
  allow_fail="$2"
 
46
 
 
47
  if ! test -e "${module_dir}/${mod}.ko" ; then
 
48
    if [ "${allow_fail}" = "true" ] ; then
 
49
      # Return silently
 
50
      return
 
51
    else
 
52
      # Print an error and fail.
 
53
      ls "${module_dir}/${mod}.ko" > /dev/null
 
54
    fi
 
55
  fi
 
56
 
 
57
  if [ -z "${prepare_module_dir_cache}" ]; then
 
58
    prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
 
59
  fi
 
60
 
 
61
  printf '%s\n' "${prepare_module_dir_cache}"
 
62
  cat << EOF
 
63
        kfreebsd_module_elf     ${module_dir_rel}/${mod}.ko
 
64
EOF
 
65
}
 
66
 
42
67
kfreebsd_entry ()
43
68
{
44
69
  os="$1"
45
70
  version="$2"
46
 
  recovery="$3" # not used yet
47
 
  args="$4"     # not used yet
48
 
  title="$(gettext_quoted "%s, with kFreeBSD %s")"
 
71
  recovery="$3"
 
72
  args="$4"
 
73
  if ${recovery} ; then
 
74
    title="$(gettext_quoted "%s, with kFreeBSD %s (recovery mode)")"
 
75
  else
 
76
    title="$(gettext_quoted "%s, with kFreeBSD %s")"
 
77
  fi
49
78
  printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
50
 
  save_default_entry | sed -e "s/^/\t/"
 
79
  if ! ${recovery} ; then
 
80
      save_default_entry | sed -e "s/^/\t/"
 
81
  fi
51
82
  if [ -z "${prepare_boot_cache}" ]; then
52
83
    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
53
84
  fi
54
 
  if [ -z "${prepare_module_dir_cache}" ]; then
55
 
    prepare_module_dir_cache="$(prepare_grub_to_access_device $(grub-probe -t device "${module_dir}") | sed -e "s/^/\t/")"
56
 
  fi
57
85
 
58
86
  printf '%s\n' "${prepare_boot_cache}"
59
87
  cat << EOF
60
88
        echo                    '$(printf "$(gettext_quoted "Loading kernel of FreeBSD %s ...")" ${version})'
61
 
        kfreebsd                ${rel_dirname}/${basename}
 
89
        kfreebsd                ${rel_dirname}/${basename} ${args}
62
90
EOF
63
91
 
64
92
  if test -n "${devices}" ; then
67
95
EOF
68
96
  fi
69
97
 
70
 
  if test -e "${module_dir}/acpi.ko" ; then
71
 
    printf '%s\n' "${prepare_module_dir_cache}"
72
 
    cat << EOF
73
 
        kfreebsd_module_elf     ${module_dir_rel}/acpi.ko
74
 
EOF
75
 
  fi
 
98
  load_kfreebsd_module acpi true
76
99
 
77
100
  case "${kfreebsd_fs}" in
78
101
    zfs)
79
 
      test -e "${module_dir}/opensolaris.ko"
80
 
      test -e "${module_dir}/zfs.ko"
81
 
      test -e "${dirname}/zfs/zpool.cache"
82
 
 
83
 
      printf '%s\n' "${prepare_module_dir_cache}"
84
 
      cat << EOF
85
 
        kfreebsd_module_elf     ${module_dir_rel}/opensolaris.ko
86
 
        kfreebsd_module_elf     ${module_dir_rel}/zfs.ko
87
 
EOF
88
 
 
 
102
      load_kfreebsd_module opensolaris false
 
103
 
 
104
      ls "${dirname}/zfs/zpool.cache" > /dev/null
89
105
      printf '%s\n' "${prepare_boot_cache}"
90
106
  cat << EOF
91
107
        kfreebsd_module         ${rel_dirname}/zfs/zpool.cache type=/boot/zfs/zpool.cache
93
109
    ;;
94
110
  esac
95
111
 
 
112
  load_kfreebsd_module ${kfreebsd_fs} false
 
113
 
96
114
  cat << EOF
97
115
        set kFreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${kfreebsd_device}
98
116
        set kFreeBSD.vfs.root.mountfrom.options=rw
120
138
  fi
121
139
 
122
140
  case ${GRUB_FS} in
123
 
    ufs1 | ufs2)        kfreebsd_fs=ufs ;;
124
 
    *)                  kfreebsd_fs=${GRUB_FS} ;;
 
141
    ufs1 | ufs2)        kfreebsd_fs=ufs ;;
 
142
    ext2)               kfreebsd_fs=ext2fs ;;
 
143
    *)                  kfreebsd_fs=${GRUB_FS} ;;
125
144
  esac
126
145
 
127
146
  case ${GRUB_FS} in
128
 
    zfs)                kfreebsd_device=$(grub-probe -t label --device ${GRUB_DEVICE}) ;;
129
 
    *)                  kfreebsd_device=${GRUB_DEVICE} ;;
 
147
    zfs)
 
148
                        # zpool name
 
149
                        kfreebsd_device=$(grub-probe -t fs_label --device ${GRUB_DEVICE})
 
150
                        # filesystem name (empty string for the main filesystem)
 
151
                        kfreebsd_device="${kfreebsd_device}$(grub-mkrelpath / | sed -e "s,/*@$,,")"
 
152
    ;;
 
153
    *)
 
154
          kfreebsd_device=${kfreebsd_fs}id/${GRUB_DEVICE_UUID}
 
155
          # Debian GNU/kFreeBSD can't remount root if it's supplied as UUID but
 
156
          # as an UUID
 
157
          if [ "x${GRUB_DISTRIBUTOR}" = "xDebian" ] \
 
158
              && ! (cat /etc/fstab | awk '!/^[[:space:]]*#/ && $2=="/" { print $1; }' \
 
159
              | grep "${kfreebsd_fs}id/${GRUB_DEVICE_UUID}" > /dev/null); then
 
160
              kfreebsd_device=${GRUB_DEVICE} 
 
161
          fi
 
162
          ;;
130
163
  esac
131
164
 
132
165
  version=`echo $basename | sed -e "s,^[^0-9]*-,,g;s/\.gz$//g"`
145
178
    module_dir_rel=$(make_system_path_relative_to_its_root $module_dir)
146
179
  fi
147
180
 
148
 
  kfreebsd_entry "${OS}" "${version}"
 
181
  kfreebsd_entry "${OS}" "${version}" false
 
182
  if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
 
183
    kfreebsd_entry "${OS}" "${version}" true "-s"
 
184
  fi
149
185
 
150
186
  list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
151
187
done