[OE-core] [PATCH RFC 07/18] rootfs-postcommands: add rootfs postprocess command to avoid /boot/ duplication
California Sullivan
california.l.sullivan at intel.com
Tue Dec 19 22:58:20 UTC 2017
EFI systems need their /boot/ directory in its own partition. By
splitting it into its own directory like this, we avoid /boot/ ending up
in the primary rootfs, and can easily create the EFI partition from the
IMAGE_BOOTFS directory.
Signed-off-by: California Sullivan <california.l.sullivan at intel.com>
---
meta/classes/rootfs-postcommands.bbclass | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index a4e627fef84..e617c26f41a 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -25,6 +25,9 @@ APPEND_append = '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", " ro
# Generates test data file with data store variables expanded in json format
ROOTFS_POSTPROCESS_COMMAND += "write_image_test_data ; "
+# Splits /boot into its own rootfs to easily turn it into its own partition
+ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("MACHINE_FEATURES", "efi", "split_bootpartition; ", "",d)}'
+
# Write manifest
IMAGE_MANIFEST = "${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.manifest"
ROOTFS_POSTUNINSTALL_COMMAND =+ "write_image_manifest ; "
@@ -317,6 +320,22 @@ python write_image_test_data() {
}
write_image_test_data[vardepsexclude] += "TOPDIR"
+IMAGE_BOOTFS="${WORKDIR}/bootfs"
+# hardlink rootfs/boot/* into bootfs/, then delete the original
+split_bootpartition () {
+ if [ ! -d ${IMAGE_BOOTFS} ];
+ then
+ mkdir -p ${IMAGE_BOOTFS}
+ else
+ rm -rf ${IMAGE_BOOTFS}/*
+ fi
+ if [ -d ${IMAGE_ROOTFS}/boot ] && [ -n "$(ls -A ${IMAGE_ROOTFS}/boot)" ];
+ then
+ cp -rla ${IMAGE_ROOTFS}/boot/* ${IMAGE_BOOTFS}/
+ rm -rf ${IMAGE_ROOTFS}/boot/*
+ fi
+}
+
# Check for unsatisfied recommendations (RRECOMMENDS)
python rootfs_log_check_recommends() {
log_path = d.expand("${T}/log.do_rootfs")
--
2.14.3
More information about the Openembedded-core
mailing list