[U-Boot] [PATCH v2 4/8] km/common: implement boardId HWkey checks as u-boot cmd

Holger Brunck holger.brunck at keymile.com
Thu May 5 15:51:06 CEST 2011


Hi,

On 05/05/2011 12:11 AM, Wolfgang Denk wrote:
> Dear Holger Brunck,
> 
> In message <02d1e3f265123ff0296b1c38b227f6d30393ee77.1304508448.git.holger.brunck at keymile.com> you wrote:
>> From: Thomas Herzmann <thomas.herzmann at keymile.com>
>>
>> BoardId and HWKey are used to identify the HW class of a given board.
>> The correct values are stored in the inventory eeprom. During creation
>> time of a boot package the boardId and HWkey for the SW is stored in
>> the default environment and burned into the flash. During boottime
>> the values in the inventory and in the environment are compared to
>> avoid starting of a SW which is not authorized for this board.
>>
>> Some bootpackages are allowed to run on a set of different boardId
>> hwKey. In this case the environment variable boardIdListHex was added
>> to the default environment. In this case the command iterates over the
>> pair values and compares them with the values read from the inventory
>> eeprom.
>>
>> The syntax of such a boardIdListHex value is e.g.: 158_1 159_1 159_2
>>
>> Signed-off-by: Thomas Herzmann <thomas.herzmann at keymile.com>
>> Signed-off-by: Holger Brunck <holger.brunck at keymile.com>
>> Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>
>> Acked-by: Heiko Schocher <hs at denx.de>
>> cc: Wolfgang Denk <wd at denx.de>
>> cc: Detlev Zundel <dzu at denx.de>
>> ---
>> Changes for v2:
>>    - split up first large patch series to three independent smaller
>>      patch series
>>    - give the cmd a more precise name
>>    - rework the patch with inputs from W.Denk:
>>       - adapt and enhance commit msg
>>       - comment the code
>>       - add error handling
> 
> This patch has checkpatch warnings.  Please fix.
>

Ok the one warning that we exceed 80 characters per line is fixed, sorry for
that. But there are two warnings remaining:
WARNING: consider using strict_strtoul in preference to simple_strtoul
#137: FILE: board/keymile/common/common.c:813:
+				bid = simple_strtoul(rest, &endp, 16);

WARNING: consider using strict_strtoul in preference to simple_strtoul
#141: FILE: board/keymile/common/common.c:817:
+					hwkey = simple_strtoul(rest, &endp, 16);

I know that we use strict_strtoul in the same patch some lines above, but at
this point we need *endp and we know that we got a non numeric character at the
end. So using simple_strtoul at this point is exactly what we want here.

Is it ok to ignore this warnings and add a comment above the codeline why we use
simple_stroul?

> ...
>> +	if (!envbid || !envhwkey) {
>> +		/*
>> +		 * BoardId/HWkey not available in the environment, so try the
>> +		 * environment variable for BoardId/HWkey list
>> +		 */
>> +		char *bidhwklist = getenv("boardIdListHex");
>> +		if (bidhwklist) {
> 
> Please insert a blank line after declarations.
> 
>

Ok fixed.

Best regards
Holger Brunck


More information about the U-Boot mailing list