OS-7260: SmartOS should support booting with loader

Details

Issue Type:Improvement
Priority:3 - Elevated
Status:Resolved
Created at:2018-09-22T06:06:02.427Z
Updated at:2019-04-08T15:39:16.075Z

People

Created by:Former user
Reported by:Former user
Assigned to:Former user

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2019-04-08T15:39:16.059Z)

Fix Versions

2019-04-11 Pete Hornberger (Release Date: 2019-04-11)

Related Issues

Description

As a first step on the long road to making SmartOS UEFI-aware, this ticket is to ween us off of GRUB by changing build_iso to create ISOs and USB images that use loader instead of GRUB - similar to say OpenIndiana.

Comments

Comment by Former user
Created at 2018-10-10T16:06:56.523Z
Updated at 2018-10-17T04:30:13.172Z

As part of this, I'm writing a new tool, build_image, that will replace the existing code for building SmartOS USB images and ISOs. It will also fold in the functionality for creating the proforma USB images used by the tools in joyent/sdc-headnode to create Triton boot media. Thus, tools/images/make_image will go away.


Comment by Former user
Created at 2018-10-10T16:08:06.192Z

My changes rely on the ability to create named LOFI devices (i.e. lofiadm -la). Currently this doesn't seem to work inside a zone, so I'm testing my changes in the GZ for now.


Comment by Former user
Created at 2018-10-15T18:21:32.935Z
Updated at 2018-10-15T22:36:05.534Z

Other things in smartos-live that will need updates as a result of this change:

1. overlay/generic/lib/svc/method/fs-joyent

Its current logic for trying to find/mount the usbkey involves iterating through every disk and looking for a /dev/dsk/{disk}p0 that has a pcfs filesystem. It then mounts it and looks for a .joyliveusb file.

For the new-style GPT/loader images, the root filesystem will be on /dev/dsk/{disk}s2.

The logic should probably be changed to check both places, so that it can support both the old and new style usb keys.

2. overlay/generic/lib/sdc/config.sh

This script has a bit of code that takes the output of sysinfo -p and passes it through eval to set up variables for all of the boot parameters.

# Loads sysinfo variables with prefix (default: SYSINFO_)
function load_sdc_sysinfo {

    prefix=$1
    [[ -z ${prefix} ]] && prefix="SYSINFO_"

    eval $(/usr/bin/sysinfo -p | sed -e "s/^/${prefix}/")
}

When booted under Loader there are a pair of boot parameters present with embedded '#' characters in the parameter name and this causes the eval to choke. I don't think there's any practical way to have a '#' character in a bash lvalue, so I think we'll need to extend the sed statement to strip out the '#' character if it's on the left side of the equal operator.


Comment by Former user
Created at 2018-10-15T18:33:00.429Z

Note that it's not in the OS proper, but if the partition/slice layout for Triton USB media is going to change we should also update sdc-usbkey in sdc-headnode.git; e.g., tools/lib/usbkey.js.


Comment by Former user
Created at 2018-10-15T20:15:05.233Z

Indeed - see TRITON-855.


Comment by Former user
Created at 2018-10-25T16:59:46.532Z

Re: load_sdc_sysinfo - a similar fix was necessary for the code in the same file that parsed /sbin/bootparams. We should audit the code base for any use of this elsewhere.


Comment by Former user
Created at 2019-02-18T17:11:43.133Z

The parts of this about the boot image is covered by OS-7309, I re-purposed this title to cover the set of changes we have in both smartos-live and illumos-joyent that aren't covered by a more specific bug.


Comment by Former user
Created at 2019-02-19T17:58:05.611Z
Updated at 2019-02-19T17:59:02.147Z

To enable additional flexibility with what we do in the Loader menu.rc, the following forth words are being added:

place

append

These new words are also leveraged by the changes for OS-7595.


Comment by Former user
Created at 2019-04-01T10:21:41.321Z
Updated at 2019-04-01T16:52:41.277Z

Testing done on the newboot bits as a whole:

QA have also been testing under QA-358


Comment by Former user
Created at 2019-04-01T15:55:07.647Z

NB: Rob also has changes to the Triton docs. As they are done via github pulls not gerrit, they're not mentioned in this CR set:

https://cr.joyent.us/#/q/topic:newboot


Comment by Former user
Created at 2019-04-02T18:29:18.625Z

I forgot to mention I also walked through a lab Manta deployment


Comment by Jira Bot
Created at 2019-04-08T09:05:15.721Z

sdc-headnode commit 252de200998ced060fb693fbfaaacaf62798fedf (branch master, by John Levon)

OS-7260 SmartOS should support booting with loader
OS-7309 build tools should support loader-based boot images
HEAD-2249 boot menu should show PI version
TRITON-855 Triton headnode tools need to handle new boot architecture
TRITON-933 Put mount-usb.sh out to pasture
TRITON-1016 Need to build and deliver the ipxe EFI binary
Reviewed by: Josh Wilsdon <josh@wilsdon.ca>
Approved by: Josh Wilsdon <josh@wilsdon.ca>


Comment by Jira Bot
Created at 2019-04-08T09:05:34.484Z

illumos-joyent commit fa83485c3551a3fd3848f1535acb98b30c6595a2 (branch master, by John Levon)

OS-7260 SmartOS should support booting with loader
OS-7271 proto.boot should include loader instead of grub
OS-7332 RICHMOND-16 mitigation ensnares stock loaders
OS-7584 MDB module for disk labelling would be useful
OS-7585 Need workaround to EFI boot on AMI BIOS
OS-7595 Triton-specific extensions to Loader
Portions contributed by: Rob Johnston <rob.johnston@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Robert Mustacchi <rm@joyent.com>


Comment by Jira Bot
Created at 2019-04-08T09:05:40.160Z

smartos-live commit b1b596be209110c23936346fdf403020c3fca336 (branch master, by John Levon)

OS-7260 SmartOS should support booting with loader
OS-7271 proto.boot should include loader instead of grub
OS-7309 build tools should support loader-based boot images
OS-7364 fs_joyent.sh test needs quotes
Portions contributed by: Rob Johnston <rob.johnston@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Robert Mustacchi <rm@joyent.com>