platform/kernel/tizen-fusing-scripts.git
6 months agosd_fusing.py: Invoke ioctl to reread partitions directly
Karol Lewandowski [Wed, 22 May 2024 12:57:56 +0000 (14:57 +0200)]
sd_fusing.py: Invoke ioctl to reread partitions directly

This commit drops blockdev(8) in favor for invoking ioctl(2) directly,
to be able to catch EBUSY errors that happen to occur due to not yet
known kernel/udev timinig issue.

This commit also drops sfdisk --no-reread flag, which affects issuing
ioctl to reread partition table _before_ actual repartitioning.  ioctl
to reread partition table after writing changes is invoked unconditionally
and can't be disabled.

Change-Id: I105c445f9fdb3d1d2eee7ffd2de3f7ad04920f13
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 months agosd_fusing.py: Refactor parameters writing
Karol Lewandowski [Tue, 21 May 2024 21:57:15 +0000 (23:57 +0200)]
sd_fusing.py: Refactor parameters writing

This commit considerably alters when and which parameters are written
to "inform" partition:

 - Parameters are now updated always, not only when --format has been
   specified (this is compatible with old sd_fusing.sh behaviour)

 - Initial parameters are collected from configuration and from user
   input to reflect actual flashing options, eg. if user chosen to
   update only 'a' partition script won't set the flag that both
   partitions are cloned

   Dynamic parameters generation allowed to drop a lot of duplicated
   params.

Change-Id: I597f104b2b7972728663e2d85555407c721b7bb0
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 months agosd_fusing.py: Improve parameter write error message
Karol Lewandowski [Wed, 22 May 2024 10:36:48 +0000 (12:36 +0200)]
sd_fusing.py: Improve parameter write error message

Change-Id: If42e16e310b1454f190b21d6cd5b662e1f17f598
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 months agoDynamic partitions: fuse tarballs containing super.img
Jacek Kryszyn [Thu, 23 May 2024 10:25:47 +0000 (12:25 +0200)]
Dynamic partitions: fuse tarballs containing super.img

Allow to fuse tarballs prepared in such a way that they already
contain super.img and do not contain rootfs.img and hal.img.

Change-Id: Iac09011bd92f51354e16e70d3bb5f9ab12f299b2
Signed-off-by: Jacek Kryszyn <j.kryszyn@samsung.com>
6 months agoDynamic partitions: change size of a slot
Jacek Kryszyn [Wed, 22 May 2024 08:02:42 +0000 (10:02 +0200)]
Dynamic partitions: change size of a slot

Slot size was incorrect due to missing brackets. Now it is
equal to double size of hal and rootfs. Some additional code
is added to take into account metadata size and alignment of
super.

Change-Id: I7f163d7e4a74b3f5e7a1a2f207ebece9581b4876
Signed-off-by: Jacek Kryszyn <j.kryszyn@samsung.com>
6 months agotizen: sd_fusing.py: Fix wrong user_partition count for vf2*
Seung-Woo Kim [Mon, 29 Apr 2024 11:16:01 +0000 (20:16 +0900)]
tizen: sd_fusing.py: Fix wrong user_partition count for vf2*

Fix wrong user_partition count for vf2* properly

Change-Id: I8a56c5673e07629d7cd4797b8e687619be97d48c
Fixes: commit 15b42595fc8a ("tizen: sd_fusing.py: change partition of vf2* for backward compatibility")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 months agotizen: sd_fusing.py: Allow updating a & b partitions in one invocation
Karol Lewandowski [Thu, 25 Apr 2024 20:47:53 +0000 (22:47 +0200)]
tizen: sd_fusing.py: Allow updating a & b partitions in one invocation

This commit adds '--update ab' option, allowing both partition sets to
be updated at once.

Change-Id: I007392f0978753589a05d9e8586877c463ac1798
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 months agotizen: sd_fusing.py: change partition of vf2* for backward compatibility
Seung-Woo Kim [Mon, 29 Apr 2024 08:58:12 +0000 (17:58 +0900)]
tizen: sd_fusing.py: change partition of vf2* for backward compatibility

Before A/B partition support, there was the empty 4th part and
user flashing partition map in initrd-flash has partition number
with the empty partition. For backward compatibility, add the 4th
partition again.

Change-Id: Ic9417218ee3bd2d20cf8c82869d0e856a8600024
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
6 months agoscripts: sd_fusing.py: Update a patch version
Marek Szyprowski [Fri, 5 Apr 2024 01:53:23 +0000 (10:53 +0900)]
scripts: sd_fusing.py: Update a patch version

Update a patch version to 2.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I4e477d99f6d6132ae8666f71e7037ae5d662c983

6 months agotizen: sd_fusing.py: add support for VisionFive2 with Super partition
Marek Szyprowski [Thu, 11 Apr 2024 12:40:39 +0000 (14:40 +0200)]
tizen: sd_fusing.py: add support for VisionFive2 with Super partition

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Id5a23a2edd5af357d1febd756793f4aa96ca0d5b

6 months agotizen: sd_fusing.py: Switch VF2 board to A/B partition scheme
Marek Szyprowski [Thu, 11 Apr 2024 11:54:01 +0000 (13:54 +0200)]
tizen: sd_fusing.py: Switch VF2 board to A/B partition scheme

Use A/B partition scheme also for VisionFive2 board.

Boot script for VF2 has been updated to discover partitions based on
their GPT name, so it is safe to change layout.

While touching this, lets remove useless 'none' partition, which was
there only to force partitions to have specific numbers, hardcoded
earlier in the boot scripts. Also reduce the size of the 'boot'
partition, as there is nothing so large to store on it.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: If5893114a217dc98766da0afcc925f05b31c0c14

6 months agotizen: sd_fusing.py: add LicheePi4A with Super partition support
Marek Szyprowski [Wed, 10 Apr 2024 11:37:27 +0000 (13:37 +0200)]
tizen: sd_fusing.py: add LicheePi4A with Super partition support

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: If13b5df03c396c59ade8ba36529d67dc285dd745

6 months agotizen: sd_fusing.py: change bogus 'param' name to 'reserved0'
Marek Szyprowski [Wed, 10 Apr 2024 10:00:33 +0000 (12:00 +0200)]
tizen: sd_fusing.py: change bogus 'param' name to 'reserved0'

The original sd_fusing_rpi4.sh had following content:

[...]
size=${PARAM_SZ}MiB, name=reserved0
size=${RESERVED1_SZ}MiB, name=reserved1
size=${RESERVED2_SZ}MiB, name=reserved2

It looks that while rewriting the above to python, the size and name has
been mixed resulting in creating 'param' partition. Then this bogus name
was copied to the Rpi4AoT and LicheePi4A variants. Restore proper
'reserved0' name for all variants.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I931a6a3b3bbaa0aaa7d2ae934b62133b9de89568

6 months agotizen: sd_fusing.py: rpi4s: getting rid of unnecessary alignments
Jacek Kryszyn [Thu, 4 Apr 2024 13:17:27 +0000 (15:17 +0200)]
tizen: sd_fusing.py: rpi4s: getting rid of unnecessary alignments

In case of rpi4s target (Tizen with dynamic partitions
on rpi4) do not perform unnecessary calculations of aligned
size of partitions.

Change-Id: Ieea75f133d35d29f72a5b2336181b200809e5f14
Signed-off-by: Jacek Kryszyn <j.kryszyn@samsung.com>
6 months agoscripts: sd_fusing.py: Update a patch version
Jaehoon Chung [Fri, 5 Apr 2024 01:53:23 +0000 (10:53 +0900)]
scripts: sd_fusing.py: Update a patch version

Update a patch version from 0 to 1.

Change-Id: I0282bb3f625331f58a9802133a0b32ac664d9d9f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
6 months agotizen: sd_fusing.py: Catch kernel not being able to re-read partition table
Karol Lewandowski [Thu, 4 Apr 2024 12:15:27 +0000 (14:15 +0200)]
tizen: sd_fusing.py: Catch kernel not being able to re-read partition table

sfdisk(8) by default request kernel to reread partition table but does not
seem to return error code when it fails to do so.  This commit fixes followig
error:

    The partition table has been altered.
    Calling ioctl() to re-read partition table.
    Re-reading the partition table failed.: Permission denied
    The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or partx(8).
    Syncing disks.
    Traceback (most recent call last):
      File "/usr/local/bin/sd_fusing.py", line 958, in <module>
        check_partition_format(args, target)
      File "/usr/local/bin/sd_fusing.py", line 711, in check_partition_format
        mkpart(args, target)
      File "/usr/local/bin/sd_fusing.py", line 596, in mkpart
        d = "/dev/" + get_partition_device(target.device, i+1)
            ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    TypeError: can only concatenate str (not "NoneType") to str

Change-Id: I32e6636f0d374e5f4327d425373d8e38f48b7916
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
6 months agotizen: sd_fusing.py: Exit if A/B update is requested on unsupported target
Łukasz Stelmach [Thu, 4 Apr 2024 10:50:07 +0000 (12:50 +0200)]
tizen: sd_fusing.py: Exit if A/B update is requested on unsupported target

This error occurs if the target class improperly inherits from
SdFusingTarget instead of SdFusingTargetAB.

Change-Id: I83379fff92566d0036a868837e613a9a9cd94f7e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agotizen: sd_fusing.py: add LicheePi4A board support
Marek Szyprowski [Fri, 29 Mar 2024 12:03:55 +0000 (13:03 +0100)]
tizen: sd_fusing.py: add LicheePi4A board support

Add support for preparing SD-card bootable on LicheePi4A board (with
A/B partitions on GPT layout).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: If956976769e07d0e2166a03651d6111c39e635a4

6 months agotizen: sd_fusing.py: add support for writing bootcode to sector zero
Marek Szyprowski [Tue, 2 Apr 2024 07:42:08 +0000 (09:42 +0200)]
tizen: sd_fusing.py: add support for writing bootcode to sector zero

Some boards require special binary bootcode in sector zero (MBR or
protective MBR) to boot properly. Add support for such case.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8cc0594328ccd6e5445d1b47804e374b0b3550a8

6 months agotizen: sd_fusing.py: add support for partition start & size specified in sectors
Marek Szyprowski [Thu, 28 Mar 2024 19:23:46 +0000 (20:23 +0100)]
tizen: sd_fusing.py: add support for partition start & size specified in sectors

Add support for specifying partition's start & size in sectors and adjust
lba-start parameter (first allowed sector of the first partition) to 34,
what is the minimal possible value for the GPT layout. This doesn't affect
any start or size of the partitions specified in MBytes, because according
to sfdisk manual, they are always aligned to 1MB.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8fdccb896072a9cddfe7e185f6650eb0471caae2

6 months agoscripts: tizen: sd_fusing.py: Add NOTICE log level
Łukasz Stelmach [Thu, 28 Mar 2024 08:59:37 +0000 (09:59 +0100)]
scripts: tizen: sd_fusing.py: Add NOTICE log level

Add a second normal logging level. This level should be used
for essential progress messages. Use with caution to avoid
overwhelming users with output.

Change-Id: Ib22446978af5289f647cdffbb4ccd56d56c7d086
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agoRevert "scripts: tizen: sd_fusing.py: Display an information during flashing"
Łukasz Stelmach [Thu, 28 Mar 2024 07:20:58 +0000 (08:20 +0100)]
Revert "scripts: tizen: sd_fusing.py: Display an information during flashing"

This partially reverts commit 8f78bf12c0eba95ebb203868856899fdcec2935c.

Only the logging module should be used for printing messages to enable
consistent control over script's output.

Change-Id: I3c9b91ff8a8accdef910700348e24be0ca1b7890
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agoscripts: tizen: sd_fusing.py: Display an information during flashing
Jaehoon Chung [Fri, 15 Mar 2024 04:26:09 +0000 (13:26 +0900)]
scripts: tizen: sd_fusing.py: Display an information during flashing

Display an information during flashing.
Developer can see what script is doing.

Change-Id: Id6ffd67b885f623f8778db9a51e7606a7896c71a
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
6 months agoscripts: tizen: sd_fusing.py: Separate the VF2 from RV64
Jaehoon Chung [Mon, 11 Mar 2024 09:24:21 +0000 (18:24 +0900)]
scripts: tizen: sd_fusing.py: Separate the VF2 from RV64

VisionFive2 needs to flash the u-boot-spl.bin.normal.out.
Separate the VF2 from RV64.

Change-Id: I19cef42d61131c6907daef2a8d791106673264c1
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
6 months agoscripts: tizen: sd_fusing.py: Add Rpi4AoT partition map
Jaehoon Chung [Fri, 12 Jan 2024 00:55:25 +0000 (09:55 +0900)]
scripts: tizen: sd_fusing.py: Add Rpi4AoT partition map

Add Rpi4Aot Partition map to support an AoT on RPi4.

Change-Id: I6ab6b1d51408c01cb2e219cc6f4699eb849f130e
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
6 months agoscripts: Add InitParams about RV64
Jaehoon Chung [Tue, 2 Jan 2024 01:40:55 +0000 (10:40 +0900)]
scripts: Add InitParams about RV64

Add InitParams about RV64(Visionfive2 board).
It will be created reboot-param.bin and reboot-param.info.

Change-Id: I282d974e777b5caea50353eb3ccc8922099f6d0c
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
6 months agoscripts: Change a class name from RpiInitParams to InitParams
Jaehoon Chung [Tue, 2 Jan 2024 01:28:02 +0000 (10:28 +0900)]
scripts: Change a class name from RpiInitParams to InitParams

InitParams can be also used for other targets, not only Rpi.
So the Rpi prefix can be removed.

Change-Id: I6b55056cddb8aef2fa582a9e40565423319904fe
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
6 months agoscripts: support x86 emulator images for QEMU
Łukasz Stelmach [Fri, 24 Nov 2023 10:59:45 +0000 (11:59 +0100)]
scripts: support x86 emulator images for QEMU

Change-Id: I24261d9dbc2926e1d0b7b39402269a09b48dd82b
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agoscripts: add support for "swap" filesystem type
Łukasz Stelmach [Fri, 24 Nov 2023 10:55:12 +0000 (11:55 +0100)]
scripts: add support for "swap" filesystem type

Run mkswap(8) for partitions with have their fstype set to "swap". x86
emulator images require swap partition to be present.

Change-Id: Ia8e9be666f1f2c587396b8e11bf515d02370a2ad
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agoscripts: support targets without the user partiton
Łukasz Stelmach [Fri, 24 Nov 2023 10:50:48 +0000 (11:50 +0100)]
scripts: support targets without the user partiton

x86 emulator images do not ship user partition. Therefore
there is no point in doing all the size calculations required
for other targets.

Change-Id: Ia59156c653695cc9067e9f971a7b4dcaa8af9d71
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agoscripts: add --partition-size feat to sd_fusing.py
Leonid [Fri, 13 Oct 2023 07:18:40 +0000 (09:18 +0200)]
scripts: add --partition-size feat to sd_fusing.py

The idea is to alter partition sizes via
overriding part_table prior to SdFusingTarget.__init__
to avoid hardcoding it every time you need such a change.

Implemented in SdFusingTarget.apply_partition_sizes

Currently only called (and tested) for RV64 target

Change-Id: Ia070359b47b9c3bfbbdb7881ddf43fb16d2df4a3
Signed-off-by: Leonid <l.sawin@samsung.com>
(cherry picked from commit 304aa532036b5c81553787dfcb33dc6376ad6e91)

6 months agoscripts: generate binaries and binaries_b dictionaries
Łukasz Stelmach [Wed, 4 Oct 2023 09:17:43 +0000 (11:17 +0200)]
scripts: generate binaries and binaries_b dictionaries

Read image filenames from the part_table and automatically
associate them with appropriate partitions. Adding or
removing partitions doesn't require manual and error-prone
changes to binaries and binaries_b dictionaries.

Change-Id: Ib1cff8cb75af8a6f6c4af6f487545c643d61f438
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agoscripts: rewrite fusing scirpts in python
Łukasz Stelmach [Mon, 4 Sep 2023 10:23:12 +0000 (12:23 +0200)]
scripts: rewrite fusing scirpts in python

Replace target specific shell fusing scirpts with a single extensible
Python script. To add a new target add a new class inheriting from
SdFusingTarget or SdFusingTargetAB and provide necessary information
in the part_table class variable.

Change-Id: I98cc732d78a8e71b423bc7ec42c1a6a890ffb41b
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 months agoInitial empty repository
Jinkun Jang [Wed, 4 Dec 2024 01:41:05 +0000 (01:41 +0000)]
Initial empty repository