want nextboot (one time boot) support
Originally created by Andriy Gapon as https://reviews.freebsd.org/D7612.
The idea is to provide an mechanism for "one time" boot config, meaning, if such config is set, the system will read and remove this config on next boot, and the followup boot will use normal (permanent) boot configuration.
The "nextboot" configuration is stored in pool label pad2 area, which is currently otherwise unused. The boot loader will read the pad2 content, and will remove the config by zeroing the pad2 area, so the next boot will not see the nextboot config and will use normal bootfs property based setup.
Since in illumos the boot environments are managed by beadm command, I don't see much need for another separate tool, so I did extent beadm activate to have two addition options, -t to set nextboot config and -T to remove it. Also beadm list and bootadm list-menu are updated to present the information.
Use case example:
root@test:/home/tsoome# beadm activate -t test Activated successfully root@test:/home/tsoome# beadm list BE Active Mountpoint Space Policy Created multiboot-16 - - 5,56M static 2016-10-30 23:53 multiboot-17 NR / 106K static 2016-11-06 13:42 test T - 12,6G static 2016-11-06 13:45 root@test:/home/tsoome#
and after reboot:
tsoome@test:~$ beadm list BE Active Mountpoint Space Policy Created multiboot-16 - - 5,56M static 2016-10-30 23:53 multiboot-17 R - 2,42M static 2016-11-06 13:42 test N / 12,7G static 2016-11-06 13:45 tsoome@test:~$
Some time has passed since this work was started, now the current update is based on two changes:
We are using nvlist based data encoding in bootenv area (previous pad2), we provide tooling to update nvlist from os and from boot loader. This way we can implement persistent data storage.
Loader zfs reader is updated to handle bootenv nvlist read and write, and nvlist updates (remove pair, add pair).
From OS userland, the data translation to/from nvlist is done in libzfsbootenv.
The initial publication of this change is https://illumos.org/rb/r/249/, now also available on Gerrit.