well you first need to make an iso image of the stuff you want with rockridge extensions which means it wont truncate the filenames.
So let's say your dir structure is like this:
If you want the root of the cd to contain file1,file2,file3,dir1, and dir2, then you must do this:
mkisofs -r -o name.iso foo
Then you use cdrecord to burn that iso onto a cd:
cdrecord -v dev=1,0,0 speed=10 -data name.iso
type "cdrecord -scanbus" to figure out which 'dev' is your cd burner.
Hope this helps.