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]

HOWTO: cross-compile the Linux kernel on Cygwin


Prerequisites:

* Cygwin snapshot 1.7.16s/20120611 or newer (DLL and headers)
* Cygwin gcc4-core 4.5 or newer, make, perl
* Cygwin gettext, libelf-devel, libgmp-devel, libmpc-devel, libmpfr-devel, zlib-devel
* (for make menuconfig) libncurses-devel or libncursesw-devel
* (for make nconfig) libncurses-devel
* (for make gconfig) libglade2.0-devel
* (for make xconfig) libQt3Support4-devel
* (for make gconfig/xconfig) X server running and DISPLAY variable set
* the attached patches


Directions:

(where ARCH=i386 TARGET=i686-pc-linux-gnu, or ARCH=x86_64 TARGET=x86_64-pc-linux-gnu, or ARCH=arm TARGET=armv5tel-unknown-linux-gnueabi etc.)

1. cross-binutils

(linux-i686-binutils and linux-x86_64-binutils are available in Ports. Otherwise you can build this yourself:)
a. Download binutils-2.22 or newer from http://ftpmirror.gnu.org/binutils/ or http://www.kernel.org/pub/linux/devel/binutils/
b. Unpack and apply config-rpath.patch.
c. ./configure --target=$TARGET --with-sysroot=/usr/$TARGET/sys-root
d. make [-jN]
e. make install DESTDIR=$PWD/DESTDIR
f. rm -fr DESTDIR/usr/lib/ DESTDIR/usr/share/{info,locale}
g. cp -r DESTDIR/usr /


2. cross-gcc

(linux-i686-gcc-core and linux-x86_64-gcc-core are available in Ports.
Otherwise you can easily build a gcc which will suffice for building the kernel yourself:)
a. Download gcc-4.5.x or newer from http://ftpmirror.gnu.org/gcc/
b. Unpack and apply config-rpath.patch.
c. ./configure --target=$TARGET --enable-languages=c --enable-version-specific-runtime-libs --disable-shared --disable-threads --disable-libgomp --disable-libitm --disable-libmudflap --disable-libquadmath --disable-libssp --with-dwarf2 --with-system-zlib
d. make [-jN]
e. make install DESTDIR=$PWD/DESTDIR
f. rm -fr DESTDIR/usr/lib/libiberty.a DESTDIR/usr/share/{gcc-*,info,locale,man/man7}
g. cp -r DESTDIR/usr /


3. kernel

a. Download a kernel from http://www.kernel.org/pub/linux/kernel/ .
b. Unpack and apply patch 0001.
c. For 3.3 or newer kernels, apply patch 0002.
d. For make xconfig, apply patch 0003.
e. For make nconfig, apply patch 0004.
f. mkdir _build
g. make ARCH=$ARCH CROSS_COMPILE=$TARGET- O=_build [defconfig|menuconfig|nconfig|gconfig|xconfig|...]
h. Edit _build/.config if necessary.
i. make ARCH=$ARCH CROSS_COMPILE=$TARGET- O=_build [-jN]
j. mkdir -p DESTDIR/boot
k. make ARCH=$ARCH CROSS_COMPILE=$TARGET- O=_build INSTALL_PATH=$PWD/DESTDIR/boot install
l. make ARCH=$ARCH CROSS_COMPILE=$TARGET- O=_build INSTALL_MOD_PATH=$PWD/DESTDIR modules_install
m. make ARCH=$ARCH CROSS_COMPILE=$TARGET- O=_build INSTALL_HDR_PATH=$PWD/DESTDIR/usr headers_install
n. find DESTDIR/usr/include -name '*.install*' -delete
o. tar Jcf kernel.tar.xz -C DESTDIR boot lib
p. tar Jcf kernel-headers.tar.xz -C DESTDIR usr/include


HTH,


Yaakov

Attachment: config-rpath.patch
Description: application/itunes-itlp

Attachment: 0001-fbdev-make-scripts-pnmtologo-dependency-portable.patch
Description: application/itunes-itlp

Attachment: 0002-tools-include-use-stdint-types-for-user-space-bytesh.patch
Description: application/itunes-itlp

Attachment: 0003-xconfig-use-pkgconfig-to-find-moc.patch
Description: application/itunes-itlp

Attachment: 0004-kconfig-nconf-fix-compile-with-ncurses-reentrant-API.patch
Description: application/itunes-itlp

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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