summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-10-12 08:58:38 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-10-12 08:58:40 +0200
commit8d99417f72bfd4ba716dcdc87ab4450331203531 (patch)
tree26d9213862055cdddae2083dae6c5300b296812c
parent1106af35ee9eaded222f9eebf41dde3318d42158 (diff)
downloadbarebox-8d99417f72bfd4ba716dcdc87ab4450331203531.tar.gz
barebox-8d99417f72bfd4ba716dcdc87ab4450331203531.tar.xz
environment: bypass overlap check for mtd devices
For mtd devices the overlap check does not work as expected for two reasons. First is that cdev->offset is 0 for mtd partitions, instead cdev->mtd->master_offset has to be used. That could be fixed easily. Second on NAND devices the environment is on the bb devices and not on the raw nand devices which means we would need something to get the mtd device from the bb device before doing the check. Both issues are fixable, but the check was mainly done to catch cases when an environment partition is created in the free space before the first MBR/GPT partition on SD/MMC devices, so leave out the mtd case for now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/startup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/common/startup.c b/common/startup.c
index 5793ea28ac..28edee4fce 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -91,6 +91,9 @@ static int check_overlap(const char *path)
if (!cenv)
return -EINVAL;
+ if (cenv->mtd)
+ return 0;
+
cdisk = cenv->master;
if (!cdisk)