|
| 1 | +Scope of this document |
| 2 | +====================== |
| 3 | + |
| 4 | +Explain how to update the Zephyr's fork of Mbed TLS to align with a newer |
| 5 | +upstream release. |
| 6 | +This document talks about Mbed TLS, but the very same applies also to |
| 7 | +TF-PSA-Crypto that, starting from Mbed TLS release 4.0, will be part of the |
| 8 | +Mbed TLS project. |
| 9 | + |
| 10 | +Upstream Mbed TLS branches and tags |
| 11 | +=================================== |
| 12 | + |
| 13 | +- Working branch name: `development` |
| 14 | +- 1 or more LTS branches named as `mbedtls-<major>.<minor>` (ex: `mbedtls-3.6`) |
| 15 | +- Tag at every release with format `v<major>.<minor>.<patch>` (ex: `v3.6.4`) |
| 16 | + |
| 17 | +How was done in the past? |
| 18 | +========================= |
| 19 | + |
| 20 | +Zephyr's fork of Mbed TLS contains some extra patches that are not applied (and |
| 21 | +that won't be applied) upstream. |
| 22 | + |
| 23 | +So the procedure for each version bump was as follows: |
| 24 | +- revert all the Zephyr's additional patches; |
| 25 | +- merge all the changes from upstream Mbed TLS; |
| 26 | +- re-apply all Zephyr's additional patches. |
| 27 | + |
| 28 | +Graphically prior to each release we had: |
| 29 | + |
| 30 | +``` |
| 31 | +* Mbed TLS commit #1 |
| 32 | +* Mbed TLS commit #2 |
| 33 | +* Mbed TLS commit #3 ("v3.6.3" tag) |
| 34 | +* Zephyr commit #1 |
| 35 | +* Zephyr commit #2 |
| 36 | +* Zephyr commit #3 ("zephyr" branch HEAD) |
| 37 | +``` |
| 38 | + |
| 39 | +and then after it: |
| 40 | + |
| 41 | +``` |
| 42 | +* Mbed TLS commit #1 |
| 43 | +* Mbed TLS commit #2 |
| 44 | +* Mbed TLS commit #3 ("v3.6.3" tag) |
| 45 | +* Zephyr commit #1 |
| 46 | +* Zephyr commit #2 |
| 47 | +* Zephyr commit #3 |
| 48 | +* Revert Zephyr commit #3 |
| 49 | +* Revert Zephyr commit #2 |
| 50 | +* Revert Zephyr commit #1 |
| 51 | +* Mbed TLS commit #4 |
| 52 | +* Mbed TLS commit #5 |
| 53 | +* Mbed TLS commit #6 ("v3.6.4" tag) |
| 54 | +* Zephyr commit #1 |
| 55 | +* Zephyr commit #2 |
| 56 | +* Zephyr commit #3 ("zephyr" branch HEAD) |
| 57 | +``` |
| 58 | + |
| 59 | +Proposed approach |
| 60 | +================= |
| 61 | + |
| 62 | +Create a branch named `zephyr-development` that includes: |
| 63 | + |
| 64 | +- all Mbed TLS' commits on `development` branch up to a certain tag and |
| 65 | +- Zephyr's custom commits. |
| 66 | + |
| 67 | +Graphically: |
| 68 | + |
| 69 | +``` |
| 70 | +* Mbed TLS commit #1 |
| 71 | +* Mbed TLS commit #2 |
| 72 | +* Mbed TLS commit #3 ("v3.6.3" tag) |
| 73 | + \ |
| 74 | + * Zephyr commit #1 |
| 75 | + * Zephyr commit #2 |
| 76 | + * Zephyr commit #3 ("zephyr-development" branch HEAD) |
| 77 | +``` |
| 78 | + |
| 79 | +All new Zephyr's patches go on top of `zephyr-development` HEAD. |
| 80 | + |
| 81 | +When a new Mbed TLS release is announced then: |
| 82 | +- current Zephyr's HEAD commit is tagged adding a `zephyr_` prefix to the |
| 83 | + upstream Mbed TLS' tag; |
| 84 | +- rebase on the upstream tag of the new release. |
| 85 | + |
| 86 | +Graphically: |
| 87 | + |
| 88 | +``` |
| 89 | +* Mbed TLS commit #1 |
| 90 | +* Mbed TLS commit #2 |
| 91 | +* Mbed TLS commit #3 (Mbed TLS tag #1 - ex: "v3.6.3") |
| 92 | +|\ |
| 93 | +| * Zephyr commit #1 |
| 94 | +| * Zephyr commit #2 |
| 95 | +| * Zephyr commit #3 ("zephyr-v3.6.3" tag) |
| 96 | +| |
| 97 | +* Mbed TLS commit #4 |
| 98 | +* Mbed TLS commit #5 |
| 99 | +* Mbed TLS commit #6 (Mbed TLS tag #1 - ex: v3.6.4) |
| 100 | +|\ |
| 101 | +| * Zephyr commit #1 |
| 102 | +| * Zephyr commit #2 |
| 103 | +| * Zephyr commit #3 ("zephyr-development" branch HEAD) |
| 104 | +``` |
| 105 | + |
| 106 | +This last graph shows the ideal situation where all the Zephyr's commits still |
| 107 | +apply also on the new Mbed TLS release. This might not be the case because: |
| 108 | +- some Zephyr's patch might have been upstream upstreamed (so it's included |
| 109 | + in Mbed TLS' commits) or |
| 110 | +- some new commit is required in order to fix compatibility between Zephyr |
| 111 | + and Mbed TLS. |
| 112 | + |
| 113 | +In these cases the number of rebased commits might change as required. |
0 commit comments