File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -598,6 +598,29 @@ static bool blk_add_partition(struct gendisk *disk,
598
598
return true;
599
599
}
600
600
601
+ static int validate_mpt_partition (struct parsed_partitions * state )
602
+ {
603
+ sector_t sect_num ;
604
+ Sector sect ;
605
+ unsigned char * data ;
606
+ int ret = 0 ;
607
+
608
+ /* MPT signature is at 0x2400000 */
609
+ sect_num = (0x2400000 / 512 ) *
610
+ (queue_logical_block_size (state -> disk -> queue ) / 512 );
611
+
612
+ data = read_part_sector (state , sect_num , & sect );
613
+ if (!data )
614
+ return ret ;
615
+
616
+ /* check for 'MPT\0' */
617
+ if (!strncmp (data , "MPT" , 4 ))
618
+ ret = 1 ;
619
+
620
+ put_dev_sector (sect );
621
+ return ret ;
622
+ }
623
+
601
624
static int blk_add_partitions (struct gendisk * disk )
602
625
{
603
626
struct parsed_partitions * state ;
@@ -609,6 +632,20 @@ static int blk_add_partitions(struct gendisk *disk)
609
632
state = check_partition (disk );
610
633
if (!state )
611
634
return 0 ;
635
+
636
+ /*
637
+ * skip adding partitions for eMMC device
638
+ * on Android 14 GPT partitions are added as block devices /dev/mmcblk0p*
639
+ * which are mounted under /media
640
+ * but we expects block devices from partition names like /dev/env and /dev/userdata
641
+ * that's why we exit here and mount partitions from MPT
642
+ */
643
+ if (validate_mpt_partition (state )) {
644
+ pr_info ("%s: skip mounting disk with MPT partition\n" , disk -> disk_name );
645
+ ret = 0 ;
646
+ goto out_free_state ;
647
+ }
648
+
612
649
if (IS_ERR (state )) {
613
650
/*
614
651
* I/O error reading the partition table. If we tried to read
You can’t perform that action at this time.
0 commit comments