blob: 69ceeaefcae57cf09862a20d48069d0a47ef9697 [file] [log] [blame]
Brian Madfa3afe2024-05-31 13:39:59 +08001SUMMARY = "Nuvoton NPCM8XX bootloader"
2DESCRIPTION = "This is front end recipe for NPCM8XX IGPS. It replace \
3original IGPS recipe which need implement many redundant function in \
4recipe or class. After we add some hook in IGPS, now we can generate \
5full bootbloader by IGPS script. We only need collect all built images \
6from deploy folder, put them to IGPS input folder, and run script."
7HOMEPAGE = "https://github.com/Nuvoton-Israel/igps-npcm8xx"
8LICENSE = "GPL-2.0-only"
9LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263"
10
11IGPS_BRANCH ?= "main"
12SRC_URI = " \
13 git://github.com/Nuvoton-Israel/igps-npcm8xx;branch=${IGPS_BRANCH};protocol=https \
14"
15SRCREV = "518d3f58f4f157373a5b1aaebaf22f80bb13d0d9"
16
17S = "${WORKDIR}/git"
18
19DEPENDS = " \
20 npcm8xx-tip-fw npcm8xx-bootblock trusted-firmware-a optee-os \
21 u-boot-nuvoton npcm7xx-bingo-native openssl-native \
22"
23inherit obmc-phosphor-utils
24inherit python3native deploy
25FILE_FMT = "file://{}"
26
27# Sign keys, replace them for production
28IGPS_KEYS = ""
29# Configuration files, clean them if no need
30IGPS_CSVS = ""
31IGPS_SETTINGS = "settings.json"
32IGPS_CONFS = "${IGPS_KEYS} ${IGPS_CSVS} ${IGPS_SETTINGS}"
33SRC_URI += "${@compose_list(d, 'FILE_FMT', 'IGPS_CONFS')}"
34
35IGPS_SCRIPT_BASE = "${S}/py_scripts/ImageGeneration"
36BB_BIN = "arbel_a35_bootblock"
37BB_BIN .= "${@'_no_tip.bin' if d.getVar("TIP_IMAGE") != 'True' else '.bin'}"
38
39do_configure[dirs] = "${WORKDIR}"
40do_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
62do_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
79do_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}
91addtask deploy before do_build after do_compile
92PACKAGE_ARCH = "${MACHINE_ARCH}"