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 <javier.viguera@digi.com>
(cherry picked from commit 8486d120355d80ea8ad5864596c8486a1d3c0db2)
This commit is contained in:
Javier Viguera 2015-06-25 18:44:52 +02:00
parent 6b31e716a5
commit ed251520b5
1 changed files with 11 additions and 0 deletions

View File

@ -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)"