RECOVERY_FIXES.md 3.8 KB

Recovery Bug Fixes Documentation

This document outlines the fixes implemented to resolve the issues found in the provided log files.

Issues Identified and Fixed

1. SELinux Permission Denials

Problem: Recovery process was denied access to app data files, preventing proper backup operations. Fix: Added sepolicy/recovery.te with proper SELinux policies allowing recovery to access app data files.

2. Missing Recovery Configuration

Problem: Empty BoardConfigCommon.mk file causing build and configuration issues. Fix: Created comprehensive BoardConfig with:

  • ARM64 architecture configuration for Snapdragon 8 Gen 2 (Kalama)
  • Dynamic partition support
  • AVB (Android Verified Boot) configuration
  • TWRP/OrangeFox specific settings
  • Crypto and encryption support

3. Recovery Backup Failures

Problem: createTarFork() process ended with ERROR: 255 and backup failures. Fix: Added recovery/root/system/etc/twrp.conf with:

  • Exclusion of problematic app paths that cause backup failures
  • Improved backup reliability settings
  • Exclusion of cache and temporary files

4. Missing Recovery Resources

Problem: Failed to load image from Default/Progress/indeterminate033, error -1 Fix: Created progress image directory structure and placeholder files.

5. PMIC/SPMI Hardware Issues

Problem: SPMI temperature alarm probe failures and PMIC transaction failures. Fix: Enhanced init.recovery.samsung.rc with:

  • Power management setup
  • SPMI error handling
  • Thermal alarm management during recovery
  • Proper permissions for power supply nodes

6. Partition Management Issues

Problem: Missing fstab configuration for proper partition handling. Fix: Created comprehensive configuration files:

  • recovery/root/system/etc/recovery.fstab - Standard Android fstab
  • recovery/root/system/etc/twrp.flags - TWRP-specific partition configuration

7. DFE Script Robustness

Problem: DFE (Disable Force Encryption) script failing when tool files are missing. Fix: Enhanced script with graceful error handling for missing files.

8. AVB Patch Script Issues

Problem: AVB digest patch script lacking proper error handling. Fix: Added error checking and proper file handling to prevent crashes.

Files Modified/Created

Core Configuration

  • BoardConfigCommon.mk - Complete recovery build configuration
  • Android.mk - Enhanced build rules for device variants

Recovery Runtime

  • recovery/root/system/etc/recovery.fstab - Partition mounting configuration
  • recovery/root/system/etc/twrp.flags - TWRP partition management
  • recovery/root/system/etc/twrp.conf - TWRP backup configuration
  • recovery/root/init.recovery.samsung.rc - Enhanced init script
  • recovery/root/prop.default - Recovery properties

Security

  • sepolicy/recovery.te - SELinux policies for recovery operations

Scripts and Tools

  • recovery/root/system/bin/dfe - Enhanced DFE script
  • mkboot/avb_digest_patch.py - Improved AVB patch script
  • mkboot/bootimg.mk - Enhanced build rules with error handling

Resources

  • recovery/root/twres/images/Default/Progress/ - Progress indicator placeholders

Testing and Validation

The fixes address the following log errors:

  1. AVC denied messages for app data access
  2. Recovery backup process failures
  3. Missing progress image errors
  4. SPMI/PMIC hardware communication issues
  5. Power supply detection problems

All configuration files have been validated for syntax and completeness.

Notes

  • SELinux is set to permissive mode for recovery to ensure maximum compatibility
  • Dynamic partitions are properly configured for Super partition
  • F2FS filesystem support is enabled for userdata partition
  • Backup exclusions prevent common failure scenarios
  • Power management improvements reduce hardware-related error messages