stdlib: Give user's disk_device priority when setting root val (#1467)
In `get_default_kernel_root_val()`, now prioiritizes the explicit disk_device passed from the user over the default implemented by the board. Also adjusts syntax for selecting this value in `set_kernel_disk_workload()` for consistency. It seems that the common use case for setting `disk_device` is that there is a mismatch between where the disk image is mounted and where the board expects it by default. In this case, it also seems common that the root partition will be on this explicit device as well. In cases where this is not true, explicit kernel arguments can be used to define the distinct disk device apart from the root. However, this seems less common than the above so, in that case, it would be easier to tie these together.
This commit is contained in:
@@ -126,16 +126,15 @@ class KernelDiskWorkload:
|
||||
) -> str:
|
||||
"""
|
||||
Get the default kernel root value to be passed to the kernel. This is
|
||||
determined by the value implemented in the ``get_disk_device()``
|
||||
function, and the disk image partition, obtained from
|
||||
``get_disk_root_partition()``
|
||||
determined by the user-passed or board-default ``disk_device``, and
|
||||
the disk image partition obtained from ``get_disk_root_partition()``.
|
||||
|
||||
:param disk_image: The disk image to be added to the system.
|
||||
|
||||
:returns: The default value for the ``root`` argument to be passed to the
|
||||
kernel.
|
||||
"""
|
||||
return self.get_disk_device() + (
|
||||
return (self._disk_device or self.get_disk_device()) + (
|
||||
self.get_disk_root_partition(disk_image) or ""
|
||||
)
|
||||
|
||||
@@ -196,11 +195,7 @@ class KernelDiskWorkload:
|
||||
" ".join(kernel_args or self.get_default_kernel_args())
|
||||
).format(
|
||||
root_value=self.get_default_kernel_root_val(disk_image=disk_image),
|
||||
disk_device=(
|
||||
self._disk_device
|
||||
if self._disk_device
|
||||
else self.get_disk_device()
|
||||
),
|
||||
disk_device=self._disk_device or self.get_disk_device(),
|
||||
)
|
||||
|
||||
# Setting the bootloader information for ARM board. The current
|
||||
|
||||
Reference in New Issue
Block a user