meta-digi-dey: rework rootfs resize on first boot

Use the package manager postinst framework to run the rootfs resize
script on first boot after the image has been flashed to the EMMC.

https://jira.digi.com/browse/DEL-1317

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2014-11-20 17:59:03 +01:00
parent f450cb3017
commit 4301bfc736
4 changed files with 10 additions and 24 deletions

View File

@ -25,11 +25,12 @@ get_emmc_block_device() {
fi
}
RESIZE2FS="$(which resize2fs)"
EMMC_BLOCK_DEVICE="$(get_emmc_block_device)"
if [ "${RESIZE_EXT4FS}" = "yes" -a -n "${EMMC_BLOCK_DEVICE}" ]; then
if [ -x "${RESIZE2FS}" -a -n "${EMMC_BLOCK_DEVICE}" ]; then
PARTITIONS="$(blkid | sed -ne "{s,\(^${EMMC_BLOCK_DEVICE}[^:]\+\):.*TYPE=\"ext4\".*,\1,g;T;p}" | sort -u)"
for i in ${PARTITIONS}; do
if ! resize2fs ${i} 2>/dev/null; then
if ! ${RESIZE2FS} ${i} 2>/dev/null; then
echo "ERROR: resize2fs ${i}"
fi
done

View File

@ -7,6 +7,8 @@ SRC_URI += " \
file://sysctl.conf \
"
SRC_URI_append_ccimx6 = " file://resize-ext4fs.sh"
do_install_append() {
install -m 0644 ${WORKDIR}/os-release ${D}${sysconfdir}/
sed -i -e 's,##DISTRO##,${DISTRO},g' \
@ -22,3 +24,8 @@ do_install_append_mx5() {
vm.lowmem_reserve_ratio = 1 1
EOF
}
do_install_append_ccimx6() {
install -d ${D}${sysconfdir}/${IMAGE_PKGTYPE}-postinsts
install -m 0755 ${WORKDIR}/resize-ext4fs.sh ${D}${sysconfdir}/${IMAGE_PKGTYPE}-postinsts/
}

View File

@ -5,10 +5,3 @@ do_install_append() {
update-rc.d -f -r ${D} stop-bootlogd remove
update-rc.d -f -r ${D} bootlogd remove
}
do_install_append_ccimx6() {
cat >> ${D}${sysconfdir}/default/rcS <<-EOF
# Resize EXT4 filesystems to the size of the partition on boot
RESIZE_EXT4FS=yes
EOF
}

View File

@ -1,15 +0,0 @@
# Copyright (C) 2014 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://resize-ext4fs.sh"
inherit update-rc.d
do_install_append() {
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/resize-ext4fs.sh ${D}${sysconfdir}/init.d/
}
INITSCRIPT_NAME = "resize-ext4fs.sh"
INITSCRIPT_PARAMS = "start 36 S ."