How to remove device tree overlay?

Hi. I’ve followed the instructions presented in Device Tree Overlays on Torizon, in order to add a custom overlay. It worked and thank you Toradex for the tutorial.

Can someone tell me if it is possible to remove the overlay I’ve added (without reinstalling the OS)? If so, then how?

Greetings @CristianM,

First of all which method did you use to install the overlay? Did you use TorizonCore Builder or did you use the “overlays.txt” method.

Well for the “overlays.txt” method it’s as simple as removing the entry in that file. For TorizonCore Builder, the process is a bit more involved. This is because TorizonCore Builder actually generates a new device tree binary with the overlays applied. Since it’s one binary blob it’s not as simple as removing something.

That being said you can rollback to the previous version of the OS that didn’t have the overlays. I’m not sure how much you’ve dug into TorizonCore Builder, but it does changes like overlays by creating a new revision of the OS. However the old revision should still be on the system. You can see the revisions available on your system like so:

:~$ ostree admin status
* torizon a58a1e8a2f6b17d425730c434ca0ae4dcc55e8dddd5d9f32ed5fff36639506b2.0
    Version: 5.1.0-devel-202012+build.6-tcbuilder.20201215191018
    origin refspec: torizon

Though in your case there should be 2 revisions listed. The revisions that is currently installed and running has a * next to it. In order to reinstall the other revision you can run sudo ostree admin deploy <version hash here>. This command will ready the specified version to be booted into on next boot.

But yeah if you don’t want to completely reflash your device then using OSTree to rollback to a previous version without the overlays is probably the most straightforward way.

Best Regards,

Thank you. I have used TorizonCore Builder. I’ve tried your suggestion, but I saw that it allows to rollback to the previous version only (there are only two revisions listed after executing ostree admin status). In my case, I made two consecutive tests, by applying two overlays; so, I couldn’t rollback to the initial OS. So, what is the solution in this case, without reflashing the device?

Well in that case we can’t do a rollback. Hmm the only alternative I can think, and this is more of a hack/workaround would be to use TorizonCore Builder to push a revision without device trees. So in theory you’d use “unpack” to unpack an umodified revision into the tool’s storage. Then I believe you need some kind of change/difference in order to deploy so you may need to fabricate some kind of change. Then use union and then deploy to push your revision that has no overlays applied.

Then again at this point it may just be less trouble to re-flash the device with Easy Installer.

Best Regards,

Thanks. Maybe it’s a good idea for you to create a way to make this easier for developers.

Thank you for your feedback, I’ll see what we can do to make this experience better.

Best Regards,