From e853e96b40a77a1c89779d9bddd612622f04a62d Mon Sep 17 00:00:00 2001 From: Gaelle Nassiet Date: Mon, 23 Mar 2015 17:51:53 +0100 Subject: always use volume mount option when mounting a partition From ROS, if enable adb using the vol.up and vol.down buttons, the /system partition is mounted by the function ensure_path_mounted() but with hardcoded mount options. As a consequence, the blocks are modified and the reboot in MOS is blocked by the dm_verity feature that detects a corruption. This patch forces the function ensure_path_mounted() to use the mount options from the volume structure, that were previously read from the fstab. Change-Id: I748d32c14cb821f4aae5bcc430089dab45375515 Signed-off-by: Gaelle Nassiet Signed-off-by: Jeremy Compostella --- roots.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roots.cpp') diff --git a/roots.cpp b/roots.cpp index 0d47577b2..c067bccb0 100644 --- a/roots.cpp +++ b/roots.cpp @@ -115,7 +115,7 @@ int ensure_path_mounted(const char* path) { } else if (strcmp(v->fs_type, "ext4") == 0 || strcmp(v->fs_type, "vfat") == 0) { result = mount(v->blk_device, v->mount_point, v->fs_type, - MS_NOATIME | MS_NODEV | MS_NODIRATIME, ""); + v->flags, v->fs_options); if (result == 0) return 0; LOGE("failed to mount %s (%s)\n", v->mount_point, strerror(errno)); -- cgit v1.2.3 From c277762de13653f73451e1a21fe73eafc51f918e Mon Sep 17 00:00:00 2001 From: Andres Morales Date: Mon, 30 Mar 2015 20:56:57 +0000 Subject: Revert "Erase PST partition if its marked to be erased." This now gets done at the framework level. Doing it here breaks the signature on the partition. This reverts commit ee19387905650cab5da7dd97ada5502cd17ac93d. Bug: 19967123 Change-Id: I2a977cb0f0ba94defa1bf9091219398ddc1d3528 (cherry picked from commit 037444642bc32d8fed3bb996823b6a62faa57195) --- roots.cpp | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'roots.cpp') diff --git a/roots.cpp b/roots.cpp index 0d47577b2..ee140160c 100644 --- a/roots.cpp +++ b/roots.cpp @@ -39,8 +39,6 @@ static struct fstab *fstab = NULL; extern struct selabel_handle *sehandle; -static const char* PERSISTENT_PATH = "/persistent"; - void load_volume_table() { int i; @@ -266,41 +264,6 @@ int format_volume(const char* volume) { return -1; } -int erase_persistent_partition() { - Volume *v = volume_for_path(PERSISTENT_PATH); - if (v == NULL) { - // most devices won't have /persistent, so this is not an error. - return 0; - } - - int fd = open(v->blk_device, O_RDWR); - uint64_t size = get_file_size(fd); - if (size == 0) { - LOGE("failed to stat size of /persistent\n"); - close(fd); - return -1; - } - - char oem_unlock_enabled; - lseek(fd, size - 1, SEEK_SET); - read(fd, &oem_unlock_enabled, 1); - - if (oem_unlock_enabled) { - if (wipe_block_device(fd, size)) { - LOGE("error wiping /persistent: %s\n", strerror(errno)); - close(fd); - return -1; - } - - lseek(fd, size - 1, SEEK_SET); - write(fd, &oem_unlock_enabled, 1); - } - - close(fd); - - return (int) oem_unlock_enabled; -} - int setup_install_mounts() { if (fstab == NULL) { LOGE("can't set up install mounts: no fstab loaded\n"); -- cgit v1.2.3 From c94fa0b01b43709531dfbcdb94abb2a1cc23be3d Mon Sep 17 00:00:00 2001 From: Andres Morales Date: Mon, 30 Mar 2015 20:56:57 +0000 Subject: DO NOT MERGE Revert "Erase PST partition if its marked to be erased." This now gets done at the framework level. Doing it here breaks the signature on the partition. This reverts commit ee19387905650cab5da7dd97ada5502cd17ac93d. Bug: 19967123 Change-Id: I447b926b733ca145f11a916d9569ce39889db627 --- roots.cpp | 37 ------------------------------------- 1 file changed, 37 deletions(-) (limited to 'roots.cpp') diff --git a/roots.cpp b/roots.cpp index 0d47577b2..ee140160c 100644 --- a/roots.cpp +++ b/roots.cpp @@ -39,8 +39,6 @@ static struct fstab *fstab = NULL; extern struct selabel_handle *sehandle; -static const char* PERSISTENT_PATH = "/persistent"; - void load_volume_table() { int i; @@ -266,41 +264,6 @@ int format_volume(const char* volume) { return -1; } -int erase_persistent_partition() { - Volume *v = volume_for_path(PERSISTENT_PATH); - if (v == NULL) { - // most devices won't have /persistent, so this is not an error. - return 0; - } - - int fd = open(v->blk_device, O_RDWR); - uint64_t size = get_file_size(fd); - if (size == 0) { - LOGE("failed to stat size of /persistent\n"); - close(fd); - return -1; - } - - char oem_unlock_enabled; - lseek(fd, size - 1, SEEK_SET); - read(fd, &oem_unlock_enabled, 1); - - if (oem_unlock_enabled) { - if (wipe_block_device(fd, size)) { - LOGE("error wiping /persistent: %s\n", strerror(errno)); - close(fd); - return -1; - } - - lseek(fd, size - 1, SEEK_SET); - write(fd, &oem_unlock_enabled, 1); - } - - close(fd); - - return (int) oem_unlock_enabled; -} - int setup_install_mounts() { if (fstab == NULL) { LOGE("can't set up install mounts: no fstab loaded\n"); -- cgit v1.2.3 From 0ddfa329acb1e6464fe5d66b58257013abf21116 Mon Sep 17 00:00:00 2001 From: Mohamad Ayyash Date: Mon, 29 Jun 2015 18:57:14 -0700 Subject: Allow mounting squashfs partitions Change-Id: Ic023eb7d8a11e2a65172a23ff39fa902ef566183 Signed-off-by: Mohamad Ayyash --- roots.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'roots.cpp') diff --git a/roots.cpp b/roots.cpp index ee140160c..bca4b57a2 100644 --- a/roots.cpp +++ b/roots.cpp @@ -111,6 +111,7 @@ int ensure_path_mounted(const char* path) { } return mtd_mount_partition(partition, v->mount_point, v->fs_type, 0); } else if (strcmp(v->fs_type, "ext4") == 0 || + strcmp(v->fs_type, "squashfs") == 0 || strcmp(v->fs_type, "vfat") == 0) { result = mount(v->blk_device, v->mount_point, v->fs_type, MS_NOATIME | MS_NODEV | MS_NODIRATIME, ""); -- cgit v1.2.3