CoreGuard: Safeguarding Foundational Capabilities of LLMs Against Model Stealing in Edge Deployment