Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1750 +/- ##
==========================================
+ Coverage 84.64% 84.75% +0.10%
==========================================
Files 76 76
Lines 22752 23000 +248
==========================================
+ Hits 19258 19493 +235
- Misses 3494 3507 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4c0aeaf to
b85184b
Compare
b85184b to
5dbb004
Compare
5dbb004 to
0f8fbc1
Compare
|
Rebased onto current master, as the dependant #1752 is merged. |
0f8fbc1 to
999d390
Compare
|
Just rebased onto current master |
999d390 to
5a0eeb2
Compare
|
Got rid of unneeded function call and function parameter. And improved some code comments. |
0d1b2ba to
3311795
Compare
|
rebased and refactored to match latest changes in master branch |
2a5394a to
a351d18
Compare
|
Just made some minor adjustments to comments, commit messages, and a test case. |
This function takes a partition of an eMMC and applies a regex to it in order to find out the base dev. This makes it easier to find out if two partitions are targeting the same eMMC. Signed-off-by: Lars Schmidt <[email protected]>
In cases where the file descriptor is just opened to get the size of the device, it is useful to have this encapsulated to make usage easier and reduce code duplication. Signed-off-by: Lars Schmidt <[email protected]>
Introduced the `r_slot_get_all_of_type()` function to retrieve all slots of a specified type. This provides a convenient way to filter slots by type, and will make future implementations easier. Signed-off-by: Lars Schmidt <[email protected]>
a351d18 to
44a63a9
Compare
|
rebased onto master to resolve conflicts. |
44a63a9 to
2dc9558
Compare
Move toggling and checking of active partition to its own function . The function takes the currently active boot partition from its parameters and changes the active boot partition to the currently inactive boot partition. It also validates if the activation was successful, in order to check for a known ioctl ext_csd bug, see [1]. This encapsulates already existing code into a function and makes it easier to reuse and avoids duplication in the future. [1]: https://rauc.readthedocs.io/en/latest/advanced.html#update-bootloader-in-emmc-boot-partitions Signed-off-by: Lars Schmidt <[email protected]>
Add validation function check_emmc_linked_slots for emmc-boot-linked slots to ensure unique boot devices, required parent slots, and same base device for linked pairs. This way a faulty configuration gets detected early and the user is notified accordingly. Signed-off-by: Lars Schmidt <[email protected]>
This adds an update handler for the 'emmc-boot-linked' slot type that just copies the image to the respective emmc boot partition (without touching the boot partition bit in extCSD). The handler also handles migration from a different boot slot configuration, like boot-emmc: If the target slot for the bootloader update is the same as the currently used one, RAUC will backup the current bootloader to the inactive boot partition first. Signed-off-by: Lars Schmidt <[email protected]>
The emmc tests will get extended. As preparation the emmc tests are moved to their own file. This separates the tests more clearly and makes it easier to distinguish them from other tests. Especially the emmc tests can not be executed in every environment as they need need RAUC_TEST_EMMC in the os environment. Signed-off-by: Lars Schmidt <[email protected]>
Add test coverage for emmc-boot-linked handler including migration, error conditions, and multi-slot configurations. Signed-off-by: Lars Schmidt <[email protected]>
Add description about the new slot type and describe how the migration to this slot type is done. It adds the possibility to group single eMMC boot slots with rootfs and other slots in order to provide a fallback mechanism for systems on eMMC. Signed-off-by: Lars Schmidt <[email protected]>
2dc9558 to
5e7ab43
Compare
| g_return_val_if_fail(error == NULL || *error == NULL, FALSE); | ||
|
|
||
| /* Pattern to find valid MMC/eMMC base device */ | ||
| *base_device = r_regex_match_simple("(/dev/mmcblk[0-9]+)", device_path); |
There was a problem hiding this comment.
The regex should be anchored at the start:
| *base_device = r_regex_match_simple("(/dev/mmcblk[0-9]+)", device_path); | |
| *base_device = r_regex_match_simple("^(/dev/mmcblk[0-9]+)", device_path); |
| itself (like the :ref:`default mechanism <sec-emmc-boot>` would) | ||
| but will leave that to the bootloader. | ||
| RAUC simply maintains the boot state, which the bootloader then uses | ||
| to activate the correct boot partition on the eMMC, perform a reset, |
There was a problem hiding this comment.
| to activate the correct boot partition on the eMMC, perform a reset, | |
| to activate the correct boot partition on the eMMC, perform a reset, |
| RAUC simply maintains the boot state, which the bootloader then uses | ||
| to activate the correct boot partition on the eMMC, perform a reset, | ||
| and start the OS with its matching bootloader. | ||
| This reduces the effort required to maintain bootloader and OS consistency. |
There was a problem hiding this comment.
| This reduces the effort required to maintain bootloader and OS consistency. | |
| This can reduce the effort required to maintain bootloader and OS compatibility, | |
| as each OS version is only started by a specific bootloader version. | |
| On the other hand, protecting against bootloader downgrades becomes more complex. |
|
|
||
| When migrating to this mechanism, the currently used eMMC boot partition and system slot | ||
| may not yet match those which are linked. | ||
| This case is handled by RAUC in order to avoid inconsistent results and unbootable systems. |
There was a problem hiding this comment.
| This case is handled by RAUC in order to avoid inconsistent results and unbootable systems. | |
| In order to avoid inconsistent results and unbootable systems, this case is handled by RAUC. |
| During the update process, RAUC compares the bootloader update target with | ||
| the currently activated bootloader. |
There was a problem hiding this comment.
| During the update process, RAUC compares the bootloader update target with | |
| the currently activated bootloader. | |
| During the update process, RAUC checks if the bootloader update target is | |
| the currently activated bootloader partition. |
| } | ||
| static gboolean emmc_boot_linked_migration_helper(RaucImage *image, RaucSlot *dest_slot, GError **error) |
There was a problem hiding this comment.
Add empty line. Also, the image parameter is unused.
| /* Check if the target slot is the currently active eMMC boot partition */ | ||
| g_message("Active eMMC boot partition for %s: boot%d", real_dest, active_partition); | ||
| g_autofree gchar *boot_suffix = g_strdup_printf("boot%d", active_partition); | ||
| if (!g_str_has_suffix(dest_slot->device, boot_suffix)) { | ||
| return TRUE; | ||
| } |
There was a problem hiding this comment.
The comment is wrong. This checks if the the target slot is not the active one and returns successfully in that case, as no copying is needed.
| self.base_dev = os.environ["RAUC_TEST_EMMC"] | ||
| self.boot0 = f"{self.base_dev}boot0" | ||
| self.boot1 = f"{self.base_dev}boot1" |
There was a problem hiding this comment.
The tests could be simplified a lot by using Path objects, but that could be a follow-up PR.
| out, err, exitcode = run(f"{system.prefix} write-slot bootloader.0 install-content/rootfs.img") | ||
|
|
||
| # Restore permissions | ||
| os.chmod(force_ro_path, 0o644) |
There was a problem hiding this comment.
Make sure to restore permissions by using try:/finally:.
| * This function sets the specified boot partition as active for the given | ||
| * eMMC device. It ensures that the specified partition is correctly set | ||
| * as the active boot partition, allowing the system to boot from it. |
There was a problem hiding this comment.
The comment is wrong. The function sets the other partition as active, which is leads to confusing usage of this function. Perhaps a better name would be r_emmc_activate_bootpart and passing the intended new state.
|
Update of the PR with what I had in the queue from the last rework iteration. range-diff
|
This feature can be used if it is not possible to avoid incompatibilities between
the bootloader (and it's components) and the operating system
During each update RAUC will ensure that the active boot partition
matches the active unsuccessful slots.
This feature will need to be supported by the bootloader, as RAUC will not write the ext_csd registers itself as in the already existing eMMC boot method, but will rely on the bootloader to sort handle it.
Depends On #1752