-
Notifications
You must be signed in to change notification settings - Fork 26
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
Allow for custom image partition schemes. #29
Conversation
b4915b2
to
6d0c7cd
Compare
Looks good other than as I mentioned in #28, I'm not seeing a need for creating multiple image files at one time. |
Please explain how you see this image registry working. Also, how does the new I'm envisioning having a folder called |
Drivers are registered with a 'name' that identifies the driver as well as a file type suffix. Names are unique. The disk image file name is generated from the basename of
So the necessary identifying information is simply appended to the basename specified with E.g., assuming
In a follow up integration PR, we introduce a commandline option ( From the configuration developer perspective:
From the end-user perspective you can specify the exact set of image types to generate, provided corresponding drivers are available either from brickstrap defaults or from the component selection, using the |
It's getting late and I'm about to call it quits, so I haven't read your previous comment yet. However, I wanted to let you know that I just pushed a branch with some image drivers so that you can see what I am hoping for in an image driver. Feel free to make comments on it as to how you see it fitting into what you are proposing here. |
One thing I would like to do is call a |
The thing I like:
The aspects which I think just don't work right at the moment, and are better addressed in this PR already:
|
6d0c7cd
to
1c26be5
Compare
I've updated my PR to provide necessary integration bits as well. Additionally I added support for validation of custom configuration options (register additional validator functions), and I've also integrated one of your default drivers, so you can see how that should work now. See brickstrap-image-drivers.sh for the example of how I integrated the "redundant rootfs + data" image type. |
brp_create_image_type img || BRP_IMAGE_RETURN_CODE=$? | ||
fi | ||
|
||
return $BRP_IMAGE_RETURN_CODE |
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.
If you are building more than one image and the first one fails and later ones succeed, won't this function still return success? It seems like if one fails we should just be calling fail
and stopping brickstrap altogether.
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.
If you are building more than one image and the first one fails and later ones succeed, won't this function still return success?
It shouldn't. brp_create_image_types
should return non-zero if any of the types fail (it uses a different variable internally so it is safe). The ||
means that BRP_IMAGE_RETURN_CODE
is set only on failure. So the end result should be that the exit code will correspond to the one from the last image to fail.
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.
got it.
1c26be5
to
0b06d81
Compare
I think it is preferable to let the create-image step continue as much as it can. During development of a project configuration it may be that you accidentally break more than one image type, so it seems preferable to have a somewhat more comprehensive report (via the error messages) than just failing immediately on the first bad image. Also, it makes it slightly easier for an end-user to work around a broken image type: even if one image build fails, another might succeed and present a viable interim alternative. |
I would really rather not have the driver name part of the file name if I am creating only one image file. |
To keep things consistent with the images I have been publishing, the image name should just be |
0b06d81
to
c2c2119
Compare
Sure, that can be done. I don't really see/understand why that is necessary, though. Question: would this special case behaviour also extend to not enforcing the corresponding file suffix (i.e.
You could also execute brickstrap a bit differently: simply specify |
How about the case when you want to make multiple images using the same driver with different parameters, for example IMAGE_SIZE? Rather than trying to handle such cases in brickstrap, I propose that we just advocate the following... Brickstrap only creates one image file when you run If you want to override the default settings of the driver, then use the corresponding environment variables. e.g. If you want to override the driver, use the If you want to override the basename of the image file, use the If you want to build additional images, then use the
For now, you can abuse the |
Uh: you can do so right now using the exact same create-image workflow you suggest already. There is no extra handling or support in brickstrap required for that, and I certainly do not propose we add it (I don't see what this would buy us, see next paragraph). Besides: how often would you want to do that versus wanting to make different image types? I'd think that between those two cases the scales would tip in favour of different types over sizes -- mainly because you generally either do not statically fix the size of the image or you have a very particular target in mind anyway (so only one specific size). Being able to generate multiple types of images as part of the same build command isn't all that exotic or out-there. It's kind of how you roll with tools like yocto/open-embedded (it is one of the few features of open-embedded that is actually easy to use for a novice user).
Let's keep the inferred default file name for the image as it is in this PR. I think the alternative has a few drawbacks:
I think my main objection is that the proposal doesn't make the brickstrap code significantly less complicated (all it really would amount to is removing two outer loops that invoke two particular functions so you can invoke those two functions with fixed arguments directly). At the same time it also does not make brickstrap any easier to use, having to fiddle with options. So I don't see what we gain by reverting to generating only a single fixed image, albeit one selected via commandline options. |
About yocto specifically: this section of its manual explains how image generation works with yocto/open-embedded. TL;DR summary is: you set up the variable IMAGE_FSTYPES in a local build config |
The point that I am trying to make is that if this already works, why are we inventing a new method to do the same thing? The complexity is not in the implementation, but rather in trying to explain "if you want to make more than one image, you can do it this way, but it only works in some cases otherwise, you have to do it this other way". Just saying "do it this way" is much simpler.
Always. I can't think of a single real-life use case for me personally (distributing images for EV3, RPi1/2 and BeagleBone) that could not be accomplished by using the default image driver and environment variables (that would be set in the Although the full truth is that the answer is neither. I don't have a single real-life case where I would want to produce more than one image from a given rootfs.
That's fine as long as there is some way I can have full control over the entire basename of the file name (not including the file extension).
By default, (i.e. the Offtopic: The reason I keep pushing back so hard about these theoretical use cases is exactly that - they are theoretical. I maintain brickstrap because it meets a real need for me (distributing images for the ev3dev.org project). If others come along with real needs and want to modify brickstrap in a way that can meet their need as well without breaking my needs, then great. However, I am quickly getting tired of spending my time thinking about what someone might want to do instead of working on something that actually meets a real need. @BrendanSimon has a real need for something other than the default image driver, so if we can make some sort of hook for him to latch on to, then great, but I expect him to do most of the work for actually implementing the driver to meet his needs. I would like to keep brickstrap as simple and minimalistic as possible. If you are interested in something more all-encompassing, maybe checkout ELBE that I heard about recently on the emdebian mailing list. These are great ideas that you have, I just can't justify spending the time it is taking me to keep up at this rate with your innovations and really understand what you are doing. It is unfortunate, but that is the way it is. |
Or if you want to reverse the roles where you are the maintainer and I am a contributor that is an option too. 😄 |
OK: that is fair enough. Going forward, it seems that the basic functionality of the PR is agreed on but that image generation should be restricted to a single image.
This is not currently the case: by default it is actually I'll readjust the PR to take your feedback into account and rework the |
c2c2119
to
705b7fc
Compare
Ok, so how does this version look which reduces the number of images being generated in a single brickstrap back down to one and ensures you have full control over the image base name (sans suffix) through By default an image name looks like this: |
{ | ||
[ $# -eq 1 -a -n "$1" ] && case "$1" in | ||
default) | ||
echo -n brp_image_default_driver |
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.
Are you missing ;;
here? I just tried running brickstrap from this branch and got
brickstrap-image.sh: line 90: syntax error near unexpected token `)'
Works after I add ;;
default) | ||
echo -n img | ||
*) | ||
eval echo -n "\$BRP_IMG_EXT_REGISTRY_$1" |
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.
;;
I'll update the PR to include the fixes found. |
You may want to wait a bit. I still can't get brickstrap to run. |
705b7fc
to
db87b97
Compare
At what point does it fail? I'm currently doing a test run and it proceeds happily to download stage with options: |
Somewhere in
|
Found the problem. #35 |
# | ||
function br_register_image_type() | ||
{ | ||
[ $# -ge 3 -a -n "$1" -a -n "$2" -a -n "$3" ] && \ |
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.
Since this is a public function, I would still rather see an error message here rather than failing silently if the parameters are bad.
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.
Agreed. Will update the PR.
6fa30d3
to
5d541a7
Compare
This commit provides preliminary support for custom partitioning schemes/image file types. For discussion refer to: issue ev3dev#10: ev3dev#10 This commit covers the following changes: - Introduce brickstrap-image.sh module for custom partitioning support. - Introduce brickstrap-image-drivers.sh module for default image type drivers. - Introduce -l option to select partitioning layout/image type driver at build time. - Source custom-image.sh files after sourcing configs. - Permit custom image type drivers to register validation functions, which are invoked during brp_init_env() - Add br_image_name, br_image_type and br_image_path functions which take no arguments. (Rename old br_image_path to brp_image_path). - Add support for DEFAULT_IMAGE_TYPE variable for project configurations to override default image type to create. - Fix bug/regression (command line parsing errors out with commands in second to last position). See issue ev3dev#35: ev3dev#35
5d541a7
to
9958215
Compare
|
Thanks for compromising with me. |
This commit provides preliminary support for custom partitioning schemes/image file types.
For discussion refer to: issue #10:
#10
This change assumes some artefacts provided by PR #28 are available:
#28
Specifically: br_image_dir() and br_image_path() functions.
This change does not address integration within brickstrap.sh itself (should be trivial, though).