I have bricked a linux embedded device.
I was experimenting with it, and added my own path to
libc I included in my path is not compatible with this particular device, so I lost ssh access to it and of course it does not boot anymore.
I can enter a sort of download mode, where I can load in memory the bootloader, the kernel, the dtb and the initramfs. I can then tell the processor to jump to a certain address in memory, and have the system boot.
This does not solve the problem, because as soon as the
root is switched from the initramfs to the flash memory of the device, the wrong libraries are used and the device stops working.
My plan is to add a custom script to the initramfs that mounts the flash, erases
/etc/ld.so.cache. I don't care if the deivice does not boot then, as soon as the files are emptied and the device is reboot, it should fall back to use the standard libraries. I can then connect via ssh and clean up the mess.
I was not able to understand where exactly I should inject my fix in the initramfs, so the question is:
Where should I insert a few lines of bash so that they are executed at boot, before
/ is mounted?