Received: from list by lists.gnu.org with archive (Exim 4.71) id 1SZjXK-0004iF-RE for mharc-grub-devel@gnu.org; Wed, 30 May 2012 10:06:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZjXE-0004hz-Td for grub-devel@gnu.org; Wed, 30 May 2012 10:06:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SZjX9-0003A8-Jc for grub-devel@gnu.org; Wed, 30 May 2012 10:06:00 -0400 Received: from e9.ny.us.ibm.com ([32.97.182.139]:54266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZjX9-00038y-FG for grub-devel@gnu.org; Wed, 30 May 2012 10:05:55 -0400 Received: from /spool/local by e9.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 30 May 2012 10:05:50 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e9.ny.us.ibm.com (192.168.1.109) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 30 May 2012 10:05:49 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id 1DB2C6E804C for ; Wed, 30 May 2012 10:05:48 -0400 (EDT) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q4UE5l8b123638 for ; Wed, 30 May 2012 10:05:47 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q4UJadep003177 for ; Wed, 30 May 2012 15:36:39 -0400 Received: from imap.linux.ibm.com (maier.raleigh.ibm.com [9.37.253.158]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q4UJadBx003126 for ; Wed, 30 May 2012 15:36:39 -0400 Received: by imap.linux.ibm.com (Postfix, from userid 48) id 550451600067; Wed, 30 May 2012 10:05:36 -0400 (EDT) Received: from beren.br.ibm.com (beren.br.ibm.com [9.18.235.57]) by imap.linux.ibm.com (Horde Framework) with HTTP; Wed, 30 May 2012 10:05:36 -0400 Date: Wed, 30 May 2012 10:05:36 -0400 Message-ID: <20120530100536.Horde.cqPs8Zir309PxikwRTDEFMA@imap.linux.ibm.com> From: Paulo Flabiano Smorigo To: grub-devel@gnu.org Subject: [PATCH] PReP record when the --no-nvram param is used User-Agent: Internet Messaging Program (IMP) H4 (5.0.10) Content-Type: multipart/mixed; boundary="=_SGKmppir309PxikwRQ80FMA" MIME-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12053014-7182-0000-0000-000001A09A53 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.182.139 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2012 14:06:05 -0000 This message is in MIME format. --=_SGKmppir309PxikwRQ80FMA Content-Type: text/plain; charset=ISO-8859-1; format=flowed; DelSp=Yes Content-Disposition: inline This is a fix to write grub in prep even if the --no-nvram is used. -- Paulo Flabiano Smorigo Linux Technology Center Brazil Software Engineer IBM Systems & Technology Group pfsmorigo@br.ibm.com / pfsmorigo@linux.vnet.ibm.com --=_SGKmppir309PxikwRQ80FMA Content-Type: text/x-patch; charset=us-ascii; name=prep_record_when_no_nvram.patch Content-Disposition: attachment; filename=prep_record_when_no_nvram.patch; size=3369 === modified file 'util/grub-install.in' --- util/grub-install.in 2012-05-11 19:07:39 +0000 +++ util/grub-install.in 2012-05-30 18:46:05 +0000 @@ -734,8 +734,31 @@ 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" \ - --device-map="${device_map}" "${install_device}" || exit 1 +--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 + + # If a install device is defined, copy the core.elf to PReP partition. + if [ -n "${install_device}" ]; then + if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" != "41" ]; then + gettext "The chosen partition is not a PReP partition." 1>&2 + echo 1>&2 + exit 1 + fi + + if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ x$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t zero_check) = xtrue ]; then + dd if="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" of="${install_device}" status=noxfer || { + gettext "Failed to copy Grub to the PReP partition." 1>&2 + echo 1>&2 + exit 1 + } + else + gettext "The PReP partition is not empty. If you are sure you want to use it, run dd to clear it:" 1>&2 + echo 1>&2 + echo " dd if=/dev/zero of=${install_device}" + exit 1 + fi + fi + if [ x"$update_nvram" = xyes ]; then ofpathname="`which ofpathname`" nvsetenv="`which nvsetenv`" @@ -768,28 +791,8 @@ # Point boot-device at the new grub install boot_device="$ofpath:$partno,"`"$grub_mkrelpath" "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" | sed 's,/,\\\\,g'` - # If a install device is defined, copy the core.elf to PReP partition. else - if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" != "41" ]; then - gettext "The chosen partition is not a PReP partition." 1>&2 - echo 1>&2 - exit 1 - fi - if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ x$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t zero_check) = xtrue ]; then - # Change boot device to the harddisk root - boot_device="$ofpath" - dd if="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" of="${install_device}" status=noxfer || { - gettext "Failed to copy Grub to the PReP partition." 1>&2 - echo 1>&2 - exit 1 - } - else - gettext "The PReP partition is not empty. If you are sure you want to use it, run dd to clear it:" 1>&2 - echo 1>&2 - echo " dd if=/dev/zero of=${install_device}" - exit 1 - fi dev="`echo "${install_device}" | sed -e 's/\/dev\///' -e 's/[0-9]\+//'`" boot_device="`$ofpathname "$dev"`" || { # TRANSLATORS: "device tree path" is the name of the device --=_SGKmppir309PxikwRQ80FMA--