summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJianxun Zhang <jianxun.zhang@linux.intel.com>2016-08-03 11:04:12 -0700
committerTom Zanussi <tom.zanussi@linux.intel.com>2016-08-03 17:34:14 -0500
commit6a09c102f2b58a34a18762de64894466152a8a7d (patch)
tree03bae1a748a7157966269b74b34b1f54adf6f387
parent62c3fdc758521303addd05347087a253646cea3b (diff)
downloadmeta-intel-6a09c102f2b58a34a18762de64894466152a8a7d.tar.gz
rmc: Add Runtime Machine Configuration (RMC) project
RMC recipe fetch RMC project and build it more than once in build time: RMC tool is built for host architecture (native). The tool for host is used to generate RMC database in build time. RMC tool is also built for target architecture, so that scripts in user space can call RMC tool on a running target. Developers can also boot a target and run rmc tool to obtain fingerprint for a new board type. RMC libraries are compiled for both of UEFI context and user space. They are always linked in RMC tool and can be linked into an EFI bootloader. The recipes don't install libraries for target's user space until we have a new client needs it. The rmc-db.bbclass provides functions to generate rmc database file for other software components to reuse. We absorb a patch from Tom Zanussi to update source location with the public link. We could put this change in another commit, but leaving the replaced internal link in this commit could cause trouble when people bisect the project but don't have access to the internal location: ---------------------- rmc: Update to use public repo The repo the rmc recipe was pointing to was private - it's now public Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> common/recipes-bsp/rmc/rmc.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/recipes-bsp/rmc/rmc.inc b/common/recipes-bsp/rmc/rmc.inc index c046e2e..bdf930d 100644 --- a/common/recipes-bsp/rmc/rmc.inc +++ b/common/recipes-bsp/rmc/rmc.inc @@ -15,7 +15,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=bcdd376d27b26bde6afadd67aa3c8b07" -SRC_URI = "git://git@git.yoctoproject.org/rmc;protocol=ssh" +SRC_URI = "git://git.yoctoproject.org/rmc" ... ---------------------- 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-db.bbclass92
-rw-r--r--common/recipes-bsp/rmc/rmc.bb46
2 files changed, 138 insertions, 0 deletions
diff --git a/classes/rmc-db.bbclass b/classes/rmc-db.bbclass
new file mode 100644
index 00000000..0fb4c272
--- /dev/null
+++ b/classes/rmc-db.bbclass
@@ -0,0 +1,92 @@
1# RMC database bbclass
2# provide functions to generate RMC database file on build host (native)
3
4DEPENDS += "rmc-native"
5
6# rmc_generate_db()
7# $1: a list of directories. Each directory holds directories for a group of
8# boards.
9# $2: path_name of rmc generates database file and records
10#
11# WARNING: content of directory of database file will be removed.
12#
13# Each board directory shall contain a fingerprint file (*.fp) at least, with
14# optional file blob(s) associated to the type of board. If a board directory
15# has no file blob, no record is created for that board.
16#
17# An example of two directories each of which contains two boards for RMC:
18# (All file and directory names are for illustration purpose.)
19#
20# dir_1/
21# board_1/
22# board_1_fingerprint.fp
23# file_1.blob
24# board_2/
25# board_2.fp
26# dir_2/
27# board_3/
28# b3.fp
29# file_1.blob
30# file_2.conf
31# board_4/
32# board_foo.fp
33# mylib.config
34#
35# To generate a RMC database "rmc.db" with data of all (actually 3) of boards in
36# a directory "deploy_dir":
37#
38# rmc_generate_db "dir_1 dir_2" "deploy_dir/rmc.db"
39#
40# The board_2 will be skipped. No record or any data for it is packed in
41# generated database because it only contains a fingerprint file.
42#
43
44rmc_generate_db () {
45 RMC_BOARD_DIRS=$1
46
47 if [ "$#" -ne 2 ]; then
48 echo "rmc_generate_db(): Wrong number of arguments: $#"
49 return 1
50 fi
51
52 RMC_DB_DIR=$(dirname "$2")
53 RMC_RECORDS=""
54
55 rm -rf ${RMC_DB_DIR}
56 mkdir -p ${RMC_DB_DIR}
57
58 # generate rmc database
59 for topdir in ${RMC_BOARD_DIRS}; do
60 # For all board dirs in a topdir:
61 CUR_BOARD_DIRS=$(find ${topdir}/* -type d)
62 for board_dir in ${CUR_BOARD_DIRS}; do
63 # FIXME: we shall fail when having more than one .fp file
64 CUR_FINGERPRINT=$(find ${board_dir}/ -name "*.fp")
65
66 # disallow a board directory without any fingerprint file in it.
67 if [ -z "${CUR_FINGERPRINT}" ]; then
68 echo "Cannot find RMC fingerprint file in ${board_dir}"
69 return 1
70 fi
71
72 CUR_FILES=$(find ${board_dir}/ -type f |grep -v '\.fp$' || true)
73
74 # allow a directory only with fingerprint file. Developer may
75 # check in fingerprint for future use.
76 if [ -z "${CUR_FILES}" ]; then
77 continue
78 fi
79
80 CUR_TAG=$(echo "${board_dir}"|sed 's/\//-/g')
81 CUR_RECORD=${RMC_DB_DIR}/rmc${CUR_TAG}.rec
82
83 rmc -R -f ${CUR_FINGERPRINT} -b ${CUR_FILES} -o ${CUR_RECORD}
84
85 RMC_RECORDS="${RMC_RECORDS} ${CUR_RECORD}"
86 done
87 done
88
89 if [ ! -z "${RMC_RECORDS}" ]; then
90 rmc -D ${RMC_RECORDS} -o "$2"
91 fi
92}
diff --git a/common/recipes-bsp/rmc/rmc.bb b/common/recipes-bsp/rmc/rmc.bb
new file mode 100644
index 00000000..d8e538b2
--- /dev/null
+++ b/common/recipes-bsp/rmc/rmc.bb
@@ -0,0 +1,46 @@
1SUMMARY = "RMC (Runtime Machine Configuration)"
2
3DESCRIPTION = "RMC project provides a tool and libraries to identify types \
4of hardware boards and access any file-based data specific to the board's \
5type at runtime in a centralized way. Software (clients) can have a generic \
6logic to query board-specific data from RMC without knowing the type of board. \
7This make it possible to have a generic software work running on boards which \
8require any quirks or customizations at a board or product level. \
9"
10
11LICENSE = "MIT"
12
13LIC_FILES_CHKSUM = "file://COPYING;md5=838c366f69b72c5df05c96dff79b35f2"
14
15SRC_URI = "git://git.yoctoproject.org/rmc"
16
17SRCREV = "9bc0f645729bb41e050395fbfac170fca351b3b8"
18
19S = "${WORKDIR}/git"
20
21DEPENDS_class-target = "gnu-efi"
22
23# from gnu-efi, we should align arch-mapping with it.
24def rmc_efi_arch(d):
25 import re
26 arch = d.getVar("TARGET_ARCH", True)
27 if re.match("i[3456789]86", arch):
28 return "ia32"
29 return arch
30
31do_compile_class-target() {
32 oe_runmake
33 oe_runmake RMC_EFI_HEADER_PREFIX=${STAGING_INCDIR}/efi RMC_EFI_ARCH="${@rmc_efi_arch(d)}" -f Makefile.efi
34}
35
36do_install() {
37 oe_runmake RMC_EFI_ARCH="${@rmc_efi_arch(d)}" RMC_INSTALL_PREFIX=${D}/usr install
38 oe_runmake RMC_EFI_ARCH="${@rmc_efi_arch(d)}" RMC_INSTALL_PREFIX=${D}/usr -f Makefile.efi install
39}
40
41do_install_class-native() {
42 install -d ${D}${STAGING_BINDIR_NATIVE}
43 install -m 0755 ${S}/src/rmc ${D}${STAGING_BINDIR_NATIVE}
44}
45
46BBCLASSEXTEND = "native"