diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index b1ca0a2ac..2e54d6909 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -636,8 +636,10 @@ struct fstab *fs_mgr_read_fstab_with_dt(const char *fstab_path) return in_place_merge(fstab_dt, fstab); } -/* combines fstab entries passed in from device tree with - * the ones found in /fstab. +/* + * tries to load default fstab. file from /odm/etc, /vendor/etc + * or /. loads the first one found and also combines fstab entries passed + * in from device tree. */ struct fstab *fs_mgr_read_fstab_default() { @@ -645,7 +647,10 @@ struct fstab *fs_mgr_read_fstab_default() std::string default_fstab; if (fs_mgr_get_boot_config("hardware", &hw)) { - default_fstab = FSTAB_PREFIX + hw; + for (const char *prefix : {"/odm/etc/fstab.","/vendor/etc/fstab.", "/fstab."}) { + default_fstab = prefix + hw; + if (access(default_fstab.c_str(), F_OK) == 0) break; + } } else { LWARNING << __FUNCTION__ << "(): failed to find device hardware name"; } diff --git a/fs_mgr/fs_mgr_priv.h b/fs_mgr/fs_mgr_priv.h index 4e2ac8bf0..377d2ecb0 100644 --- a/fs_mgr/fs_mgr_priv.h +++ b/fs_mgr/fs_mgr_priv.h @@ -41,8 +41,6 @@ #define PWARNING PLOG(WARNING) << FS_MGR_TAG #define PERROR PLOG(ERROR) << FS_MGR_TAG -const std::string FSTAB_PREFIX("/fstab."); - __BEGIN_DECLS #define CRYPTO_TMPFS_OPTIONS "size=256m,mode=0771,uid=1000,gid=1000"