I just lost two and a half hours of my life trying to restore a Linksys WRT54GS (v.7) from DD-WRT to the official firmware. None of the restore/reset options I tried worked during that time. Despite various attempts the router always returned to the DD-WRT configuration.
Finally, I managed to find a solution by installing the VXWorks-revert firmware (via DD-WRT router database) for this router (available on the DD-WRT site for this router’s downloads). After rebooting and uploading the firmware via TFTP the router fell back to a recovery mode from which I was able to load the official firmware (via Web GUI). Starting with the same method using the official firmware never worked until after installing VXWorks-revert.