From owner-freebsd-ia64@FreeBSD.ORG Tue Jan 26 18:25:10 2010 Return-Path: Delivered-To: ia64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C2411065679 for ; Tue, 26 Jan 2010 18:25:10 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout023.mac.com (asmtpout023.mac.com [17.148.16.98]) by mx1.freebsd.org (Postfix) with ESMTP id 7879E8FC14 for ; Tue, 26 Jan 2010 18:25:10 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp023.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KWV00IIK9TLIV20@asmtp023.mac.com> for ia64@freebsd.org; Tue, 26 Jan 2010 10:24:58 -0800 (PST) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-0908210000 definitions=main-1001260131 From: Marcel Moolenaar Date: Tue, 26 Jan 2010 10:24:57 -0800 Message-id: To: ia64@freebsd.org X-Mailer: Apple Mail (2.1077) Cc: Subject: About /boot being a symlink to /efi/boot and ZFS X-BeenThere: freebsd-ia64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the IA-64 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2010 18:25:10 -0000 All, Due to limitations of the EFI loader, files under /boot had to be on the EFI system partition for the boot process to work. And in order to boot the new kernel after building an installing a new kernel, the only viable option for that was to make /boot a symlink to /efi/boot and mount the EFI system partition under /efi by default. While initially this was mostly preventing us from having more than 1 FreeBSD installation on a single machine, over time this showed to cause bigger problems. The first and foremost problem is that it causes the kernel to panic when you use ZFS. The reason for the panic is that ZFS maintains a cache file that lives under /boot/zfs on FreeBSD. This is because /boot/zfs really is /efi/boot/zfs on ia64 and /efi is a FAT file system that needs the Giant lock, which ZFS simply does not deal with well or at all. To solve this issue, I had 3 choices: ZFS-1 Teach ZFS about Giant for the time that Giant is still around ZFS-2 Fix the FAT file system implement by not needing Giant ZFS-3 Eliminate /boot as a symlink to /efi/boot A second problem recently popped up when mergemaster started to compare file and directory types and started to complain about /boot not being a directory like it should be. While this isn't a big issue, mergemaster has no way of ignoring directories so it'll will always come up. To solve the mergemaster issue, I had 2 choices: MM-1 Extend mergemaster to allow it to ignore directories without ignoring the files in them MM-2 Eliminate /boot as a symlink to /efi/boot It has always been nice to be able to install multiple versions of FreeBSD, especially for development and maintenance, and for that to happen, I had to eliminate /boot as a symlink to /efi/boot. You get the drift... So, I changed to not use the EFI file system protocol, but rather the EFI block I/O protocol. This make the loader aware of the partitions on the disk. Using FreeBSD's file system support on top of that, we were able to read from the EFI system partition, a FreeBSD UFS file system and even ISO9660s. Secondly, I added a command line argument to the loader (a boot option in EFIs boot manager terminology) so that one can select the default partition to boot from. With these 2 changes, the loader can boot FreeBSD directly from the UFS root file system and consequently /boot does not have to be a symlink onto /efi and both ZFS and mergemaster are happy campers. To migrate your existing installation to the new scheme, follow the following instructions: 1. Upgrade to the latest 8-STABLE or 9-CURRENT sources. 2. Perform a full 'make buildworld' and 'make buildkernel' 3. Perform a 'make installworld' only [after step 3 you have the latest loader on /efi] 4. Remove the /boot symlink (and only the symlink) 5. Perform a 'make installworld' again -- a bit excessive, but easier for the instructions. [after step 5 you have a minimally populated /boot on the root file system] 6. Perform a 'make installkernel' -- this installs the latest kernel in /boot on the root file system. [after step 6 the EFI file system holds the preview kernel and the UFS root file system holds the latest kernel] 7. Copy /efi/boot/loader.conf and /efi/boot/device.hints to /boot/loader.conf and /boot/device.hinst (resp). 8. From /boot/loader.conf, remove the vfs.root.mountfrom line. 9. Copy the FreeBSD loader to a more proper directory. Type: # mkdir /efi/FreeBSD # cp /efi/boot/loader.efi /efi/FreeBSD 10. Reboot. 11. In the EFI boot manager, add a new entry for FreeBSD by using "FreeBSD/loader.efi" as the loader and "-dev part2:" as the boot option string (can be either Unicode or ASCII). 12. Boot FreeBSD. Check that the loader version is 2.1. If not, you're not using the right loader. If the loader version is right but the loader cannot find a kernel, run 'lsdev' in the loader to list all partitions and try them until you find the right one. Note that part0: can be expected to be the EFI system partition, so you that only if you can't find a kernel on any other partitons. Remember to update the EFI boot manager accordingly. [In FreeBSD, running the latest kernel] 13. Cleanup the EFI system partition: # rm -rf /efi/boot NOTE: The installation process has not been changed yet, so a new installation still makes /boot a symlink to /efi/boot. This is being worked on -- the installation needs to add a boot entry to the EFI boot menu to make sure the loader knows which partition to boot from. FYI, -- Marcel Moolenaar xcllnt@mac.com