Brian Ma | dfa3afe | 2024-05-31 13:39:59 +0800 | [diff] [blame] | 1 | SUMMARY = "Nuvoton NPCM8XX bootloader" |
| 2 | DESCRIPTION = "This is front end recipe for NPCM8XX IGPS. It replace \ |
| 3 | original IGPS recipe which need implement many redundant function in \ |
| 4 | recipe or class. After we add some hook in IGPS, now we can generate \ |
| 5 | full bootbloader by IGPS script. We only need collect all built images \ |
| 6 | from deploy folder, put them to IGPS input folder, and run script." |
| 7 | HOMEPAGE = "https://github.com/Nuvoton-Israel/igps-npcm8xx" |
| 8 | LICENSE = "GPL-2.0-only" |
| 9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
| 10 | |
| 11 | IGPS_BRANCH ?= "main" |
| 12 | SRC_URI = " \ |
| 13 | git://github.com/Nuvoton-Israel/igps-npcm8xx;branch=${IGPS_BRANCH};protocol=https \ |
| 14 | " |
Tim Lee | d05c796 | 2024-07-31 11:50:39 +0800 | [diff] [blame] | 15 | SRCREV = "d3b7edaca6748b95e7fdcdf7b2fd1b06ce438f96" |
Brian Ma | dfa3afe | 2024-05-31 13:39:59 +0800 | [diff] [blame] | 16 | |
| 17 | S = "${WORKDIR}/git" |
| 18 | |
Brian Ma | 2ac06e6 | 2024-07-17 11:11:45 +0800 | [diff] [blame] | 19 | DEPENDS = "npcm7xx-bingo-native openssl-native" |
Brian Ma | dfa3afe | 2024-05-31 13:39:59 +0800 | [diff] [blame] | 20 | inherit obmc-phosphor-utils |
| 21 | inherit python3native deploy |
| 22 | FILE_FMT = "file://{}" |
| 23 | |
| 24 | # Sign keys, replace them for production |
| 25 | IGPS_KEYS = "" |
| 26 | # Configuration files, clean them if no need |
| 27 | IGPS_CSVS = "" |
| 28 | IGPS_SETTINGS = "settings.json" |
| 29 | IGPS_CONFS = "${IGPS_KEYS} ${IGPS_CSVS} ${IGPS_SETTINGS}" |
| 30 | SRC_URI += "${@compose_list(d, 'FILE_FMT', 'IGPS_CONFS')}" |
| 31 | |
| 32 | IGPS_SCRIPT_BASE = "${S}/py_scripts/ImageGeneration" |
| 33 | BB_BIN = "arbel_a35_bootblock" |
| 34 | BB_BIN .= "${@'_no_tip.bin' if d.getVar("TIP_IMAGE") != 'True' else '.bin'}" |
| 35 | |
| 36 | do_configure[dirs] = "${WORKDIR}" |
| 37 | do_configure() { |
| 38 | KEY_FOLDER=${IGPS_SCRIPT_BASE}/keys/openssl |
| 39 | CSV_FOLDER=${IGPS_SCRIPT_BASE}/inputs/registers |
| 40 | # keys |
| 41 | install -d ${KEY_FOLDER} |
| 42 | if [ -n "${IGPS_KEYS}" ];then |
| 43 | cp -v ${IGPS_KEYS} ${KEY_FOLDER} |
| 44 | fi |
| 45 | |
| 46 | # csv files |
| 47 | install -d ${CSV_FOLDER} |
| 48 | if [ -n "${IGPS_CSVS}" ];then |
| 49 | cp -v ${IGPS_CSVS} ${CSV_FOLDER} |
| 50 | fi |
| 51 | |
| 52 | # change customized settings for XML and key setting |
| 53 | if [ -n "${IGPS_SETTINGS}" ];then |
| 54 | cd ${S} |
| 55 | python3 ${IGPS_SCRIPT_BASE}/config_replacer.py ${WORKDIR}/${IGPS_SETTINGS} |
| 56 | fi |
| 57 | } |
| 58 | |
Brian Ma | 2ac06e6 | 2024-07-17 11:11:45 +0800 | [diff] [blame] | 59 | do_compile[depends] += " \ |
| 60 | npcm8xx-tip-fw:do_deploy npcm8xx-bootblock:do_deploy \ |
| 61 | trusted-firmware-a:do_deploy optee-os:do_deploy \ |
| 62 | u-boot-nuvoton:do_deploy" |
Brian Ma | dfa3afe | 2024-05-31 13:39:59 +0800 | [diff] [blame] | 63 | do_compile() { |
| 64 | # copy Openbmc built images |
| 65 | cd ${DEPLOY_DIR_IMAGE} |
| 66 | cp -v ${BB_BIN} bl31.bin tee.bin u-boot.bin ${IGPS_SCRIPT_BASE}/inputs |
| 67 | |
| 68 | cd ${IGPS_SCRIPT_BASE} |
| 69 | install -d output_binaries/tmp |
| 70 | install -d inputs/key_input |
| 71 | if [ "${TIP_IMAGE}" = "True" ] || [ "${SA_TIP_IMAGE}" = "True" ];then |
| 72 | # Do not sign combo0 image again |
| 73 | python3 ${S}/py_scripts/GenerateAll.py openssl ${DEPLOY_DIR_IMAGE} |
| 74 | else |
| 75 | # for No TIP, we can run IGPS script directly |
| 76 | python3 ${S}/py_scripts/GenerateAll.py openssl |
| 77 | fi |
| 78 | } |
| 79 | |
| 80 | do_deploy() { |
| 81 | OUT=${IGPS_SCRIPT_BASE}/output_binaries |
| 82 | BOOTLOADER=u-boot.bin.merged |
| 83 | install -d ${DEPLOYDIR} |
| 84 | if [ "${SA_TIP_IMAGE}" = "True" ];then |
| 85 | install -m 644 ${OUT}/Secure/image_no_tip_SA.bin ${DEPLOYDIR}/${BOOTLOADER} |
| 86 | elif [ "${TIP_IMAGE}" = "True" ];then |
| 87 | install -m 644 ${OUT}/Secure/Kmt_TipFwL0_Skmt_TipFwL1_BootBlock_BL31_Tee_uboot.bin ${DEPLOYDIR}/${BOOTLOADER} |
| 88 | else |
| 89 | install -m 644 ${OUT}/Basic/image_no_tip.bin ${DEPLOYDIR}/${BOOTLOADER} |
| 90 | fi |
| 91 | } |
| 92 | addtask deploy before do_build after do_compile |
| 93 | PACKAGE_ARCH = "${MACHINE_ARCH}" |