-
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 scheme #10
Comments
I'm all for this. The Ping-Pong Rootfs and Golden Rootfs are outside of the scope of brickstrap (other than being implemented in a board definition directory), but we can certainly create images that can be used by these. I'm thinking that we modify the create-image function to check for a file named I also have a use case for BeagleBone Black where I need to offset the initial partition a bit to leave room for |
Sure. The upgrade process is user specific, but it relies on an underlying partition scheme having been setup. I wouldn't want to repartition on the fly. That's just asking for trouble ;-) System can use their own update scripts or other software. Currently I'm trialling |
The guestfish utility does not seem to have prepared disk images for anything other than two partitions. e.g. -N bootroot I think for my usecase, -N bootroot, followed by part-add would probably work, but the hard part is determining the start and stop sectors (probably not that hard). Would be nice to specify order of partitions, size and let the utility work it out. Similar to But for total generality, one can not assume the number of partitions or filesystem types, so I'm guessing that we need to use:
|
You can see a more general form of using guestfish that I started for the BBB here. You are on the right track. |
I have hard-coded the sectors, but you could make bash do the math. |
Also the partition to resize to max available space needs to be configurable. In my use case this would be partition 4, the |
Actually, I think resizing is done on the running system. It should be possible to do this on an actual SD card mounted in the CHROOT environment, yes? Though I guess that wont work for devices using onboard flash (eMMC, etc). |
Yes, that is how it is currently done and is the easiest way in my opinion.
If you want to resize the partitions on an SD card "offline", the best way would be to use a partitioning tool like |
I notice that wikiepedia says the partition type for FAT32 should be 0Ch for capacity > 7.8GB, and 0Bh for capacity < 7.8GB
My linux kernel isn't booting properly (it hangs) when I boot off Sandisk Ultra 16GB & 32GB Micro SD cards, but works perfectly well with Sandisk Ultra 8GB card. I'm wondering if the MBR type of 0Bh could be an issue? Or I could have just got lucky with the 8GB card and/or unlucky with the 16GB/32GB card? |
Your FAT partition is < 7.8GB in all cases though, right? So partition type is always |
Yes (64MB) but even if there was a need to increase it, it would definitely be < 7.8GB. |
The Wikipedia article isn't very clear on the 'why' of it, and what the issue actually is. It's nothing to do with FAT16 versus FAT32 per se because that distinction is about limits on file systems and not disk partitions (which is what this limit is about). The specific limit here is the size of the partition in number of sectors. (Which is still different from capacity limits in bytes, as sectors can in theory vary in size as well.) Specifically the limit is due to the fact only 24 bits are used to describe the size of the partition (leaving the first/last 8 out of 32 for a tag, i.e. the boot flag or partition type). See: http://www.win.tue.nl/~aeb/partitions/partition_tables-2.html |
Once PR #28 is merged, the new
|
This commit provides preliminary support for custom partitioning schemes/image file types. For discussion refer to: issue ev3dev#10: ev3dev#10 This change assumes some artefacts provided by PR ev3dev#28 are available: ev3dev#28 Specifically: br_image_dir() and br_image_path() functions. This change does **not** address integration within brickstrap.sh itself (should be trivial, though).
This commit provides preliminary support for custom partitioning schemes/image file types. For discussion refer to: issue ev3dev#10: ev3dev#10 This change assumes some artefacts provided by PR ev3dev#28 are available: ev3dev#28 Specifically: br_image_dir() and br_image_path() functions. This change does **not** address integration within brickstrap.sh itself (should be trivial, though).
This commit provides preliminary support for custom partitioning schemes/image file types. For discussion refer to: issue ev3dev#10: ev3dev#10 This change assumes some artefacts provided by PR ev3dev#28 are available: ev3dev#28 Specifically: br_image_dir() and br_image_path() functions. This change does **not** address integration within brickstrap.sh itself (should be trivial, though).
Will the new scheme do the following?
In my use case, the contents of rootfs2.tar is exactly the same as rootfs1.tar (or empty). The two partitions are used for active software and inactive software (for upgrades). The other scenario is rootfs1 and rootfs2 are different contents. |
I don't think so. The way guestfish works is that you can create mount points, so you make a guestfish script that mounts each partition to the appropriate place in the file system. Then you just use a single tar to populate everything. In your case where you have 2 identical partitions where one is probably not mounted, you can just dd the contents of one partition to another in the image that is created.
It's an option, but... this would be a waste of cpu since the tar would be compressed, only to be uncompressed when creating the image file. The tar is only meant to be a temporary intermediate file. The rest of your comments seem to be just a repeat of the first item, so to sum up, sure you can do this, you just need to write a guestfish script to do it. |
There is the use case for burning an SD card with all partitions and contents in one easy step :) The other use case is for remotely upgrading units in the field with the same or similar partition scheme. In that case I would be transferring the tar.gz files (over a slowish cellular network), then uncompressing/unarchiving into the inactive/upgrade partition. Generally this will just be one rootfs image, however there is another case where the the bootloader (BOOT.BIN, which includes u-boot and an FPGA firmware blob) may require updating (usually due to FPGA firmware updates) and possibly uEnv.txt also. So it would be nice to be able to generate an archive of each filesystem, as well as be able to have a combo of the filesystems as disk image. If brickstrap or guestfish can't support this for some reason, then the I will have to do it as a post-processing task. If I understand what you are saying about guestfish, it requires a single tar image of the entire filesystem, with known directories (mount points) which it will use to copy information to the disk image partitions. A post processing step could (optionally) do the same thing to generate the individual rootfs archives. Not sure if guestfish can be used to extract the files from the image into the archives? Hmmm, interesting .... |
OK. For this sort of thing, I would run |
OK, a hook can be used, though I'm not sure what a |
Components are implement, just no proper docs yet. This should give you an idea of how it works though. |
In the context of my earlier comment, |
The scheme permits the project/configuration author to execute custom bash functions during the
Yes: you could do this by creating a corresponding driver for each type of rootfs/image you wish to output.
Yes, though it is more advisable to use the Where:
The advantage of sticking to the name specified in But if you really do not care about that and you really care about the exact file names you can either:
Sure: custom drivers amount to a bash function so you can do pretty much anything you like in there.
Ditto.
Ditto. The caveat is of course: with a custom driver you have to figure out the right commands or right guestfish script to set up your image the way you want from just the |
@BrendanSimon, have a look at https://github.com/ev3dev/brickstrap/blob/3bd88298f6405503a4535c259bb3e31770b6a4b6/image-drivers/reduntant-rootfs-plus-data it does just about everything you are asking, I think. guestfish is really amazing and can do just about anything. Read all about it: http://libguestfs.org/guestfish.1.html |
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 drivers 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() - Remove brp_create_image() which is superseded by brp_create_images().
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 drivers 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() - Remove brp_create_image() which is superseded by brp_create_images().
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 drivers 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() - Remove brp_create_image() which is superseded by brp_create_images().
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.
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.
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
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
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
After some revisions PR #29 is now merged. This issue can probably be closed. @BrendanSimon ? |
I will take a look and will let you know :) |
Recoverable Partition Scheme
Currently the image creation is fixed in the brickstrap.sh script. It would be better if this was factored out user/target to configuration, so that each build type can specify it's own partition scheme, etc.
My use case is for devices deployed in remote locations, that need to be remotely upgraded, and cannot be bricked if something goes wrong in the upgrade process. e.g. loss of network, power drop out, etc. In general this is solved by have multiple rootfs partitions.
My use case
More general use case
Other partitioning schemes can be considered, including those with logical volumes, extended volumes, lvm, etc.
Ping-Pong Rootfs
When a reboot occurs, the boot loader should have the capability to fallback to the last working rootfs if the latest rootfs fails integrity checks, does not load properly or does not run to a certain state where it would set something to notify the bootloader of it's success (e.g. a u-boot env var). This is sometimes referred to as a ping-pong rootfs system.
Golden Rootfs
A similar approach is to have the first partition the golden partition that never gets touched once programmed in the factory, and the second rootfs is the only one that gets upgraded. This can have issues of upgrading an upgraded system. i.e. upgrading a running system. It can be solved by booting into the golden partition before doing the upgrade of the 2nd partition. This can mean the system is down while doing the upgrade, which may not be acceptable.
An extension of the Golden Rootfs is to have a 3 rootfs partions -- one golden that never ever gets touched, and two other rootfs partitions for ping-pong. The Golden (or Recovery/Fallback) partition is usually small and simple whose main purpose is to be able to upgrade the main rootfs partitions with valid information.
The text was updated successfully, but these errors were encountered: