[vim2] fix issues with passing entropy to zircon.

This CL fixes a bunch of small issues that surfaced when we tried to
port this change to a different board.

Changes:

* Sort includes in alphabetical order.
* Remove magic constant specifying the size of the kernel entropy
cmdline string.
* Fix error in the static_assert checking bounds of the
CMDLINE_ENTROPY_SIZE (each char would produce 4 bits of entropy instead
of 8)
* Add static_assert checking that CMDLINE_ENTROPY_BITS is multiple of
32, to avoid writing more than we request.
* Separate the hw_rand_hex into a function that only reads the hw rng
and another that converts an uint32 into a 8 hex chars.
* Fix a typo that avoided adding a '\0' at the end of the cmdline
string.
* Add a mandatory_memset implementation, and call that instead of
memset for clearing the cmdline buffer after adding the zbi cmdline.

TEST=flashed into a vim2 and checked that zircon received the entropy.
Manually verified that the static asserts have the right bounds.

Change-Id: I93a33c48d201572be3a6603c11b381a297459eb0
1 file changed