]> code.delx.au - refind/commitdiff
Updated mkrlconf, refind-install, and addition of @/boot to standard
authorsrs5694 <srs5694@users.sourceforge.net>
Fri, 6 Nov 2015 00:21:12 +0000 (19:21 -0500)
committersrs5694 <srs5694@users.sourceforge.net>
Fri, 6 Nov 2015 00:21:12 +0000 (19:21 -0500)
search path to better cope with Btrfs. Also fixed a memory management
bug in SIP code that could cause a crash if SIP features were
activated on a system that did not support SIP.

NEWS.txt
mkcdimage
mkrlconf
refind-install
refind/apple.c
refind/config.h
refind/main.c

index 827ab964dd6d36e591146cb0db0e76f8f282cc42..f661e602716c3e563c5aadfc2bf26730c626141f 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,10 @@
 0.9.3 (??/??/2015):
 -------------------
 
+- Added "@/boot" to default also_scan_dirs setting. This makes kernels
+  show up on Btrfs volumes under Ubuntu (and perhaps others), at least when
+  the Btrfs driver is loaded.
+
 - Added new System Integrity Protection (SIP) rotation feature for Macs
   running OS X 10.11 or later. This feature is disabled by default, except
   on CD-R and USB flash drive images, on which it's enabled. To enable it,
index 26cc7854a5cc24273eb2c783aa10ed05bf1a17d5..8e5649b6e4008e7d9ff5812f1e5074d1660ac387 100755 (executable)
--- a/mkcdimage
+++ b/mkcdimage
@@ -72,22 +72,10 @@ mkisofs -A "Bootable rEFInd" -V "rEFInd_$Version" -volset "rEFInd_$Version" \
     -eltorito-alt-boot -efi-boot refind-bin-$Version.img \
     -no-emul-boot ./
 
-# Below is like above, but also creates an El Torito entry for BIOS
-# booting. That's useless, but in case something flakes out without
-# it, I'll preserve this version for a while....
-#mkisofs -A "Bootable rEFInd" -V "rEFInd $Version" -volset "rEFInd $Version" \
-#    -J -r -v -x ./lost+found -o ../../refind-cd-$Version.iso \
-#    -b refind-bin-$Version.img -c boot.cat -no-emul-boot -boot-load-size 4 \
-#    -eltorito-alt-boot -efi-boot refind-bin-$Version.img \
-#    -no-emul-boot ./
-
 # Create a bootable USB flash drive image, using the FAT filesystem
 # created above and a stored partition table image (plus some empty
 # sectors)....
 #
-# Note: Seems to work on only a few systems, so I'm not distributing
-# the resulting images yet....
-#
 rm -f ../../refind-flashdrive-$Version.*
 let FatSize=`du -s refind-bin-$Version.img | cut -f 1`
 let FatSize=($FatSize)+2048
index f6369c7a70bdf71dcfbe221aed471668b45b7cd2..031c82a6012af41e2e74f759eb64f67ba520814a 100755 (executable)
--- a/mkrlconf
+++ b/mkrlconf
 
 # Revision history:
 #
-#  0.9.3 -- Renamed from mkrlconf.sh to mkrlconf
-#  0.9.0 -- Added check for OS type, to keep from running pointlessly on OS X
-#  0.7.7 -- Fixed bug that caused stray PARTUUID= and line breaks in generated file
-#  0.5.1 -- Initial release
+#  0.10.0 -- Renamed from mkrlconf.sh to mkrlconf; changed to get $DefaultOptions
+#            from /proc/cmdline rather than from GRUB
+#  0.9.0  -- Added check for OS type, to keep from running pointlessly on OS X
+#  0.7.7  -- Fixed bug that caused stray PARTUUID= and line breaks in generated file
+#  0.5.1  -- Initial release
 #
 # Note: mkrlconf version numbers match those of the rEFInd package
 # with which they first appeared.
 RLConfFile="/boot/refind_linux.conf"
 
 if [[ `uname -s` != "Linux" ]] ; then
-   echo "This script is intended to be run from Linux. Aborting!"
-   echo ""
-   exit 1
+    echo "This script is intended to be run from Linux. Aborting!"
+    echo ""
+    exit 1
 fi
 
 if [[ ! -f $RLConfFile || $1 == "--force" ]] ; then
-   if [[ -f /etc/default/grub ]] ; then
-      # We want the default options used by the distribution, stored here....
-      source /etc/default/grub
-   fi
-   RootFS=`df / | grep dev | cut -f 1 -d " "`
-   StartOfDevname=`echo $RootFS | cut -b 1-7`
-   if [[ $StartOfDevname == "/dev/sd" || $StartOfDevName == "/dev/hd" ]] ; then
-      # Identify root filesystem by UUID rather than by device node, if possible
-      Uuid=`blkid -o export -s UUID $RootFS 2> /dev/null | grep UUID=`
-      if [[ -n $Uuid ]] ; then
-         RootFS=$Uuid
-      fi
-   fi
-   DefaultOptions="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
-   echo "\"Boot with standard options\"        \"ro root=$RootFS $DefaultOptions \"" > $RLConfFile
-   echo "\"Boot to single-user mode\"          \"ro root=$RootFS $DefaultOptions single\"" >> $RLConfFile
-   echo "\"Boot with minimal options\"         \"ro root=$RootFS\"" >> $RLConfFile
+    RootFS=`df / | grep dev | cut -f 1 -d " "`
+    StartOfDevname=`echo $RootFS | cut -b 1-7`
+    if [[ $StartOfDevname == "/dev/sd" || $StartOfDevName == "/dev/hd" ]] ; then
+        # Identify root filesystem by UUID rather than by device node, if possible
+        Uuid=`blkid -o export -s UUID $RootFS 2> /dev/null | grep UUID=`
+        if [[ -n $Uuid ]] ; then
+            RootFS=$Uuid
+        fi
+    fi
+    DefaultOptions=`cat /proc/cmdline | cut -d ' ' -f 2- | sed 's/$/ /' | sed 's/initrd=.* //g' | sed 's/ *$//'`
+    echo "\"Boot with standard options\"  \"$DefaultOptions\"" > $RLConfFile
+    echo "\"Boot to single-user mode\"    \"$DefaultOptions single\"" >> $RLConfFile
+    echo "\"Boot with minimal options\"   \"ro root=$RootFS\"" >> $RLConfFile
 else
-   echo "Existing $RLConfFile found! Not overwriting!"
-   echo "To force overwriting, pass the --force option."
-   echo ""
+    echo "Existing $RLConfFile found! Not overwriting!"
+    echo "To force overwriting, pass the --force option."
+    echo ""
 fi
index a59c1580a0f3881f4e794de1efc51f92ce6c142a..663c612092496a1687cc21a9bf19c2e36de90127 100755 (executable)
@@ -167,11 +167,11 @@ GetParams() {
       echo "or --preloader! Aborting!"
       exit 1
    fi
-   if [[ "$KeepName" == 1 && "$OSTYPE" != "linux-gnu" ]] ; then
+   if [[ "$KeepName" == 1 && ("$OSTYPE" != "linux" && "$OSTYPE" != "linux-gnu") ]] ; then
       echo "The --keepname option is valid only under Linux! Aborting!"
       exit 1
    fi
-   if [[ "$KeepName" == 1 && "$TargetDir" != "/EFI/BOOT" ]] ; then
+   if [[ "$KeepName" == 1 && "$TargetDir" == "/EFI/BOOT" ]] ; then
       echo "The --keepname option is incompatible with --usedefault! Aborting!"
       exit 1
    fi
@@ -398,13 +398,11 @@ DetermineTargetDir() {
 # Determine (or guess) the filesystem used on the Linux /boot filesystem.
 # Store the result in the BootFS global variable.
 SetBootFS() {
-   local Blkid
-
    BootFS=""
    case "$OSTYPE" in
-      linux-gnu)
-           if command -v blkid 2>/dev/null; then
-              BootPart=`df /boot | grep dev | cut -f 1 -d " "`
+      linux*)
+           if command -v blkid &>/dev/null; then
+              BootPart=`df $RootDir/boot | grep dev | cut -f 1 -d " "`
               BootFS=`blkid -o export $BootPart 2> /dev/null | grep TYPE= | cut -f 2 -d =`
            fi
            ;;
@@ -607,7 +605,7 @@ MountDefaultTarget() {
       else
          mount -t msdos "$TargetPart" "$InstallDir"
       fi
-   elif [[ $OSTYPE == linux-gnu ]] ; then
+   elif [[ $OSTYPE == linux* ]] ; then
       mount -t vfat "$TargetPart" "$InstallDir"
    fi
    if [[ $? != 0 ]] ; then
@@ -1074,24 +1072,31 @@ GenerateRefindLinuxConf() {
       echo "Existing $RLConfFile found; not overwriting."
    else
       echo "Creating $RLConfFile; edit it to adjust kernel options."
-      if [[ -f "$RootDir/etc/default/grub" ]] ; then
-         # We want the default options used by the distribution, stored here....
-         source "$RootDir/etc/default/grub"
-         echo "Setting default boot options based on $RootDir/etc/default/grub"
-      fi
       RootFS=`df "$RootDir" | grep dev | cut -f 1 -d " "`
+      echo "RootFS starts as $RootFS"
       StartOfDevname=`echo "$RootFS" | cut -b 1-7`
       if [[ "$StartOfDevname" == "/dev/sd" || "$StartOfDevName" == "/dev/hd" ]] ; then
          # Identify root filesystem by UUID rather than by device node, if possible
          Uuid=`blkid -o export -s UUID "$RootFS" 2> /dev/null | grep UUID=`
          if [[ -n $Uuid ]] ; then
             RootFS="$Uuid"
+            echo "Uuid is $Uuid"
+            echo "Adjusting RootFS to $RootFS"
+         fi
+      fi
+      if [[ $RootDir == "/" ]] ; then
+         DefaultOptions=`cat /proc/cmdline | cut -d ' ' -f 2- | sed 's/$/ /' | sed 's/initrd=.* //g' | sed 's/ *$//'`
+      else
+         if [[ -f "$RootDir/etc/default/grub" ]] ; then
+            # We want the default options used by the distribution, stored here....
+            source "$RootDir/etc/default/grub"
+            echo "Setting default boot options based on $RootDir/etc/default/grub"
          fi
+         DefaultOptions="ro root=$RootFS $GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
       fi
-      DefaultOptions="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
-      echo "\"Boot with standard options\"        \"ro root=$RootFS $DefaultOptions \"" > $RLConfFile
-      echo "\"Boot to single-user mode\"          \"ro root=$RootFS $DefaultOptions single\"" >> $RLConfFile
-      echo "\"Boot with minimal options\"         \"ro root=$RootFS\"" >> $RLConfFile
+      echo "\"Boot with standard options\"  \"$DefaultOptions\"" > $RLConfFile
+      echo "\"Boot to single-user mode\"    \"$DefaultOptions single\"" >> $RLConfFile
+      echo "\"Boot with minimal options\"   \"ro root=$RootFS\"" >> $RLConfFile
    fi
 }
 
@@ -1190,7 +1195,7 @@ case "$OSTYPE" in
         fi
         InstallOnOSX $1
         ;;
-   linux-gnu)
+   linux*)
         InstallOnLinux
         ;;
    *)
index bc72cbb9e5156a8454415e29259341b076d4d62c..e5bc99a3b29117fe0b3e0e4986b2de3460bc0f88 100644 (file)
@@ -31,7 +31,7 @@ CHAR16 *gCsrStatus = NULL;
 // Get CSR (Apple's System Integrity Protection [SIP], or "rootless") status
 // information.
 EFI_STATUS GetCsrStatus(UINT32 *CsrStatus) {
-    UINT32     *ReturnValue;
+    UINT32     *ReturnValue = NULL;
     UINTN      CsrLength;
     EFI_GUID   CsrGuid = CSR_GUID;
     EFI_STATUS Status = EFI_INVALID_PARAMETER;
@@ -44,9 +44,9 @@ EFI_STATUS GetCsrStatus(UINT32 *CsrStatus) {
             } else {
                 Status = EFI_BAD_BUFFER_SIZE;
             }
-        }
-        MyFreePool(ReturnValue);
-    }
+            MyFreePool(ReturnValue);
+        } // if (Status == EFI_SUCCESS)
+    } // if (CsrStatus)
     return Status;
 } // INTN GetCsrStatus()
 
index 72c9fc0e3dd471a90b8ddb6c412109dff24f006d..b69b0a3a0544b917ee6f713b14f15524b6147a9f 100644 (file)
@@ -72,7 +72,7 @@ typedef struct {
 // Note: Below is combined with MOK_NAMES to make default
 #define DONT_SCAN_FILES L"shim.efi,shim-fedora.efi,shimx64.efi,PreLoader.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi,bootmgr.efi"
 #define DONT_SCAN_VOLUMES L"LRS_ESP"
-#define ALSO_SCAN_DIRS L"boot"
+#define ALSO_SCAN_DIRS L"boot,@/boot"
 
 EFI_STATUS ReadFile(IN EFI_FILE_HANDLE BaseDir, CHAR16 *FileName, REFIT_FILE *File, UINTN *size);
 VOID ReadConfig(CHAR16 *FileName);
index 6234a974f7d0f3020ee067e49afcff2d73f5f714..b92365048f2d798a69040c7e253207a3f5a5c19c 100644 (file)
@@ -192,7 +192,7 @@ static VOID AboutrEFInd(VOID)
 
     if (AboutMenu.EntryCount == 0) {
         AboutMenu.TitleImage = BuiltinIcon(BUILTIN_ICON_FUNC_ABOUT);
-        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.9.2.7");
+        AddMenuInfoLine(&AboutMenu, L"rEFInd Version 0.9.2.8");
         AddMenuInfoLine(&AboutMenu, L"");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2006-2010 Christoph Pfisterer");
         AddMenuInfoLine(&AboutMenu, L"Copyright (c) 2012-2015 Roderick W. Smith");