tizen: sd_fusing.py: add LicheePi4A board support 48/308748/7
authorMarek Szyprowski <m.szyprowski@samsung.com>
Fri, 29 Mar 2024 12:03:55 +0000 (13:03 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Thu, 4 Apr 2024 10:37:54 +0000 (12:37 +0200)
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

scripts/tizen/sd_fusing.py

index c71d6de..a3aea30 100755 (executable)
@@ -488,6 +488,66 @@ class VF2(InitParams, SdFusingTarget):
         self.apply_partition_sizes(args.partition_sizes)
         super().__init__(device, 'gpt')
 
+class LicheePi4A(InitParams, SdFusingTargetAB):
+    long_name = "LicheePi4A"
+    part_table = [
+        {"size": None, "fstype": "raw",  "name": "spl+uboot",
+         "start_sector": 34, "size_sectors": 4062,
+         "ptype": "8DA63339-0007-60C0-C436-083AC8230908",
+         "binaries": ["u-boot-with-spl.bin"],},
+        {"size": 128,  "fstype": "vfat", "name": "boot_a",
+         "ptype": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
+         "binaries": "boot.img"},
+        {"size": 3072, "fstype": "ext4", "name": "rootfs_a",
+         "binaries": "rootfs.img"},
+        {"size": 1344, "fstype": "ext4", "name": "system-data",
+         "binaries": "system-data.img"},
+        {"size": None, "fstype": "ext4", "name": "user",
+         "binaries": "user.img"},
+        {"size": 32,   "fstype": "ext4", "name": "module_a",
+         "binaries": "modules.img"},
+        {"size": 32,   "fstype": "ext4", "name": "ramdisk_a",
+         "binaries": "ramdisk.img"},
+        {"size": 32,   "fstype": "ext4", "name": "ramdisk-recovery_a",
+         "binaries": "ramdisk-recovery.img"},
+        {"size": 8,    "fstype": "ext4", "name": "inform"},
+        {"size": 256,  "fstype": "ext4", "name": "hal_a",
+         "binaries": "hal.img"},
+        {"size": 128,  "fstype": "vfat", "name": "boot_b",
+         "ptype": "C12A7328-F81F-11D2-BA4B-00A0C93EC93B",
+         "binaries_b": "boot.img"},
+        {"size": 3072, "fstype": "ext4", "name": "rootfs_b",
+         "binaries_b": "rootfs.img"},
+        {"size": 32,   "fstype": "ext4", "name": "module_b",
+         "binaries_b": "modules.img"},
+        {"size": 32,   "fstype": "ext4", "name": "ramdisk_b",
+         "binaries_b": "ramdisk.img"},
+        {"size": 32,   "fstype": "ext4", "name": "ramdisk-recovery_b",
+         "binaries_b": "ramdisk-recovery.img"},
+        {"size": 256,  "fstype": "ext4", "name": "hal_b",
+         "binaries_b": "hal.img"},
+        {"size": 4,    "fstype": "raw",  "name": "param"},
+        {"size": 64,   "fstype": "raw",  "name": "reserved1"},
+        {"size": 125,  "fstype": "raw",  "name": "reserved2"},
+    ]
+    params = (('reboot-param.bin', 'norm'),
+              ('reboot-param.info', 'norm'),
+              ('partition-ab.info', 'a'),
+              ('partition-ab-cloned.info', '1'),
+              ('upgrade-status.info', '0'),
+              ('partition-a-status.info', 'ok'),
+              ('partition-b-status.info', 'ok'))
+
+    # bootcode written to the protective MBR, aka RV64 'J 0x4400' (sector 34)
+    bootcode = b'\x6f\x40\x00\x40'
+
+    def __init__(self, device, args):
+        self.user_partition = 4
+        self.reserved_space = 5
+        self.update = args.update
+        self.apply_partition_sizes(args.partition_sizes)
+        super().__init__(device, 'gpt')
+
 class X86emu(SdFusingTarget):
     part_table = [
         {"size": 512,    "fstype": "vfat",  "name": "EFI", "start": 4,
@@ -531,6 +591,7 @@ TARGETS = {
     'rpi4aot': Rpi4AoT,
     'vf2': VF2,
     'rv64': RV64,
+    'lpi4a': LicheePi4A,
     'x86emu32': X86emu32,
     'x86emu64': X86emu64,
 }