Files
oxmc f6176009b1 Add recovery_ui and recovery_toolkit scaffolding (first draft, not build-tested)
Stages TWRP's GUI engine and standalone tooling as PawletOS-owned modules
instead of a bootable/recovery fork, per the plugin-architecture finding in
NOTES-ota-recovery-ab.md: stock recovery_main.cpp already dlopen()s
librecovery_ui_ext.so and dlsym()s make_device() from it at runtime, so the
UI layer doesn't require touching stock bootable/recovery at all. Confirmed
via source grep that recovery.cpp/install.cpp have zero references into the
partition manager/backup engine/GUI code and vice versa.

recovery_ui/: TWRP's gui/, minuitwrp/, libpixelflinger/ (copied verbatim,
GPL-3.0), plus a new device/ providing PawletTwrpUI (a ScreenRecoveryUI
subclass) and make_device() — written from scratch against stock's
RecoveryUI/ScreenRecoveryUI virtual-method contract, since TWRP's own fork
never ships a make_device() (every real TWRP device provides its own, and
no reference device tree was available to copy from). Top-level Android.bp
defines librecovery_ui_pawlet_twrp, the module TARGET_RECOVERY_UI_LIB should
point at. gui/Android.bp and minuitwrp/Android.bp had their include_dirs
rewritten for the new paths.

recovery_toolkit/: partition manager, backup engine (tar/digest/adbbu/apex),
filesystem/format support (exfat/dosfstools/gpt/fuse/mtp/crypto), scripting
(openrecoveryscript/orscmd/twrpinstall), shared helpers. Source only, no
Android.bp yet for any of it.

Known gap blocking recovery_ui from actually linking: gui/'s libguitwrp
depends on libaosprecovery, built from recovery_toolkit/helpers/twrp.cpp via
a Go Soong plugin (libaosprecovery_defaults.go) not yet ported. Neither repo
has been build-tested — no local AOSP build environment available in this
workspace. See each directory's README.md for a precise done/not-done
breakdown.
2026-07-11 16:34:35 -07:00

111 lines
2.6 KiB
C

#ifndef UTIL_LINUX_PT_SUN_H
#define UTIL_LINUX_PT_SUN_H
#include <stdint.h>
#define SGI_LABEL_MAGIC 0x0be5a941
#define SGI_MAXPARTITIONS 16
#define SGI_MAXVOLUMES 15
/* partition types */
enum {
SGI_TYPE_VOLHDR = 0x00,
SGI_TYPE_TRKREPL = 0x01,
SGI_TYPE_SECREPL = 0x02,
SGI_TYPE_SWAP = 0x03,
SGI_TYPE_BSD = 0x04,
SGI_TYPE_SYSV = 0x05,
SGI_TYPE_ENTIRE_DISK = 0x06,
SGI_TYPE_EFS = 0x07,
SGI_TYPE_LVOL = 0x08,
SGI_TYPE_RLVOL = 0x09,
SGI_TYPE_XFS = 0x0a,
SGI_TYPE_XFSLOG = 0x0b,
SGI_TYPE_XLV = 0x0c,
SGI_TYPE_XVM = 0x0d
};
struct sgi_device_parameter {
unsigned char skew;
unsigned char gap1;
unsigned char gap2;
unsigned char sparecyl;
uint16_t pcylcount;
uint16_t head_vol0;
uint16_t ntrks; /* tracks in cyl 0 or vol 0 */
unsigned char cmd_tag_queue_depth;
unsigned char unused0;
uint16_t unused1;
uint16_t nsect; /* sectors/tracks in cyl 0 or vol 0 */
uint16_t bytes;
uint16_t ilfact;
uint32_t flags; /* SGI_DEVPARAM_* controller flags */
uint32_t datarate;
uint32_t retries_on_error;
uint32_t ms_per_word;
uint16_t xylogics_gap1;
uint16_t xylogics_syncdelay;
uint16_t xylogics_readdelay;
uint16_t xylogics_gap2;
uint16_t xylogics_readgate;
uint16_t xylogics_writecont;
} __attribute__((packed));
enum {
SGI_DEVPARAM_SECTOR_SLIP = 0x01,
SGI_DEVPARAM_SECTOR_FWD = 0x02,
SGI_DEVPARAM_TRACK_FWD = 0x04,
SGI_DEVPARAM_TRACK_MULTIVOL = 0x08,
SGI_DEVPARAM_IGNORE_ERRORS = 0x10,
SGI_DEVPARAM_RESEEK = 0x20,
SGI_DEVPARAM_CMDTAGQ_ENABLE = 0x40
};
struct sgi_disklabel {
uint32_t magic; /* magic number */
uint16_t root_part_num; /* # root partition */
uint16_t swap_part_num; /* # swap partition */
unsigned char boot_file[16]; /* name of boot file */
struct sgi_device_parameter devparam; /* not used now */
struct sgi_volume {
unsigned char name[8]; /* name of volume */
uint32_t block_num; /* logical block number */
uint32_t num_bytes; /* how big, in bytes */
} __attribute__((packed)) volume[SGI_MAXVOLUMES];
struct sgi_partition {
uint32_t num_blocks; /* size in logical blocks */
uint32_t first_block; /* first logical block */
uint32_t type; /* type of this partition */
} __attribute__((packed)) partitions[SGI_MAXPARTITIONS];
/* checksum is the 32bit 2's complement sum of the disklabel */
uint32_t csum; /* disk label checksum */
uint32_t padding; /* padding */
} __attribute__((packed));
static inline uint32_t sgi_pt_checksum(struct sgi_disklabel *label)
{
int i;
uint32_t *ptr = (uint32_t *) label;
uint32_t sum = 0;
i = sizeof(*label) / sizeof(*ptr);
while (i) {
i--;
sum -= be32_to_cpu(ptr[i]);
}
return sum;
}
#endif /* UTIL_LINUX_PT_SUN_H */