Re: [PATCH 7/9] powerpc/ps3: Add check for otheros image size
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2020-03-29 14:02:45
Hi Geoff, On Fri, Mar 27, 2020 at 9:26 PM Geoff Levand [off-list ref] wrote:
The ps3's otheros flash loader has a size limit of 16 MiB for the uncompressed image. If that limit will be reached output the flash image file as 'otheros-too-big.bld'. Signed-off-by: Geoff Levand <geoff@infradead.org>
Thanks for your patch!
quoted hunk ↗ jump to hunk
--- a/arch/powerpc/boot/wrapper +++ b/arch/powerpc/boot/wrapper@@ -570,7 +570,16 @@ ps3) count=$overlay_size bs=1 odir="$(dirname "$ofile.bin")" - rm -f "$odir/otheros.bld" - gzip -n --force -9 --stdout "$ofile.bin" > "$odir/otheros.bld" + + # The ps3's flash loader has a size limit of 16 MiB for the uncompressed + # image. If a compressed image that exceeded this limit is written to + # flash the loader will decompress that image until the 16 MiB limit is + # reached, then enter the system reset vector of the partially decompressed + # image. No warning is issued. + rm -f "$odir"/{otheros,otheros-too-big}.bld + size=$(${CROSS}nm --no-sort --radix=d "$ofile" | egrep ' _end$' | cut -d' ' -f1) + bld="otheros.bld" + [ $size -le 16777216 ] || bld="otheros-too-big.bld" + gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld" ;; esac
Why not print an error message and exit 1 instead, like is done for
other fatal errors?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds