HomeFreeBSD

[nvram2env] fix nvram2env to scan all of memory, not 1/4th

Description

[nvram2env] fix nvram2env to scan all of memory, not 1/4th

The variable "size" stores number of words (4bytes). But the loop over
memory uses size as number of bytes to scan memory. As result it fetches
only 1/4th of memory.

This patch solves this problem and nvram2env fetches all NVRAM variables.

Test plan:

Pre-requisites: any MIPS board with ASCII-based NVRAM mapped into memory

  • Add "device nvram2env" into kernel configuration
  • Specify hints: base is mandatory (according to nvram2env(4))

hint.nvram.0.base=0x1c7f8000 (it's valid address for Asus RT-N53 with
flags = 0x4)

  • Build & load kernel with bootverbose

Actual result: only part of nvram variables are found
Expected result: all variables are found

Submitted by: Michael Zhilin <mizhka@gmail.com>
Differential Revision: https://reviews.freebsd.org/D6466