Skip to content

Conversation

b49020
Copy link
Member

@b49020 b49020 commented May 1, 2025

This PR intends to update RB1 partition layout such that it is compatible with future edk2/UEFI support as well as optimising for size to drop redundant partitions and reducing size for boot partition.

ndechesne and others added 3 commits April 30, 2025 17:22
As reported on qualcomm-linux#9,
the GUID used for rootfs is incorrectly. It was wrongly inherited from
the original partition XML file of an Android build, and the GUID
which was used corresponds to what Android uses for userdata
partition.

This changes sets the correct GUID
(b921b045-1df0-41c3-af44-4c6f280d3fae) for Root Partition (64-bit
ARM/AArch64).

Reported-by: Loic Minier <[email protected]>
Signed-off-by: Nicolas Dechesne <[email protected]>
Signed-off-by: Sumit Garg <[email protected]>
The *_r partitions are dropped since they are no longer supporting any
known use-case. The A/B boot sequence offers all the needed features as
of now.

Signed-off-by: Sumit Garg <[email protected]>
Given the UEFI boot requirement, the boot partition is only meant to
support U-Boot chainloaded from ABL. The traditional Linux android boot
image is no longer required to support booting Yocto, so let's optimize
for size and give more flash space available for the user.

4MB is choosen as maximum limit for U-Boot image size since with more
UEFI features enabled like secure boot etc. the size can cross 2MB
limit.

Signed-off-by: Sumit Garg <[email protected]>
@b49020 b49020 requested a review from ndechesne as a code owner May 1, 2025 15:28
@b49020 b49020 requested a review from lumag May 1, 2025 15:28
@lool
Copy link
Contributor

lool commented May 5, 2025

Thanks for progressing this @b49020!

Each commit makes sense to me; NB: I haven't tested the updated partitions.

I wonder how we should convey the assumptions and requirements for people consuming these files.

We have an effort in progress to build a companion site to convey the role of each repo under qualcomm-linux and how they work together (perhaps also repositories outside of qualcomm-linux org), but I believe we still want each repo to carry its own documentation when relevant.

If I was trying to convey this in, say, a markdown doc along with qcom-ptool, I'd share my basic understanding of what we're trying to do here and the state of things as follows (this is a bit of a brain dump):

- this repository contains tooling and reference partition layouts for modern Linux based boot architectures for RBx boards
- Qualcomm currently supports two reference Linux based OSes (Yocto with meta-qcom and Debian with qcom-deb-images) to be used with this
- Qualcomm picked partition GUIDs, partition names, and partition size budgets in support of various boot flows

The supported boot flows are:
- "u-boot": PBL => XBL => ABL => U-Boot => high-level OS (Linux) for RB1
- (preferred) "uefi": PBL => XBL => UEFI => high-level OS (Linux) for all other RBx boards

On RB1, the partition layout should enable a future migration to an "uefi" boot flow at the time where UEFI firmware is available.

The currently supported features are:
- A/B boot
- secure boot for the UEFI boot flow
- capsule updates for the UEFI boot flow

The following partitions are used by the following layer for these purposes:
- xbl_a/xbl_b: used by PBL, image of the XBL loader
- xbl_config_a, xbl_config_b: used by XBl, store its config
- ...
- 

Copy link

@loicpoulain loicpoulain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I guess we will do further cleanup once we know the role of each partition.

@b49020
Copy link
Member Author

b49020 commented May 5, 2025

@lool

We have an effort in progress to build a companion site to convey the role of each repo under qualcomm-linux and how they work together (perhaps also repositories outside of qualcomm-linux org), but I believe we still want each repo to carry its own documentation when relevant.

Looks like a great idea to me. I will try to document bits along as per your suggestion however some comments on following bits:

The currently supported features are:

I am not sure if this repo is the right place to hold a list of features supported by the firmware as it can easily get out of sync. It's better to put them under overall Qcom Linux documentation specifically under board specific BSP documentation.

The following partitions are used by the following layer for these purposes:

This info makes sense for this repo however we are still collecting information about role of each partition. Once that's available we can document them as well as drop unneeded partitions.

@ndechesne
Copy link
Contributor

thanks. I will wait for @lumag to approve the PR since there are open items to discuss.

@b49020 are you also looking at protecting/hiding the firmware partitions, so that they aren't easy to be overriden from a Linux OS?

@b49020
Copy link
Member Author

b49020 commented May 5, 2025

@ndechesne

@b49020 are you also looking at protecting/hiding the firmware partitions, so that they aren't easy to be overriden from a Linux OS?

That would really be a nice feature but I am unsure if that's achievable on Qcom platforms since the firmware and the OS partitions co-exist in the main eMMC flash area. One idea could be to support a dedicated flash media for OS installation like SD card then we can restrict eMMC access to firmware only but that will just be a lot of flash space left wasted.

@b49020
Copy link
Member Author

b49020 commented May 5, 2025

I suppose UFS allows for this kind of partitioning based of different LUNs.

@lool
Copy link
Contributor

lool commented May 5, 2025

@ndechesne

@b49020 are you also looking at protecting/hiding the firmware partitions, so that they aren't easy to be overriden from a Linux OS?

That would really be a nice feature but I am unsure if that's achievable on Qcom platforms since the firmware and the OS partitions co-exist in the main eMMC flash area. One idea could be to support a dedicated flash media for OS installation like SD card then we can restrict eMMC access to firmware only but that will just be a lot of flash space left wasted.

What about eMMC boot partitions? Could we use these as is being done for the CDT?

@ndechesne
Copy link
Contributor

What about eMMC boot partitions? Could we use these as is being done for the CDT?

Indeed. I had that in mind, or perhaps finding something with write protect. there are 2 'features' here. 1) hide the partitions which are not dedicated to the OS, 2) ensure that a user cannot 'easily' erase them.

@loicpoulain
Copy link

loicpoulain commented May 5, 2025

What about eMMC boot partitions? Could we use these as is being done for the CDT?

Indeed. I had that in mind, or perhaps finding something with write protect. there are 2 'features' here. 1) hide the partitions which are not dedicated to the OS, 2) ensure that a user cannot 'easily' erase them.

To leverage hw boot partition:

  • Whatever we flash here should fit into the 2x4MB available (mmcboot0, mmcboot1)
  • We probably have to modify the bootloader to look into boot0 and boot1 when looking for its firmware blob, I suspect it only browse the gpt in user partition at the moment? (@b49020)
  • It would be good to keep the board-specific CDT isolated from platform-specific blobs/firmwares (devcfg, TZ...).

Note also that GPT has partition attribute flags, like Read-Only or Hidden, and actually all our partitions are marked read-only, however the Linux kernel does not seem to care about it...

@ricardosalveti
Copy link
Contributor

What about eMMC boot partitions? Could we use these as is being done for the CDT?

This will force changing quite a few components, and size might still not be enough.

Following EBBR (https://github.com/ARM-software/ebbr/blob/main/source/chapter4-firmware-media.rst#gpt-partitioning) we can set them as 'required partition'. In the end they will be exposed, but as described in EBBR, ideally those wouldn't automatically be changed by generic linux installers (but would depend on the installer).

@b49020
Copy link
Member Author

b49020 commented May 6, 2025

What about eMMC boot partitions? Could we use these as is being done for the CDT?

Although we should be able to change later boot-loader stages but the PBL code (ROM code on Qcom platforms) loads XBL-SC from the xbl_* partition. The ROM code is un-modifiable and if it doesn't support loading from an eMMC boot partition then we won't have any option then. I will double check though.

The second main issue will be the size constraint as below:

Whatever we flash here should fit into the 2x4MB available (mmcboot0, mmcboot1)

This will only be able to hold a single uefi_a partition (sz: 8MB) which really will be a blocker to use these partitions if we really want a dedicated storage option for the OS.

Another issue is that the firmware/boot-loader itself uses the same GPT partition layout to load firmware images which is being used by the OS as well. It's really a problem for distro installers as they can't create or alter the GPT partition layout to best suite their needs like dynamic size of ESP partition, rootfs or if user wants to create a separate userdata partition which might be encrypted as well.

@ndechesne
Copy link
Contributor

Although we should be able to change later boot-loader stages but the PBL code (ROM code on Qcom platforms) loads XBL-SC from the xbl_* partition. The ROM code is un-modifiable and if it doesn't support loading from an eMMC boot partition then we won't have any option then. I will double check though.

PBL (like most boot components) will 'search' for partition by looking up GUID. I don't know if they search in user data only, or if they seach in the boot partitions too..

@b49020 b49020 force-pushed the rb1-conf-update branch 2 times, most recently from d58b0ae to 4c6e7bc Compare May 12, 2025 13:08
b49020 added 3 commits May 12, 2025 18:42
The bluetooth_* partitions are known to be not used by the Yocto or
Debian BSP, so let's drop them.

Signed-off-by: Sumit Garg <[email protected]>
The future firmware plan for RB1 is to switch from current ABL boot flow
to proper edk2/UEFI boot flow as supported by RB3G2. This partition layout
update helps us to prepare for migration from current ABL based boot flow
to rather edk2/UEFI based boot flow. IOW, there won't be any need to
chainload U-Boot to provide UEFI interface once we migrate.

Add UEFI, corresponding DTB and recoveryinfo partitions similar to what
we currently have on RB3G2.

Signed-off-by: Sumit Garg <[email protected]>
In order to be compliant with future edk2/UEFI upgrade, let's update
GUIDs for *_b partitions which is required to be compatible with capsule
update requirements.

Signed-off-by: Sumit Garg <[email protected]>
b49020 added 2 commits May 12, 2025 18:42
Add ddr_b partition which is to be used in order to support proper A/B
boot flow.

Signed-off-by: Sumit Garg <[email protected]>
Add description as to how qcom-ptool is internded to be used and list
supported boot flows.

Signed-off-by: Sumit Garg <[email protected]>
@b49020 b49020 force-pushed the rb1-conf-update branch from 4c6e7bc to ab7d69e Compare May 12, 2025 13:12
@b49020
Copy link
Member Author

b49020 commented May 12, 2025

I hope I have addressed all the comments, feel free to review again.

@lumag lumag merged commit f475042 into qualcomm-linux:main May 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants