Hi, On 11/10/25 9:34 PM, Marco Felsch wrote: > Add a pbl uncompress helper since uncompress() can't be used directly > within pbl. > > Signed-off-by: Marco Felsch <[email protected]> > --- > include/pbl.h | 1 + > pbl/decomp.c | 12 ++++++++++++ > 2 files changed, 13 insertions(+) > > diff --git a/include/pbl.h b/include/pbl.h > index > b330010562c4aba5fccbb4c421bb95291fa0bea1..9db4652e833bf5e82fd42a1cae19e94c4f2f868f > 100644 > --- a/include/pbl.h > +++ b/include/pbl.h > @@ -15,6 +15,7 @@ extern unsigned long free_mem_ptr; > extern unsigned long free_mem_end_ptr; > > void pbl_barebox_uncompress(void *dest, void *compressed_start, unsigned int > len); > +int pbl_dtbz_uncompress(void *dest, void *compressed_start, unsigned long > len); > > void fdt_find_mem(const void *fdt, unsigned long *membase, unsigned long > *memsize); > int fdt_fixup_mem(void *fdt, unsigned long membase[], unsigned long > memsize[], size_t num); > diff --git a/pbl/decomp.c b/pbl/decomp.c > index > ebdf81ddfbe5af65a382b7221c7102dcc791e5b9..4d50ea15555ba96bdc2fcac4c48708c6e1261d4d > 100644 > --- a/pbl/decomp.c > +++ b/pbl/decomp.c > @@ -51,6 +51,12 @@ static void noinline errorfn(char *error) > while (1); > } > > +static noinline void errorfn_nohang(char *error) > +{ > + puts_ll("ERROR: "); > + puts_ll(error); > +}
This way we won't have error message for CONFIG_PBL_CONSOLE without DEBUG_LL, see: https://lore.kernel.org/barebox/[email protected]/T/#u I am not sure why this is needed though. Failing to decompress a compressed device tree that was linked into barebox means there is runtime memory corruption. We should panic/hang in this case. Cheers, Ahmad > + > extern unsigned char sha_sum[]; > extern unsigned char sha_sum_end[]; > > @@ -110,3 +116,9 @@ void pbl_barebox_uncompress(void *dest, void > *compressed_start, unsigned int len > NULL, NULL, > dest, NULL, errorfn); > } > + > +int pbl_dtbz_uncompress(void *dest, void *compressed_start, unsigned long > len) > +{ > + return decompress(compressed_start, len, NULL, NULL, dest, NULL, > + errorfn_nohang); > +} > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
