diff options
author | LAVEENA FULWANI <quic_lfulwani@quicinc.com> | 2022-09-14 14:53:25 +0530 |
---|---|---|
committer | LAVEENA FULWANI <quic_lfulwani@quicinc.com> | 2022-09-27 17:16:54 +0530 |
commit | 5ecf463246ecf94618a2b195084c1cd6b1a71144 (patch) | |
tree | 07c723a7a7d368600950e6074fd742756947038f | |
parent | bd54d2e474fe93f27bb8e2cb9336585598b31389 (diff) |
Adding support for SDExpress card in Recovery mode on anorak
CRs-Fixed: 3290761
Change-Id: I520c5e360e270872a3d153a39f69efb853aa0673
-rw-r--r-- | install/fuse_install.cpp | 14 | ||||
-rw-r--r-- | recovery.cpp | 14 |
2 files changed, 24 insertions, 4 deletions
diff --git a/install/fuse_install.cpp b/install/fuse_install.cpp index 91d5d1bd..5c535942 100644 --- a/install/fuse_install.cpp +++ b/install/fuse_install.cpp @@ -45,6 +45,8 @@ #define SDCARD_BLK_0_PATH "/dev/block/mmcblk0p1" #define MMC_1_TYPE_PATH "/sys/block/mmcblk1/device/type" #define SDCARD_BLK_1_PATH "/dev/block/mmcblk1p1" +#define SDEXPRESS_0_TYPE_PATH "/sys/block/nvme0n1/device/transport" +#define SDEXPRESS_BLK_0_PATH "/dev/block/nvme0n1p1" static constexpr const char* SDCARD_ROOT = "/sdcard"; // How long (in seconds) we wait for the fuse-provided package file to @@ -224,7 +226,7 @@ static int check_mmc_is_sdcard (const char* mmc_type_path) return -1; } LOG(INFO) << "MMC type is : " << mmc_type.c_str(); - if (!strncmp(mmc_type.c_str(), "SD", strlen("SD"))) + if (!strncmp(mmc_type.c_str(), "SD", strlen("SD")) || !strncmp(mmc_type.c_str(), "pcie", strlen("pcie"))) return 0; else return -1; @@ -240,7 +242,7 @@ static int do_sdcard_mount() { LOG(ERROR) << "Unknown volume for /sdcard. Check fstab\n"; goto error; } - if (strncmp(v->fs_type.c_str(), "vfat", sizeof("vfat"))) { + if (strncmp(v->fs_type.c_str(), "vfat", sizeof("vfat")) && strncmp(v->fs_type.c_str(), "exfat", sizeof("exfat"))) { LOG(ERROR) << "Unsupported format on the sdcard: " << v->fs_type.c_str() << "\n"; goto error; @@ -262,6 +264,14 @@ static int do_sdcard_mount() { v->flags, v->fs_options.c_str()); } + else if (check_mmc_is_sdcard(SDEXPRESS_0_TYPE_PATH) == 0) { + LOG(INFO) << "Mounting sdexpress on " << SDEXPRESS_BLK_0_PATH; + rc = mount(SDEXPRESS_BLK_0_PATH, + v->mount_point.c_str(), + v->fs_type.c_str(), + v->flags, + v->fs_options.c_str()); + } else { LOG(ERROR) << "Unable to get the block path for sdcard."; goto error; diff --git a/recovery.cpp b/recovery.cpp index 134a80d7..dabfbf28 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -77,6 +77,8 @@ static constexpr const char* CACHE_ROOT = "/cache"; #define SDCARD_BLK_0_PATH "/dev/block/mmcblk0p1" #define MMC_1_TYPE_PATH "/sys/block/mmcblk1/device/type" #define SDCARD_BLK_1_PATH "/dev/block/mmcblk1p1" +#define SDEXPRESS_0_TYPE_PATH "/sys/block/nvme0n1/device/transport" +#define SDEXPRESS_BLK_0_PATH "/dev/block/nvme0n1p1" static bool save_current_log = false; @@ -332,7 +334,7 @@ static int check_mmc_is_sdcard (const char* mmc_type_path) return -1; } LOG(INFO) << "MMC type is : " << mmc_type.c_str(); - if (!strncmp(mmc_type.c_str(), "SD", strlen("SD"))) + if (!strncmp(mmc_type.c_str(), "SD", strlen("SD")) || !strncmp(mmc_type.c_str(), "pcie", strlen("pcie"))) return 0; else return -1; @@ -349,7 +351,7 @@ static int do_sdcard_mount(RecoveryUI* ui) ui->Print("Unknown volume for /sdcard. Check fstab\n"); goto error; } - if (strncmp(v->fs_type.c_str(), "vfat", sizeof("vfat"))) { + if (strncmp(v->fs_type.c_str(), "vfat", sizeof("vfat")) && strncmp(v->fs_type.c_str(), "exfat", sizeof("exfat"))) { ui->Print("Unsupported format on the sdcard: %s\n", v->fs_type.c_str()); goto error; @@ -371,6 +373,14 @@ static int do_sdcard_mount(RecoveryUI* ui) v->flags, v->fs_options.c_str()); } + else if (check_mmc_is_sdcard(SDEXPRESS_0_TYPE_PATH) == 0) { + LOG(INFO) << "Mounting sdexpress on " << SDEXPRESS_BLK_0_PATH; + rc = mount(SDEXPRESS_BLK_0_PATH, + v->mount_point.c_str(), + v->fs_type.c_str(), + v->flags, + v->fs_options.c_str()); + } else { LOG(ERROR) << "Unable to get the block path for sdcard."; goto error; |