How to get surfaces for lightmaps...

I was trying to learn how to implement lightmaps and didnt understand how to get surfaces froms a set of polygons…Will I have different surfaces for each wall in a room? How do I subdivide my world into surfaces?
Thank you.

have a look at for some tutorials on lightmaps