Both Allnet and OpenMesh sysupgrade uses fw_setenv from uboot-envtools to
change different settings in the uboot environment. uboot-envtools version
2013.01 introduced a filesystem lock "/var/lock/fw_printenv.lock" to guarantee
mutually exclusive access to the uboot environment. But the path /var doesn't
exist on the sysupgrade ramfs.
An upgrade on these devices fails since r36033 ("[package] uboot-envtools:
upgrade to version 2013.01.01") with following messages:
Error opening lock file /var/lock/fw_printenv.lock
failed to update U-Boot environment
Creating the "/var/lock" path before running fw_setenv is therefore a
requirement unless the locking functionality in fw_setenv is removed or
replaced with optional locking.
Signed-off-by: Sven Eckelmann <[email protected]>
---
target/linux/ar71xx/base-files/lib/upgrade/allnet.sh | 5 +++++
target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/allnet.sh
b/target/linux/ar71xx/base-files/lib/upgrade/allnet.sh
index 9a375ff..8076fbd 100644
--- a/target/linux/ar71xx/base-files/lib/upgrade/allnet.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/allnet.sh
@@ -7,6 +7,7 @@
platform_add_ramfs_ubootenv() {
[ -e /usr/sbin/fw_printenv ] && install_bin /usr/sbin/fw_printenv
/usr/sbin/fw_setenv
[ -e /etc/fw_env.config ] && install_file /etc/fw_env.config
+ [ -e /bin/mkdir ] && install_bin /bin/mkdir /bin/mkdir
}
append sysupgrade_pre_upgrade platform_add_ramfs_ubootenv
@@ -151,6 +152,10 @@ rootfs_size $rootfs_hexsize
rootfs_checksum $rootfs_md5
bootcmd bootm $vmlinux_hexaddr
EOF
+
+ # fw_setenv needs the lock /var/lock/fw_setenv.lock
+ mkdir -p /var/lock/
+
fw_setenv -s /tmp/fw_env_upgrade || {
echo "failed to update U-Boot environment"
return 1
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh
b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh
index 5179875..7b82180 100644
--- a/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/openmesh.sh
@@ -31,6 +31,7 @@ platform_add_ramfs_ubootenv()
{
[ -e /usr/sbin/fw_printenv ] && install_bin /usr/sbin/fw_printenv
/usr/sbin/fw_setenv
[ -e /etc/fw_env.config ] && install_file /etc/fw_env.config
+ [ -e /bin/mkdir ] && install_bin /bin/mkdir /bin/mkdir
}
append sysupgrade_pre_upgrade platform_add_ramfs_ubootenv
@@ -190,6 +191,9 @@ platform_do_upgrade_openmesh()
printf "rootfs_size %s\n" $rootfs_checksize >> $uboot_env_upgrade
printf "rootfs_checksum %s\n" $rootfs_md5 >> $uboot_env_upgrade
+ # fw_setenv needs the lock /var/lock/fw_setenv.lock
+ mkdir -p /var/lock/
+
fw_setenv -s $uboot_env_upgrade || {
echo "failed to update U-Boot environment"
return 1
--
1.8.4.rc3
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel