[OpenWrt-Devel] [Patch][BCM63XX][V2][RFC] Select HW_RANDOM_BCM63XX only in the SoCs that support it.

José Vázquez ppvazquezfer at gmail.com
Sat Jun 28 09:09:54 EDT 2014

2014-06-27 13:14 GMT+02:00, Jonas Gorski <jogo at openwrt.org>:
> On Fri, Jun 27, 2014 at 1:00 PM, José Vázquez <ppvazquezfer at gmail.com>
> wrote:
>> 2014-06-27 12:29 GMT+02:00, Jonas Gorski <jogo at openwrt.org>:
>>> On Wed, Jun 18, 2014 at 5:34 PM, José Vázquez Fernández
>>> <ppvazquezfer at gmail.com> wrote:
>>>> Select HW_RANDOM_BCM63XX only in the SoCs that support it.
>>>> Only BCM6368, BCM6362 and BCM63268 have a hardware random numbers
>>>> generator, so, if none of these are selected, don't compile it.
>>>> Tested with BCM6358 and BCM6328 successfully with both 3.10 and 3.14
>>>> kernels.
>>>> Signed off by: José Vázquez Fernández <ppvazquezfer at gmail.com>
>>> Sorry, I still don't see the point of this. All this patch does is
>>> slightly reduce the visibility of HW_RANDOM_BCM63XX. And since this is
>>> a user selectable symbol, I don't think this makes much sense because
>>> if you don't want it built, you can just not select it.
>>> Also, COMPILE_TEST should only be added if it actually compiles for
>>> other arches (or even different mips targets), which it doesn't.
>>> Jonas
>> The point is that, if HW_RANDOM_BCM63XX is deselected, the kernel
>> sends an error because HW_RANDOM_BCM63XX depends on BCM63XX. The
>> patch, as you saw, force compilation of trng only in the SoCs that has
>> that hardware. If in the kernel are only selected SoCs that don't have
>> that hardware, the driver is not compiled.
> "sends an error"? Can please paste the actual error message? Because I
> don't see one if I disable HW_RANDOM_BCM63XX.
This is the error message:

TTY driver to output user messages via printk (TTY_PRINTK) [N/y/?] n
Hardware Random Number Generator Core support (HW_RANDOM) [Y/n/m/?] y
  Timer IOMEM HW Random Number Generator support
  Atmel Random Number Generator support (HW_RANDOM_ATMEL) [N/m/y/?] n
  Broadcom BCM63xx Random Number Generator support (HW_RANDOM_BCM63XX)
[Y/n/m/?] (NEW) aborted!

Console input/output is redirected. Run 'make oldconfig' to update

make[7]: *** [silentoldconfig] Error 1
make[6]: *** [silentoldconfig] Error 2

The present kernel configuration has modules disabled.
Type 'make config' and enable loadable module support.
Then build a kernel with module support enabled.

make[5]: *** [modules] Error 1
make[5]: Leaving directory

Some lines of the kernel config file with HW_RANDOM and
HW_RANDOM_BCM63XX disabled:
# CONFIG_TTY_PRINTK is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_RAW_DRIVER is not set

The patch was done to avoid that error and to save few kilobytes of
RAM and flash in the boards that don't have hwrng.

>> COMPILE_TEST is added if the patch has interest for linux-mips. You
>> are right: in OpenWRT is useless.
>> Any advice to improve it?
> It's actually the hw random (crypto?) guys that would be interested in
> this, mips is only collateral because some of the headers exist in
> arch/mips.
> To satisfy COMPILE_TEST, convert any bcm_{read,write}* calls to
> __raw_{read,write}*, probably
> move the register definitions from include/asm/mach-bcm63xx/* to the
> driver itself. If you can enable it for x86 and it compiles, then you
> succeeded ;-)
> Jonas
I'll send COMPILE_TEST patch with the modifications that you recommend
to linux-mips because Florian sent the driver to that patchwork two
years ago and it was accepted.

Any advice will be very welcome.

Best regards:

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list