Commit aa3bc365 authored by Geoff Levand's avatar Geoff Levand Committed by Michael Ellerman
Browse files

powerpc/ps3: Add check for otheros image size



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: default avatarGeoff Levand <geoff@infradead.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/897c2a59-378e-7c9b-3976-d0a0def90913@infradead.org
parent 8f53f9c0
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -571,7 +571,18 @@ 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"
    if [ $size -gt $((0x1000000)) ]; then
        bld="otheros-too-big.bld"
    fi
    gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld"
    ;;
esac