HOWTO: Linux kernel compilation for ARM using cygwin

Claudio Scordino cloud.of.andor@gmail.com
Thu Aug 2 08:57:00 GMT 2007


Hi,

    thanks to all suggestions and help that I received from you in the last
days, I was able of succesfully compiling a Linux kernel using Cygwin.

Here I report all the steps that I made, just in case someone else need this info.

Thanks again,

           Claudio

1. Install cygwin among with the following packets:
    libncurses, libncurses-devel, ELFIO, wget, gcc-core, gcc-g++,
    cpio, make, patch, tar, vim, gettext, libintl
    Note: install these packages using cygwin's setup.exe

2. Download and install on Windows an ELF toolchain for ARM from:
    http://www.gnuarm.org/bu-2.17_gcc-4.2.0-c-c++_nl-1.15.0_gi-6.6.exe
    Note: the default host toolchain of Cygwin is not ELF
    Note: the toolchains of the Yagarto project are not compliant with Cygwin

3. Create on Windows the directory C:\kernel

4. Open a cygwin shell

5. Mount the directory as "managed":
    mount -f -o managed C:\\kernel $HOME/kernel
    Note: an ext2 partition is not necessary to compile the kernel.

6. Enter into the kernel directory:
    cd $HOME/kernel

7. Download the kernel:
    wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.tar.bz2

8. Extract the archive:
    tar -xvjf linux-2.6.22.tar.bz2

9. Patch the kernel in the following points:

diff -ur linux-2.6.22/scripts/mod/file2alias.c
linux-2.6.22-new/scripts/mod/file2alias.c
--- linux-2.6.22/scripts/mod/file2alias.c       2007-07-09 01:32:17.000000000 +0200
+++ linux-2.6.22-new/scripts/mod/file2alias.c   2007-08-01 16:32:17.078125000 +0200
@@ -29,7 +29,12 @@

  #include <ctype.h>

+/* Added by cloud */
+#ifdef __CYGWIN__
+typedef __uint32_t     __u32;
+#else
  typedef uint32_t       __u32;
+#endif
  typedef uint16_t       __u16;
  typedef unsigned char  __u8;

diff -ur linux-2.6.22/scripts/mod/modpost.h linux-2.6.22-new/scripts/mod/modpost.h
--- linux-2.6.22/scripts/mod/modpost.h  2007-07-09 01:32:17.000000000 +0200
+++ linux-2.6.22-new/scripts/mod/modpost.h      2007-08-01 16:37:04.281250000 +0200
@@ -11,6 +11,13 @@

  #include "elfconfig.h"

+
+#ifdef __CYGWIN__
+typedef uint16_t Elf32_Section;
+typedef uint16_t Elf64_Section;
+#endif
+
+
  #if KERNEL_ELFCLASS == ELFCLASS32

  #define Elf_Ehdr    Elf32_Ehdr

10. Configure the kernel:
     make ARCH=arm CROSS_COMPILE=arm-elf- HOST_LOADLIBES="-lintl -lncurses"
menuconfig

11. Build the kernel:
     make ARCH=arm CROSS_COMPILE=arm-elf- HOST_LOADLIBES="-lintl -lncurses"





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



More information about the Cygwin mailing list