95 Commits

Author SHA1 Message Date
Maciej Borzecki
37fc0edcdc boot: decouple model from seal/reseal handling via an auxiliary type
It is desired that the seal/reseal code only operates on the input provided in
modeenv rather than poking other external structures. The change decouples the
lower level code from accessing the model directly.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-06-11 13:16:53 +02:00
Maciej Borzecki
09829e9f4e boot: tweak naming, rename SignKeyID to ModelSignKeyID
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-06-11 10:08:10 +02:00
Maciej Borzecki
3e7f75369c boot: set sign-key-id when making the system bootable
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-06-10 17:01:39 +02:00
Samuele Pedroni
37c1255389 boot/image: support image.Customizations.BootFlags
to achieve this change the signature of MakeBootableImage (also drop
now unused argument)

setImageBootFlags needed adjustments and also the tests using it
2021-04-30 21:15:38 +02:00
Michael Vogt
13723e8eb7 Merge pull request #10174 from bboozzoo/bboozzoo/uc20-recovery-make-bootable
boot: split out a helper for making recovery system bootable
2021-04-21 17:46:19 +02:00
Maciej Borzecki
0e547e485b boot: use prepare image time flag when making a recovery system bootable
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-21 12:16:43 +02:00
Maciej Borzecki
8d5f4293ee boot: split out a helper for making recovery system bootable
Split out bits that make the recovery system bootable. Those will be used
independently when creating a recovery system and setting it up for boot.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-20 13:40:16 +02:00
Maciej Borzecki
e314de5171 boot: update tests to match new error messages
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-20 11:36:57 +02:00
Maciej Borzecki
d4f888598f boot, bootloader: extend unit tests, bump year
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-15 19:21:46 +02:00
Maciej Borzecki
d392e198ee boot: support for full command line override through gadget files
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-15 19:20:21 +02:00
Maciej Borzecki
f070eda096 boot: set kernel command line arguments when making the new run system usable
When setting up the run system, set the kernel command line arguments provided
by the gadget.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-12 10:21:10 +02:00
Maciej Borzecki
08fa3319de Merge branch 'bboozzoo/uc20-cmdline-in-recovery-system' into bboozzoo/uc20-cmdline-in-run-mode 2021-04-12 10:20:52 +02:00
Maciej Borzecki
973781113b boot: set extra kernel command line arguments when making a recovery system bootable
When preparing an image, make sure that the recovery system contains the kernel
command line arguments requested by the gadget.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-09 14:13:38 +02:00
Maciej Borzecki
dae4b64fec boot: provide the gadget snap path when sealing keys for recovery systems
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-08 12:27:53 +02:00
Ian Johnson
216271e125 boot/makebootable.go: drop rootdir from MakeRunnableSystem
This parameter is no longer used.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-03-11 11:45:29 -06:00
Ian Johnson
98078d6ee5 boot, o/devicestate: split makeBootable20 into two parts
Split makeBootable20 into two parts, one MakeRunnableSystem and
MakeBootableImage, with the former being exclusively for image-prepare time ops,
and the latter being for UC20 install mode preparing an active run system.

Additionally, for MakeRunnableSystem, remove out the final bit which sets the
boot variables and officially marks the point at which the system is ready to be
rebooted into the run mode. This will allow us to refactor the install mode
changes more easily in a future commit, but for now we get the same behavior
with EnsureNextBootToRunMode() in the install mode setup-run-system task.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2021-03-09 20:25:47 -06:00
Maciej Borzecki
4e42aa7be7 boot: record current system as good when installing
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-02-18 14:37:45 +01:00
Maciej Borzecki
b7907d925a boot: set kernel command line in modeenv during install
Populate modeenv with kernel command line during installation.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-11-30 14:15:53 +01:00
Ian Johnson
5caf44461f boot/makebootable.go: set snapd_recovery_mode=install at image-build time
This is the first step to doing away with the current default of
snapd_recovery_mode being unset implying "install". We need prepare-image (and
thus also ubuntu-image) to start writing "snapd_recovery_mode=install".

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2020-11-16 18:24:14 -06:00
Maciej Borzecki
50db1a0a85 boot: boot config install API change, update tests
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-11-13 14:31:16 +01:00
Ian Johnson
16a875474b boot: tweak test output for MockSecboot{,Re}SealKeys 2020-11-02 17:25:29 +01:00
Maciej Borzecki
4b1213ccb0 boot: update calls to (Re)SealKeys
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-11-02 14:27:30 +01:00
Claudio Matsuoka
274580e652 boot: update tests for multiple key seal and reseal
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
2020-10-29 23:32:36 -03:00
Maciej Borzecki
75f4bed5cf boot: look at the gadget for run mode bootloader when making the system bootable
When setting up a UC20 run mode system, the bootloader config may have been
installed when populating the ubuntu-boot partition. However, for trusted assets
bootloader which have their configuration managed directly by snapd, the config
will only be installed though an explicit call to InstallBootConfig().

Tweak the code to use the gadget snap to identify the right bootloader.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-09-30 09:03:21 +02:00
Maciej Borzecki
9a6c9db431 boot: make asset observers aware of system data partitions being encrypted
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2020-09-29 14:49:26 +02:00