Hi, thank you for contacting JustAnswer.com. My name is Russell. I will do my best to provide the right answer to your question.
The conventional way of reloading or repairing an Android OS on an Android phone or tablet device, is to do a Data Wipe & Factory Reset. That admittedly clears out all user data, but it *does* get the software back into undamaged usable condition, in 95+ % of the cases.
What Linux application do you contemplate using (in case I can advise you about it) ? note that though MAC OS X is based upon Linux, you may not find a true Linux application to run well on it. Linux applications can run dependably upon Linux, even if not the exact 'flavor' of Linux they were designed on or for.