Samadhi is the realization of the nature of mind. Samadhi is meditation where the main focus is on the nature of mind. The main meditation is on the view of the nature of mind to eliminate all mental problems. Mental problems do not mean the abnormal problems. Mental problems here refer to the negative emotions, and ignorance.
Ignorance is the main cause of all negative emotions.
The meditation has its focus on each of the negative emotions to eliminate them. In this way, you will be liberated. Of the two side practices contained in the Ngondro or Foundation practices , one purifies your karma. The other develops the merit that supports and strengthens the practice to make it successful. The two side practices are the methods and meditation is the main practice.