dd-WRT project is an open source project to reimplement router firmware for Linksys routers, and new version even support my buffalo router! (WBR-G54 is supported, but mine is WBR-B11, which is 99% same as G54, so I bravely give it a test, haha)
After reading some passages in forum and wiki, I downloaded the generic firmware, edit it and ... Flash!!
After a minute, my router is up and running again! Now I can add many many functions to it easily, even changing the kernel! Great project.