I am submitting the following fast-track on behalf of Konstanin Ananyev and Sherry Moore. Minor release binding is requested. The timeout is set for 02-18-2009.
-jg 1. Introduction 1.1. Project/Component Working Name: Introducing libgrubmgmt library for GRUB menu management. 1.2. Name of Document Author/Supplier: Konstantin Ananyev 1.3. Date of This Document: 01/07/2009 1.3.1. Date this project was conceived: 06/01/2008 2. Project Summary 2.1. Project Description: This project will provide a library to process the GRUB menu. The library libgrubmgmt provides APIs to locate the active menu.lst, parse it and interpret GRUB menu entries. 2.2 Risks and Assumptions: This project has dependencies on stable GRUB menu format for Solaris. 4. Technical Description: 4.1. Details: The library libgrubmgmt provides APIs to locate the active menu.lst, parse the menu and interpret GRUB menu entries. It will interpret the following GRUB menu entry commands: findroot, bootfs, kernel, kernel$, module, module$. When Fast Reboot is enabled either by setting the "config/fastreboot_default" property in "system/boot-config" service to "true", or by invoking reboot(1M) with the "-f" option directly, the library will be used by commands reboot(1M) or init(1M) 6 to extract boot arguments associated with the default or specified menu entry from menu.lst. If libgrubmgmt fails to interpret the GRUB menu entry, reboot(1M) and init(1M) would fall back to the regular reboot behavior. 4.1.1 APIs and Consumers With initial integration, the consumers of the library are reboot(1M) and init(1M) on x86. They are only using the two of the interfaces listed in section 4.5 Interfaces grub_get_boot_args() grub_cleanup_boot_args() Other utilities that manipulate GRUB menus, such as bootadm(1M), can be modified to leverage this library, at which point additional interfaces can be ARC'ed. 4.1.2 Examples On systems with "config/fastreboot_default" set to "true": # reboot # init 6 Fast reboot with bootargs from the default GRUB menu entry. # reboot 3 Fast reboot with bootargs from the 3rd GRUB menu entry. For example for the following default GRUB menu entry: title benew1 findroot (BE_benew1,0,a) bootfs rpool/ROOT/benew1 kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS module$ /platform/i86pc/$ISADIR/boot_archive # reboot is equivalent to: # reboot -f -- rpool/ROOT/benew1 \ /platform/i86pc/kernel/amd64/unix \ -B zfs-bootfs=rpool/ROOT/benew1,\ bootpath="/pci at 0,0/pci10de,5c at 9/pci108e,4131 at 1/sd at 0,0:a" 4.2. Bug/RFE Number(s): 6768468 Introducing svc:/system/boot-config service 6775160 reboot -f ignores active BE and resets zfs pool bootfs property 4.5. Interfaces: Minor binding only. INTERFACE COMMITMENT LEVEL ===================================================== /lib/libgrubmgmt.so.1 consolidation private /lib/libgrubmgmt.so consolidation private /usr/include/libgrubmgmt.h consolidation private SUNWgrubu consolidation private grub_get_boot_args() consolidation private grub_cleanup_boot_args() consolidation private grub_strerror() consolidation private 4.6. Doc Impact: Man pages for reboot(1M) needs to be modified. 4.6.1 Man pages for reboot(1M) Example 3 Fast Rebooting The following examples use the f option to perform fast reboots. The following command reboots to the default entry in the grub | menu file menu.lst. | example# reboot -f 4.6.2 New man pages for libgrubmgmt See appendix A. 4.7. Admin/Config Impact The System Administration Guide needs to be updated to reflect the change in the behavior when no command line arguments are provided to reboot(1M). 6. Resources and Schedule: 6.4. Steering Committee requested information 6.4.1. Consolidation C-team Name: ON 6.5. ARC review type: FastTrack 6.6. ARC Exposure: open Appendix A GRUB Menu Management Library Functions grubmgmt(3GRUBMGMT) NAME grub_get_boot_args - collect boot argument from the specified GRUB menu entry. If entrynum == -1, default GRUB menu entry will be used. grub_cleanup_boot_args - clean up and releases all the resources allocated by grub_get_boot_args. SYNOPSIS cc [ flag... ] file... -lgrubmgmt [ library... ] #include <libgrubmgmt.h> int grub_get_boot_args(grub_boot_args_t *bargs, int entrynum); void grub_cleanup_boot_args(grub_boot_args_t *bargs); PARAMETERS entrynum Integer representing the entry or line number in the menu. bargs Pointer to boot argument data structure. DESCRIPTION The grub_get_boot_args() function returns the boot arguments from the specified GRUB menu entry in the first argument. If entrynum is -1, default GRUB menu entry will be used. Caller must allocate grub_boot_args_t and call the function with a pointer to it as its first argument. The grub_cleanup_boot_args() function clean up and releases all the resources allocated by grub_get_boot_args(). RETURN VALUES grub_get_boot_args() returns zero on success and an error value on failrue. See errno.h for details. ATTRIBUTES See attributes(5) for descriptions of the following attri- butes: ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | Interface Stability | Evolving | |_____________________________|_____________________________| | MT-Level | Safe | |_____________________________|_____________________________| SEE ALSO errno.h(3HEAD)