util-linux: only apply the bbappend if ima distro flag set

Run yocto-check-layer-wrapper to check layer compliance of Yocto will report the signatures error:

util-linux:do_compile: 9c04caa1d37ca0fa0caa2f48a01912d1b3d35de2ac668c4cddd6158bbac9c374 ->
53de68708253461d617177c02a60d0e798f5f7727c14cc8e6b9a8bbedc53de99
bitbake-diffsigs --task util-linux do_compile --signature
9c04caa1d37ca0fa0caa2f48a01912d1b3d35de2ac668c4cddd6158bbac9c374
53de68708253461d617177c02a60d0e798f5f7727c14cc8e6b9a8bbedc53de99

Rename util-linux_%.bbappend to util-linux-integrity.inc and add a new
bbappend. Make sure this piece of code should be applied only if the ima
feature is set.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
This commit is contained in:
Yi Zhao
2019-06-26 12:43:58 +08:00
committed by Jia Zhang
parent 06f4d3eece
commit 392371e4b0
2 changed files with 20 additions and 19 deletions

View File

@@ -0,0 +1,19 @@
CFLAGS_remove += "-pie -fpie"
# We need -no-pie in case the default is to generate pie code.
#
do_compile_append_class-target() {
${CC} ${CFLAGS} ${LDFLAGS} -no-pie -static \
sys-utils/switch_root.o \
-o switch_root.static
}
do_install_append_class-target() {
install -d "${D}${sbindir}"
install -m 0700 "${B}/switch_root.static" \
"${D}${sbindir}/switch_root.static"
}
PACKAGES =+ "${PN}-switch-root.static"
FILES_${PN}-switch-root.static = "${sbindir}/switch_root.static"

View File

@@ -1,19 +1 @@
CFLAGS_remove += "-pie -fpie"
# We need -no-pie in case the default is to generate pie code.
#
do_compile_append_class-target() {
${CC} ${CFLAGS} ${LDFLAGS} -no-pie -static \
sys-utils/switch_root.o \
-o switch_root.static
}
do_install_append_class-target() {
install -d "${D}${sbindir}"
install -m 0700 "${B}/switch_root.static" \
"${D}${sbindir}/switch_root.static"
}
PACKAGES =+ "${PN}-switch-root.static"
FILES_${PN}-switch-root.static = "${sbindir}/switch_root.static"
require ${@bb.utils.contains('DISTRO_FEATURES', 'ima', 'util-linux-integrity.inc', '', d)}