[oe] [PATCH 03/15] meta-installer: add anaconda support for target build
Hongxu Jia
hongxu.jia at windriver.com
Thu Nov 23 12:09:03 UTC 2017
While "anaconda-support" in DISTRO_FEATURES, it enable
features of target build.
The target build requires:
- packages to help installation
- append anaconda_support_kernel to KERNEL_CLASSES which
add dmthin.scc and crypt.scc to kernel config
- manually install grub/grub-efi for image install to workaround
grub/grub-efi confliction
- add distro feature check of systemd and ldconfig
- add init manager checking
- add rpm packages check
- emit target image env to help installation
Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
.../classes/anaconda_support_image.bbclass | 40 ++++++++++++++++++++++
meta-installer/conf/layer.conf | 2 ++
.../packagegroups/packagegroup-anaconda-support.bb | 26 ++++++++++++++
3 files changed, 68 insertions(+)
create mode 100644 meta-installer/classes/anaconda_support_image.bbclass
create mode 100644 meta-installer/recipes-installersupport/packagegroups/packagegroup-anaconda-support.bb
diff --git a/meta-installer/classes/anaconda_support_image.bbclass b/meta-installer/classes/anaconda_support_image.bbclass
new file mode 100644
index 0000000..d11e85b
--- /dev/null
+++ b/meta-installer/classes/anaconda_support_image.bbclass
@@ -0,0 +1,40 @@
+FEATURE_PACKAGES_anaconda-support = "packagegroup-anaconda-support"
+IMAGE_FEATURES_append = " anaconda-support"
+
+# Generate filesystem images for image copy install
+IMAGE_FSTYPES += "ext4"
+
+ROOTFS_POSTPROCESS_COMMAND_append = " copy_grub_lib;"
+IMAGE_POSTPROCESS_COMMAND_append = " emit_image_env;"
+
+inherit distro_features_check
+REQUIRED_DISTRO_FEATURES = "systemd ldconfig"
+
+DEPENDS += "grub grub-efi"
+
+copy_grub_lib() {
+ if [ -d ${STAGING_DIR_HOST}${libdir}/grub ]; then
+ echo "Copy grub & grub-efi lib"
+ mkdir -p ${IMAGE_ROOTFS}${libdir}/grub
+ cp -rf ${STAGING_DIR_HOST}${libdir}/grub/* ${IMAGE_ROOTFS}${libdir}/grub
+ fi
+}
+
+python emit_image_env () {
+ localdata = bb.data.createCopy(d)
+
+ # Export DISTRO for installer build
+ localdata.setVarFlag("DISTRO", "unexport", "")
+
+ dumpfile = d.expand("${TOPDIR}/installersupport_${PN}")
+ with open(dumpfile , "w") as f:
+ bb.data.emit_env(f, localdata, True)
+}
+
+python __anonymous () {
+ if not bb.utils.contains("PACKAGE_CLASSES", "package_rpm", True, False, d):
+ raise bb.parse.SkipPackage('Target build requires RPM packages to be the default in PACKAGE_CLASSES.')
+
+ if d.getVar("VIRTUAL-RUNTIME_init_manager", True) != "systemd":
+ raise bb.parse.SkipPackage('Target build requires systemd, set VIRTUAL-RUNTIME_init_manager = "systemd" in local.conf')
+}
diff --git a/meta-installer/conf/layer.conf b/meta-installer/conf/layer.conf
index 2788d1c..95b5004 100644
--- a/meta-installer/conf/layer.conf
+++ b/meta-installer/conf/layer.conf
@@ -27,3 +27,5 @@ SRC_DISTRIBUTE_LICENSES += "FLTK"
LAYER_PATH_meta-installer = "${LAYERDIR}"
+KERNEL_CLASSES_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'anaconda-support', 'anaconda_support_kernel', '', d)}"
+IMAGE_CLASSES_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'anaconda-support', 'anaconda_support_image', '', d)}"
diff --git a/meta-installer/recipes-installersupport/packagegroups/packagegroup-anaconda-support.bb b/meta-installer/recipes-installersupport/packagegroups/packagegroup-anaconda-support.bb
new file mode 100644
index 0000000..0617d90
--- /dev/null
+++ b/meta-installer/recipes-installersupport/packagegroups/packagegroup-anaconda-support.bb
@@ -0,0 +1,26 @@
+DESCRIPTION = "Packages required by target build to help the installation"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+
+inherit packagegroup
+
+RDEPENDS_${PN} = " \
+ sudo \
+ kernel-image \
+ grubby \
+ shadow \
+ efibootmgr \
+ kmod \
+ lvm2 \
+ util-linux-mount \
+ init-ifupdown \
+ libuser \
+ dracut \
+ cryptsetup \
+ sed \
+ grep \
+ dosfstools \
+ e2fsprogs \
+ btrfs-tools \
+"
+
--
2.8.1
More information about the Openembedded-devel
mailing list