blob: cfd3dec453d5fbe04e8f3dd7f336160e03fa3635 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* (C) Copyright 2013 Teresa Gámez, Phytec Messtechnik GmbH
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <common.h>
#include <bootsource.h>
#include <envfs.h>
#include <init.h>
#include <io.h>
#include <fs.h>
#include <linux/stat.h>
#if defined(CONFIG_DEFAULT_ENVIRONMENT) && defined(CONFIG_MCI_STARTUP)
static int omap_env_init(void)
{
struct stat s;
char *diskdev = "/dev/disk0.0";
int ret;
if (bootsource_get() != BOOTSOURCE_MMC)
return 0;
ret = stat(diskdev, &s);
if (ret) {
printf("no %s. using default env\n", diskdev);
return 0;
}
mkdir("/boot", 0666);
ret = mount(diskdev, "fat", "/boot");
if (ret) {
printf("failed to mount %s\n", diskdev);
return 0;
}
if (IS_ENABLED(CONFIG_OMAP_BUILD_IFT))
default_environment_path = "/dev/defaultenv";
else
default_environment_path = "/boot/barebox.env";
return 0;
}
late_initcall(omap_env_init);
#endif
|