diff options
| -rw-r--r-- | classes/rmc-systemd-boot.bbclass | 12 | ||||
| -rw-r--r-- | common/recipes-bsp/rmc/rmc-db.bb | 48 | ||||
| -rw-r--r-- | conf/layer.conf | 10 |
3 files changed, 70 insertions, 0 deletions
diff --git a/classes/rmc-systemd-boot.bbclass b/classes/rmc-systemd-boot.bbclass new file mode 100644 index 00000000..ad2cf106 --- /dev/null +++ b/classes/rmc-systemd-boot.bbclass | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # rmc-systemd-boot bbclass | ||
| 2 | # Deploy central RMC database file to ESP | ||
| 3 | |||
| 4 | IMAGE_INSTALL_append = " rmc" | ||
| 5 | |||
| 6 | inherit systemd-boot | ||
| 7 | |||
| 8 | do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy" | ||
| 9 | |||
| 10 | efi_populate_append() { | ||
| 11 | install -m 0400 ${DEPLOY_DIR_IMAGE}/rmc.db ${DEST}/rmc.db | ||
| 12 | } | ||
diff --git a/common/recipes-bsp/rmc/rmc-db.bb b/common/recipes-bsp/rmc/rmc-db.bb new file mode 100644 index 00000000..14553af0 --- /dev/null +++ b/common/recipes-bsp/rmc/rmc-db.bb | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | SUMMARY = "Central RMC Database" | ||
| 2 | DESCRIPTION = "Generate a centralized RMC database for RMC feature. \ | ||
| 3 | Fingerprints and data for all boards supported are specified by variable \ | ||
| 4 | RMC_BOARD_DATA_DIRS which is a list of top directories that contains \ | ||
| 5 | subdirectories for boards. Developers can add their top directories by appending \ | ||
| 6 | them to this variable in a rmc-db.bbappend.Refer to rmc-db bbclass for more \ | ||
| 7 | information." | ||
| 8 | |||
| 9 | LICENSE = "MIT" | ||
| 10 | |||
| 11 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690" | ||
| 12 | |||
| 13 | S = "${WORKDIR}" | ||
| 14 | |||
| 15 | inherit rmc-db | ||
| 16 | |||
| 17 | RMC_BOARD_DATA_DIRS_append := " ${THISDIR}/boards/" | ||
| 18 | RMC_DB_DIR = "${WORKDIR}/db" | ||
| 19 | |||
| 20 | # Let sstate be aware of change in any added board directories | ||
| 21 | do_generate_rmc_db[file-checksums] = "${@get_rmc_top_dirs_list(d)}" | ||
| 22 | |||
| 23 | # derived from get_lic_checksum_file_list(d) in base.bbclass in OE | ||
| 24 | def get_rmc_top_dirs_list(d): | ||
| 25 | dirlist = [] | ||
| 26 | dirs = d.getVar("RMC_BOARD_DATA_DIRS", True) or '' | ||
| 27 | topdirs = dirs.split() | ||
| 28 | for each in topdirs: | ||
| 29 | dirlist.append(each + ":" + str(os.path.exists(each))) | ||
| 30 | return " ".join(dirlist) | ||
| 31 | |||
| 32 | do_generate_rmc_db () { | ||
| 33 | rmc_generate_db "${RMC_BOARD_DATA_DIRS}" "${RMC_DB_DIR}"/rmc.db | ||
| 34 | } | ||
| 35 | |||
| 36 | addtask generate_rmc_db after do_compile | ||
| 37 | |||
| 38 | inherit deploy | ||
| 39 | |||
| 40 | do_deploy () { | ||
| 41 | if [ -f ${RMC_DB_DIR}/rmc.db ]; then | ||
| 42 | install -m 0400 ${RMC_DB_DIR}/rmc.db ${DEPLOYDIR} | ||
| 43 | else | ||
| 44 | echo "Warning: no RMC central database found, skip deployment." | ||
| 45 | fi | ||
| 46 | } | ||
| 47 | |||
| 48 | addtask deploy after do_generate_rmc_db | ||
diff --git a/conf/layer.conf b/conf/layer.conf index d8e5000d..41e42e83 100644 --- a/conf/layer.conf +++ b/conf/layer.conf | |||
| @@ -15,3 +15,13 @@ LICENSE_PATH += "${LAYERDIR}/common/custom-licenses" | |||
| 15 | # This should only be incremented on significant changes that will | 15 | # This should only be incremented on significant changes that will |
| 16 | # cause compatibility issues with other layers | 16 | # cause compatibility issues with other layers |
| 17 | LAYERVERSION_intel = "3" | 17 | LAYERVERSION_intel = "3" |
| 18 | |||
| 19 | |||
| 20 | # Exclude RMC patches unless RMC Feature is eanbled | ||
| 21 | RMC_BBMASK := "${LAYERDIR}/common/recipes-bsp/systemd-boot/systemd-boot.*\.bbappend \ | ||
| 22 | ${LAYERDIR}/common/recipes-core/initrdscripts/initramfs-live-install-efi.*\.bbappend \ | ||
| 23 | ${LAYERDIR}/common/recipes-bsp/gnu-efi/gnu-efi.*\.bbappend" | ||
| 24 | |||
| 25 | BBMASK += "${RMC_BBMASK}" | ||
| 26 | |||
| 27 | BBMASK_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'rmc', '${RMC_BBMASK}', '', d)}" | ||
