The WRT54G is a wireless router made by linksys. A few years ago linksys released its WRT54G firmware source code giving the open source community the ability to make its own versions.
Installing Linux on your wireless router has many benefits and in my opinion few risks. The one risk you do face is turning your router into a "Brick". Now, this does seem like a big chance to take but there are many options if upgrade fails. Also, if you follow the installation instructions for each wrt54g firmware distribution you will not have a problem.
Typical ways to "Brick" your wrt54g router are: trying to install your firmware upgrade over a wireless connection, interrupting the upgrade, and finally powering cycling during or five minutes after the upgrade.
General rules to follow are:
1. Always perform an upgrade from the original wrt54g linksys firmware not other firmware distributions.
2. Set your firmware back to factory defaults.
3. Do not upgrade from a wireless connection.
4. Do not turn off your router for about five minutes after the upgrade.
5. Insure your firmware is meant for your router, some firmware versions are meant for the WRT54GS (WRT54G with speed booster), and the regular wrt54g.
6. Follow the given instructions for each given firmware distribution.
7. Enable the Boot_wait function on your router . This option will give you the ability recover from a failed upgrade by using tftp to upload new firmware.
Linksys does have tools to that will let you recover from failed distributions. There are many different wrt54g firmware distrobutions to pick from. Some have specific purposes: like being used for a wireless hotspot or a radius server. Do your research before installing and always follow the exact installation instructions.