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 | " |
| 15 | SRCREV = "518d3f58f4f157373a5b1aaebaf22f80bb13d0d9" |
| 16 | |
| 17 | S = "${WORKDIR}/git" |
| 18 | |
| 19 | DEPENDS = " \ |
| 20 | npcm8xx-tip-fw npcm8xx-bootblock trusted-firmware-a optee-os \ |
| 21 | u-boot-nuvoton npcm7xx-bingo-native openssl-native \ |
| 22 | " |
| 23 | inherit obmc-phosphor-utils |
| 24 | inherit python3native deploy |
| 25 | FILE_FMT = "file://{}" |
| 26 | |
| 27 | # Sign keys, replace them for production |
| 28 | IGPS_KEYS = "" |
| 29 | # Configuration files, clean them if no need |
| 30 | IGPS_CSVS = "" |
| 31 | IGPS_SETTINGS = "settings.json" |
| 32 | IGPS_CONFS = "${IGPS_KEYS} ${IGPS_CSVS} ${IGPS_SETTINGS}" |
| 33 | SRC_URI += "${@compose_list(d, 'FILE_FMT', 'IGPS_CONFS')}" |
| 34 | |
| 35 | IGPS_SCRIPT_BASE = "${S}/py_scripts/ImageGeneration" |
| 36 | BB_BIN = "arbel_a35_bootblock" |
| 37 | BB_BIN .= "${@'_no_tip.bin' if d.getVar("TIP_IMAGE") != 'True' else '.bin'}" |
| 38 | |
| 39 | do_configure[dirs] = "${WORKDIR}" |
| 40 | do_configure() { |
| 41 | KEY_FOLDER=${IGPS_SCRIPT_BASE}/keys/openssl |
| 42 | CSV_FOLDER=${IGPS_SCRIPT_BASE}/inputs/registers |
| 43 | # keys |
| 44 | install -d ${KEY_FOLDER} |
| 45 | if [ -n "${IGPS_KEYS}" ];then |
| 46 | cp -v ${IGPS_KEYS} ${KEY_FOLDER} |
| 47 | fi |
| 48 | |
| 49 | # csv files |
| 50 | install -d ${CSV_FOLDER} |
| 51 | if [ -n "${IGPS_CSVS}" ];then |
| 52 | cp -v ${IGPS_CSVS} ${CSV_FOLDER} |
| 53 | fi |
| 54 | |
| 55 | # change customized settings for XML and key setting |
| 56 | if [ -n "${IGPS_SETTINGS}" ];then |
| 57 | cd ${S} |
| 58 | python3 ${IGPS_SCRIPT_BASE}/config_replacer.py ${WORKDIR}/${IGPS_SETTINGS} |
| 59 | fi |
| 60 | } |
| 61 | |
| 62 | do_compile() { |
| 63 | # copy Openbmc built images |
| 64 | cd ${DEPLOY_DIR_IMAGE} |
| 65 | cp -v ${BB_BIN} bl31.bin tee.bin u-boot.bin ${IGPS_SCRIPT_BASE}/inputs |
| 66 | |
| 67 | cd ${IGPS_SCRIPT_BASE} |
| 68 | install -d output_binaries/tmp |
| 69 | install -d inputs/key_input |
| 70 | if [ "${TIP_IMAGE}" = "True" ] || [ "${SA_TIP_IMAGE}" = "True" ];then |
| 71 | # Do not sign combo0 image again |
| 72 | python3 ${S}/py_scripts/GenerateAll.py openssl ${DEPLOY_DIR_IMAGE} |
| 73 | else |
| 74 | # for No TIP, we can run IGPS script directly |
| 75 | python3 ${S}/py_scripts/GenerateAll.py openssl |
| 76 | fi |
| 77 | } |
| 78 | |
| 79 | do_deploy() { |
| 80 | OUT=${IGPS_SCRIPT_BASE}/output_binaries |
| 81 | BOOTLOADER=u-boot.bin.merged |
| 82 | install -d ${DEPLOYDIR} |
| 83 | if [ "${SA_TIP_IMAGE}" = "True" ];then |
| 84 | install -m 644 ${OUT}/Secure/image_no_tip_SA.bin ${DEPLOYDIR}/${BOOTLOADER} |
| 85 | elif [ "${TIP_IMAGE}" = "True" ];then |
| 86 | install -m 644 ${OUT}/Secure/Kmt_TipFwL0_Skmt_TipFwL1_BootBlock_BL31_Tee_uboot.bin ${DEPLOYDIR}/${BOOTLOADER} |
| 87 | else |
| 88 | install -m 644 ${OUT}/Basic/image_no_tip.bin ${DEPLOYDIR}/${BOOTLOADER} |
| 89 | fi |
| 90 | } |
| 91 | addtask deploy before do_build after do_compile |
| 92 | PACKAGE_ARCH = "${MACHINE_ARCH}" |