I would remove all the flaking and loose debris. Get some joint compound and slightly water it down. Get a plastic trowel or metal one if you want to do this more often. Float over the area with a nice coating of the compound. Remember, joint compound shrinks and requires over night drying and then sanding before pass two.
When the patch dries, then lightly sand it and apply another coating. Keep doing this process until the applied coating is even with the old. Then on your very last coating apply your texture design.
Now, prime the area after thorough drying. Then apply your finish coat.