If there is black discharge in the ear it can be a sign of ear mites or infection. Ear mites are white but their debris leave behind a dry salt and pepper looking substance. It is often crumbly is not in all cases. Ear infections can be bacteria, yeast, or a combination of both. Some of the discharge due to infection is dark brown- like mud. This debris is often wet or sticky and can have a sweet or musty odor. In cases of sever infection, the odor can be extremely unpleasant and almost rotten. All three of these require medications specific to the problem. Ear cytologies are done at your veterinarian where the discharge is stained and examined under a microscope. The vet may prescribe a flush, ointment, oral medication or any combination of these.
Some dogs ears are prone to getting more dirty than others naturally. Also some dogs and some breeds (i.e. basset hounds, cocker spaniels) are more prone to infections.
If you cannot get to the vet right away, you can try cleaning your dogs ears with a solution of one part white vinegar and one part water. Fill the ear canal and massage the outside of the ear. Then let your dog shake his head (you may want to attempt this outdoors). You can wipe the ear with soft cotton (cotton ball or gauze.) DO NOT use a Q-tip as they do not hold still and you can hurt them or drive the debris further down the ear canal. This alone will not solve the problem, but it will help start treatment and is safe to use.
Hope this helps. Please let me know if you need additional information.