This is how you can proceed with the patching and painting - this is not the "only" way to do this, but this protocol will work fine.
Prime the wall first with a good primer/sealer that has good adhesion to most any surface. I would use Zinsser's oil based Coverstain (with good ventilation. You can usually tint this to match the finish paint color - ask the paint store about doing this.
Then repair the cracks, nail holes and dents etc.... For the drywall repair I would use drywall compound for any large repairs and spackle for small nail holes and dents. Use drywall fiberglass mesh tape over the "cracks" Allow the repairs to dry.
Once dry, you may sand the repairs smooth. Do not sand through your primer coat that you originally put down prior to repairing if you house is older (pre - 1978 in United States) as the underlying surface may contain lead. If there is a lot of sanding use a shop vac with a HEPA filter and a sanding attachment (for more detail on using a shop vac with sander attachment see:
Minimizing Dust When Sanding Drywall CompoundAfter repairs are completed, wipe them with a micro mesh tack cloth and spot prime them with the Coverstain primer.
Once the above is completed you are ready to paint with the finish paint.