This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiling a Linux kernel using Cygwin


Samuel Robb wrote:
On Fri, 2007-07-27 at 16:43 +0200, Claudio Scordino wrote:
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 :(


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...


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 ?



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).

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 :)



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>

Thank you for the instructions. It's what I'm doing now :)



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...

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


-- 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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]