Assuming the question is " "How can I prevent a customer from installing their own firmware?", industry standards regarding this issue are (in short):
- Use a secure bootloader that would only accept to boot on a firmware that is signed with your key.
- Use a secure storage (also called fuses, or OTP (one-time-programming)) to store this key so that it just can't be physicaly modified.
- Use an oracle chipset that will do the crypto job for you and abstract the keys.
Moreover, you'll also have to ensure that your device is safe for hardware attack (like changing the flash device after the signature has been verified)
The problem is that your device must be ready for all that. It's the kind of security that must be designed at the very beginning of the project and that is very difficult to add later.
What kind of hardware do you have ? Does it implement TEE or SEE mechanisms ?
If not, there's some companion chip that you can embed on your hardware to implement this...
Anyway, the real point is the private key.
If private key is leaked, then the whole security is broken.
Usually (and based on my experience working for companies that manage that kind of secrets) the public key is burnt on the device by the hardware manufacturer during the production at plant and isn't even known by the company developing firmware.
To ease development, there usually two sets of keys: production keys, that are the best kept secret and only use in production devices and development keys that are burnt on devices for developers.
Usually, on this "development devices", the most critical functions can't be ran.
To go further, search for OTP, SEE, TEE, Key Ladder, etc...