rmc: Add recipe and bbclass for RMC feature

RMC Feature is based on RMC project, systemd-boot, EFI installer
to enable a single generic image, built for multiple platforms,
automatically applies customization and quirks specific to a type
of boards at runtime.

In another word, you will see a single image behaves differently
and intelligently according to the type of board it is running on.

To Enable this feature: add the two lines in conf file:
DISTRO_FEATURES_append = " rmc"
EFI_PROVIDER = "rmc-systemd-boot"

Based on Saul Wold's initial work on a feature switch, RMC patches
in systemd-boot, installer and gnu-efi aren't built unless the
feature is enabled.

For a supported board, this feature can :
() show and boot with board-specific boot entries in boot menu
in live-boot and post-installation.

() apply a kernel cmdline fragment to the end of cmdline to boot
Linux kernel. This is effective for any boot entry user chooses in
boot menu.

() create directory and deploy files only for the type of the
running board to target's file systems. What left on target after
installation is just same as the result from installing a conventional
image customized for a single type of hardware.

To add support of new boards, a new variable RMC_BOARD_DATA_DIRS
is the interface to developers. How-to information will be provided
with examples in following patches.

Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Reviewed-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
This commit is contained in:
Jianxun Zhang 2016-08-03 11:04:16 -07:00 committed by Tom Zanussi
parent daa587ed5c
commit 96cd0d7428
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# rmc-systemd-boot bbclass
# Deploy central RMC database file to ESP
IMAGE_INSTALL_append = " rmc"
inherit systemd-boot
do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy"
efi_populate_append() {
install -m 0400 ${DEPLOY_DIR_IMAGE}/rmc.db ${DEST}/rmc.db
}

View File

@ -0,0 +1,48 @@
SUMMARY = "Central RMC Database"
DESCRIPTION = "Generate a centralized RMC database for RMC feature. \
Fingerprints and data for all boards supported are specified by variable \
RMC_BOARD_DATA_DIRS which is a list of top directories that contains \
subdirectories for boards. Developers can add their top directories by appending \
them to this variable in a rmc-db.bbappend.Refer to rmc-db bbclass for more \
information."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
S = "${WORKDIR}"
inherit rmc-db
RMC_BOARD_DATA_DIRS_append := " ${THISDIR}/boards/"
RMC_DB_DIR = "${WORKDIR}/db"
# Let sstate be aware of change in any added board directories
do_generate_rmc_db[file-checksums] = "${@get_rmc_top_dirs_list(d)}"
# derived from get_lic_checksum_file_list(d) in base.bbclass in OE
def get_rmc_top_dirs_list(d):
dirlist = []
dirs = d.getVar("RMC_BOARD_DATA_DIRS", True) or ''
topdirs = dirs.split()
for each in topdirs:
dirlist.append(each + ":" + str(os.path.exists(each)))
return " ".join(dirlist)
do_generate_rmc_db () {
rmc_generate_db "${RMC_BOARD_DATA_DIRS}" "${RMC_DB_DIR}"/rmc.db
}
addtask generate_rmc_db after do_compile
inherit deploy
do_deploy () {
if [ -f ${RMC_DB_DIR}/rmc.db ]; then
install -m 0400 ${RMC_DB_DIR}/rmc.db ${DEPLOYDIR}
else
echo "Warning: no RMC central database found, skip deployment."
fi
}
addtask deploy after do_generate_rmc_db

View File

@ -15,3 +15,13 @@ LICENSE_PATH += "${LAYERDIR}/common/custom-licenses"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_intel = "3"
# Exclude RMC patches unless RMC Feature is eanbled
RMC_BBMASK := "${LAYERDIR}/common/recipes-bsp/systemd-boot/systemd-boot.*\.bbappend \
${LAYERDIR}/common/recipes-core/initrdscripts/initramfs-live-install-efi.*\.bbappend \
${LAYERDIR}/common/recipes-bsp/gnu-efi/gnu-efi.*\.bbappend"
BBMASK += "${RMC_BBMASK}"
BBMASK_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'rmc', '${RMC_BBMASK}', '', d)}"