Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | SUMMARY = "Firmware image recipe for generating SD-Card artifacts." |
| 2 | |
| 3 | inherit deploy nopackages |
| 4 | |
| 5 | DEPENDS = "trusted-firmware-a \ |
| 6 | virtual/control-processor-firmware \ |
| 7 | n1sdp-board-firmware" |
| 8 | |
| 9 | LICENSE = "MIT" |
| 10 | PACKAGE_ARCH = "${MACHINE_ARCH}" |
| 11 | COMPATIBLE_MACHINE = "n1sdp" |
| 12 | RM_WORK_EXCLUDE += "${PN}" |
| 13 | do_configure[noexec] = "1" |
| 14 | do_compile[noexec] = "1" |
| 15 | do_install[noexec] = "1" |
| 16 | |
| 17 | FIRMWARE_DIR = "n1sdp-board-firmware_source" |
| 18 | PRIMARY_DIR = "${WORKDIR}/n1sdp-board-firmware_primary" |
| 19 | SECONDARY_DIR = "${WORKDIR}/n1sdp-board-firmware_secondary" |
| 20 | |
| 21 | SOC_BINARIES = "mcp_fw.bin scp_fw.bin mcp_rom.bin scp_rom.bin" |
| 22 | |
| 23 | prepare_package() { |
| 24 | cd ${WORKDIR} |
| 25 | |
| 26 | # Master/Primary |
| 27 | cp -av ${RECIPE_SYSROOT}/${FIRMWARE_DIR}/* ${PRIMARY_DIR} |
| 28 | mkdir -p ${PRIMARY_DIR}/SOFTWARE/ |
| 29 | |
| 30 | # Copy FIP binary |
| 31 | cp -v ${RECIPE_SYSROOT}/firmware/fip.bin ${PRIMARY_DIR}/SOFTWARE/ |
| 32 | |
| 33 | # Copy SOC binaries |
| 34 | for f in ${SOC_BINARIES}; do |
| 35 | cp -v ${RECIPE_SYSROOT}/firmware/${f} ${PRIMARY_DIR}/SOFTWARE/ |
| 36 | done |
| 37 | |
| 38 | sed -i -e 's|^C2C_ENABLE.*|C2C_ENABLE: TRUE ;C2C enable TRUE/FALSE|' \ |
| 39 | ${PRIMARY_DIR}/MB/HBI0316A/io_v123f.txt |
| 40 | sed -i -e 's|^C2C_SIDE.*|C2C_SIDE: MASTER ;C2C side SLAVE/MASTER|' \ |
| 41 | ${PRIMARY_DIR}/MB/HBI0316A/io_v123f.txt |
| 42 | sed -i -e 's|.*SOCCON: 0x1170.*PLATFORM_CTRL.*|SOCCON: 0x1170 0x00000100 ;SoC SCC PLATFORM_CTRL|' \ |
| 43 | ${PRIMARY_DIR}/MB/HBI0316A/io_v123f.txt |
| 44 | |
| 45 | # Update load address for trusted boot |
| 46 | sed -i -e '/^IMAGE4ADDRESS:/ s|0x60200000|0x64200000|' ${PRIMARY_DIR}/MB/HBI0316A/images.txt |
| 47 | sed -i -e '/^IMAGE4UPDATE:/ s|FORCE |SCP_AUTO|' ${PRIMARY_DIR}/MB/HBI0316A/images.txt |
| 48 | sed -i -e '/^IMAGE4FILE: \\SOFTWARE\\/s|uefi.bin|fip.bin |' ${PRIMARY_DIR}/MB/HBI0316A/images.txt |
| 49 | |
| 50 | # Slave/Secondary |
| 51 | cp -av ${RECIPE_SYSROOT}/${FIRMWARE_DIR}/* ${SECONDARY_DIR} |
| 52 | mkdir -p ${SECONDARY_DIR}/SOFTWARE/ |
| 53 | |
| 54 | # Copy SOC binaries |
| 55 | for f in ${SOC_BINARIES}; do |
| 56 | cp -v ${RECIPE_SYSROOT}/firmware/${f} ${SECONDARY_DIR}/SOFTWARE/ |
| 57 | done |
| 58 | |
| 59 | sed -i -e 's|^C2C_ENABLE.*|C2C_ENABLE: TRUE ;C2C enable TRUE/FALSE|' \ |
| 60 | ${SECONDARY_DIR}/MB/HBI0316A/io_v123f.txt |
| 61 | sed -i -e 's|^C2C_SIDE.*|C2C_SIDE: SLAVE ;C2C side SLAVE/MASTER|' \ |
| 62 | ${SECONDARY_DIR}/MB/HBI0316A/io_v123f.txt |
| 63 | sed -i -e 's|.*SOCCON: 0x1170.*PLATFORM_CTRL.*|SOCCON: 0x1170 0x00000101 ;SoC SCC PLATFORM_CTRL|' \ |
| 64 | ${SECONDARY_DIR}/MB/HBI0316A/io_v123f.txt |
| 65 | sed -i -e '/^TOTALIMAGES:/ s|5|4|' ${SECONDARY_DIR}/MB/HBI0316A/images.txt |
| 66 | sed -i -e 's|^IMAGE4|;&|' ${SECONDARY_DIR}/MB/HBI0316A/images.txt |
| 67 | } |
| 68 | |
| 69 | do_deploy() { |
| 70 | # prepare Master & Slave packages |
| 71 | prepare_package |
| 72 | |
| 73 | for dir in ${PRIMARY_DIR} ${SECONDARY_DIR}; do |
| 74 | dir_name=$(basename ${dir}) |
| 75 | mkdir -p ${D}/${dir_name} |
| 76 | cp -av ${dir} ${D} |
| 77 | |
| 78 | # Compress the files |
| 79 | tar -C ${D}/${dir_name} -zcvf ${DEPLOYDIR}/${dir_name}.tar.gz ./ |
| 80 | done |
| 81 | } |
| 82 | do_deploy[dirs] += "${PRIMARY_DIR} ${SECONDARY_DIR}" |
| 83 | do_deploy[cleandirs] += "${PRIMARY_DIR} ${SECONDARY_DIR}" |
| 84 | do_deploy[umask] = "022" |
| 85 | addtask deploy after do_prepare_recipe_sysroot |