-
Notifications
You must be signed in to change notification settings - Fork 199
driver/bareboxdriver.py: Add parameter 'boot_command' #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportBase: 63.2% // Head: 63.2% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #1071 +/- ##
======================================
Coverage 63.2% 63.2%
======================================
Files 152 152
Lines 11330 11330
======================================
Hits 7169 7169
Misses 4161 4161 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but boot_command
should be documented in doc/configuration.rst
.
@@ -1595,6 +1595,7 @@ Arguments: | |||
- bootstring (regex, default="Linux version \\d"): regex that indicating that the Linux Kernel is | |||
booting | |||
- password (str): optional, password to use for access to the shell | |||
- boot_command (str, default="boot -v"): optional, boot command to boot target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@@ -206,4 +208,4 @@ def boot(self, name: str): | |||
if name: | |||
self.console.sendline(f"boot -v {name}") | |||
else: | |||
self.console.sendline("boot -v") | |||
self.console.sendline(self.boot_command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at this again: I think this can be quite confusing. self.boot_command
is only used if name is set to an empty string. I don't think that's right. At the very least, this should be documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, it's like: With boot_command
you can overwrite the global default 'boot -v' and thus set a 'new' global default. This in turn can be overwritten with name
if necessary. def boot(self, name: str = ""):
Do you have a suggestion on how it might be more intuitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Letting name default to an empty string looks good to me and should be adopted also by the UBootDriver.
Is setting boot_command
and calling barebox.boot("mmc0")
a valid use case? If it isn't, we could raise an exception in that case. This also applies to the UBootDriver.
In general: I don't really understand why you'd want to set a custom boot command and use the boot method, neither in barebox nor in U-Boot (and I know that boot_command
is already implemented in the UBootDriver, but still). If you don't use the standard boot command, what keeps you from simply calling barebox.console.sendline("bootm ..")
in your strategy/script? What's the benefit here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we have 2 usecases:
- Set a default boot source in the config using it the complete test. This works for UbootDriver via boot_command, but not with the BareboxDriver. The BareboxStrategy calls the BareboxDriver,boot("") so you need to configure the barebox itself. It would be nice to do this in the config with the supposed change.
- With GraphStrategy we can define different boot scenarios and go with "via" to a shell booted from the selected source. For this a direct choose through BareboxDriver,boot(SOURCE) would be helpful. This works for BareboxDriver, but not for UbootDriver. (U-Boot boot commands Support #1082)
Is there a prefer Way to select the boot_command? Should we get rid of the Driver.boot functions and set the drivers boot source only via strategy?
The difference between the barebox "boot -v NAME" and uboot "COMMAND" was choosen because we consider the barebox interface to be more stable. If needed we could remove the "run" from the uboot boot_command and also select a target (environment script).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we have 2 usecases:
- Set a default boot source in the config using it the complete test. This works for UbootDriver via boot_command, but not with the BareboxDriver. The BareboxStrategy calls the BareboxDriver,boot("") so you need to configure the barebox itself. It would be nice to do this in the config with the supposed change.
- With GraphStrategy we can define different boot scenarios and go with "via" to a shell booted from the selected source. For this a direct choose through BareboxDriver,boot(SOURCE) would be helpful. This works for BareboxDriver, but not for UbootDriver. (Wip/uboot boot #1082)
This does not really answer my question, does it? I see the boot methods as a convenience feature to boot the regular way (i.e. boot [<name>]
) . If you need anything special, you could just do it yourself (see my suggestion). I see no downside to this.
Is there a prefer Way to select the boot_command? Should we get rid of the Driver.boot functions and set the drivers boot source only via strategy?
I think for the regular case, they are convenient, see above. Everything else could be handled in a strategy.
The difference between the barebox "boot -v NAME" and uboot "COMMAND" was choosen because we consider the barebox interface to be more stable. If needed we could remove the "run" from the uboot boot_command and also select a target (environment script).
I don't really understand this.
Don't get me wrong here, I'm not strictly against the PR, especially since we have the same in the UBootDriver, but I'd like to prevent implementing special cases and overcomplicating the code if the alternative has no obvious downside and does not involve patching the driver.
I guess @Emantor and @jluebbe should weigh in because they reviewed #621.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we have 2 usecases:
- Set a default boot source in the config using it the complete test. This works for UbootDriver via boot_command, but not with the BareboxDriver. The BareboxStrategy calls the BareboxDriver,boot("") so you need to configure the barebox itself. It would be nice to do this in the config with the supposed change.
- With GraphStrategy we can define different boot scenarios and go with "via" to a shell booted from the selected source. For this a direct choose through BareboxDriver,boot(SOURCE) would be helpful. This works for BareboxDriver, but not for UbootDriver. (Wip/uboot boot #1082)
This does not really answer my question, does it? I see the boot methods as a convenience feature to boot the regular way (i.e.
boot [<name>]
) . If you need anything special, you could just do it yourself (see my suggestion). I see no downside to this.
We currently work with a static strategy for most tests, like
self.barebox.boot("") |
The idea was to handle the boot source via the driver.
def boot
seams to be place to do this.Adding it as a strategy parameter would also work. I would be nice to have the same API for barebox and u-boot driver.
Is there a prefer Way to select the boot_command? Should we get rid of the Driver.boot functions and set the drivers boot source only via strategy?
I think for the regular case, they are convenient, see above. Everything else could be handled in a strategy.
The difference between the barebox "boot -v NAME" and uboot "COMMAND" was choosen because we consider the barebox interface to be more stable. If needed we could remove the "run" from the uboot boot_command and also select a target (environment script).
I don't really understand this.
This was mostly about #1082
Don't get me wrong here, I'm not strictly against the PR, especially since we have the same in the UBootDriver, but I'd like to prevent implementing special cases and overcomplicating the code if the alternative has no obvious downside and does not involve patching the driver.
I guess @Emantor and @jluebbe should weigh in because they reviewed #621.
6c4b3ad
to
8fbc6de
Compare
Sorry, I am not yet familiar with your processes. |
5972615
to
72ff289
Compare
To adapt the BareboxDriver and be consistent with the UBootDriver, the parameter 'boot_command' is added. Now you can do something like this: targets: main: drivers: BareboxDriver: boot_command: "boot net" Signed-off-by: Fabian Meuren <[email protected]>
Add 'test_barebox_boot' test to meet code coverage and maintain related documentation Signed-off-by: Fabian Meuren <[email protected]>
72ff289
to
6f3e055
Compare
Is this still relevant since we now have proper boot command support for the |
Yes this is the equivalent default boot command for the BareboxDriver |
gently ping |
To adapt the BareboxDriver and be consistent with the UBootDriver, the parameter 'boot_command' is added. Now you can set the boot source and do something like this:
targets:
main:
drivers:
BareboxDriver:
boot_command: "boot net"
Signed-off-by: Fabian Meuren [email protected]