[PATCH] binman: blob_dtb: improve error message when SPL is not found
Jérémie Dautheribes
jeremie.dautheribes at bootlin.com
Fri Nov 28 11:48:46 CET 2025
On 27/11/2025 19:40, Tom Rini wrote:
> On Thu, Nov 27, 2025 at 07:04:06PM +0100, Jérémie Dautheribes wrote:
>> Hi Tom,
>>
>> On 09/09/2025 19:03, Tom Rini wrote:
>>> On Wed, Aug 20, 2025 at 05:06:54PM +0200, Jérémie Dautheribes wrote:
>>>
>>>> When using binman with the '-a spl-dtb=y' flag, if the SPL blob is not
>>>> found, binman throws a cryptic error message:
>>>> binman: 'NoneType' object has no attribute 'startswith'
>>>>
>>>> Let's improve the error message to explicitly state which SPL blob is
>>>> missing.
>>>> This is particularly useful when binman is used as a standalone tool
>>>> outside the U-Boot source tree.
>>>>
>>>> Signed-off-by: Jérémie Dautheribes <jeremie.dautheribes at bootlin.com>
>>>> ---
>>>> tools/binman/etype/blob_dtb.py | 5 +++++
>>>> 1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
>>>> index b234323d7cf..772579394d4 100644
>>>> --- a/tools/binman/etype/blob_dtb.py
>>>> +++ b/tools/binman/etype/blob_dtb.py
>>>> @@ -8,6 +8,8 @@
>>>> from binman.entry import Entry
>>>> from binman.etype.blob import Entry_blob
>>>> from dtoc import fdt_util
>>>> +import errno
>>>> +import os
>>>> import struct
>>>> # This is imported if needed
>>>> @@ -42,6 +44,9 @@ class Entry_blob_dtb(Entry_blob):
>>>> """Get the device-tree from the list held by the 'state' module"""
>>>> self._filename = self.GetDefaultFilename()
>>>> self._pathname, _ = self.FdtContents(self.GetFdtEtype())
>>>> + if self._pathname is None:
>>>> + raise FileNotFoundError(errno.ENOENT,
>>>> + os.strerror(errno.ENOENT), self._filename)
>>>> return super().ReadBlobContents()
>>>> def ProcessContents(self):
>>>
>>> Sorry for the delay in review. We also need to update the function
>>> comment so that python coverage remains at 100%.
>>
>> Sorry but I'm really not familiar with python coverage. I had a look to the
>> official documentation and it looks like I need to add a test to cover this
>> specific function. That is what you are requesting?
>
> So, doc/develop/binman_tests.rst talks a bit about testing of binman and
> python coverage. In this case I believe the issue is that the function
> you're modifying needs to have the comment block annotations updated to
> include the exception it can throw.
>
Ok I got it, I'll send a V2 including this comment annotation, thanks
for your help!
Jérémie
More information about the U-Boot
mailing list