[U-Boot] hardware versions to Kernel

Chris Packham judge.packham at gmail.com
Mon Mar 12 07:19:18 UTC 2018


On Sat, Mar 10, 2018 at 6:34 AM, Andy Rea <andy at azureussolutions.com> wrote:
> I have an ARM CPU on a board that has 3 optional sub boards plugged into it,
> all of which have 3 hardware rev bits connected to the CPU
>
>
>
> Rather than getting the CPU to do mmap type stuff or sys/class/gpio stuff to
> read those versions in the kernel, is there a way for u-boot to push that
> information ( even it's a U32 or a string ) into the kernel somewhere that
> can be parsed?  I tried some code in the board startup to create env vars to
> append into the bootargs but they aren't evaluated each boot properly (
> boards are optional and revs can change )  so cat /proc/cmdlne stayed the
> same value all the time
>
>
>
> Is there a better way to do this?

I've done something similar in the past by having u-boot manipulate
the device-tree passed to the kernel with a few calls to
fdt_setprop(). It's practical when you have a few tweaks to make. I've
used it for telling the kernel to disable bits of hardware on
prototype boards.

For more substantial configurations you could use a FIT image[1]. I've
also used this for having u-boot tell the kernel about plug-in boards.
Ultimately we ended up switching to device-tree overlays once the
kernel support caught up so that we could support hot-plugging boards.

[1] - http://git.denx.de/?p=u-boot.git;a=blob_plain;f=doc/uImage.FIT/howto.txt;hb=HEAD


More information about the U-Boot mailing list