diff --git a/meta-edgeos/recipes-core/images/edgeos-image.bb b/meta-edgeos/recipes-core/images/edgeos-image.bb index 86dd09b..9acb074 100644 --- a/meta-edgeos/recipes-core/images/edgeos-image.bb +++ b/meta-edgeos/recipes-core/images/edgeos-image.bb @@ -44,4 +44,6 @@ BUILDCFG_VARS += " \ # Disable WIC's automatic fstab updates WIC_CREATE_EXTRA_ARGS = "--no-fstab-update" -IMAGE_INSTALL:append = "expand-rootfs" \ No newline at end of file +IMAGE_INSTALL:append = "expand-rootfs" + +IMAGE_INSTALL:append = " persistent-storage" diff --git a/meta-edgeos/recipes-core/persistent-storage/files/data-setup.service b/meta-edgeos/recipes-core/persistent-storage/files/data-setup.service new file mode 100644 index 0000000..c068780 --- /dev/null +++ b/meta-edgeos/recipes-core/persistent-storage/files/data-setup.service @@ -0,0 +1,12 @@ +[Unit] +Description=Prepare /data for application +After=data.mount +Requires=data.mount + +[Service] +Type=oneshot +ExecStart=/usr/bin/data-setup.sh +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/meta-edgeos/recipes-core/persistent-storage/files/data-setup.sh b/meta-edgeos/recipes-core/persistent-storage/files/data-setup.sh new file mode 100644 index 0000000..4908faf --- /dev/null +++ b/meta-edgeos/recipes-core/persistent-storage/files/data-setup.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu +mkdir -p /data/updateapp +chmod 700 /data/updateapp \ No newline at end of file diff --git a/meta-edgeos/recipes-core/persistent-storage/files/data.mount b/meta-edgeos/recipes-core/persistent-storage/files/data.mount new file mode 100644 index 0000000..81e54a4 --- /dev/null +++ b/meta-edgeos/recipes-core/persistent-storage/files/data.mount @@ -0,0 +1,13 @@ +[Unit] +Description=Mount persistent data partition +After=local-fs-pre.target +Before=local-fs.target + +[Mount] +What=/dev/disk/by-partlabel/data +Where=/data +Type=ext4 +Options=defaults,noatime + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/meta-edgeos/recipes-core/persistent-storage/persistent-storage.bb b/meta-edgeos/recipes-core/persistent-storage/persistent-storage.bb new file mode 100644 index 0000000..6b973b3 --- /dev/null +++ b/meta-edgeos/recipes-core/persistent-storage/persistent-storage.bb @@ -0,0 +1,28 @@ +SUMMARY = "Persistent data partition mount + setup" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +SRC_URI = " \ + file://data.mount \ + file://data-setup.service \ + file://data-setup.sh \ +" + +inherit systemd + +SYSTEMD_SERVICE:${PN} = "data.mount data-setup.service" +SYSTEMD_AUTO_ENABLE:${PN} = "enable" + +do_install() { + install -d ${D}${systemd_unitdir}/system + install -m 0644 ${WORKDIR}/data.mount ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/data-setup.service ${D}${systemd_unitdir}/system/ + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/data-setup.sh ${D}${bindir}/ +} + +FILES:${PN} += " \ + ${systemd_unitdir}/system/data.mount \ + ${systemd_unitdir}/system/data-setup.service \ + ${bindir}/data-setup.sh \ +" \ No newline at end of file diff --git a/meta-edgeos/recipes-support/expand-rootfs/expand-rootfs.bb b/meta-edgeos/recipes-support/expand-rootfs/expand-rootfs.bb index ea45b9a..58755df 100644 --- a/meta-edgeos/recipes-support/expand-rootfs/expand-rootfs.bb +++ b/meta-edgeos/recipes-support/expand-rootfs/expand-rootfs.bb @@ -2,9 +2,6 @@ SUMMARY = "First-boot rootfs auto-expansion service" DESCRIPTION = "Expands the active root partition and grows the filesystem on first boot." LICENSE = "CLOSED" -PR = "r4" - - SRC_URI = " \ file://expand-rootfs.sh \ file://expand-rootfs.service \ diff --git a/meta-edgeos/wic/rpi-partuuid.wks b/meta-edgeos/wic/rpi-partuuid.wks index 9b1c4bf..1e5e639 100644 --- a/meta-edgeos/wic/rpi-partuuid.wks +++ b/meta-edgeos/wic/rpi-partuuid.wks @@ -1,3 +1,4 @@ bootloader --ptable gpt part /boot --source bootimg-partition --ondisk mmcblk0 --fstype=vfat --label boot --active --align 4096 --size 128M --uuid "${EDGE_BOOT_PARTUUID}" -part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096 --size 8192M --uuid "${EDGE_ROOT_PARTUUID}" \ No newline at end of file +part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --label root --align 4096 --size 8192M --uuid "${EDGE_ROOT_PARTUUID}" +part --ondisk mmcblk --fstype=ext4 --label data --align 4 --size 1024 --use-uuid \ No newline at end of file