Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@
[submodule "meta-security"]
path = meta-security
url = https://git.yoctoproject.org/git/meta-security
[submodule "meta-flatpak"]
path = meta-flatpak
url = https://github.com/klihub/meta-flatpak
branch = intel-iot-refkit/flatpak
ignore = untracked
[submodule "meta-gplv2"]
path = meta-gplv2
url = https://git.yoctoproject.org/git/meta-gplv2
2 changes: 2 additions & 0 deletions docker/build-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ if [ -z "$BUILD_TARGET" ]; then
(REFKIT_CI_SDK_TARGETS) _sufx=":do_populate_sdk" ;;
(REFKIT_CI_ESDK_TARGETS) _sufx=":do_populate_sdk_ext" ;;
(REFKIT_CI_TEST_EXPORT_TARGETS) _sufx=":do_test_iot_export" ;;
(REFKIT_CI_FLATPAK_RUNTIME_TARGETS) _sufx="-flatpak-runtime:do_test_iot_export" ;;
(REFKIT_CI_FLATPAK_SDK_TARGETS) _sufx="-flatpak-sdk" ;;
(*) continue;;
esac
for img in `grep ${ci_var} ${WORKSPACE}/refkit_ci_vars | perl -pe 's/.+="(.*)"/\1/g; s/[^ a-zA-Z0-9_-]//g'`; do
Expand Down
1 change: 1 addition & 0 deletions meta-flatpak
Submodule meta-flatpak added at ccb6b1
1 change: 1 addition & 0 deletions meta-gplv2
Submodule meta-gplv2 added at de001b
49 changes: 48 additions & 1 deletion meta-refkit/classes/refkit-image.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ FEATURE_PACKAGES_tools-debug_append = " valgrind"
FEATURE_PACKAGES_computervision = "packagegroup-computervision"
FEATURE_PACKAGES_computervision-test = "packagegroup-computervision-test"

inherit ${@bb.utils.contains('DISTRO_FEATURES', 'flatpak', \
'flatpak-image', '', d)}

IMAGE_LINGUAS = " "

LICENSE = "MIT"
Expand Down Expand Up @@ -436,7 +439,11 @@ ROOTFS_POSTPROCESS_COMMAND += "refkit_image_patch_os_release; "
# Instead we pre-configure some defaults in the image and can remove
# the useless service.
refkit_image_disable_firstboot () {
for i in /etc/systemd /lib/systemd /usr/lib/systemd /bin /usr/bin; do
SEARCH_DIRS='/etc/systemd /usr/lib/systemd /usr/bin'
if [ "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '1', '0', d)}" = "0" ]; then
SEARCH_DIRS=$SEARCH_DIRS' /lib/systemd /bin'
fi
for i in ${SEARCH_DIRS}; do
d="${IMAGE_ROOTFS}$i"
if [ -d "$d" ] && [ ! -h "$d" ]; then
for e in $(find "$d" -name systemd-firstboot.service -o -name systemd-firstboot.service.d -o -name systemd-firstboot); do
Expand Down Expand Up @@ -494,3 +501,43 @@ EOF
fi
}
ROOTFS_POSTPROCESS_COMMAND += "refkit_image_system_serialgetty; "

# Prepare the symlinks required for merged /usr at the time of rootfs creation.

# The links created in rootfs are:
#/bin --> /usr/sbin
#/sbin --> /usr/sbin
#/lib --> /usr/lib
#/lib64 --> /usr/lib64

# We cannot make these symlinks as part of 'base-files' or some other package.
# Because at rootfs creation, installation of the package(say kernel) that
# depends on these root folders/links fails, if package manager installs this
# package prior to base-files.

# These symbolic links in top level folder should present as long as
# - kerenl tools use /lib/{module,firmware}
# - shell scripts uses
#upstream commit waiting for review:
# http://lists.openembedded.org/pipermail/openembedded-core/2017-February/133151.html
create_merged_usr_symlinks() {
install -m 0755 -d ${IMAGE_ROOTFS}/${base_bindir}
install -m 0755 -d ${IMAGE_ROOTFS}/${base_sbindir}
install -m 0755 -d ${IMAGE_ROOTFS}/${base_libdir}
lnr ${IMAGE_ROOTFS}${base_bindir} ${IMAGE_ROOTFS}/bin
lnr ${IMAGE_ROOTFS}${base_sbindir} ${IMAGE_ROOTFS}/sbin
lnr ${IMAGE_ROOTFS}${base_libdir} ${IMAGE_ROOTFS}/${baselib}

if [ "${nonarch_base_libdir}" != "${base_libdir}" ]; then
install -m 0755 -d ${IMAGE_ROOTFS}/${nonarch_base_libdir}
lnr ${IMAGE_ROOTFS}${nonarch_base_libdir} ${IMAGE_ROOTFS}/lib
fi

# create base links for multilibs
multi_libdirs="${@d.getVar('MULTILIB_VARIANTS')}"
for d in $multi_libdirs; do
install -m 0755 -d ${IMAGE_ROOTFS}/${exec_prefix}/$d
lnr ${IMAGE_ROOTFS}/${exec_prefix}/$d ${IMAGE_ROOTFS}/$d
done
}
ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_symlinks; ', '',d)}"
2 changes: 2 additions & 0 deletions meta-refkit/conf/bblayers.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ REFKIT_LAYERS = " \
##OEROOT##/../meta-security-isafw \
##OEROOT##/../meta-intel-realsense \
##OEROOT##/../meta-clang \
##OEROOT##/../meta-flatpak \
##OEROOT##/../meta-gplv2 \
"

# REFKIT_LAYERS += "##OEROOT##/../meta-openembedded/meta-efl"
Expand Down
8 changes: 8 additions & 0 deletions meta-refkit/conf/conf-notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ Common targets are:
refkit-image-gateway (when building an image with tools and
configuration for acting as an IoT sensor
gateway)

If you enable flatpak applications (see the comments in local.conf on how to
do this), you can build two additional image variants:
<image>-flatpak-runtime flatpak-enabled version of <image>
<image>-flatpak-sdk flatpak SDK runtime (OSTree repo) for the above

You can use a -flatpak-sdk image variant on your (flatpak-enabled) host
to build flatpaks for the -flatpak-runtime image variant.
14 changes: 14 additions & 0 deletions meta-refkit/conf/distro/include/refkit-ci.inc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ require conf/distro/include/refkit-development.inc
# If we can access /dev/kvm, then let's use it.
QEMU_USE_KVM = "${@ 'intel-corei7-64 intel-core2-32 qemux86 qemux86-64' if os.access('/dev/kvm', os.R_OK|os.W_OK) else '' }"

# Enable flatpak application support.
require conf/distro/include/flatpak-applications.inc

REFKIT_VM_IMAGE_TYPES = "wic.xz wic.zip wic.bmap wic.xz.sha256sum"

#
Expand All @@ -72,6 +75,17 @@ REFKIT_CI_SDK_TARGETS=""
# Uses the fully-populated image to ensure that the eSDK is as complete
# as possible.
REFKIT_CI_ESDK_TARGETS=""
# We'll automatically enable flatpak runtime/SDK support for the
# following targets if flatpak support is enabled (by commenting out
# the corresponding require above.
REFKIT_CI_FLATPAK_RUNTIME_TARGETS = " \
${@bb.utils.contains('DISTRO_FEATURES', 'flatpak', \
'refkit-image-minimal', '', d)} \
"
REFKIT_CI_FLATPAK_SDK_TARGETS = " \
${@bb.utils.contains('DISTRO_FEATURES', 'flatpak', \
'refkit-image-minimal', '', d)} \
"
# Following targets would be executed with do_test_iot_export task
REFKIT_CI_TEST_EXPORT_TARGETS="refkit-image-common refkit-image-computervision refkit-image-gateway"
# Execute automatic tests for following images with corresponding
Expand Down
17 changes: 17 additions & 0 deletions meta-refkit/conf/distro/include/usrmerge.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

#enable merged /usr
REFKIT_DEFAULT_DISTRO_FEATURES += "usrmerge"

export base_bindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefix}/bin', '${base_prefix}/bin', d)}"
export base_sbindir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefix}/sbin', '${base_prefix}/sbin', d)}"
export base_libdir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefix}/${baselib}', '${base_prefix}/${baselib}', d)}"
export nonarch_base_libdir = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefix}/lib', '${base_prefix}/lib', d)}"

#nativesdk
base_bindir_nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${bindir_nativesdk}', '/bin', d)}"
base_sbindir_nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${sbindir_nativesdk}', '/sbin', d)}"
base_libdir_nativesdk = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${libdir_nativesdk}', '/lib', d)}"

DISTRO_FEATURES_remove = " gobject-introspection-data"


2 changes: 2 additions & 0 deletions meta-refkit/conf/distro/refkit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,5 @@ INHERIT += "uninative"
# necessary patch "net-tools: enable native and nativesdk variant"
# is in OE-core): swtpm_setup.sh needs netstat command.
DEPENDS_append_pn-swtpm-wrappers-native = " net-tools-native"

require conf/distro/include/usrmerge.inc
15 changes: 15 additions & 0 deletions meta-refkit/conf/local.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,21 @@ PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"
#
#require conf/distro/include/refkit-production.inc

# If you'd like to enable support for flatpak applications and building
# flatpak SDK runtime repositories, which you can use on your flatpak-
# enabled host to build flatpak applications for a flatpak-enabled version
# of an image, enabled the require line below. You can build a flatpak-
# enabled version of an image by appending '-flatpak-runtime' to the image
# name. Simiarly you can build a flatpak SDK runtime for such an image
# by appending '-flatpak-sdk' to the image name.
#
# For instance, to build a flatpak-enabled version of the minimal image and
# a flatpak SDK runtime for it, use
#
# bitbake refkit-image-minimal-flatpak-runtime refkit-image-minimal-flatpak-sdk
#
#require conf/distro/include/flatpak-applications.inc

# systemd-bootchart is a useful tool to analyze and optimize a system
# boot time. The tool is available in IoT Reference OS Kit and needs to be activated
# by a kernel command-line parameter which requires to build a new
Expand Down
2 changes: 2 additions & 0 deletions meta-refkit/recipes-core/busybox/busybox_%.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ RRECOMMENDS_${PN}_remove = "${PN}-syslog"
SRC_URI_append = "\
file://refkit.cfg \
"

RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh', '', d)}"
4 changes: 4 additions & 0 deletions meta-refkit/recipes-core/systemd/systemd_%.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
# systemd-getty-generator (instead of the Yocto default
# systemd-serialgetty that creates everything in do_install).
PACKAGECONFIG_append = "serial-getty-generator"

#usrmege supported changes
EXTRA_OECONF_append = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', ' --disable-split-usr', ' --enable-split-usr', d)}"
rootprefix = "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '${exec_prefix}', '${base_prefix}', d)}"
1 change: 1 addition & 0 deletions meta-refkit/recipes-extended/bash_%.bbappend
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}"
9 changes: 9 additions & 0 deletions meta-refkit/recipes-image/images/refkit-initramfs.bb
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,12 @@ IMA_EVM_ROOTFS_SIGNED = "-maxdepth 0 -false"
IMA_EVM_ROOTFS_HASHED = "-maxdepth 0 -false"
IMA_EVM_ROOTFS_CLASS = "${@bb.utils.contains('IMAGE_FEATURES', 'ima', 'ima-evm-rootfs', '',d)}"
inherit ${IMA_EVM_ROOTFS_CLASS}

create_merged_usr_links() {
mkdir -p ${IMAGE_ROOTFS}${libdir} ${IMAGE_ROOTFS}${bindir} ${IMAGE_ROOTFS}${sbindir}
lnr ${IMAGE_ROOTFS}${libdir} ${IMAGE_ROOTFS}/${baselib}
lnr ${IMAGE_ROOTFS}${bindir} ${IMAGE_ROOTFS}/bin
lnr ${IMAGE_ROOTFS}${sbindir} ${IMAGE_ROOTFS}/sbin
}
ROOTFS_PREPROCESS_COMMAND += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', 'create_merged_usr_links;', '', d)}"