summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKichan Kwon <k_c.kwon@samsung.com>2020-09-24 13:45:02 +0900
committerKichan Kwon <k_c.kwon@samsung.com>2020-09-25 15:26:10 +0900
commitcc846f49a549c9a20bdcc32d4b97b552e4741174 (patch)
tree24de78018ed93f5fd0483364e392310aed925937
parent131f37d7f6d99c88ab82087b66172b9ccb39704b (diff)
downloadsystem-recovery-cc846f49a549c9a20bdcc32d4b97b552e4741174.tar.gz
system-recovery-cc846f49a549c9a20bdcc32d4b97b552e4741174.tar.bz2
system-recovery-cc846f49a549c9a20bdcc32d4b97b552e4741174.zip
No longer mount platform partitions
- Kernel writes Journal log when system-data is mounted - Modifying data with flashing can break partition - Although fsck recovers partition, we have to prevent this situation - In addition, USB mountpoint is changed - mkdir in /opt is failed because of SMACK - So, move to /tmp which has '*' SMACK label Change-Id: I683cbc932106c766a38856690f26c9e1472d7edd Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
-rw-r--r--CMakeLists.txt2
-rw-r--r--packaging/system-recovery.spec2
-rw-r--r--scripts/recovery-init.in51
3 files changed, 4 insertions, 51 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 90f2068..c2ec6b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT(system-recovery)
SET(INITRD_RECOVERY_LIBEXEC_DIR ${LIBEXECDIR}/initrd-recovery)
SET(SYSTEM_RECOVERY_LIBEXEC_DIR ${LIBEXECDIR}/system-recovery)
-SET(USB_MOUNTPOINT_ROOT ${TZ_SYS_STORAGE})
+SET(USB_MOUNTPOINT_ROOT /tmp)
SET(USB_MOUNTPOINT_PREFIX USBDrive)
SET(PKGS
diff --git a/packaging/system-recovery.spec b/packaging/system-recovery.spec
index 9b5beff..0436db5 100644
--- a/packaging/system-recovery.spec
+++ b/packaging/system-recovery.spec
@@ -9,7 +9,6 @@ Source0: %{name}-%{version}.tar.gz
Source1001: system-recovery.manifest
BuildRequires: cmake
-BuildRequires: pkgconfig(libtzplatform-config)
Requires: initrd-recovery
@@ -25,7 +24,6 @@ cp %{SOURCE1001} .
%build
%cmake . -DLIBEXECDIR=%{_libexecdir} \
- -DTZ_SYS_STORAGE=%{TZ_SYS_STORAGE} \
-DINITRD_RECOVERY_LIST_DIR=%{initrd_recovery_list_dir}
%install
diff --git a/scripts/recovery-init.in b/scripts/recovery-init.in
index c0cb159..280c968 100644
--- a/scripts/recovery-init.in
+++ b/scripts/recovery-init.in
@@ -3,7 +3,6 @@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
SYSTEM_RECOVERY="@SYSTEM_RECOVERY_LIBEXEC_DIR@/system-recovery"
SYSTEM_RECOVERY_GUI="/usr/bin/system-recovery_gui"
-FAKE_ROOT=/system
MOUNT="/usr/bin/mount"
BLKID="/usr/sbin/blkid"
@@ -17,18 +16,9 @@ RMDIR="/usr/bin/rmdir"
TR="/usr/bin/tr"
#------------------------------------------------
-# get partition id
-#------------------------------------------------
-get_partition_id() {
- PART_ROOTFS=$("$BLKID" --match-token PARTLABEL=ROOTFS -o device || "$BLKID" --match-token LABEL=rootfs -o device)
- PART_SYSTEM_DATA=$("$BLKID" --match-token PARTLABEL=SYSTEM-DATA -o device || "$BLKID" --match-token LABEL=system-data -o device)
- PART_USER=$("$BLKID" --match-token PARTLABEL=USER -o device || "$BLKID" --match-token LABEL=user -o device)
-}
-
-#------------------------------------------------
# mount_usb_partitions
#------------------------------------------------
-USB_MOUNTPOINT_PREFIX=${FAKE_ROOT}@USB_MOUNTPOINT_ROOT@/@USB_MOUNTPOINT_PREFIX@
+USB_MOUNTPOINT_PREFIX=@USB_MOUNTPOINT_ROOT@/@USB_MOUNTPOINT_PREFIX@
mount_usb_partitions() {
echo "mount USB partitions"
DEVICE_TYPE_LIST=(
@@ -68,27 +58,6 @@ mount_usb_partitions() {
}
#------------------------------------------------
-# mount_partitions
-#------------------------------------------------
-mount_partitions() {
- echo "mount partitions"
- get_partition_id
-
- "$MOUNT" -t ext4 ${PART_ROOTFS} ${FAKE_ROOT} -o ro
- "$MOUNT" -t ext4 ${PART_SYSTEM_DATA} ${FAKE_ROOT}/opt
- "$MOUNT" -t ext4 ${PART_USER} ${FAKE_ROOT}/opt/usr
-
- "$MOUNT" -t proc none ${FAKE_ROOT}/proc
- "$MOUNT" -t sysfs none ${FAKE_ROOT}/sys
- "$MOUNT" -t smackfs smackfs ${FAKE_ROOT}/sys/fs/smackfs
- "$MOUNT" -t devtmpfs devtmpfs ${FAKE_ROOT}/dev
- "$MOUNT" -t devpts devpts ${FAKE_ROOT}/dev/pts
- "$MOUNT" -t tmpfs tmpfs ${FAKE_ROOT}/tmp -o mode=1777,smackfsroot=*
-
- mount_usb_partitions
-}
-
-#------------------------------------------------
# umount_usb_partitions
#------------------------------------------------
umount_usb_partitions() {
@@ -102,20 +71,6 @@ umount_usb_partitions() {
}
#------------------------------------------------
-# umount_partitions
-#------------------------------------------------
-umount_partitions() {
- echo "umount partitions"
- "$SYNC"
-
- umount_usb_partitions
-
- "$UMOUNT" ${FAKE_ROOT}/opt/usr
- "$UMOUNT" ${FAKE_ROOT}/opt
- "$UMOUNT" ${FAKE_ROOT}
-}
-
-#------------------------------------------------
# do_reboot
#------------------------------------------------
do_reboot() {
@@ -133,7 +88,7 @@ do_reboot() {
# system-recovery initrc
#------------------------------------------------
echo "Starting system recovery."
-mount_partitions
+mount_usb_partitions
# For debugging - It should be deleted on Release
/sbin/agetty -l /bin/sh -n --keep-baud 115200,38400,9600 ttyS1 linux &
@@ -141,5 +96,5 @@ mount_partitions
[ -x "${SYSTEM_RECOVERY_GUI}" ] && "${SYSTEM_RECOVERY_GUI}" &
[ -x "${SYSTEM_RECOVERY}" ] && "${SYSTEM_RECOVERY}"
-umount_partitions
+umount_usb_partitions
do_reboot