blob: 4959f9c83539faecf200779104e3b0102fd94fe4 [file] [log] [blame]
Peng Fan94df9882018-11-20 10:19:46 +00001#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0+
3#
4# script to check whether the file exists in imximage.cfg for i.MX8M
5#
6
7file=$1
8
9post_process=$2
10
11blobs=`awk '/^SIGNED_HDMI/ {print $2} /^LOADER/ {print $2} /^SECOND_LOADER/ {print $2} /^DDR_FW/ {print $2}' $file`
12for f in $blobs; do
Baruch Siach8a0746d2019-01-02 08:58:28 +020013 if [ $f = "spl/u-boot-spl-ddr.bin" ] || [ $f = "u-boot.itb" ]; then
Peng Fan94df9882018-11-20 10:19:46 +000014 continue
15 fi
16
17 if [ -f $f ]; then
18 continue
Frieder Schrempf162c72c2019-12-11 10:06:06 +000019 else
Peng Fan94df9882018-11-20 10:19:46 +000020 echo "WARNING '$tmp' not found, resulting binary is not-functional" >&2
21 exit 1
22 fi
Peng Fan94df9882018-11-20 10:19:46 +000023done
24
Baruch Siach8a0746d2019-01-02 08:58:28 +020025if [ $post_process = 1 ]; then
Frieder Schrempf162c72c2019-12-11 10:06:06 +000026 if [ -f lpddr4_pmu_train_1d_imem.bin ]; then
27 objcopy -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 lpddr4_pmu_train_1d_imem.bin lpddr4_pmu_train_1d_imem_pad.bin
28 objcopy -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 lpddr4_pmu_train_1d_dmem.bin lpddr4_pmu_train_1d_dmem_pad.bin
29 objcopy -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 lpddr4_pmu_train_2d_imem.bin lpddr4_pmu_train_2d_imem_pad.bin
Peng Fan94df9882018-11-20 10:19:46 +000030 cat lpddr4_pmu_train_1d_imem_pad.bin lpddr4_pmu_train_1d_dmem_pad.bin > lpddr4_pmu_train_1d_fw.bin
Frieder Schrempf162c72c2019-12-11 10:06:06 +000031 cat lpddr4_pmu_train_2d_imem_pad.bin lpddr4_pmu_train_2d_dmem.bin > lpddr4_pmu_train_2d_fw.bin
Peng Fan4b78bb52019-08-27 06:24:43 +000032 dd if=spl/u-boot-spl.bin of=spl/u-boot-spl-pad.bin bs=4 conv=sync
33 cat spl/u-boot-spl-pad.bin lpddr4_pmu_train_1d_fw.bin lpddr4_pmu_train_2d_fw.bin > spl/u-boot-spl-ddr.bin
34 rm -f lpddr4_pmu_train_1d_fw.bin lpddr4_pmu_train_2d_fw.bin lpddr4_pmu_train_1d_imem_pad.bin lpddr4_pmu_train_1d_dmem_pad.bin lpddr4_pmu_train_2d_imem_pad.bin spl/u-boot-spl-pad.bin
Peng Fan94df9882018-11-20 10:19:46 +000035 fi
Frieder Schrempf162c72c2019-12-11 10:06:06 +000036 if [ -f ddr4_imem_1d.bin ]; then
37 objcopy -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 ddr4_imem_1d.bin ddr4_imem_1d_pad.bin
38 objcopy -I binary -O binary --pad-to 0x4000 --gap-fill=0x0 ddr4_dmem_1d.bin ddr4_dmem_1d_pad.bin
39 objcopy -I binary -O binary --pad-to 0x8000 --gap-fill=0x0 ddr4_imem_2d.bin ddr4_imem_2d_pad.bin
Peng Fand3c7d842019-09-16 03:09:44 +000040 cat ddr4_imem_1d_pad.bin ddr4_dmem_1d_pad.bin > ddr4_1d_fw.bin
Frieder Schrempf162c72c2019-12-11 10:06:06 +000041 cat ddr4_imem_2d_pad.bin ddr4_dmem_2d.bin > ddr4_2d_fw.bin
Peng Fand3c7d842019-09-16 03:09:44 +000042 dd if=spl/u-boot-spl.bin of=spl/u-boot-spl-pad.bin bs=4 conv=sync
43 cat spl/u-boot-spl-pad.bin ddr4_1d_fw.bin ddr4_2d_fw.bin > spl/u-boot-spl-ddr.bin
44 rm -f ddr4_1d_fw.bin ddr4_2d_fw.bin ddr4_imem_1d_pad.bin ddr4_dmem_1d_pad.bin ddr4_imem_2d_pad.bin spl/u-boot-spl-pad.bin
45 fi
Peng Fan94df9882018-11-20 10:19:46 +000046fi
47
48exit 0