From ed251520b5aec8d87d243af4a1321407439d40ce Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Thu, 25 Jun 2015 18:44:52 +0200 Subject: [PATCH] u-boot-fw-utils: reconfigure u-boot env depending on boot media Add post-installation script that runs on first boot to reconfigure the u-boot environment depending on the media (EMMC,SD) the target is booting from. Signed-off-by: Javier Viguera (cherry picked from commit 8486d120355d80ea8ad5864596c8486a1d3c0db2) --- .../recipes-bsp/u-boot/u-boot-dey-fw-utils_2013.04.bb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-fw-utils_2013.04.bb b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-fw-utils_2013.04.bb index d9141950b..91dd8e9d7 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-fw-utils_2013.04.bb +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey-fw-utils_2013.04.bb @@ -39,6 +39,17 @@ do_install() { install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/ } +pkg_postinst_${PN}() { + # run the postinst script on first boot + if [ x"$D" != "x" ]; then + exit 1 + fi + MMCDEV="$(sed -ne 's,.*root=/dev/mmcblk\([0-9]\)p.*,\1,g;T;p' /proc/cmdline)" + if [ -n "${MMCDEV}" ]; then + sed -i -e "s,^/dev/mmcblk[^[:blank:]]\+,/dev/mmcblk${MMCDEV},g" /etc/fw_env.config + fi +} + PACKAGE_ARCH = "${MACHINE_ARCH}" COMPATIBLE_MACHINE = "(ccimx6)"