summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLiang Yang <liang.yang@amlogic.com>2018-01-12 13:35:07 +0800
committerXiaobo Gu <xiaobo.gu@amlogic.com>2018-01-17 00:11:54 -0700
commitc858c975ff6dc632835baf800028f3f9124b09ac (patch)
tree1af76c8deb3ad98b47c25049665833b6fe9760bd /tools
parent33d1a33494f713cf3359779d145c74bb8bd07f4a (diff)
downloadu-boot-odroid-c1-c858c975ff6dc632835baf800028f3f9124b09ac.tar.gz
PD#158552 : env: add env support for nand/emmc
Never use mtd part as env in amlogic case; For Nand/Emmc base, we use /dev/nand_env and /dev/block/env. Change-Id: I28c2933bd3b8af3629e61fd4ba41efac4fab2fa6 Signed-off-by: Liang Yang <liang.yang@amlogic.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/env/fw_env.c33
-rw-r--r--tools/env/fw_env.config7
2 files changed, 20 insertions, 20 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 1173eea782..67ee75166a 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1030,6 +1030,9 @@ static int flash_write (int fd_current, int fd_target, int dev_target)
DEVOFFSET (dev_target), DEVNAME (dev_target));
#endif
+ /* Amlogic Add */
+ DEVTYPE(dev_target) = MTD_ABSENT;
+
rc = flash_write_buf(dev_target, fd_target, environment.image,
CUR_ENVSIZE, DEVOFFSET(dev_target),
DEVTYPE(dev_target));
@@ -1051,11 +1054,12 @@ static int flash_write (int fd_current, int fd_target, int dev_target)
return 0;
}
+
static int flash_read (int fd)
{
struct mtd_info_user mtdinfo;
- struct stat st;
int rc;
+ struct stat st;
rc = fstat(fd, &st);
if (rc < 0) {
@@ -1064,25 +1068,13 @@ static int flash_read (int fd)
return -1;
}
- if (S_ISCHR(st.st_mode)) {
- rc = ioctl(fd, MEMGETINFO, &mtdinfo);
- if (rc < 0) {
- fprintf(stderr, "Cannot get MTD information for %s\n",
- DEVNAME(dev_current));
- return -1;
- }
- if (mtdinfo.type != MTD_NORFLASH &&
- mtdinfo.type != MTD_NANDFLASH &&
- mtdinfo.type != MTD_DATAFLASH &&
- mtdinfo.type != MTD_UBIVOLUME) {
- fprintf (stderr, "Unsupported flash type %u on %s\n",
- mtdinfo.type, DEVNAME(dev_current));
- return -1;
- }
- } else {
- memset(&mtdinfo, 0, sizeof(mtdinfo));
- mtdinfo.type = MTD_ABSENT;
- }
+ /*
+ * Never use mtd part as env in amlogic case;
+ * For Nand/Emmc base, we use chardev '/dev/nand_env',
+ * and /dev/block/env.
+ */
+ memset(&mtdinfo, 0, sizeof(mtdinfo));
+ mtdinfo.type = MTD_ABSENT;
DEVTYPE(dev_current) = mtdinfo.type;
@@ -1455,6 +1447,7 @@ static int get_config (char *fname)
i++;
}
+
fclose (fp);
HaveRedundEnv = i - 1;
diff --git a/tools/env/fw_env.config b/tools/env/fw_env.config
index c9b9f6a160..9ea3a8bf9d 100644
--- a/tools/env/fw_env.config
+++ b/tools/env/fw_env.config
@@ -20,3 +20,10 @@
# Block device example
#/dev/mmcblk0 0xc0000 0x20000
+
+# Amlogic nand example
+/dev/nand_env 0x0 0x10000 0x200
+
+# Amlogic emmc example
+/dev/block/env 0x0 0x40000 0x200
+