summaryrefslogtreecommitdiff
path: root/payloads/libpayload/util/kconfig/confdata.c
diff options
context:
space:
mode:
authorPatrick Georgi <patrick.georgi@coresystems.de>2010-04-20 16:00:07 +0000
committerPatrick Georgi <patrick.georgi@coresystems.de>2010-04-20 16:00:07 +0000
commit01c2f5b0f20331bcfb16df2b7e1f3122a57795c2 (patch)
tree3ada8023901f77ce8e3206748bd31d7265d80095 /payloads/libpayload/util/kconfig/confdata.c
parent682ea3cc2132639311d772ad9bcb00748e59a257 (diff)
Copy mingw support for kconfig from coreboot to libpayload
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de> Acked-by: Patrick Georgi <patrick.georgi@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5463 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/util/kconfig/confdata.c')
-rw-r--r--payloads/libpayload/util/kconfig/confdata.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/payloads/libpayload/util/kconfig/confdata.c b/payloads/libpayload/util/kconfig/confdata.c
index 549dc0332e..81fa28bf97 100644
--- a/payloads/libpayload/util/kconfig/confdata.c
+++ b/payloads/libpayload/util/kconfig/confdata.c
@@ -15,6 +15,13 @@
#define LKC_DIRECT_LINK
#include "lkc.h"
+#ifdef WIN32
+#define mkdir(x,y) mkdir(x)
+#define UNLINK_IF_NECESSARY(x) unlink(x)
+#else
+#define UNLINK_IF_NECESSARY(X)
+#endif
+
static void conf_warning(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
@@ -448,7 +455,7 @@ int conf_write(const char *name)
"# libpayload version: %s\n"
"%s%s"
"#\n"),
- getenv("KERNELVERSION"),
+ getenv("KERNELVERSION")?getenv("KERNELVERSION"):"",
use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : "");
@@ -539,6 +546,7 @@ int conf_write(const char *name)
if (*tmpname) {
strcat(dirname, basename);
strcat(dirname, ".old");
+ UNLINK_IF_NECESSARY(dirname);
rename(newname, dirname);
if (rename(tmpname, newname))
return 1;
@@ -702,14 +710,14 @@ int conf_write_autoconf(void)
"# libpayload version: %s\n"
"# %s"
"#\n",
- getenv("KERNELVERSION"), ctime(&now));
+ getenv("KERNELVERSION")?getenv("KERNELVERSION"):"", ctime(&now));
fprintf(out_h, "/*\n"
" * Automatically generated C config: don't edit\n"
" * libpayload version: %s\n"
" * %s"
" */\n"
"#define AUTOCONF_INCLUDED\n",
- getenv("KERNELVERSION"), ctime(&now));
+ getenv("KERNELVERSION")?getenv("KERNELVERSION"):"", ctime(&now));
for_all_symbols(i, sym) {
sym_calc_value(sym);
@@ -773,6 +781,7 @@ int conf_write_autoconf(void)
name = getenv("KCONFIG_AUTOHEADER");
if (!name)
name = "include/linux/autoconf.h";
+ UNLINK_IF_NECESSARY(name);
if (rename(".tmpconfig.h", name))
return 1;
name = getenv("KCONFIG_AUTOCONFIG");
@@ -782,6 +791,7 @@ int conf_write_autoconf(void)
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
+ UNLINK_IF_NECESSARY(name);
if (rename(".tmpconfig", name))
return 1;