For most repair scenarios (hard brick), the file is your best friend. For software corruption without a total brick, use Scatter Firmware with SP Flash Tool.