It depends on your manner of entry. If you entered without inspection, then you are not likely eligible to adjust status here. You would need to depart and reenter. You may be eligible for the provisional unlawful presence waiver program which would allow you to process your waiver here in the States instead of after you leave. If you entered with inspection, then you may be eligible to adjust status.
If you entered the country on a visa, then you will not have to return to your country to have your immigration interview.
If you entered illegally, then you will have to return to your country for your immigration interview.
Do be aware that if you entered the country illegally twice, you will be ineligible for the hardship waiver.
Please consider retaining an immigration attorney with experience doing hardship waivers before proceeding with any application.
What needs to be done for you to become a legal permanent resident depends on whether you entered the US with a valid visa or not.
J Charles Ferrari Eng & Nishimura 213.622.2255 The statement above is general in nature and does not constitute legal advice, as not all the facts are known. You should retain an attorney to review all the facts specific to your case in order to receive advise specific to your case. The statement above does not create an attorney/client relationship. Answers on Avvo can only be general ones, as specific answers would require knowledge of all the facts. As such, they may or may not apply to the question.
If you entered with a visa, then you would just apply for adjustment of status here (assuming there are no other complications).
If you did not enter with a visa, you have two options. One is the new provisional waiver program. However, I have been advising people in your situtation to apply for an advance parole (travel document) to leave and re-enter the U.S. The reason is that once you re-enter lawfully, you would be able to adjust your status in the U.S. just like someone who entered with a visa. I would always prefer that a client apply within the U.S. rather than outside the U.S., because you have more rights if you are physically in the U.S.
Advance parole is only available for humanitarian, work, and educational reasons. Some of my clients are considering signing up for a two-week study abroad program focusing on cultural studies or ecotourism, etc, to see if USCIS will permit them to travel.