-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Feature request: tryboot support in pi-gen #677
Comments
That sounds good. Maybe using the same approach as buildroot uses (mtools and genimage) might simplify export-image and make it easy for the user to provide their own genimage.conf file. Is your current work to support tryboot_a_b public anywhere? |
No. We are still early in development. Here is what I have changed to set the rootfs size: export-image/prerun.sh
I set $ROOT_SIZE in the config file. If it doesn't exist, I fall back to the original setting. Also, along with creating the whole eMMC image, I extract the rootfs image that can be loaded live: export-image/05-finalize/01-run.sh:
To keep the load image small, it only includes partition p1 (fat32 boot) and p2 (rootfs ext4). I have removed the call to "resize2fs" in "stage2/01-sys-tweaks/files/resize2fs_once". Instead, on first run, I create a blank p3 the same size as p2 and format it ext4. Then I create a data drive with the remainder p4 as ext4, and mount that off of root. This supports the old tryboot.txt mechanism. To support tryboot_a_b, I would have to create a second boot partition p3 (fat32) and rootfs partition p4 (ext4), with the remainder for data, p5 (ext4). Note that this is 5 partitions, so the eMMC would have to be GPT instead of MBR partitioning. |
There is a few steps I added to pi-gen to help with implementing tryboot_a_b. You may want to consider these. export-image/05-finalise/01-run.sh:
export-image/prerun.sh:
My rc.local, but this could be added to the pi runonce script:
We stream the file [image name].tar.gz through our web server. Our update manager pipes the stream to tar by calling popen("tar --overwrite –xvz -C /dev -f -"). The "-C" switch tells tar to run in the /dev directory. The tar file contains two files, bootfs and rootfs. The dev directory has the symbolic links /dev/bootfs and /dev/rootfs, which point to the secondary partitions. So tar is unzipping the files directly to the partitions. If pclose() succeeds, that tells us that the partitions are loaded and intact, since targz does integrity checks. At this point, we do the tryboot. If successful, we change the symbolic links to point to the old partitions to set up for the next update. |
@muellR Is your update manager completely custom or based upon SWupdate/other? I'm interested in how people manage synchronizing / schedule updates on APT based systems. |
Our software is ported to run on several platforms with various operating systems, so our update management is custom and unique to each one. To the outside world, you HTTP POST to a special file to perform OS updates. |
We are using pi-gen to build a customized version of the Raspberry Pi OS Lite (removing some packages, adding others). We want to support the the tryboot_a_b option. This requires me to modify pi-gen to create 5 partitions: two boot (Fat32), two rootfs (ext4), and a data partition. I would need to be able to declare the sizes of the boot and rootfs partitions, leaving the remainder for the data partition. I have already modified the process to take the desired rootfs partition size from the config file, but I don't like doing this. It makes it difficult to upgrade pi-gen, because I have to make sure that my changes have been properly merged into the update.
The text was updated successfully, but these errors were encountered: