Re: [PATCH] lib: logo: support a single pre-rendered logo file as an alternative to SVG

SCHNEIDER Johannes <[email protected]>
Newsgroups org.infradead.lists.barebox
Message-ID <AM0PR06MB4148A7BB04949283840342DCBC112@AM0PR06MB4148.eurprd06.prod.outlook.com>
Hoi Ahmad,


>
> Hello Johannes,
> 
> On 6/2/26 8:08 AM, Johannes Schneider wrote:
> > Add a "Logo source" choice that switches between the upstream behaviour
> > (BAREBOX_LOGO_STOCK -- render Documentation/barebox.svg at build time
> > with ImageMagick) and a new pre-rendered single-file mode
> > (BAREBOX_LOGO_FILE -- include one PNG verbatim, no conversion).
> >
> > The single-file mode addresses two issues for vendor-branded splashes
> > on fixed-resolution panels:
> >
> >   - The multi-size stock options can be combined; e.g. enabling 640
> >     and a hypothetical 800 variant in parallel embedded both blobs,
> >     even though only one is ever displayed on a given panel.  The new
> >     BAREBOX_LOGO_FILE selector replaces all of the BAREBOX_LOGO_<size>
> >     flags with a single configurable PNG path -- exactly one logo
> >     blob in the resulting binary.
> >
> >   - It removes the build-time ImageMagick dependency in the
> >     custom-logo path.  CI environments where Inkscape and ImageMagick
> >     versions drift (see the SELF_CALL=xxx Inkscape workaround at
> >     the top of cmd_png) can produce a pre-rendered PNG once and check
> >     it in.  Stock mode keeps its existing convert(1) chain.
> >
> > The new symbol is barebox-logo-custom; the resulting bblogo blob is
> > embedded under __bblogo_barebox_logo_custom_{start,end} and exposed at
> > /logo/barebox-logo-custom.<ext> in the running barebox.
> >
> > CONFIG_BAREBOX_LOGO_FILE_PATH selects the source PNG, relative to the
> > barebox srctree (default lib/logo/barebox-logo-custom.png).  The
> > existing BAREBOX_LOGO_64..640 size options remain available, gated on
> > BAREBOX_LOGO_STOCK.
> 
> CONFIG_BAREBOX_LOGO is solely about including the barebox logo.
> 
> To include your custom PNG, just put it into your environment (e.g.
> /env/data), no need to patch barebox. You are not even limited to one
> logo in that case.
>

... *that* is indeed the better solution.

so please disregard this patch :-S

>
> Tangentially related, I am in favor of including vendor logos (e.g. in
> your case Leica's) into barebox for use with the vendor board support,
> but these should also be SVGs IMO.
>

they are SVGs, but (now would) live in the yocto/bitbake level, not the sources
directly - like the rest of the files going into the /env while we build barebox


gruß
Johannes


>
> > Upstream-Status: Pending
> 
> Please drop this out-of-place tag.
> 
> Cheers,
> Ahmad
> 
> >
> > Assisted-by: Claude Opus 4.7 (1M context)
> > Signed-off-by: Johannes Schneider <[email protected]>
> > ---
> >  lib/logo/Kconfig  | 35 +++++++++++++++++++++++++++++++++++
> >  lib/logo/Makefile | 19 +++++++++++++++++++
> >  2 files changed, 54 insertions(+)
> >
> > diff --git a/lib/logo/Kconfig b/lib/logo/Kconfig
> > index 7e5a6fcb63..ab64ce242d 100644
> > --- a/lib/logo/Kconfig
> > +++ b/lib/logo/Kconfig
> > @@ -35,6 +35,30 @@ config BAREBOX_LOGO_QOI
> >
> >  endchoice
> >
> > +choice
> > +     prompt "Logo source"
> > +     default BAREBOX_LOGO_STOCK
> > +     help
> > +       Choose how the boot logo is produced.
> > +
> > +config BAREBOX_LOGO_STOCK
> > +     bool "Stock barebox logo (rendered from SVG)"
> > +     help
> > +       Render Documentation/barebox.svg at build time into the sizes
> > +       selected below.  Requires ImageMagick's convert tool in the
> > +       build environment.
> > +
> > +config BAREBOX_LOGO_FILE
> > +     bool "Pre-rendered logo from file"
> > +     help
> > +       Use a pre-rendered PNG as the boot logo, taken verbatim with
> > +       no build-time conversion.  Suitable for vendor-branded boot
> > +       splashes; no ImageMagick dependency.
> > +
> > +endchoice
> > +
> > +if BAREBOX_LOGO_STOCK
> > +
> >  config BAREBOX_LOGO_64
> >       bool "include 64x32 pixel logo"
> >
> > @@ -50,4 +74,15 @@ config BAREBOX_LOGO_400
> >  config BAREBOX_LOGO_640
> >       bool "include 640x320 pixel logo"
> >
> > +endif # BAREBOX_LOGO_STOCK
> > +
> > +config BAREBOX_LOGO_FILE_PATH
> > +     string "Pre-rendered logo path (relative to srctree)"
> > +     depends on BAREBOX_LOGO_FILE
> > +     default "lib/logo/barebox-logo-custom.png"
> > +     help
> > +       Path to the pre-rendered PNG, relative to the barebox source
> > +       tree.  The file is included as-is; drop it at this location
> > +       before invoking the build.
> > +
> >  endif # BAREBOX_LOGO
> > diff --git a/lib/logo/Makefile b/lib/logo/Makefile
> > index 9792a4699f..7bd7fbb352 100644
> > --- a/lib/logo/Makefile
> > +++ b/lib/logo/Makefile
> > @@ -1,5 +1,6 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >
> > +ifdef CONFIG_BAREBOX_LOGO_STOCK
> >  OPTS_barebox-logo-w64 = -resize 64
> >  bblogo-$(CONFIG_BAREBOX_LOGO_64) += barebox-logo-w64
> >
> > @@ -14,6 +15,14 @@ bblogo-$(CONFIG_BAREBOX_LOGO_400) += barebox-logo-w400
> >
> >  OPTS_barebox-logo-w640 = -resize 640
> >  bblogo-$(CONFIG_BAREBOX_LOGO_640) += barebox-logo-w640
> > +endif
> > +
> > +ifdef CONFIG_BAREBOX_LOGO_FILE
> > +# Strip the Kconfig string's surrounding quotes.
> > +barebox-logo-file-path := $(patsubst "%",%,$(CONFIG_BAREBOX_LOGO_FILE_PATH))
> > +
> > +bblogo-y += barebox-logo-custom
> > +endif
> >
> >  obj-y += $(patsubst %,%.bblogo.o,$(bblogo-y))
> >  extra-y += $(patsubst %,%.bblogo,$(bblogo-y))
> > @@ -62,6 +71,7 @@ endif
> >
> >  CONVERTOPTS += -background none
> >
> > +ifdef CONFIG_BAREBOX_LOGO_STOCK
> >  quiet_cmd_bmp = BMP     $@
> >        cmd_bmp = convert $(OPTS_$(@F:.bmp=)) $(CONVERTOPTS) $< bmp:$@
> >
> > @@ -76,6 +86,15 @@ quiet_cmd_png = PNG     $@
> >
> >  %.png: $(srctree)/Documentation/barebox.svg FORCE
> >       $(call if_changed,png)
> > +endif
> > +
> > +ifdef CONFIG_BAREBOX_LOGO_FILE
> > +quiet_cmd_logo_copy = COPY    $@
> > +      cmd_logo_copy = cp $< $@
> > +
> > +barebox-logo-custom.png: $(srctree)/$(barebox-logo-file-path) FORCE
> > +     $(call if_changed,logo_copy)
> > +endif
> >
> >  quiet_cmd_qoi = QOI     $@
> >        cmd_qoi =      $(objtree)/scripts/qoiconv $< $@
> >
> > base-commit: 81fbe2e8d0d445032498a0bfecf9fd270f00985a
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.