Currently the logic of boot has a lot of per-snap-type cheks in the
exported functions. Going forwards into core20 we know these checks
are going to get more involved, so now is a good time to switch things
around so that different implementations exist for each of the
situations, and thus the checks can be done while looking up which
implementation to use, instead of in each of the functions.
The Bootloader.Dir() method is no longer needed and can be removed.
It used to be used to extract kernel assets but that is now part
of the Bootloader interface so expect for test code nothing is
using "Dir()" anymore. The extraction of boot assets is now done
via the Bootloader interface directly.
Note that Dir() also does not make sense for bootloaders that work
inside partitions (like littleKernel).
Little Kernel(lk) is popular bootloader used by many arm SoCs
Reference source: https://github.com/littlekernel/lk
As it is often used by Android devices, almost every Qualcomm and MTK SoCs
are supporting lk.
lk is using boot image format, which packs kernel, initrd, dtbs. This is then
flashed to dedicated boot partition.
As lk is minimalistic bootloader it does not support advanced scripting
as u-boot does.
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
After moving ExtractKernelAssets and RemoveKernelAssets implementation to bootloader's
implementation, tests needs to be updated.
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
Different bootloaders might have different requirements about boot
asset extraction. Cleaner way is to move this implementation to each
bootloader implementation
Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>
The bootloader code is old and does not use the current pattern
of "bootloader_test" and only accessing exported data. This PR
fixes this by moving bits into the "bootloader_test" style.
Sorry, its boring and a bit mechanic.
For historic (and organic) reasons the bootloader/bootloader_test.go
code contains an implementation of a mock bootloader. However this
is redundant now that we have boot/boottest/mockbootloader.go
that implements the same. So this PR updates the bootloader_test
code to use the common mock loader.
The 'partition' package is actually about bootloaders, so 'bootloader' name
seems more fitting.
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>