Howto compile uClinux tool chain under Cygwin (latest tool chain version of 20060615)



I just compiled the m68k-elf-tools (for M68K/Coldfire tools) under Cygwin,
but it should also work for the ARM platform!

make sure the following tools are installed in Cygwin:
gcc-core, gcc-g++, binutils, cpio, make, patch, tar, vim, gettext, libintl

open the Cygwin Bash Shell
mkdir /uClinux
cd /uClinux

download the sources from:
http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20060803.tar.gz and
save it to the uClinux directory

tar xvzf uClinux-dist-20060803.tar.gz

remove /uClinux/uClinux-dist/linux-2.6.x/scripts/basic/docproc
remove /uClinux/uClinux-dist/linux-2.6.x/scripts/basic/fixdep
remove /uClinux/uClinux-dist/linux-2.6.x/scripts/basic/split-include
remove /uClinux/uClinux-dist/linux-2.6.x/scripts/kconfig/conf

download the following M68K/ColdFire/ARM tool chain sources from:
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20060615/ and save
it to the uClinux directory:
build-uclinux-tools.sh
binutils-2.16.tar.gz
elf2flt-20060608.tar.gz
gcc-4.1.1.tar.bz2
genromfs-0.5.1.tar.gz

save
http://www.uclinux.org/pub/uClinux/uclinux-elf-tools/tools-20030314/genromfs-0.5.1-cygwin-020605.patch
to
/uClinux/

vim build-uclinux-tools.sh
change line 57 and 58 when ARM platform
make comments of line 66-67
#LINUXVERS="2.6.16"
#UCLIBCVERS="20060608"
change line 72 into
ROOTDIR="${BASEDIR}/uClinux-dist"
change line 86-87 into
KERNEL="${BASEDIR}/uClinux-dist/linux-2.6.x"
UCLIBC="${BASEDIR}/uClinux-dist/uClibc"
make comments of line 171-172
#rm -rf ${KERNEL}
#rm -rf ${UCLIBC}
make comments of line 275-276
#extract linux-${LINUXVERS}.tar*
#extract uClibc-${UCLIBCVERS}.tar*
change line 877 into
UCLIBC_CONFIG="${BASEDIR}/uClinux-dist/uClibc-${_CPU}.config"

A small patch needs to be applied to the linux kernel, so the following
error doesn't occur:
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf.o:conf.c:(.text+0x91): undefined reference to
`_libintl_gettext'

Get this patch from
http://sources.redhat.com/ml/crossgcc/2006-05/msg00093.html
Save the patch to
/uClinux/uClinux-dist/linux-2.6.x/support_cygwin_cross.patch
cd /uClinux/uClinux-dist/linux-2.6.x/
patch -p1 < support_cygwin_cross.patch

copy the file /uClinux-dist/uClibc/.config from a binary distribution to the
file
/uClinux/uClinux-dist/uClibc/extra/Configs/Config.${_CPU}.default (where
${_CPU} is for example m86k)
or run
/uClinux/uClinux-dist/uClibc/make config
to make one yourself and save /uClinux/uClinux-dist/uClibc/.config to the
file
/uClinux/uClinux-dist/uClibc/extra/Configs/Config.${_CPU}.default (where
${_CPU} is for example m86k)

../build-uclinux-tools.sh continue 2>&1 | tee errs.txt

during STAGE1 all files are extracted

before STAGE3 I had to make a comment (because of linking errors) of line 31
(LIBS := -lcygwin $(LIBS)) in the file
/uClinux/elf2flt-20060608/Makefile.in

mkdir /tftpboot
cd /uClinux/uClinux-dist/uClibc
make clean
cd ..
make config
make dep
make

last but not least, build a binary archive for distribution.
cd /uClinux
../build-uclinux-tools.sh dist



.