platform/core/system/tota-ua.git
2 years agoAdd critical_log to indicate upgrade progress
SangYoun Kwak [Mon, 27 Jun 2022 05:09:49 +0000 (14:09 +0900)]
Add critical_log to indicate upgrade progress

Change-Id: Iee469d3fcbb3bc2dd614f20fbed1158f161ff5a9
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
2 years agoAdd partition cloning verification 98/276598/2
Mateusz Moscicki [Tue, 21 Jun 2022 09:51:07 +0000 (11:51 +0200)]
Add partition cloning verification

Change-Id: I410b9330808542f529b7e1be0f6b82d4c0294c60

2 years agoVerify the checksum of the files delivered with delta.tar 57/276557/3
Mateusz Moscicki [Mon, 20 Jun 2022 12:35:00 +0000 (14:35 +0200)]
Verify the checksum of the files delivered with delta.tar

Change-Id: I0e7ce71df3b3ef11e64bfc1665e62691ba63ad42

2 years agoSimplify the invocation of partition cloning 24/276724/1
Mateusz Moscicki [Thu, 23 Jun 2022 10:18:07 +0000 (12:18 +0200)]
Simplify the invocation of partition cloning

Change-Id: I15dcced02fd0d9f468616212e7715ce4e18a202f

2 years agoAdd sleep 60 before clone_partitions.service to avoid booting congestion 61/276461/2
Hyotaek Shim [Fri, 17 Jun 2022 05:04:16 +0000 (14:04 +0900)]
Add sleep 60 before clone_partitions.service to avoid booting congestion

Change-Id: I8e881a86874ecd935917eabef728e1b503c5f06f
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
2 years agoRevert "Delay the launch of clone_partitions.service" 57/276457/1
Hyotaek Shim [Fri, 17 Jun 2022 04:42:24 +0000 (04:42 +0000)]
Revert "Delay the launch of clone_partitions.service"

This reverts commit 466e3ecd38fefd6a94b01179010620f50061a2c3.

Change-Id: Ia93c180d2b69ed75717c6cf52bcd47a4c6a9ca44

2 years agoDelay the launch of clone_partitions.service 15/276315/2
Mateusz Moscicki [Tue, 14 Jun 2022 11:06:11 +0000 (13:06 +0200)]
Delay the launch of clone_partitions.service

The delay is needed to minimize the risk that due to a problem with some
service, the system will reboot during cloning.

Change-Id: Idb65aeee01e8987ce1fef32c0c7892d8c2a5db9e

2 years agoMerge changes from topic "new_update_types" into tizen
Mateusz Mościcki [Fri, 10 Jun 2022 15:19:48 +0000 (15:19 +0000)]
Merge changes from topic "new_update_types" into tizen

* changes:
  Remove script responsible for full upgrade
    Rename upgrade types:

2 years agoAdd '-l' option to blkid for optimization 65/276165/2
SangYoun Kwak [Fri, 10 Jun 2022 08:23:33 +0000 (17:23 +0900)]
Add '-l' option to blkid for optimization

Change-Id: I8183808210a9fca55e8c754e91da1a986ff27dae
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
2 years agoRemove script responsible for full upgrade 64/276164/2
Mateusz Moscicki [Fri, 10 Jun 2022 08:18:58 +0000 (10:18 +0200)]
Remove script responsible for full upgrade

This type of upgrade was necessary because it was the only one that did
not require extracing files from the delta.tar.gz. At the moment each
type of A/B upgrade is performed without the need to extract images from
the archive so a separate script is unnecessary.

Change-Id: Ied4c9afc8894e1c774fb960822ca6743c0fb8b2e

2 years ago Rename upgrade types: 16/276116/1
Mateusz Moscicki [Thu, 9 Jun 2022 16:27:41 +0000 (18:27 +0200)]
  Rename upgrade types:

  Types now include information in the name about what the upgrade is
  (FULL_IMAGE, DELTA_IMAGE) and when it is to be performed
  (BEFORE_BOOT_FOTA, AT_BOOT_FOTA):

    PRE_UA    -> FULL_IMAGE:BEFORE_BOOT_FOTA
    FULL_IMG  -> FULL_IMAGE:AT_BOOT_FOTA
    DELTA_IMG -> DELTA_IMAGE:AT_BOOT_FOTA

Change-Id: Ic0a71c1e2463ac3bad9b0c0a1119ab562cd9b100

2 years agoAdd support for lzma patches (DELTA_IMG) 96/275896/10
Mateusz Moscicki [Sat, 4 Jun 2022 11:42:50 +0000 (13:42 +0200)]
Add support for lzma patches (DELTA_IMG)

Change-Id: I48db15713776faa1366e87666bdc96a79c1c61d3

2 years agoupgrade scripts: use upgrade-apply to flash images 84/275884/7
Mateusz Moscicki [Fri, 3 Jun 2022 12:10:37 +0000 (14:10 +0200)]
upgrade scripts: use upgrade-apply to flash images

Change-Id: Ib4d22862fb71b0e465e49200dfe92e1350338ec6

2 years agoupgrade scripts: extract the common code to upgrade-common.sh 83/275883/4
Mateusz Moscicki [Fri, 3 Jun 2022 12:01:57 +0000 (14:01 +0200)]
upgrade scripts: extract the common code to upgrade-common.sh

Change-Id: I01cb0deeac4aeae745bcb225a651a3b031a58ce6

2 years agoCheck if partitions are cloned before cloning them(except recovery mode) 40/275940/2
SangYoun Kwak [Tue, 7 Jun 2022 05:47:23 +0000 (14:47 +0900)]
Check if partitions are cloned before cloning them(except recovery mode)

Change-Id: I4ea8705f8bea55ed8b901167a93a18bf37a08325
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
2 years agoAdd dest_size 73/275873/2
Mateusz Majewski [Fri, 3 Jun 2022 11:07:26 +0000 (13:07 +0200)]
Add dest_size

Change-Id: I0510236e0036b9409f632a4109a9e83ace58a6c7

2 years agoFix dest-sha1 parameter name in help 72/275872/1
Mateusz Majewski [Fri, 3 Jun 2022 10:57:38 +0000 (12:57 +0200)]
Fix dest-sha1 parameter name in help

Change-Id: Ifd4720395217c414bbbeef99f9e347ac619badac

2 years agoDepend on some libraries in a static and not dynamic way 70/275870/1
Mateusz Majewski [Fri, 3 Jun 2022 09:58:36 +0000 (11:58 +0200)]
Depend on some libraries in a static and not dynamic way

Change-Id: I33b151e26df773593b370c063e2947cda246942f

2 years agoDrop unneeded tizen prefix in service name 38/275838/1
Mateusz Moscicki [Thu, 2 Jun 2022 16:48:14 +0000 (18:48 +0200)]
Drop unneeded tizen prefix in service name

Change-Id: Ic0eba413c5f84b27e21b7fe12ac2281a13d679cb

2 years agoupgrade scripts: Improve check exectuion 86/275786/3
Mateusz Moscicki [Wed, 1 Jun 2022 13:45:10 +0000 (15:45 +0200)]
upgrade scripts: Improve check exectuion

This change is to prevent bash from exiting a script with an error when
a command returns a code other than 0, which is expected.

E.g.:

    SOME_VAR=$(grep some_value /some/file)

as the "errexit" flag is set, if "some_value" is not found grep will
return exit code 1 and the script will abort. This behavior also varies
with different versions of bash, so it is better in such cases to avoid
invoking commands that may return non-zero code.

Change-Id: I3f9eefc51a37d9762a9b47cc716805957461891f

2 years agoMerge changes I5c53427b,I6922a19d,Ibe876dd0,I67cdb84c into tizen
Karol Lewandowski [Thu, 2 Jun 2022 09:53:53 +0000 (09:53 +0000)]
Merge changes I5c53427b,I6922a19d,Ibe876dd0,I67cdb84c into tizen

* changes:
  Add SHA1 verification support to upgrade-apply
  Import SHA1
  Add upgrade-apply tool
  Import ss_brotli_patch

2 years agoAdd SHA1 verification support to upgrade-apply 82/275782/4
Mateusz Majewski [Wed, 1 Jun 2022 05:43:52 +0000 (07:43 +0200)]
Add SHA1 verification support to upgrade-apply

Change-Id: I5c53427b8096874c7b5e6a0abc725a9b6bcaa162

2 years agoImport SHA1 81/275781/2
Mateusz Majewski [Tue, 31 May 2022 12:26:01 +0000 (14:26 +0200)]
Import SHA1

This is copied from platform/core/system/libtota @ b25d02d618797b5fb2fbe61a188d6a28dc720bf8.

Change-Id: I6922a19d20f68ee2c5ba640ebdc95084f5b32cb4

2 years agoAdd upgrade-apply tool 72/275472/12
Mateusz Majewski [Tue, 31 May 2022 07:12:30 +0000 (09:12 +0200)]
Add upgrade-apply tool

This is a tool that allows us to apply an upgrade provided in a tar
archive to a partition. Hopefully this will allow us to simplify the
upgrade codebase a bit.

Change-Id: Ibe876dd0141065e8c150a360b329f67ca6935c69

2 years agoImport ss_brotli_patch 41/275741/2
Mateusz Majewski [Tue, 31 May 2022 07:12:01 +0000 (09:12 +0200)]
Import ss_brotli_patch

This is copied from platform/core/system/libtota @ b25d02d618797b5fb2fbe61a188d6a28dc720bf8.

Change-Id: I67cdb84caa1da7bf5ed8be9669ca4c219868f5d7

2 years agoChange the location of the reset partitions_cloned flag 07/275707/3
Mateusz Moscicki [Mon, 30 May 2022 14:17:59 +0000 (16:17 +0200)]
Change the location of the reset partitions_cloned flag

The flag must be reset after verifying that partitions are currently
cloned, and before modifying partition contents.

Change-Id: Ieb1144ad1ff91d33acc1a0c7025d851a1d1992c3

2 years agoRemove the upgrade-common.inc file that remains after a full upgrade. 06/275706/1
Mateusz Moscicki [Mon, 30 May 2022 14:16:44 +0000 (16:16 +0200)]
Remove the upgrade-common.inc file that remains after a full upgrade.

Change-Id: I5b9541b6c4944ecef5a1cf37bae82034578960ea

2 years agoFix clone_partitions.sh 02/275702/1
Mateusz Moscicki [Mon, 30 May 2022 11:47:55 +0000 (13:47 +0200)]
Fix clone_partitions.sh

Change-Id: I7f56f2e710992f1e72b65b7340f5fca0bd5ca387

2 years agoRemove locking from upgrade-full.sh 00/275700/2
Mateusz Moscicki [Mon, 30 May 2022 10:53:07 +0000 (12:53 +0200)]
Remove locking from upgrade-full.sh

upgrade-full.sh is not run directly, it is called from
upgrade-trigger.sh which set the lock.

Change-Id: I11da508e0042a7acc147176a12958bea8b56302d

2 years agoSkip cloning partitions if they are already cloned 75/275475/4
Mateusz Moscicki [Wed, 25 May 2022 15:56:31 +0000 (17:56 +0200)]
Skip cloning partitions if they are already cloned

Change-Id: I99709049ebc8c36e8c1a5058d06ca77e692b615f

2 years agoAdd a lock to the upgrade script 22/275422/6
Mateusz Moscicki [Tue, 24 May 2022 20:43:35 +0000 (22:43 +0200)]
Add a lock to the upgrade script

One of the steps in A/B upgrade is to clone a partitions from the
current slot to the next slot. At the same time there is
clone_partition.service that also clones partitions for recovery
purposes. Adding a lock is to prevent both processes from cloning
partitions at the same time.

Change-Id: I6f831eebbd6de37617a0b09145dbd70f15d7d638

2 years agoDelete upgrade files when they are no longer needed 16/275416/7
Mateusz Moscicki [Tue, 24 May 2022 14:59:24 +0000 (16:59 +0200)]
Delete upgrade files when they are no longer needed

Change-Id: I950b79274a9050b8ba8e3d10a3a2799fd13f3ec4

2 years agoSet/clear partition status when processing fota or partition cloning 65/275465/6
SangYoun Kwak [Wed, 25 May 2022 08:09:34 +0000 (17:09 +0900)]
Set/clear partition status when processing fota or partition cloning

Clear partition cloned status (as 0) before FOTA.
Set partition status as "ok" after partitions are cloned.

Change-Id: Icacc0630c716f0b4c7bc1cccf10508c63b388d05
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
2 years agoMerge "Make check_ua_op_mode slightly less broken" into tizen
Mateusz Mościcki [Wed, 25 May 2022 15:40:53 +0000 (15:40 +0000)]
Merge "Make check_ua_op_mode slightly less broken" into tizen

2 years agoChange critical error logs to be logged as critical_logs 77/275377/4
SangYoun Kwak [Tue, 24 May 2022 01:34:32 +0000 (10:34 +0900)]
Change critical error logs to be logged as critical_logs

Change-Id: If1edd58b6c493c5f29959cc52bc52fbe617ab89b
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
2 years agoMake check_ua_op_mode slightly less broken 10/275410/1
Mateusz Majewski [Tue, 24 May 2022 11:51:05 +0000 (13:51 +0200)]
Make check_ua_op_mode slightly less broken

Change-Id: Ib1cfa0111756d5bb7f992699da49665c27e3b0cb

2 years agoMerge "Drop unneeded device_board_* commands" into tizen
Karol Lewandowski [Fri, 20 May 2022 15:16:22 +0000 (15:16 +0000)]
Merge "Drop unneeded device_board_* commands" into tizen

2 years agoDrop unneeded device_board_* commands 28/275328/1
Karol Lewandowski [Fri, 20 May 2022 12:32:45 +0000 (14:32 +0200)]
Drop unneeded device_board_* commands

These are executed from running system, not from ramdisk-recovery.

Change-Id: I07bbc57beb405d60103842640891c9db3feb6678

2 years agoChange the severity of the mount fail message 83/275283/1
Mateusz Moscicki [Thu, 19 May 2022 11:14:13 +0000 (13:14 +0200)]
Change the severity of the mount fail message

Change-Id: I833adcdc9b9bcfacec4e3596f4d3543d48ef7ed7

2 years agoMerge branch 'tizen' into tizen_6.5 33/275233/1
Karol Lewandowski [Wed, 18 May 2022 21:14:14 +0000 (23:14 +0200)]
Merge branch 'tizen' into tizen_6.5

Change-Id: Icfa3053a9386f178a895ba19e1088b3733746c7d

2 years agoSet upgrade progress 14/275014/2
Mateusz Moscicki [Wed, 11 May 2022 18:02:12 +0000 (20:02 +0200)]
Set upgrade progress

Change-Id: If4c51014c5f2638eae3f15bc97ab988d1de7a500

2 years agoVerify the checksums of flashed images 13/275013/1
Mateusz Moscicki [Fri, 6 May 2022 14:49:36 +0000 (16:49 +0200)]
Verify the checksums of flashed images

Change-Id: I16178fe5ab33efd043db10d6d4612cce717a487d

2 years agoRemove CPUQuota in clone_partitions.service 21/274921/2
Hyotaek Shim [Thu, 12 May 2022 06:47:15 +0000 (15:47 +0900)]
Remove CPUQuota in clone_partitions.service

Change-Id: I780d82e233208fd84d77316d6577d789de684fb9
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
2 years agoRemove CPUQuota in clone_partitions.service 22/274922/1
Hyotaek Shim [Thu, 12 May 2022 06:47:15 +0000 (15:47 +0900)]
Remove CPUQuota in clone_partitions.service

Change-Id: I780d82e233208fd84d77316d6577d789de684fb9
Signed-off-by: Hyotaek Shim <hyotaek.shim@samsung.com>
(cherry picked from commit d8fbc8b33e4d5eaa155b749b690c8591da73e9af)

2 years agoMerge branch 'tizen' into tizen_6.5 76/274676/1
Mateusz Moscicki [Thu, 5 May 2022 19:18:51 +0000 (21:18 +0200)]
Merge branch 'tizen' into tizen_6.5

Change-Id: If2709885808145e43adbd120554aa16460ee1cd7

2 years agoRun clone_partitions.sh in the recovery mode 85/274385/5
Mateusz Moscicki [Wed, 27 Apr 2022 10:02:23 +0000 (12:02 +0200)]
Run clone_partitions.sh in the recovery mode

In recovery mode if two slots are available, we assume that the current
one is valid and the second slot is faulty. So we clone the current
partitions to the other slot so that we have both slots from which the
system can boot correctly.

Change-Id: I12f0951bbde815eafa7b9018f3283469df435cd3

2 years agoMerge branch 'tizen' into tizen_6.5 17/274117/1 accepted/tizen/6.5/unified/20220424.221529 submit/tizen_6.5/20220422.113133
Mateusz Moscicki [Thu, 21 Apr 2022 11:53:51 +0000 (13:53 +0200)]
Merge branch 'tizen' into tizen_6.5

Change-Id: Iad50df2ff30dcb4ef1fba21fc5bd5e65149353f2

2 years agoAdd partition cloning 30/273830/6 submit/tizen/20220422.113153
Mateusz Moscicki [Thu, 14 Apr 2022 08:16:44 +0000 (10:16 +0200)]
Add partition cloning

When the system boots correctly after the upgrade, we clone the
partitions listed in /hal/etc/upgrade/background_copy.list so that we can
boot from the other slot if nececssary.

Change-Id: I977688e1a159e3504bfe9422bda4103d3f2867a1

2 years agoMerge branch 'tizen' into tizen_6.5 02/273502/1
Mateusz Moscicki [Wed, 6 Apr 2022 11:41:58 +0000 (13:41 +0200)]
Merge branch 'tizen' into tizen_6.5

Change-Id: Id5ff48d149416c55d22e4732eba94955cc253049

2 years agoMove all scripts to one standard location 49/273349/2
Karol Lewandowski [Mon, 4 Apr 2022 18:31:08 +0000 (20:31 +0200)]
Move all scripts to one standard location

This commit changes installation of the upgrade scripts to
/usr/libexec/upgrade-support, so that
 - delta generation scripts can copy whole directory contents
   instead of needing to follow each change in script's file names
 - other packages can potentially install additional scripts

Change-Id: I89357f31ef738d1860ff4b90cf1bf559096f4d68

2 years agoMove a common part of ugprade scripts to a separate file 88/273288/3
Mateusz Moscicki [Fri, 1 Apr 2022 16:34:59 +0000 (18:34 +0200)]
Move a common part of ugprade scripts to a separate file

Change-Id: If3b6f887d245cc0b99cd648742b4d9312e90543c

2 years agoAdd support for the full upgrade images 04/273104/6
Mateusz Moscicki [Wed, 30 Mar 2022 14:16:33 +0000 (16:16 +0200)]
Add support for the full upgrade images

An archive considered to be a full upgrade is one whose all entries in
update.cfg file are of type PRE_UA.
In this case, due to the size of the archive and the probable lack of
available space for unpacking, the images are written directly from the
packed archive.

Change-Id: Iba92d8340c6f1b9f49ecb9567f7fee3a2cbde4ff

2 years agoMerge "Merge branch 'tizen' into tizen_6.5" into tizen_6.5
Karol Lewandowski [Fri, 11 Mar 2022 15:37:38 +0000 (15:37 +0000)]
Merge "Merge branch 'tizen' into tizen_6.5" into tizen_6.5

2 years agoMerge branch 'tizen' into tizen_6.5 44/272244/1 accepted/tizen/6.5/unified/20220314.125400 submit/tizen_6.5/20220311.163427
Mateusz Moscicki [Fri, 11 Mar 2022 15:00:34 +0000 (16:00 +0100)]
Merge branch 'tizen' into tizen_6.5

Change-Id: I8d9ea7af7d1eef126a5801e85c7e5ec2fdec59fa

2 years agoStop displaying unnecessary errors 43/272243/1 accepted/tizen/unified/20220313.205632 submit/tizen/20220311.163642
Mateusz Moscicki [Tue, 8 Mar 2022 10:30:50 +0000 (11:30 +0100)]
Stop displaying unnecessary errors

Change-Id: I7579c69b110d7a42958543fca4f0145244bedddf

2 years agoblkid-api: Fix incorrect pointer check 37/272237/1
Karol Lewandowski [Fri, 11 Mar 2022 10:19:19 +0000 (11:19 +0100)]
blkid-api: Fix incorrect pointer check

Change-Id: Iec1d8620e3e6e47d7be75bd82e96153457f6a5a4

2 years agoblkid-api: Fix incorrect pointer check 28/272228/1 submit/tizen/20220311.101315
Karol Lewandowski [Fri, 11 Mar 2022 10:19:19 +0000 (11:19 +0100)]
blkid-api: Fix incorrect pointer check

Change-Id: Iec1d8620e3e6e47d7be75bd82e96153457f6a5a4

2 years agoStop displaying unnecessary errors 97/272097/3
Mateusz Moscicki [Tue, 8 Mar 2022 10:30:50 +0000 (11:30 +0100)]
Stop displaying unnecessary errors

Change-Id: I7579c69b110d7a42958543fca4f0145244bedddf

2 years agoMerge branch 'tizen_6.5' into tizen 07/272007/1
Mateusz Moscicki [Fri, 4 Mar 2022 14:36:00 +0000 (15:36 +0100)]
Merge branch 'tizen_6.5' into tizen

Change-Id: Id14818e9a3d4427c6270c3164bbfcff7d7438fe6

2 years agoDisable mounting of rootfs in DELTA_IMG and DELTA_IMG_AB upgrade mode 46/271946/1
Mateusz Moscicki [Thu, 3 Mar 2022 12:35:24 +0000 (13:35 +0100)]
Disable mounting of rootfs in DELTA_IMG and DELTA_IMG_AB upgrade mode

rootfs file system cannot be mounted because the next step will perform
a binary modification.

Change-Id: I8bb7b960848c5effbfafd2481df94555be91d86c

2 years agoMount rootfs as ro only when rootfs uses dm-verity 04/271804/3
Mateusz Moscicki [Tue, 1 Mar 2022 14:27:07 +0000 (15:27 +0100)]
Mount rootfs as ro only when rootfs uses dm-verity

rootfs can be upgraded in two ways:

  1. By modifying files (DELTA_FS)
  2. By applying a binary patch (DELTA_IMG, DELTA_IMG_AB)

If the upgrade is done with a binary patch, the file system should be
mounted as RO so that its checksum is not changed.

Change-Id: I05a1925aa688a968cf9ecdb9f68a7be4c12d018a

2 years agoMerge branch 'tizen_6.5' into tizen 31/271531/1 accepted/tizen/unified/20220223.231324 submit/tizen/20220223.125107
Mateusz Moscicki [Tue, 22 Feb 2022 12:07:55 +0000 (13:07 +0100)]
Merge branch 'tizen_6.5' into tizen

Change-Id: I2433eaf408973fd8b55bf9bbf39ea413dc6b83d9

2 years agoExtract additional upgrade scripts 30/271530/1
Mateusz Moscicki [Tue, 22 Feb 2022 12:07:00 +0000 (13:07 +0100)]
Extract additional upgrade scripts

Change-Id: I7c4675436e567059364a8e0da563e386423bba0b

2 years agoMerge remote-tracking branch 'origin/tizen_6.5' into tizen 65/271465/1 accepted/tizen/unified/20220222.034414 submit/tizen/20220221.170321
Mateusz Moscicki [Mon, 21 Feb 2022 15:25:49 +0000 (16:25 +0100)]
Merge remote-tracking branch 'origin/tizen_6.5' into tizen

Change-Id: I6a05404cd57a58b110cfbc01364dfb7d36fd0856

2 years agoMerge changes from topic "binary-diff-brotli" into tizen_6.5 accepted/tizen/6.5/unified/20220222.132813 submit/tizen_6.5/20220221.170828
Karol Lewandowski [Mon, 21 Feb 2022 15:20:37 +0000 (15:20 +0000)]
Merge changes from topic "binary-diff-brotli" into tizen_6.5

* changes:
  Run scripts from the path where upgrade-trigger.sh is
  Mount rootfs as read-only
  Fix "use after free"
  Enable static linking to libtota
  Add support for DELTA_IMG_AB update type

2 years agoRun scripts from the path where upgrade-trigger.sh is 23/271123/2
Mateusz Moscicki [Tue, 15 Feb 2022 13:16:55 +0000 (14:16 +0100)]
Run scripts from the path where upgrade-trigger.sh is

Upgrade scripts like:

  upgrade-trigger.sh
  upgrade-fota.sh
  upgrade-partia.sh
  upgrade-prepare-partitions.sh

should be run from the path to which they were extracted from the
delta.tar.

Change-Id: Ic7fb2869ca41fa223997d18d9546fa01f258d609

2 years agoMount rootfs as read-only 84/270884/3
Mateusz Moscicki [Thu, 3 Feb 2022 12:17:04 +0000 (13:17 +0100)]
Mount rootfs as read-only

Change-Id: I5663fac73d62888cdb284dfa88e869d5cb651c7d

2 years agoFix "use after free" 20/270420/4
Mateusz Moscicki [Tue, 1 Feb 2022 12:37:13 +0000 (13:37 +0100)]
Fix "use after free"

Change-Id: I832770abb9ad0dbdee65fe14883c31cd317ed73d

2 years agoEnable static linking to libtota 19/270419/3
Mateusz Moscicki [Tue, 18 Jan 2022 14:07:20 +0000 (15:07 +0100)]
Enable static linking to libtota

delta.ua is provided in the delta.tar file to perform the system
upgrade. When linked dynamically it calls functions from libtota that
are on the old system, while we would like to use the new version.

Change-Id: Ifaf889ac498886eab3310edbf250d99c22cb8bd1

2 years agoAdd support for DELTA_IMG_AB update type 18/270418/3
Mateusz Moscicki [Thu, 27 Jan 2022 13:00:07 +0000 (14:00 +0100)]
Add support for DELTA_IMG_AB update type

Add new partition upgrade type - DELTA_IMG_AB
A patch is a binary diff between two partition that is compressed with
the Brotli algorithm.
Brotli has a good compression ratio and allows decompression using a
small amount of memory (during tests, it did not exceed 17MB).

Change-Id: I467eb1bfefa2ffb1866515c1f18aeb21e710ebd1

2 years agoAdd support for the case that rootfs is a device mapped by DM 17/270417/2
Mateusz Moscicki [Tue, 1 Feb 2022 12:10:59 +0000 (13:10 +0100)]
Add support for the case that rootfs is a device mapped by DM

Change-Id: I074e72c9fad9289d059e81bd0801f7f26460aa64

2 years agoMerge branch 'tizen' into tizen_6.5 accepted/tizen/6.5/unified/20211231.161241 submit/tizen_6.5/20211229.171734
Karol Lewandowski [Thu, 30 Dec 2021 13:11:24 +0000 (14:11 +0100)]
Merge branch 'tizen' into tizen_6.5

Change-Id: Ib040e970ecd05893f67253b8134fcff067ec29c2

2 years agoRevert "Ensure required 'A/B partition switch' program is available" accepted/tizen/unified/20211231.161330 submit/tizen/20211230.132434
Karol Lewandowski [Thu, 30 Dec 2021 13:08:59 +0000 (14:08 +0100)]
Revert "Ensure required 'A/B partition switch' program is available"

This reverts commit e4e165e7be32be63403e5306b73f0711423e5d8b, as
* the program is not universally available,
* it should not be needed when legacy upgrade is used.

Change-Id: I21d8adc31f64bb71989665e826676ba1a70caae1

2 years agoMerge branch 'tizen' into tizen_6.5 54/268554/2
Mateusz Moscicki [Wed, 29 Dec 2021 13:12:32 +0000 (14:12 +0100)]
Merge branch 'tizen' into tizen_6.5

Change-Id: I9b33cafba04a2ad4cdab903226e590000d22d423

2 years agoEnsure required 'A/B partition switch' program is available 56/268556/1
Karol Lewandowski [Fri, 24 Dec 2021 13:51:30 +0000 (14:51 +0100)]
Ensure required 'A/B partition switch' program is available

Change-Id: Idfd9b899830419581964d3b5e01a284e34b7c5c8

2 years agoReflect the change from partition_switch to device_board_switch_partition 53/268553/1
Mateusz Moscicki [Fri, 24 Dec 2021 10:52:28 +0000 (11:52 +0100)]
Reflect the change from partition_switch to device_board_switch_partition

Change-Id: I042a9468b9e3e36a68a6792c38e9fd67a596f7d5

2 years agoMerge branch 'tizen' into tizen_6.5 73/267773/1 accepted/tizen/6.5/unified/20211212.212847 submit/tizen_6.5/20211209.154403
Mateusz Moscicki [Thu, 9 Dec 2021 14:00:26 +0000 (15:00 +0100)]
Merge branch 'tizen' into tizen_6.5

Change-Id: I23bdab528b12fe242a8b06fd42ebc3386777a2ab

2 years agoUse /run/upgrade-sysroot instead of /system 79/267679/2 accepted/tizen/unified/20211213.133531 submit/tizen/20211209.154145
Mateusz Moscicki [Tue, 7 Dec 2021 11:38:06 +0000 (12:38 +0100)]
Use /run/upgrade-sysroot instead of /system

Change-Id: I1b781134eafc29b07d0e6410407c665e3bd911df

2 years agoUse PARTLABEL based on LABEL from update.cfg and /hal/etc/upgrade/label_map.list 28/267528/2
Mateusz Moscicki [Mon, 6 Dec 2021 16:44:30 +0000 (17:44 +0100)]
Use PARTLABEL based on LABEL from update.cfg and /hal/etc/upgrade/label_map.list

Change-Id: I25edbad79770baa298bd0f404e9ba0d1acc08eb3

2 years agoCopy partitions listed in the /hal/etc/upgrade/background_copy.list 27/267527/1
Mateusz Moscicki [Mon, 6 Dec 2021 16:40:50 +0000 (17:40 +0100)]
Copy partitions listed in the /hal/etc/upgrade/background_copy.list

Change-Id: I283ad7e6de2997ecdfb17c44096eb5c57380e50f

2 years agoUse partition_switch to change the partition slot 24/267524/1
Mateusz Moscicki [Mon, 6 Dec 2021 16:10:16 +0000 (17:10 +0100)]
Use partition_switch to change the partition slot

Change-Id: I3e4c995190d62838e1c4cff464e831d9376710f4

2 years agoMerge branch 'tizen' into tizen_6.5 65/267265/1 accepted/tizen/6.5/unified/20211201.221725 submit/tizen_6.5/20211130.134151
Karol Lewandowski [Tue, 30 Nov 2021 13:34:17 +0000 (14:34 +0100)]
Merge branch 'tizen' into tizen_6.5

Change-Id: I6b199ffe055027b8cb119e27a3856e492250a84b

2 years agoSupport ro update during normal boot in delta.ua: 31/265631/15 accepted/tizen/unified/20211203.125407 submit/tizen/20211130.134324 submit/tizen/20211202.130243
Ernest Borowski [Mon, 25 Oct 2021 16:19:35 +0000 (16:19 +0000)]
Support ro update during normal boot in delta.ua:

1. Allow to use GPT partition labels rather than hardcoded partitions.
2. Allow to use specified block device rather than hardcoded one.
3. Add usage function.
4. Add function that translates errors into usable form for end user.
5. Add support for a|b slot partition scheme.
6. Fix bug when logging file was not opened before usage.
7. Change log file path from /last_update.log to
   /opt/data/update/last_update.log
8. Do not disable stdout && stderr

Add blkid-print application that is used to determine partition name
based on GPT LABEL.

Change-Id: Ifbc5aaa435791d4de91a896b5b34b874cb46fe8d
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
2 years agoupgrade-trigger.sh: Add support for launching A|B upgrade. 30/265630/11
Ernest Borowski [Mon, 25 Oct 2021 14:09:10 +0000 (14:09 +0000)]
upgrade-trigger.sh: Add support for launching A|B upgrade.

This mode has different functionality therefore there are other scripts
supporting it.

When upgrade-trigger.sh detects that system uses A|B partition scheme
it executes new upgrade type using 3 stages:
1. upgrade-prepare-partitions.sh -- it is responsible for backing up
   partitions from current slot to next one
2. upgrade-partial.sh -- it is responsible for upgrading partitions
   on next slot using dd and delta.ua
3. upgrade-fota.sh -- it is responsible for finishing upgrade
   and rebooting device into fota RW mode.

Change-Id: I1c8c4fbaf3d2b4817ba7e88690cab316a5cee6e6
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
2 years agoAdd A|B upgrade support during normal boot mode. 29/265629/10
Ernest Borowski [Mon, 25 Oct 2021 14:05:52 +0000 (14:05 +0000)]
Add A|B upgrade support during normal boot mode.

Change-Id: Ibc9501827ddc1a5d3f1669d97c189ef6e05361b1
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
2 years agoImprove upgrade-trigger.sh flashing speed. 63/264563/1 accepted/tizen/6.5/unified/20211028.120308 accepted/tizen/unified/20210926.235801 submit/tizen/20210924.144745 submit/tizen_6.5/20211028.162501 tizen_6.5.m2_release
Ernest Borowski [Wed, 22 Sep 2021 10:49:07 +0000 (10:49 +0000)]
Improve upgrade-trigger.sh flashing speed.

Change-Id: I0e9f6d29b1971893f34b773c8343a466a942018e
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
3 years agoAlways log update progress inside ua. 85/261285/1 accepted/tizen/unified/20210829.234841 submit/tizen/20210817.140154 submit/tizen/20210826.114923 submit/tizen/20210827.084901
Ernest Borowski [Wed, 14 Jul 2021 13:31:09 +0000 (13:31 +0000)]
Always log update progress inside ua.

Progress was not reported during headless upgrade.
This information is required for os-upgrade automatic tests.

Change-Id: Ic2ca02f1d1b92b90329abee516c7d15b6ffd7ca1
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
3 years agoAllow to use labels in uppercase in update.cfg 14/258914/1 accepted/tizen/unified/20210604.120743 submit/tizen/20210603.041836
Mateusz Moscicki [Thu, 27 May 2021 13:50:16 +0000 (15:50 +0200)]
Allow to use labels in uppercase in update.cfg

This is required to be able to flash the partition with the BOOT label,
which is in upperacse.

Change-Id: Ib018befe9cee4c66bc6ae13708d1cc436ba04f23

3 years agoImprove logging in upgrade-trigger.sh script. 35/258235/3 accepted/tizen/unified/20210526.051953 submit/tizen/20210514.153447
Ernest Borowski [Wed, 12 May 2021 12:42:08 +0000 (12:42 +0000)]
Improve logging in upgrade-trigger.sh script.

- Add log helper function which can log to stdout and file

logging format:
[script-name][tag]actual_log
currently supported tag formats: [Error] [Info]

Change-Id: Iebb727b8ec4a12fca80b03f6b64c472134749020
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
3 years agoImprove upgrade-trigger.sh script: 16/257416/5
Ernest Borowski [Fri, 23 Apr 2021 17:05:12 +0000 (17:05 +0000)]
Improve upgrade-trigger.sh script:

- Add support for delta.tar.gz
- Add missing ""
- Add proper error handling
- Remove useless cat

Change-Id: I6fd9e6e611bd9232d5a2ca5f6cf129d644a1e1f5
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
3 years agoFix invalid parenthesis 81/246781/1 accepted/tizen/unified/20201109.123541 submit/tizen/20201104.064230
Kichan Kwon [Wed, 4 Nov 2020 06:39:52 +0000 (15:39 +0900)]
Fix invalid parenthesis

Change-Id: I8cf55406c5f81bc4816d065ffdc0827dee84cc42
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoSet progress to 100% as soon as hash remaking is finished 56/246556/2 submit/tizen/20201104.032152
Kichan Kwon [Fri, 30 Oct 2020 04:58:12 +0000 (13:58 +0900)]
Set progress to 100% as soon as hash remaking is finished

- verity-handler always use 45 seconds though hash is not made
- To prevent this situation, cancel progress thread after
  hash thread is terminated

Change-Id: Ie31f259e0270874128a98c16ae81e1cd7f8d2b81
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoUpdate boilerplate 55/246555/2
Kichan Kwon [Thu, 29 Oct 2020 09:36:37 +0000 (18:36 +0900)]
Update boilerplate

Change-Id: I7785ff75af0de67bfa0c69c81a81aa906d6b3f32
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoImprove the readability about progress rearrangement 33/246333/1
Kichan Kwon [Wed, 28 Oct 2020 07:36:42 +0000 (16:36 +0900)]
Improve the readability about progress rearrangement

Change-Id: Idd92eccb52614e10b74550f03c6f3d3adda9f645
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoFix build warning 52/246152/3
Kichan Kwon [Mon, 26 Oct 2020 02:42:06 +0000 (11:42 +0900)]
Fix build warning

Change-Id: I21adccf31a2fc5a97598520220b5bae776dd189c
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoIntroduce verity-handler 46/246146/4
Kichan Kwon [Mon, 26 Oct 2020 02:16:55 +0000 (11:16 +0900)]
Introduce verity-handler

- It launches verityctl and updates progress
- If dm-verity is enabled, initrd-fota will launch it

Change-Id: Ibb82ac06e4c628bbb7c0428ed5c1eefccb9ef041
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoReflect dm-verity status to update progress 45/246145/3
Kichan Kwon [Mon, 26 Oct 2020 01:56:56 +0000 (10:56 +0900)]
Reflect dm-verity status to update progress

- With dm-verity : 20 ~ 80%
  - 80 ~ 100% is for hash remaking
- Without dm-verity : 20 ~ 100%

Change-Id: Icf9a65456eb40334f239f12ac407ddee22d7e6a9
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoUpdate img-verifier usage 76/245176/1 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.113738 accepted/tizen/6.0/unified/hotfix/20201103.001810 accepted/tizen/unified/20201006.044411 submit/tizen/20201005.081807 submit/tizen_6.0/20201029.205105 submit/tizen_6.0_hotfix/20201102.192505 submit/tizen_6.0_hotfix/20201103.114805 tizen_6.0.m2_release
Kichan Kwon [Mon, 5 Oct 2020 06:03:01 +0000 (15:03 +0900)]
Update img-verifier usage

Change-Id: Ida586c4b105ea96ca490e50c7d1f5d30a78e114d
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoInput log path instead of macro 80/244780/1 accepted/tizen/unified/20200928.072843 submit/tizen/20200925.063159
Kichan Kwon [Thu, 24 Sep 2020 06:58:33 +0000 (15:58 +0900)]
Input log path instead of macro

- If you want to write log file, input "-l LOG_FILE_PATH"
- In addition, you have to use "-i IMAGE_PATH" option

Change-Id: I9c7802981caa78f794d6d4518db474cbfea0cda5
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
3 years agoRename pre script to setup script 25/244325/1 accepted/tizen/unified/20200921.044220 submit/tizen/20200921.015202
Kichan Kwon [Thu, 17 Sep 2020 08:29:05 +0000 (17:29 +0900)]
Rename pre script to setup script

Change-Id: Iaeaaf005a9760fd9c1edb0ae91a6044f2855c041
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>