On 3/27/20 7:35 AM, Punit Agrawal wrote:
Hi Heinrich,

Heinrich Schuchardt <xypron.g...@gmx.de> writes:

Up to now for MBR and GPT partitions the info field 'bootable' was set to 1
if either the partition was an EFI system partition or the bootable flag
was set.

Turn info field 'bootable' into a bit mask with separate bits for bootable
and EFI system partition.

This will allow us to identify the EFI system partition in the UEFI
sub-system.

Signed-off-by: Heinrich Schuchardt <xypron.g...@gmx.de>
---
  disk/part_dos.c | 10 ++++++++--
  disk/part_efi.c | 12 ++++++++----
  include/part.h  | 11 ++++++++++-
  3 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c

[...]

diff --git a/include/part.h b/include/part.h
index 0b5cf3d5e8..a63d1d0cda 100644
--- a/include/part.h
+++ b/include/part.h
@@ -51,13 +51,22 @@ struct block_drvr {
  #define PART_TYPE_LEN 32
  #define MAX_SEARCH_PARTITIONS 64

+#define PART_BOOTABLE                  1
+#define PART_EFI_SYSTEM_PARTITION      2
+

Maybe you missed my comments on the previous version [0].

As the above defines are used as bit positions, please consider using
BIT() for clarity.

Thanks,
Punit

Sorry to miss that. I will change it in the next round.

Thanks for reviewing.

Best regards

Heinrich


[0] https://lists.denx.de/pipermail/u-boot/2020-March/404081.html

  typedef struct disk_partition {
        lbaint_t        start;  /* # of first block in partition        */
        lbaint_t        size;   /* number of blocks in partition        */
        ulong   blksz;          /* block size in bytes                  */
        uchar   name[PART_NAME_LEN];    /* partition name                       
*/
        uchar   type[PART_TYPE_LEN];    /* string type description              
*/
-       int     bootable;       /* Active/Bootable flag is set          */
+       /*
+        * The bootable is a bitmask with the following fields:
+        *
+        * PART_BOOTABLE                the MBR bootable flag is set
+        * PART_EFI_SYSTEM_PARTITION    the partition is an EFI system partition
+        */
+       int     bootable;
  #if CONFIG_IS_ENABLED(PARTITION_UUIDS)
        char    uuid[UUID_STR_LEN + 1]; /* filesystem UUID as string, if exists 
*/
  #endif
--
2.25.1

Reply via email to