[elbe-devel] [PATCH] elbepack: hdimg: copy partition binary blobs from target

Thomas Weißschuh thomas.weissschuh at linutronix.de
Fri Jan 10 13:38:02 CET 2025


Hi John,

On Fri, Jan 10, 2025 at 11:47:54AM +0106, John Ogness wrote:
> There are two methods for inserting binary blobs into an image:
> 
> 1. directly, implemented by add_binary_blob()
> 
> 2. as a partition, implemented by create_binary()
> 
> The second method is newer and was introduced with
> commit 1058f6c89f02 ("hdimg: implement partition filles with
> binary data from file"). It is obviously a complete new
> implementation as it does not use the same style or naming
> as add_binary_blob(). And unfortunately, it was implemented
> such that the binary blob file is taken from 'chroot' instead
> of from 'target'. This means that binary blob files can only
> be used if available from a package. 'chroot' does not contain
> any files created from fine-tuning or archives.
> 
> The first, older method uses files from 'target'.
> 
> Modify create_binary() so that it also uses files from 'target'
> thus allowing fine-tuning and archive files to be used as well
> as mirroring the behavior of add_binary_blob().
> 
> Signed-off-by: John Ogness <john.ogness at linutronix.de>
> ---
>  elbepack/hdimg.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
> index faeea2c3..43e7945d 100644
> --- a/elbepack/hdimg.py
> +++ b/elbepack/hdimg.py
> @@ -335,7 +335,7 @@ def create_binary(disk, part, ppart, target):
>      with entry.losetup() as loopdev:
>          # copy from buildenv if path starts with /

This comment should also be adapted.

>          if part.text('binary')[0] == '/':
> -            tmp = target + '/' + 'chroot' + part.text('binary')
> +            tmp = target + '/' + 'target' + part.text('binary')

There is yet another copy of this in build_image_mtd().

>          # copy from project directory
>          else:
>              tmp = target + '/' + part.text('binary')

This now breaks if the file is only really available in the
buildenvironment, however unlikely.
I really dislike the usage of "/" to distinguish the source.
It's not even documented for this specific element as its schema is
rfs:type and not rfs:binaryblob.
What do you think about having an XML attribute the specifies the
source properly?


More information about the elbe-devel mailing list