From: George Robinson <george.robinson@prototech.us>
To: u-boot@lists.denx.de
Subject: [U-Boot] SUCCESS: Building U-Boot for MIPS64 on Windows7
Date: Wed, 01 Aug 2018 15:48:34 -0700 [thread overview]
Message-ID: <508ff616cac4764b30a5e8c1673ccdd0@prototech.us> (raw)
I was able to successfully Build U-Boot v2018.07 under Windows 7 SP1
(64bit)
- under MinGW64_NT-6.1 ( a.k.a. MSYS2 or MSYS64 )
- using the native host toolchain (with GCC v7.3.0 for x86_64 code
generation on x86_64 CPU)
- using the target toolchain (with GCC v5.3.0 for MIPS code generation
on x86_64 CPU (Sourcery CodeBench Lite 2016.05-8) )
by modifying the function parse_dep_file() defnied in
u-boot-master/scripts/basic/fixdep.c, as illustrated below:
The change was necessary because the command "gcc cc -Wp,-MD,
dependencyfile.o.d..." generates a dependency file containg Windows
style paths like:
C:\src\bin
...instead of the Linux like path, like:
/c/src/bin
static void parse_dep_file(void *map, size_t len)
{
char *m = map;
char *end = m + len;
char *p;
char s[PATH_MAX];
int is_target;
int saw_any_target = 0;
int is_first_dep = 0;
while (m < end) {
/* Skip any "white space" */
while (m < end && (*m == ' ' || *m == '\t' || *m == '\\' || *m == '\r'
|| *m == '\n'))
m++;
/* Skip any "non-white space" */
p = m;
while (p < end && *p != ' ' && *p != '\t' && *p != '\\' && *p != '\r'
&& *p != '\n')
p++;
/* Convert any Windows paths into Cygwin paths, just like "cygpath -u
<windowspath>" would do. */
if( ( (p-m) >=2) && (*(m+1) == ':') && ((*(m+2) == '/') || (*(m+2) ==
'\\')) && (((*m>='A') && (*m<='Z')) || ((*m>='a') && (*m<='z'))) )
{
*(m+1)= (*m) | 0x20; //Convert the drive letter to lowercase and
move it where the colon was
*m = '/'; //Prepend a forward slash
//*(m+2) = '/'; //Make sure a forward slash follows the drive letter
// Substitute remaining backslashes in the
Windows path, with forward slashes
while (p < end && *p != ' ' && *p != '\t' && *p != '\r' && *p !=
'\n')
{
if(*p == '\\')
*p = '/';
p++;
}
#ifdef FIXDEP_DBG
fprintf(stderr,"FIXDEP: Windows path@%ld= %s\n", m-(char*)map, m);
#endif
}
/* Is the token we found a target name? */
is_target = (*(p-1) == ':');
/* Don't write any target names into the dependency file */
if (is_target) {
/* The /next/ file is the first dependency */
is_first_dep = 1;
} else if( (p-m) > 0 )
{ /* Save this token/filename */
memcpy(s, m, p-m);
s[p - m] = 0;
/* Ignore certain dependencies */
if (strrcmp(s, "include/generated/autoconf.h") &&
strrcmp(s, "arch/um/include/uml-config.h") &&
strrcmp(s, "include/linux/kconfig.h") &&
strrcmp(s, ".ver")) {
/*
* Do not list the source file as dependency,
* so that kbuild is not confused if a .c file
* is rewritten into .S or vice versa. Storing
* it in source_* is needed for modpost to
* compute srcversions.
*/
if (is_first_dep) {
/*
* If processing the concatenation of
* multiple dependency files, only
* process the first target name, which
* will be the original source name,
* and ignore any other target names,
* which will be intermediate temporary
* files.
*/
if (!saw_any_target) {
saw_any_target = 1;
printf("source_%s := %s\n\n",
target, s);
printf("deps_%s := \\\n",
target);
}
is_first_dep = 0;
} else
printf(" %s \\\n", s);
do_config_file(s);
}
}
/*
* Start searching for next token immediately after the first
* "whitespace" character that follows this token.
*/
m = p + 1;
}
if (!saw_any_target) {
fprintf(stderr, "fixdep: parse error; no targets found\n");
exit(1);
}
printf("\n%s: $(deps_%s)\n\n", target, target);
printf("$(deps_%s):\n", target);
}
Also the command "gcc -print-file-name=include" generates such Windows
style paths.
They can be adjusted by patching the NOSTDINC_FLAGS assignment in the
main Makefile as such:
PossiblyWinPath = $(shell $(CC) -print-file-name=include)
NOSTDINC_FLAGS += -nostdinc -isystem $(shell cygpath -u $(subst
\\,\/,$(PossiblyWinPath)))
CHECKFLAGS += $(NOSTDINC_FLAGS)
Besides the above, in order to get it to compile I had to define the
following data types because they were Linux-specific and were not
defined in the sys/types.h belonging to MinGW64.
#ifdef __CHECKER__
#define __bitwise__ __attribute__((bitwise))
#else
#define __bitwise__
#endif
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif
typedef unsigned short __u16;
typedef unsigned int __u32;
typedef unsigned long long int __u64;
typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
typedef __u32 __bitwise __le32;
typedef __u32 __bitwise __be32;
#if defined(__GNUC__)
typedef __u64 __bitwise __le64;
typedef __u64 __bitwise __be64;
#endif
typedef __u16 __bitwise __sum16;
typedef __u32 __bitwise __wsum;
Also, I had to add:
#include <linux/byteorder/swab.h>
...to the file tools/zynqmpbif.c, because__swab32 was not defined
anywhere in the default headers.
Is, this of any interest to anyone ?
next reply other threads:[~2018-08-01 22:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-01 22:48 George Robinson [this message]
2018-08-02 13:23 ` [U-Boot] SUCCESS: Building U-Boot for MIPS64 on Windows7 Bin Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=508ff616cac4764b30a5e8c1673ccdd0@prototech.us \
--to=george.robinson@prototech.us \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox