]> code.delx.au - refind/commitdiff
Merge commit '2ede1b8a25d32e057bcb9d246a9fd855a09bfc7c'
authorsrs5694 <srs5694@users.sourceforge.net>
Mon, 3 Oct 2016 17:58:34 +0000 (13:58 -0400)
committersrs5694 <srs5694@users.sourceforge.net>
Mon, 3 Oct 2016 17:58:34 +0000 (13:58 -0400)
CREDITS.txt
NEWS.txt
debian/control
docs/refind/getting.html
docs/refind/sip.html
filesystems/fsw_ext4.c
filesystems/fsw_ext4.h
refind-install
refind.spec

index 1200d4483b3c721cdb96e16f71a4f7ea6058d4b1..821c2115c7cb6ab74223cb569462e23ecce063c7 100644 (file)
@@ -47,6 +47,9 @@ Program (C source code) files:
   contributed them to this project, along with several miscellaneous
   improvements.
 
+* Martin Whitaker (other@martin-whitaker.me.uk) added 64-bit support
+  to the ext4fs driver.
+
 * Emerson Barcelos (emerson_freitas@yahoo.com.br) wrote the code for
   enabling Intel VMX support (the enable_and_lock_vmx token in
   refind.conf).
index 7da2c69f16e466150f74a9d32a668916b2f0ae99..219353aea2aa16e66c7e64e8bfa97bb492a190ca 100644 (file)
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,3 +1,9 @@
+0.10.4 (?/??/2016):
+-------------------
+
+- Tweaked refind-install to do a better job of detecting disks other
+  than /dev/sd? and /dev/hd? devices.
+
 0.10.3 (4/24/2016):
 -------------------
 
index 4a9c48c49afe44e7e5388447132873406430a178..83be274bfdff41c4166bf8e1d7b114d413b22f5e 100644 (file)
@@ -10,13 +10,13 @@ Vcs-Git: git://anonscm.debian.org/collab-maint/refind.git
 
 Package: refind
 Architecture: amd64 i386 arm64
-Depends: debconf, efibootmgr, openssl, sbsigntool, parted, ${misc:Depends}
+Depends: debconf, efibootmgr, openssl, sbsigntool, parted, util-linux, ${misc:Depends}
 Description: boot manager for EFI-based computers
  A graphical boot manager for EFI- and UEFI-based computers, such as all
  Intel-based Macs and recent (most 2011 and later) PCs. rEFInd presents a
  boot menu showing all the EFI boot loaders on the EFI-accessible
  partitions, and optionally BIOS-bootable partitions on Macs and BIOS boot
- entries on UEFI PCs with CSMs. EFI-compatbile OSes, including Linux,
+ entries on UEFI PCs with CSMs. EFI-compatible OSes, including Linux,
  provide boot loaders that rEFInd can detect and launch. rEFInd can launch
  Linux EFI boot loaders such as ELILO, GRUB Legacy, GRUB 2, and 3.3.0 and
  later kernels with EFI stub support. EFI filesystem drivers for ext2/3/4fs,
index 3fa39c9772619aaa9aded40e1f586dee91822f65..f80f3a202579baa4523ec896156680ce93d59106 100644 (file)
@@ -17,7 +17,7 @@
 href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Originally written: 3/14/2012; last Web page update:
-4/24/2016, referencing rEFInd 0.10.3</p>
+6/24/2016, referencing rEFInd 0.10.3</p>
 
 <p>This Web page is provided free of charge and with no annoying outside ads; however, I did take time to prepare it, and Web hosting does cost money. If you find this Web page useful, please consider making a small donation to help keep this site up and running. Thanks!</p>
 
@@ -235,25 +235,50 @@ BIOS-booted computer.</p>
 
 <p>I know of a small number of pre-packaged versions of rEFInd, either in official OS repositories or in ancillary repositories:</p>
 
-<p class="sidebar"><b>Warning:</b> Ubuntu 16.04's <tt>sbsigntool</tt> package has a bug that causes the <tt>sbsign</tt> utility to crash randomly. (See <a href="https://bugs.launchpad.net/ubuntu/+source/sbsigntool/+bug/1574372">this bug report</a> for details.) When installing Ubuntu with Secure Boot active from the PPA, this bug will be triggered and is likely to prevent successful installation. Therefore, I recommend you disable Secure Boot or install from the Debian package (with the <tt>sbsigntool</tt> package <i>uninstalled</i>) to avoid this problem. This bug does not exist in Ubuntu 15.10 and earlier.</p>
-
 <ul>
 
-<li><a name="ppa"><b>Ubuntu</b></a>&mdash;Although an official Ubuntu package
-    isn't available, I've created a <a
-    href="https://launchpad.net/~rodsmith/+archive/refind">rEFInd PPA</a> for
-    Ubuntu. To use it, open a Terminal window and type <tt
-    class="userinput">sudo apt-add-repository ppa:rodsmith/refind</tt>, then <tt
-    class="userinput">sudo apt-get update</tt>. You can then type <tt
-    class="userinput">sudo apt-get install refind</tt> to install the package.
-    You'll be asked to decide whether to install rEFInd to the ESP when you
-    first install it. Thereafter, the rEFInd version will update along with your
-    other software. This package is built with GNU-EFI and is not signed with a
-    Secure Boot key; however, the install script should sign the binary with a
-    locally-generated key if it detects that your system uses Secure Boot. Thus,
-    if you've previously installed one of my binaries on a Secure Boot system
-    and added its key as a MOK, you'll have to add your local key when you
-    reboot.</li>
+<li><b>Debian</b>&mdash;Debian added rEFInd 0.10.3 to its "sid" (unstable")
+    repository in June of 2016. Because most people don't use this
+    "bleeding-edge" version of the distribution, it is not yet a practical
+    option for most users; but it is on the way. You can download and
+    install it as a separate package <a
+    href="https://packages.debian.org/unstable/admin/refind">here.</a>
+    Debian's inclusion of rEFInd means that derivative distributions, such
+    as Ubuntu and Mint, will eventually receive rEFInd packages, too. Be
+    aware that Debian's package is not signed with a Secure Boot key,
+    although if the <tt>sbsigntool</tt> package is installed, the
+    installation scripts will generate and use their own Secure Boot
+    keys and sign the binary with them.</li>
+
+<li><b>Ubuntu</b>&mdash;Two Ubuntu-specific methods of installing rEFInd in
+    this distribution exist:
+
+    <ul>
+
+    <li>Ubuntu 16.10 ("Yakkety Yak") has synced the Debian package. As I
+       write (in late June, 2016), it's not yet available in the
+       repositories, but it should appear there eventually. Note that, like
+       the Debian package, this one is not signed for use with Secure Boot,
+       but if your system includes the <tt>sbsigntool</tt> package, the
+       installer will generate a local key for this purpose.</li>
+
+    <li>I've created a <a
+       href="https://launchpad.net/~rodsmith/+archive/refind">rEFInd
+       PPA</a> for Ubuntu. To use it, open a Terminal window and type <tt
+       class="userinput">sudo apt-add-repository ppa:rodsmith/refind</tt>,
+       then <tt class="userinput">sudo apt-get update</tt>. You can then
+       type <tt class="userinput">sudo apt-get install refind</tt> to
+       install the package. You'll be asked to decide whether to install
+       rEFInd to the ESP when you first install it. Thereafter, the rEFInd
+       version will update along with your other software. This package is
+       built with GNU-EFI and is not signed with a Secure Boot key;
+       however, the install script should sign the binary with a
+       locally-generated key if it detects that your system uses Secure
+       Boot. Thus, if you've previously installed one of my binaries on a
+       Secure Boot system and added its key as a MOK, you'll have to add
+       your local key when you reboot.</li>
+
+    </ul></li>
 
 <li><b>Arch Linux</b>&mdash;You can obtain rEFInd from the Arch
     repositories, in both a stable version (the <tt>refind-efi</tt> package
index bf46e6ec8b2c821c0181f409f2ea977e29bf2415..6d0c907af175ac8e7e944de4030631e0f6a612ff 100644 (file)
@@ -283,7 +283,7 @@ href="mailto:rodsmith@rodsbooks.com">rodsmith@rodsbooks.com</a></p>
 
 <p>Once rEFInd is installed, you can use it to manage SIP features; however, the rEFInd features needed to do this are disabled by default. You must uncomment or add two lines to your <tt>refind.conf</tt> file:</p>
 
-<p class="sidebar"><b>Note:</b> Apple code samples and technical discussions are filled with the acronym "CSR." I don't know what this acronym means, but as it appears to be used in preference to "SIP" or "rootless" when referring to specific values, I used it in the <tt>refind.conf</tt> files token names.</p>
+<p class="sidebar"><b>Note:</b> Apple code samples and technical discussions are filled with the acronym "CSR." I don't know what this acronym means, but as it appears to be used in preference to "SIP" or "rootless" when referring to specific values, I used it in the <tt>refind.conf</tt> file's token names.</p>
 
 <ul>
 
index 2cf009b5066113e66213eae32a02cdb68a9d8c05..7557629691d07fbf99b6784e81d96092dcda99e0 100644 (file)
@@ -93,10 +93,10 @@ static int fsw_ext4_group_sparse(fsw_u32 group)
 }
 
 /* calculate the first block number of the group */
-static __inline fsw_u32
+static __inline fsw_u64
 fsw_ext4_group_first_block_no(struct ext4_super_block *sb, fsw_u32 group_no)
 {
-        return group_no * (fsw_u32)EXT4_BLOCKS_PER_GROUP(sb) +
+        return group_no * (fsw_u64)EXT4_BLOCKS_PER_GROUP(sb) +
                 sb->s_first_data_block;
 }
 
@@ -110,7 +110,8 @@ static fsw_status_t fsw_ext4_volume_mount(struct fsw_ext4_volume *vol)
     fsw_status_t    status;
     void            *buffer;
     fsw_u32         blocksize;
-    fsw_u32         groupcnt, groupno, gdesc_per_block, gdesc_bno, gdesc_index, metabg_of_gdesc;
+    fsw_u32         groupcnt, groupno, gdesc_per_block, gdesc_index, metabg_of_gdesc;
+    fsw_u64         gdesc_bno;
     struct ext4_group_desc *gdesc;
     int             i;
     struct fsw_string s;
@@ -140,7 +141,7 @@ static fsw_status_t fsw_ext4_volume_mount(struct fsw_ext4_volume *vol)
     if (vol->sb->s_rev_level == EXT4_DYNAMIC_REV &&
         (vol->sb->s_feature_incompat & ~(EXT4_FEATURE_INCOMPAT_FILETYPE | EXT4_FEATURE_INCOMPAT_RECOVER |
                                          EXT4_FEATURE_INCOMPAT_EXTENTS | EXT4_FEATURE_INCOMPAT_FLEX_BG |
-                                         EXT4_FEATURE_INCOMPAT_META_BG)))
+                                         EXT4_FEATURE_INCOMPAT_64BIT | EXT4_FEATURE_INCOMPAT_META_BG)))
         return FSW_UNSUPPORTED;
 
     if (vol->sb->s_rev_level == EXT4_DYNAMIC_REV &&
@@ -187,7 +188,7 @@ static fsw_status_t fsw_ext4_volume_mount(struct fsw_ext4_volume *vol)
     gdesc_per_block = EXT4_DESC_PER_BLOCK(vol->sb);
     
     // Read the group descriptors to get inode table offsets
-    status = fsw_alloc(sizeof(fsw_u32) * groupcnt, &vol->inotab_bno);
+    status = fsw_alloc(sizeof(fsw_u64) * groupcnt, &vol->inotab_bno);
     if (status)
         return status;
 
@@ -220,6 +221,8 @@ static fsw_status_t fsw_ext4_volume_mount(struct fsw_ext4_volume *vol)
         // Get group descriptor table and block number of inode table...
         gdesc = (struct ext4_group_desc *)((char *)buffer + gdesc_index * vol->sb->s_desc_size);
         vol->inotab_bno[groupno] = gdesc->bg_inode_table_lo;
+        if (vol->sb->s_desc_size >= EXT4_MIN_DESC_SIZE_64BIT)
+            vol->inotab_bno[groupno] |= (fsw_u64)gdesc->bg_inode_table_hi << 32;
 
         fsw_block_release(vol, gdesc_bno, buffer);
     }
@@ -254,8 +257,18 @@ static void fsw_ext4_volume_free(struct fsw_ext4_volume *vol)
 
 static fsw_status_t fsw_ext4_volume_stat(struct fsw_ext4_volume *vol, struct fsw_volume_stat *sb)
 {
-    sb->total_bytes = (fsw_u64)vol->sb->s_blocks_count_lo * vol->g.log_blocksize;
-    sb->free_bytes  = (fsw_u64)vol->sb->s_free_blocks_count_lo * vol->g.log_blocksize;
+    fsw_u64         count;
+
+    count = vol->sb->s_blocks_count_lo;
+    if (vol->sb->s_desc_size >= EXT4_MIN_DESC_SIZE_64BIT)
+        count |= (fsw_u64)vol->sb->s_blocks_count_hi << 32;
+    sb->total_bytes = count * vol->g.log_blocksize;
+
+    count = vol->sb->s_free_blocks_count_lo;
+    if (vol->sb->s_desc_size >= EXT4_MIN_DESC_SIZE_64BIT)
+        count |= (fsw_u64)vol->sb->s_free_blocks_count_hi << 32;
+    sb->free_bytes  = count * vol->g.log_blocksize;
+
     return FSW_SUCCESS;
 }
 
@@ -270,7 +283,8 @@ static fsw_status_t fsw_ext4_volume_stat(struct fsw_ext4_volume *vol, struct fsw
 static fsw_status_t fsw_ext4_dnode_fill(struct fsw_ext4_volume *vol, struct fsw_ext4_dnode *dno)
 {
     fsw_status_t    status;
-    fsw_u32         groupno, ino_in_group, ino_bno, ino_index;
+    fsw_u32         groupno, ino_in_group, ino_index;
+    fsw_u64         ino_bno;
     fsw_u8          *buffer;
 
     if (dno->raw)
@@ -418,7 +432,8 @@ static fsw_status_t fsw_ext4_get_by_extent(struct fsw_ext4_volume *vol, struct f
                 // Is the requested block in this extent?
                 if(bno >= ext4_extent->ee_block && bno < ext4_extent->ee_block + ext4_extent->ee_len)
                 {
-                    extent->phys_start = ext4_extent->ee_start_lo + (bno - ext4_extent->ee_block);
+                    extent->phys_start = ((fsw_u64)ext4_extent->ee_start_hi << 32) | ext4_extent->ee_start_lo;
+                    extent->phys_start += (bno - ext4_extent->ee_block);
                     extent->log_count = ext4_extent->ee_len - (bno - ext4_extent->ee_block);
                     return FSW_SUCCESS;
                 }
@@ -435,7 +450,8 @@ static fsw_status_t fsw_ext4_get_by_extent(struct fsw_ext4_volume *vol, struct f
                 if(bno >= ext4_extent_idx->ei_block)
                 {
                     // Follow extent tree...
-                    status = fsw_block_get(vol, ext4_extent_idx->ei_leaf_lo, 1, (void **)&buffer);
+                    fsw_u64 phys_bno = ((fsw_u64)ext4_extent_idx->ei_leaf_hi << 32) | ext4_extent_idx->ei_leaf_lo;
+                    status = fsw_block_get(vol, phys_bno, 1, (void **)&buffer);
                     if (status)
                         return status;
                     buf_offset = 0;
index df7ad3581938bc036456bb12be58a71fcf435f25..f6889d0dc9f8149f02097fe84e9fcb27469f9c3c 100644 (file)
@@ -46,7 +46,7 @@ struct fsw_ext4_volume {
     struct fsw_volume g;            //!< Generic volume structure
     
     struct ext4_super_block *sb;    //!< Full raw ext2 superblock structure
-    fsw_u32     *inotab_bno;        //!< Block numbers of the inode tables
+    fsw_u64     *inotab_bno;        //!< Block numbers of the inode tables
     fsw_u32     ind_bcnt;           //!< Number of blocks addressable through an indirect block
     fsw_u32     dind_bcnt;          //!< Number of blocks addressable through a double-indirect block
     fsw_u32     inode_size;         //!< Size of inode structure in bytes
index b28a79eb01f77a749f8c13878b984b41ded07860..19da6a0b09d225cfbfde70caff12b70b3dd7b649 100755 (executable)
@@ -39,6 +39,7 @@
 
 # Revision history:
 #
+# 0.10.4  -- Improved handling of disks (other than /dev/[sh]d? disks).
 # 0.10.2  -- Improved Secure Boot detection in Linux, fixed --usedefault in OS X,
 #            and fixed bug that could cause mountesp to be installed as a FILE
 #            called /usr/local/bin in OS X.
@@ -1052,13 +1053,15 @@ ReSignBinaries() {
 # and EspFilesystem the filesystem (always "vfat")
 FindLinuxESP() {
    echo "The ESP doesn't seem to be mounted! Trying to find it...."
+   local Name
    local Drive
    local PartNum
    local TableType
    local DmStatus
    local SkipIt
    local Dmraid
-   for Drive in `ls /dev/[sh]d?` ; do
+   for Name in `lsblk -r | grep disk | cut -f 1 -d " "` ; do
+      Drive="/dev/$Name"
       SkipIt=0
       Dmraid=`which dmraid 2> /dev/null`
       if [ -x "$Dmraid" ] ; then
@@ -1109,7 +1112,13 @@ FindMountedESP() {
    if [[ $EspFilesystem != 'vfat' ]] ; then
       echo "$RootDir/$InstallDir doesn't seem to be on a VFAT filesystem. The ESP must be"
       echo "mounted at $RootDir/boot or $RootDir/boot/efi and it must be VFAT! Aborting!"
-      exit 1
+      if [[ -d /sys/firmware/efi ]] ; then
+         exit 1
+      else
+         echo "The computer appears to be running in BIOS mode and has no ESP. You should"
+         echo "create an ESP, and ideally boot in EFI mode, before installing rEFInd."
+         exit 0
+      fi
    fi
    echo "ESP was found at $InstallDir using $EspFilesystem"
 } # FindMountedESP
index 6bf717083e0cbad101902686ff7ed977fe1dd35f..c3849cdaa4a11ca1b7e1ccc165cf40e902778a68 100644 (file)
@@ -37,7 +37,7 @@ A graphical boot manager for EFI- and UEFI-based computers, such as all
 Intel-based Macs and recent (most 2011 and later) PCs. rEFInd presents a
 boot menu showing all the EFI boot loaders on the EFI-accessible
 partitions, and optionally BIOS-bootable partitions on Macs and BIOS boot
-entries on UEFI PCs with CSMs. EFI-compatbile OSes, including Linux,
+entries on UEFI PCs with CSMs. EFI-compatible OSes, including Linux,
 provide boot loaders that rEFInd can detect and launch. rEFInd can launch
 Linux EFI boot loaders such as ELILO, GRUB Legacy, GRUB 2, and 3.3.0 and
 later kernels with EFI stub support. EFI filesystem drivers for ext2/3/4fs,