/
webos_image.bbclass
126 lines (106 loc) · 6.06 KB
/
webos_image.bbclass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Copyright (c) 2012-2024 LG Electronics, Inc.
# IMAGE_FEATURES controls the contents of webOS OSE images
#
# Available IMAGE_FEATURES:
#
# webos-minimal: webOS minimal packages
# webos-systemapps: webOS system app packages
# webos-systemservices: webOS system service packages
# webos-testapps: webOS test app packages
# webos-extended: webOS extended packages
#
# webos-devel: Additional packages useful for during development
# webos-test: Additional packages for running unit and integration tests
#
# webos-extract-ls2-api: Add task to extract luna-service2 api list
# webos-validate-ls2-conf: Add task to validate LS2 sysbus files
# webos-production-image: Specific features to productize
#
# and IMAGE_FEATURES from core-image
IMAGE_FEATURES[validitems] = "webos-minimal webos-systemapps webos-testapps webos-extended webos-devel webos-test webos-extract-ls2-api webos-validate-ls2-conf webos-production-image "
FEATURE_PACKAGES_webos-minimal = "packagegroup-webos-minimal"
FEATURE_PACKAGES_webos-systemapps = "packagegroup-webos-systemapps"
FEATURE_PACKAGES_webos-systemservices = "packagegroup-webos-systemservices"
FEATURE_PACKAGES_webos-testapps = "packagegroup-webos-testapps"
FEATURE_PACKAGES_webos-extended = "packagegroup-webos-extended"
FEATURE_PACKAGES_webos-devel = "packagegroup-webos-devel"
FEATURE_PACKAGES_webos-test = "packagegroup-webos-test"
WEBOS_IMAGE_DEFAULT_SSH_IMAGE_FEATURE = "ssh-server-dropbear"
WEBOS_IMAGE_DEFAULT_FEATURES = "package-management"
WEBOS_IMAGE_DEFAULT_FEATURES:append = "${@ ' ${WEBOS_IMAGE_DEFAULT_SSH_IMAGE_FEATURE}' if d.getVar('WEBOS_DISTRO_PRERELEASE') != '' else ''}"
WEBOS_IMAGE_DEFAULT_FEATURES:append:emulator = " ${WEBOS_IMAGE_DEFAULT_SSH_IMAGE_FEATURE}"
WEBOS_IMAGE_DEFAULT_FEATURES:append = "${@ ' webos-production-image' if d.getVar('WEBOS_DISTRO_PRERELEASE') == '' else ''}"
WEBOS_IMAGE_BASE_INSTALL = " \
packagegroup-core-boot \
${WEBOS_IMAGE_EXTRA_INSTALL} \
"
WEBOS_IMAGE_EXTRA_INSTALL = " \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-aiframework', 'packagegroup-webos-ml', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-audio', 'packagegroup-webos-audio', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-bluetooth', 'packagegroup-webos-bluetooth', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-camera', 'packagegroup-webos-camera', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-connectivity', 'packagegroup-webos-connectivity', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-dac', 'libcap-bin', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-diagnostics', 'packagegroup-webos-diagnostics', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-graphics', 'packagegroup-webos-graphics', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-i18n', 'packagegroup-webos-i18n', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-media', 'packagegroup-webos-media', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-media-drm', 'packagegroup-webos-media-drm', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'webos-screencast', 'packagegroup-webos-screencast', '', d)} \
"
IMAGE_INSTALL ?= "${WEBOS_IMAGE_BASE_INSTALL}"
# Perform validation for all ls2 security configuration jsons
IMAGE_CLASSES += "${@bb.utils.contains('IMAGE_FEATURES', 'webos-validate-ls2-conf', 'webos_ls2_conf_validate', '', d)}"
# webOS supports the generation of oss package information file.
# $ bitbake -c write_oss_pkg_info <image>
IMAGE_CLASSES += "webos_oss_pkg_info pkg_dependency webos_ls2_api_info ${@bb.utils.contains('IMAGE_FEATURES', 'webos-extract-ls2-api', 'webos_ls2_api_list', '', d)}"
# Add ${webos_sysconfdir}/build/image-name during image construction that contains the image name
ROOTFS_POSTPROCESS_COMMAND += "rootfs_set_image_name ; clean_python_installation ; verify_acg ; "
# Can be used to echo image name to ${webos_sysconfdir}/build/image-name
rootfs_set_image_name () {
mkdir -p ${IMAGE_ROOTFS}${webos_sysconfdir}/build
echo ${IMAGE_BASENAME} > ${IMAGE_ROOTFS}${webos_sysconfdir}/build/image-name
}
# cleanup python installation
clean_python_installation () {
for p in `find ${IMAGE_ROOTFS}${libdir} -name "*pyo" `
do
rm -f $p
done
}
# run LS2 ACG verification code
python verify_acg () {
def herror(c, m):
oe.qa.handle_error(c, m, d)
import verify_ls2_acg
verify_ls2_acg.handle_error = herror
if not verify_ls2_acg.Verify("${IMAGE_ROOTFS}"):
bb.note("LS2 hub config not found, ACG verification skipped")
}
# A hook function to support read-only-rootfs IMAGE_FEATURES
webos_read_only_rootfs_hook () {
set -x
# Tweak the mount option and fs_passno for rootfs in fstab
sed -i -e '/^[#[:space:]]*\/dev\/root/{s/rw/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab
# Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes
if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then
sed -i 's/\(^[ \t]*ROOTFS_READ_ONLY=\)no/\1=yes/' ${IMAGE_ROOTFS}/etc/default/rcS
if ! grep "^[ \t]*ROOTFS_READ_ONLY=yes[ \t]*$" ${IMAGE_ROOTFS}/etc/default/rcS ; then
bbfatal "Failed to change ROOTFS_READ_ONLY settings in ${IMAGE_ROOTFS}/etc/default/rcS"
fi
fi
}
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "webos_read_only_rootfs_hook ; ", "", d)}'
inherit core-image
inherit webos_machine_impl_dep
inherit webos_filesystem_paths
inherit webos_prerelease_dep
do_rootfs[depends] += "libpbnjson-native:do_populate_sysroot"
# Build only wic.vmdk for qemux86*, otherwise wic.vmdk might conflict with tar.gz and cause errors like:
# | tar: ./usr/lib/perl/5.24.1/unicore/lib/Bc/EN.pl: file changed as we read it
IMAGE_FSTYPES:qemux86 = "wic.vmdk"
IMAGE_FSTYPES:qemux86-64 = "wic.vmdk"
# Create the CVE status as a json file and set file name as below.
# CVE status will be generated only when INHERIT += "cve_check"
CVE_CHECK_FORMAT_TEXT = "0"
CVE_CHECK_MANIFEST_JSON = "${IMGDEPLOYDIR}/${IMAGE_BASENAME}-cve.json"