Discussion:
Compiling a Linux kernel using Cygwin
Claudio Scordino
2007-07-27 14:43:10 UTC
Permalink
Hi all,

I have to compile a Linux kernel using Cygwin on Windows XP (I know, it's a
very silly thing, but it does not depend on me, unfortunately...).

I already have a gcc cross-compile toolchain for my target (arm) installed on
Windows.

I already installed gcc-core, gcc-g++, binutils, cpio, make, patch, tar, vim,
gettext, libintl and libncurses on cygwin (do I need something else?).

Since I assume that I need symbolic links, I use an ext2 filesystem on a USB
PenDrive, using the ext2fsd driver for Windows.

However, I'm receiving a lot of errors, everywhere.

Some of them:

1) Sometimes when compiling, I receive the error "cannot mv file A to B: invalid
request code".

However, the system allows me to manually copy file A on B and then remove file
A (which is almost the same thing, so I wonder why the mv command does not work).

2) I'm not able of doing a "make menuconfig" even using the host gcc.

The system does not find ncurses libraries. But I've installed them!

Does anybody know how to solve these problems ?

More general question: did anybody build succesfully a Linux kernel under cygwin?

Any hel and suggestion is very welcome.

Many thanks in advance,

Claudio
Bob McConnell
2007-07-27 15:10:30 UTC
Permalink
Cross compiling on Cygwin is not foolish at all. I have two commercial
SDKs set up that way and know of more than a few other people doing just
that. I target both ARM7 and Motorola CPUs. In both cases the SDK
installed on top of my existing Cygwin configuration and just worked.

But you might have some luck finding applicable help on the Digi support
forums <http://www.digi.com/support/forum/>. The Digi ConnectME and
related devices use the ARM7 and are available in configurations
optimized for Linux. Basically they put the CPU, RAM, flash Ethernet and
serial ports all in an RJ-45 connector shell. The original version used
Cygwin and GCC with the NetSilicon NetOS 6 kernel, but due to customer
demand they added options for Linux.

You will find the Linux support forums under Embedded Modules and
Microprocessors.

Bob McConnell
-----Original Message-----
Sent: Friday, July 27, 2007 10:43 AM
Subject: Compiling a Linux kernel using Cygwin
Hi all,
I have to compile a Linux kernel using Cygwin on Windows
XP (I know, it's a
very silly thing, but it does not depend on me, unfortunately...).
I already have a gcc cross-compile toolchain for my target
(arm) installed on
Windows.
I already installed gcc-core, gcc-g++, binutils, cpio, make,
patch, tar, vim,
gettext, libintl and libncurses on cygwin (do I need something else?).
Since I assume that I need symbolic links, I use an ext2
filesystem on a USB
PenDrive, using the ext2fsd driver for Windows.
However, I'm receiving a lot of errors, everywhere.
1) Sometimes when compiling, I receive the error "cannot mv
file A to B: invalid
request code".
However, the system allows me to manually copy file A on B
and then remove file
A (which is almost the same thing, so I wonder why the mv
command does not work).
2) I'm not able of doing a "make menuconfig" even using the host gcc.
The system does not find ncurses libraries. But I've installed them!
Does anybody know how to solve these problems ?
More general question: did anybody build succesfully a Linux
kernel under cygwin?
Any hel and suggestion is very welcome.
Many thanks in advance,
Claudio
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
Samuel Robb
2007-07-27 15:20:08 UTC
Permalink
Post by Claudio Scordino
Hi all,
I have to compile a Linux kernel using Cygwin on Windows XP (I know, it's a
very silly thing, but it does not depend on me, unfortunately...).
I already have a gcc cross-compile toolchain for my target (arm) installed on
Windows.
I'm going to assume that this is a Cygwin based toolchain. If this is
not the case, then you want to be talking about your build environment
with whoever built your toolchain, not the Cygwin mailing lists.
Post by Claudio Scordino
I already installed gcc-core, gcc-g++, binutils, cpio, make, patch, tar, vim,
gettext, libintl and libncurses on cygwin (do I need something else?).
Did you install these using the Cygwin setup.exe, or did you get them
from some other source? If you try to mix and match, say, mingw or
Microsoft Services For Unix utilities with Cygwin, you're going to run
into problems.
Post by Claudio Scordino
Since I assume that I need symbolic links, I use an ext2 filesystem on a USB
PenDrive, using the ext2fsd driver for Windows.
You shouldn't need to do this - Cygwin supports symbolic links just
fine.
Post by Claudio Scordino
However, I'm receiving a lot of errors, everywhere.
1) Sometimes when compiling, I receive the error "cannot mv file A to B: invalid
request code".
However, the system allows me to manually copy file A on B and then remove file
A (which is almost the same thing, so I wonder why the mv command does not work).
I suspect this is a symptom of using the ext2fsd and the PenDrive. As I
mentioned, you shouldn't need to do this - Cygwin will handle symbolic
links perfectly well.

For cross-compiling a kernel, though, you may want to use a managed
mount; this will help you avoid some file name case-sensitivity issues
that crop up in the kernel source code (ex, the netfiler code uses file
names that differ only in case). Read up on managed mounts in the the
Cygwin FAQ:

http://cygwin.com/faq/faq.using.html

Short instructions for using a managed mount

1. Create a new, empty directory:
$ mkdir -p /usr/src/kernel

2. Mount it as a managed directory:
$ mount -o managed c:/cygwin/usr/src/kernel /usr/src/kernel

3. Change into the managed mount directory:
$ cd /usr/src/kernel

4. Extract the kernel source in the managed mount directory:
$ tar -xzf <path-to-kernel-src-archive>
Post by Claudio Scordino
2) I'm not able of doing a "make menuconfig" even using the host gcc.
The system does not find ncurses libraries. But I've installed them!
IIRC, you'll need to patch menuconfig to build properly under Cygwin...
though the problems that I can remember dealt with libintl, not with
ncurses.

What errors do you see when you do "make menuconfig"?
Post by Claudio Scordino
Does anybody know how to solve these problems ?
Possibly :-) We will probably need a bit more information (as I've
asked for above) in order to help you, though.
Post by Claudio Scordino
More general question: did anybody build succesfully a Linux kernel under cygwin?
I used to work for a company (http://www.timesys.com) that did (and
still does) support cross-compiling Linux under Cygwin. So yes, it is
indeed possible - and, frankly, not all that difficult, either.

-Samrobb
Claudio Scordino
2007-07-30 17:34:24 UTC
Permalink
Post by Samuel Robb
Post by Claudio Scordino
Hi all,
I have to compile a Linux kernel using Cygwin on Windows XP (I know, it's a
very silly thing, but it does not depend on me, unfortunately...).
I already have a gcc cross-compile toolchain for my target (arm) installed on
Windows.
I'm going to assume that this is a Cygwin based toolchain. If this is
not the case, then you want to be talking about your build environment
with whoever built your toolchain, not the Cygwin mailing lists.
The toolchain is located in Programs/yagarto/bin/arm-elf-gcc, so I assume that
is not a cygwin toolchain but a Yagarto's one. I'm going to write an email to
Yagarto developers.

Anyway, most of the errors I receive seem not related to the toolchain itself
but to my mistakes using cygwin :(
Post by Samuel Robb
Post by Claudio Scordino
I already installed gcc-core, gcc-g++, binutils, cpio, make, patch, tar, vim,
gettext, libintl and libncurses on cygwin (do I need something else?).
Did you install these using the Cygwin setup.exe, or did you get them
from some other source? If you try to mix and match, say, mingw or
Microsoft Services For Unix utilities with Cygwin, you're going to run
into problems.
No, I don't want to mix stuff on the PC, otherwise it would be a mess.
I already had "Microsoft Services for Unix" on the PC, but I installed all those
packages using the setup.exe of cygwin.
If necessary, I can remove Microsoft Services for Unix completely...
Post by Samuel Robb
Post by Claudio Scordino
Since I assume that I need symbolic links, I use an ext2 filesystem on a USB
PenDrive, using the ext2fsd driver for Windows.
You shouldn't need to do this - Cygwin supports symbolic links just
fine.
Oh, very good! What happens if I create a jffs2 filesystem containing sybolic
links made using Cygwin ? Will they be symbolic links also on the Linux target ?
Or cygwin uses an internal represention which differs from the Unix one ?
Post by Samuel Robb
Post by Claudio Scordino
However, I'm receiving a lot of errors, everywhere.
1) Sometimes when compiling, I receive the error "cannot mv file A to B: invalid
request code".
However, the system allows me to manually copy file A on B and then remove file
A (which is almost the same thing, so I wonder why the mv command does not work).
I suspect this is a symptom of using the ext2fsd and the PenDrive. As I
mentioned, you shouldn't need to do this - Cygwin will handle symbolic
links perfectly well.
Yes, using a managed mount point these errors disappeared :)
Post by Samuel Robb
For cross-compiling a kernel, though, you may want to use a managed
mount; this will help you avoid some file name case-sensitivity issues
that crop up in the kernel source code (ex, the netfiler code uses file
names that differ only in case). Read up on managed mounts in the the
http://cygwin.com/faq/faq.using.html
Short instructions for using a managed mount
$ mkdir -p /usr/src/kernel
$ mount -o managed c:/cygwin/usr/src/kernel /usr/src/kernel
$ cd /usr/src/kernel
$ tar -xzf <path-to-kernel-src-archive>
Thank you for the instructions. It's what I'm doing now :)
Post by Samuel Robb
Post by Claudio Scordino
2) I'm not able of doing a "make menuconfig" even using the host gcc.
The system does not find ncurses libraries. But I've installed them!
IIRC, you'll need to patch menuconfig to build properly under Cygwin...
though the problems that I can remember dealt with libintl, not with
ncurses.
What errors do you see when you do "make menuconfig"?
$ make ARCH=arm CROSS_COMPILE=arm-elf- HOST_LOADLIBES="-lintl" menuconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/kconfig/lxdialog/checklist.o
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:32:20: curses.h: No such file or directory
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:97: error: parse error before "chtype"

I receive errors even if I add -lncurses or -lcurses. Moreover, I couldn't
locate the ncurses libraries on the /lib and /usr/lib directories even if cygwin
says that they are installed...
Post by Samuel Robb
Post by Claudio Scordino
More general question: did anybody build succesfully a Linux kernel under cygwin?
I used to work for a company (http://www.timesys.com) that did (and
still does) support cross-compiling Linux under Cygwin. So yes, it is
indeed possible - and, frankly, not all that difficult, either.
Ok, if someone made it, then it is possible, somehow.

Another error: if I put a .config file in the Linux directory and I try to make
the kernel (without 'menuconfig') I receive the following error:

In file included from include/linux/sched.h:4,^M
from arch/arm/kernel/asm-offsets.c:13:^M
include/linux/auxvec.h:4:24: error: asm/auxvec.h: No such file or directory^M

The file exists. It seems a problem related to symbolic links...

Many thanks for your precious help,

Claudio
Claudio Scordino
2007-07-31 14:37:23 UTC
Permalink
Hi,

I tried using the gcc toolchain of cygwin (i.e. no crosscompilation) but the
following problems still appear (so the problem is not related to the toolchain
itself).


1) make HOST_LOADLIBES="-lintl"

HOSTCC scripts/genksyms/parse.o
HOSTLD scripts/genksyms/genksyms
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
Error: not ELF
make[2]: *** [scripts/mod/elfconfig.h] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2




2) make HOST_LOADLIBES="-lintl" menuconfig

$ make HOST_LOADLIBES="-lintl" menuconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/kconfig/lxdialog/checklist.o
In file included from scripts/kconfig/lxdialog/checklist.c:24:
scripts/kconfig/lxdialog/dialog.h:32:20: curses.h: No such file or directory




I'm using a managed mountpoint. Should I mount the mountpoint with the
--executable or --text options ?

Many thanks for any help,

Claudio
Samuel Robb
2007-07-31 14:49:09 UTC
Permalink
Post by Claudio Scordino
Post by Samuel Robb
Post by Claudio Scordino
Hi all,
I have to compile a Linux kernel using Cygwin on Windows XP (I know, it's a
very silly thing, but it does not depend on me, unfortunately...).
I already have a gcc cross-compile toolchain for my target (arm) installed on
Windows.
I'm going to assume that this is a Cygwin based toolchain. If this is
not the case, then you want to be talking about your build environment
with whoever built your toolchain, not the Cygwin mailing lists.
The toolchain is located in Programs/yagarto/bin/arm-elf-gcc, so I assume that
is not a cygwin toolchain but a Yagarto's one. I'm going to write an email to
Yagarto developers.
Well, according to their home page, this probably isn't a Cygwin
toolchain - http://www.yagarto.de/ says:

Why another GNU ARM toolchain?
Initially I was searching for a toolchain with the following features:
* not based on Cygwin
* works with Eclipse
* cheap for the beginners

... so I'm going to go out on a limb and presume that this isn't a
Cygwin based toolchain (since they seemed to want to avoid that for some
reason, and since other pages on their site mention this is a MinGW
based toolchain.)

If this is the case, then unfortunately, you will have trouble with
symbolic links, paths, and probably other areas, as well.

Unfortunately, this means that using this toolchain with Cygwin is
probably *not* what you want to do. I'm glad my advice on managed
mounts, etc. helped you get a *little* further, but I suspect your best
bet is to uninstall Cygwin, and follow the installation instructions
that they provide for their development environment:

http://www.yagarto.de/howto/yagarto1/index.html

It also means that your questions about the toolchain should be directed
at Yagarto's own support forum, instead of this mailing list:

http://en.mikrocontroller.net/forum/17

Good luck! I hope things work out for you.

-Samrobb

Reini Urban
2007-07-28 10:36:45 UTC
Permalink
Post by Claudio Scordino
More general question: did anybody build succesfully a Linux kernel under cygwin?
Not a kernel but binutils, gcc-core, gcc-g++ and the stdlibc++, which is
about as complex as the kernel. Target was a fedora core.

Managed mounts help a lot, but manual fixing case by case helps also.
--
Reini
Christopher Faylor
2007-07-28 15:19:27 UTC
Permalink
Post by Reini Urban
Post by Claudio Scordino
More general question: did anybody build succesfully a Linux kernel under cygwin?
Not a kernel but binutils, gcc-core, gcc-g++ and the stdlibc++, which is
about as complex as the kernel. Target was a fedora core.
Managed mounts help a lot, but manual fixing case by case helps also.
I've built linux kernels under Cygwin but, IIRC, there were some case
sensitivity issues to deal with. There should be someone out there
in the wide world of google who has accomplished this feat.

cgf
Morgan Gangwere
2007-07-28 16:30:43 UTC
Permalink
On 7/28/07, Christopher Faylor
Post by Christopher Faylor
Post by Reini Urban
Post by Claudio Scordino
More general question: did anybody build succesfully a Linux kernel under cygwin?
Not a kernel but binutils, gcc-core, gcc-g++ and the stdlibc++, which is
about as complex as the kernel. Target was a fedora core.
Managed mounts help a lot, but manual fixing case by case helps also.
I've built linux kernels under Cygwin but, IIRC, there were some case
sensitivity issues to deal with. There should be someone out there
in the wide world of google who has accomplished this feat.
cgf
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
What i would do Is take and build the basic nessesary binaries (ie
binutils, g++, bash, etc.) and send them to the target machine (an arm
box). then I would focus on building the kernel. I would go for
byte-compiling each one as a static object and then going about
linking. Have you built a kernel before?

Also, Debian has pre-made ARM kernels built -- check out
packages.us.debian.org -- there should be a fairly recent kernel
simply tar/gz'd (thats How Debs Work). I tired building an LFS (Linux
From Scratch) for an ARM once and it wasnt the most efficient --
timing said that it took a good 6 hours (i left it over night). Hope
that helps.

(also, using a system like debian gives you a certain amount of flexibility)
--
Morgan gangwere

"Space does not reflect society, it expresses it." -- Castells, M.,
Space of Flows, Space of Places: Materials for a Theory of Urbanism in
the Information Age, in The Cybercities Reader, S. Graham, Editor.
2004, Routledge: London. p. 82-93.
Continue reading on narkive:
Loading...