/etc/rcS.d contains the scripts that are executed at boot time. These are in general symbolic links to the scripts in /etc/init.d
gdm start/stop script is found in /etc/init.d/. If you're missing the link to this script in /etc/rcS.d then it is a reason why your gdm does not start when your linux box boots.