From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Y9cTI-0006UO-Oc for mharc-grub-devel@gnu.org; Fri, 09 Jan 2015 11:31:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9cTG-0006Q0-I2 for grub-devel@gnu.org; Fri, 09 Jan 2015 11:31:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9cTC-00026P-FW for grub-devel@gnu.org; Fri, 09 Jan 2015 11:31:34 -0500 Received: from mail.ixsystems.com ([69.198.165.135]:64170 helo=barracuda.ixsystems.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9cTC-00026C-9T for grub-devel@gnu.org; Fri, 09 Jan 2015 11:31:30 -0500 X-ASG-Debug-ID: 1420821086-08ca04359c03030002-Td4drV Received: from [192.168.0.51] (75-130-56-30.static.kgpt.tn.charter.com [75.130.56.30]) by barracuda.ixsystems.com with ESMTP id ZuioAUSyYBnumlXk (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Fri, 09 Jan 2015 08:31:27 -0800 (PST) X-Barracuda-Envelope-From: kris@pcbsd.org X-Barracuda-AUTH-User: kris@pcbsd.org X-Barracuda-Apparent-Source-IP: 75.130.56.30 Message-ID: <54B0025E.4020407@pcbsd.org> Date: Fri, 09 Jan 2015 11:31:26 -0500 From: Kris Moore User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Patch to fix kldstat(2) / dtrace when booting FreeBSD Content-Type: multipart/mixed; boundary="------------060307020700090901010309" X-ASG-Orig-Subj: Patch to fix kldstat(2) / dtrace when booting FreeBSD X-Barracuda-Connect: 75-130-56-30.static.kgpt.tn.charter.com[75.130.56.30] X-Barracuda-Start-Time: 1420821087 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.2.0.41:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ixsystems.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.14129 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.198.165.135 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: Fri, 09 Jan 2015 16:31:35 -0000 This is a multi-part message in MIME format. --------------060307020700090901010309 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit The following patch fixes an important issue when booting FreeBSD. FreeBSD's kldstat(2) function expects that the full pathname will be provided to kernel / modules. The current GRUB was striping this out and only leaving the filename itself. This broke dtrace and other things which used the full pathname to locate the kernel or modules on disk. The attached patch fixes this behavior. -- Kris Moore PC-BSD Software iXsystems --------------060307020700090901010309 Content-Type: text/x-csrc; name="patch-grub-core_loader_i386_bsd.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch-grub-core_loader_i386_bsd.c" diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c index 8f691e0..fb47969 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -415,11 +415,15 @@ grub_freebsd_add_meta_module (const char *filename, const char *type, grub_addr_t addr, grub_uint32_t size) { const char *name; - name = grub_strrchr (filename, '/'); + /* Don't strip the full path, some FreeBSD functionality, such + * as kldstat(2) / dtrace, rely on this. Instead we only need to remove + * any ZFS dataset information first. */ + name = grub_strrchr (filename, '@'); if (name) name++; else name = filename; + if (grub_strcmp (type, "/boot/zfs/zpool.cache") == 0) name = "/boot/zfs/zpool.cache"; --------------060307020700090901010309--