Hack to make fw_setenv work
The fw_setenv is not working with the kernel mtd driver. It works
on a plain flat file, and flashcp which is used in /update works.
Find the u-boot-env mtd, link it in run and copy the contents to a
plain file in /run during init. In shutdown, check for the link,
the file having data, no current image update for the u-boot-env,
and that the content differs from the mtd via the link. If all
are true create a symlink to the file and trigger the update.
Along wtih changing the fw_env.config this causes the fw_setenv
and fw_printenv utilities to set and update this cached file which
will be synced during a normal bmc reboot. This will allow us to
set the ethaddr variable which already requires a reboot to activate.
Note: the links are directly in /run because the fw_{set,print}env
utilities limit the env file name to 16 characters.
Signed-off-by: Milton Miller <miltonmm@us.ibm.com>
diff --git a/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh b/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
index 431780a..0dc4c35 100644
--- a/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
+++ b/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-init.sh
@@ -29,6 +29,13 @@
echo $m
}
+env=$(findmtd u-boot-env)
+if test -n $env
+then
+ ln -s /dev/$env /run/mtd:u-boot-env
+ cp /run/mtd:u-boot-env /run/fw_env
+fi
+
rofs=$(findmtd rofs)
rwfs=$(findmtd rwfs)