summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJianxun Zhang <jianxun.zhang@linux.intel.com>2016-08-03 18:04:16 (GMT)
committerTom Zanussi <tom.zanussi@linux.intel.com>2016-08-03 22:37:41 (GMT)
commit96cd0d74286d98a26e34adcfc2bfa7c691c65a97 (patch)
tree82bf08c4fa54e6ffe6f033bd9692e052924edd5a
parentdaa587ed5c950cdcbc3a4b2561fb92209c0784ec (diff)
downloadmeta-intel-96cd0d74286d98a26e34adcfc2bfa7c691c65a97.tar.gz
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>
-rw-r--r--classes/rmc-systemd-boot.bbclass12
-rw-r--r--common/recipes-bsp/rmc/rmc-db.bb48
-rw-r--r--conf/layer.conf10
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 0000000..ad2cf10
--- /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
4IMAGE_INSTALL_append = " rmc"
5
6inherit systemd-boot
7
8do_bootimg[depends] += "${MLPREFIX}rmc-db:do_deploy"
9
10efi_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 0000000..14553af
--- /dev/null
+++ b/common/recipes-bsp/rmc/rmc-db.bb
@@ -0,0 +1,48 @@
1SUMMARY = "Central RMC Database"
2DESCRIPTION = "Generate a centralized RMC database for RMC feature. \
3Fingerprints and data for all boards supported are specified by variable \
4RMC_BOARD_DATA_DIRS which is a list of top directories that contains \
5subdirectories for boards. Developers can add their top directories by appending \
6them to this variable in a rmc-db.bbappend.Refer to rmc-db bbclass for more \
7information."
8
9LICENSE = "MIT"
10
11LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
12
13S = "${WORKDIR}"
14
15inherit rmc-db
16
17RMC_BOARD_DATA_DIRS_append := " ${THISDIR}/boards/"
18RMC_DB_DIR = "${WORKDIR}/db"
19
20# Let sstate be aware of change in any added board directories
21do_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
24def 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
32do_generate_rmc_db () {
33 rmc_generate_db "${RMC_BOARD_DATA_DIRS}" "${RMC_DB_DIR}"/rmc.db
34}
35
36addtask generate_rmc_db after do_compile
37
38inherit deploy
39
40do_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
48addtask deploy after do_generate_rmc_db
diff --git a/conf/layer.conf b/conf/layer.conf
index d8e5000..41e42e8 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
17LAYERVERSION_intel = "3" 17LAYERVERSION_intel = "3"
18
19
20# Exclude RMC patches unless RMC Feature is eanbled
21RMC_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
25BBMASK += "${RMC_BBMASK}"
26
27BBMASK_remove = "${@bb.utils.contains('DISTRO_FEATURES', 'rmc', '${RMC_BBMASK}', '', d)}"