How to create a self-signed certificate with openssl?

I'm adding https support to an embedded linux device. I have tried to generate a self-signed certificate with these steps: openssl req -new > cert.csr openssl rsa -in privkey.pem -out key.pem o...