f6176009b1
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.
73 lines
1.9 KiB
C
73 lines
1.9 KiB
C
#ifndef _LINUX_REBOOT_H
|
|
#define _LINUX_REBOOT_H
|
|
|
|
/*
|
|
* Magic values required to use _reboot() system call.
|
|
*/
|
|
|
|
#define LINUX_REBOOT_MAGIC1 0xfee1dead
|
|
#define LINUX_REBOOT_MAGIC2 672274793
|
|
#define LINUX_REBOOT_MAGIC2A 85072278
|
|
#define LINUX_REBOOT_MAGIC2B 369367448
|
|
|
|
|
|
/*
|
|
* Commands accepted by the _reboot() system call.
|
|
*
|
|
* RESTART Restart system using default command and mode.
|
|
* HALT Stop OS and give system control to ROM monitor, if any.
|
|
* CAD_ON Ctrl-Alt-Del sequence causes RESTART command.
|
|
* CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task.
|
|
* POWER_OFF Stop OS and remove all power from system, if possible.
|
|
* RESTART2 Restart system using given command string.
|
|
*/
|
|
|
|
#define LINUX_REBOOT_CMD_RESTART 0x01234567
|
|
#define LINUX_REBOOT_CMD_HALT 0xCDEF0123
|
|
#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
|
|
#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000
|
|
#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC
|
|
#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
|
|
|
|
/* Including <unistd.h> makes sure that on a glibc system
|
|
<features.h> is included, which again defines __GLIBC__ */
|
|
#include <unistd.h>
|
|
#include "linux_reboot.h"
|
|
|
|
#define USE_LIBC
|
|
|
|
#ifdef USE_LIBC
|
|
|
|
/* libc version */
|
|
#if defined __GLIBC__ && __GLIBC__ >= 2
|
|
# include <sys/reboot.h>
|
|
# define REBOOT(cmd) reboot(cmd)
|
|
#else
|
|
extern int reboot(int, int, int);
|
|
# define REBOOT(cmd) reboot(LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,(cmd))
|
|
#endif
|
|
static inline int my_reboot(int cmd) {
|
|
return REBOOT(cmd);
|
|
}
|
|
|
|
#else /* no USE_LIBC */
|
|
|
|
/* direct syscall version */
|
|
#include <linux/unistd.h>
|
|
|
|
#ifdef _syscall3
|
|
_syscall3(int, reboot, int, magic, int, magic_too, int, cmd);
|
|
#else
|
|
/* Let us hope we have a 3-argument reboot here */
|
|
extern int reboot(int, int, int);
|
|
#endif
|
|
|
|
static inline int my_reboot(int cmd) {
|
|
return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd);
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
#endif /* _LINUX_REBOOT_H */
|