From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Philippe Gerum <rpm@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] [rfc] Building Linux kernel in Xenomai tree.
Date: Sun, 8 Jan 2006 17:55:23 +0100 [thread overview]
Message-ID: <17345.17403.927352.223271@domain.hid> (raw)
In-Reply-To: <43C11EEB.8040003@domain.hid>
[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 673 bytes --]
Philippe Gerum wrote:
> Gilles Chanteperdrix wrote:
> > The current approach is to use the sources of the running kernel if the
> > only option specified is --enable-linux-build. Do you mean you find this
> > feature superfluous ?
> >
>
> If $enableval is "y", then no path has been specified, so you can
> default to the running kernel in such a case.
Here is a third version of the patch, where :
* the --enable-sim option is removed
* the --with-linux-srcdir option is removed
* the CC variable is passed to kernel build system
* prepare-kernel.sh no longer removes target directories before
creating symbolic links.
--
Gilles Chanteperdrix.
[-- Attachment #2: xeno-build-kernel.3.diff --]
[-- Type: application/octet-stream, Size: 10055 bytes --]
diff -Nurp --exclude .svn --exclude '*~' --exclude Makefile.in --exclude configure --exclude aclocal.m4 --exclude autom4te.cache trunk/Makefile.am branches/build-kernel/Makefile.am
--- trunk/Makefile.am 2006-01-04 18:39:12.000000000 +0100
+++ branches/build-kernel/Makefile.am 2006-01-08 17:46:23.000000000 +0100
@@ -51,3 +51,44 @@ install-exec-local: devices
install-nodev:
$(MAKE) SUDO=false install
+
+if XENO_BUILD_LINUX
+linux/%: linux/.xenomai-prepared
+ $(top_srcdir)/scripts/prepare-kernel.sh \
+ --adeos="$(ADEOS_PATCH)" --linux=linux \
+ --arch=$(XENO_LINUX_ARCH) && \
+ cross=`expr $(CC) : '\(.*\)gcc' || :` && \
+ cd linux && $(MAKE) $* \
+ ARCH=$(XENO_LINUX_ARCH) CC=$(CC) CROSS_COMPILE=$$cross
+
+linux/.xenomai-prepared: config.status
+ ./config.status linux
+
+linux/install: linux/all
+ @sudo=; if test x`id -u` != x0 && test \! "x`type $(SUDO)`" = x; then \
+ sudo=$(SUDO); fi && \
+ cross=`expr $(CC) : '\(.*\)gcc' || :` && \
+ $$sudo $(mkinstalldirs) $(DESTDIR)/boot && \
+ cd linux && $$sudo $(MAKE) modules_install install \
+ ARCH=$(XENO_LINUX_ARCH) CC=$(CC) CROSS_COMPILE=$$cross \
+ INSTALL_PATH=$(DESTDIR)/boot \
+ INSTALL_MOD_PATH=$(DESTDIR)
+
+distclean-linux:
+ @test -e linux/.config && \
+ mv linux/.config linux/.config.saved.xenomai; \
+ $(MAKE) linux/distclean; \
+ test -e linux/.config.saved.xenomai && \
+ mv linux/.config.saved.xenomai linux/.config
+
+config oldconfig mconfig menuconfig gconfig xconfig:
+ $(MAKE) linux/$@
+
+all-recursive: linux/all
+
+clean-recursive: linux/clean
+
+distclean-recursive: distclean-linux
+
+install-recursive: linux/install
+endif
diff -Nurp --exclude .svn --exclude '*~' --exclude Makefile.in --exclude configure --exclude aclocal.m4 --exclude autom4te.cache trunk/configure.in branches/build-kernel/configure.in
--- trunk/configure.in 2006-01-07 11:46:12.000000000 +0100
+++ branches/build-kernel/configure.in 2006-01-08 17:48:54.000000000 +0100
@@ -48,18 +48,27 @@ AC_MSG_CHECKING([for target architecture
case "$host" in
i*86*-*)
XENO_TARGET_ARCH=i386
+ XENO_LINUX_ARCH=i386
+ arch_have_sim=y
;;
powerpc-*|ppc-*)
XENO_TARGET_ARCH=powerpc
+ XENO_LINUX_ARCH=ppc
+ arch_have_sim=y
;;
powerpc64-*|ppc64-*)
XENO_TARGET_ARCH=powerpc
+ XENO_LINUX_ARCH=ppc64
+ arch_have_sim=y
;;
ia64-*)
XENO_TARGET_ARCH=ia64
+ XENO_LINUX_ARCH=ia64
+ arch_have_sim=y
;;
bfin-*|bfinnommu-*|blackfin-*)
XENO_TARGET_ARCH=blackfin
+ XENO_LINUX_ARCH=bfinnommu
if test x$enable_shared = xyes; then
AC_MSG_ERROR([Shared libraries unsupported -- reconfigure passing --disable-shared])
fi
@@ -150,6 +159,152 @@ if test $XENO_TARGET_ARCH = i386; then
AC_MSG_RESULT(${CONFIG_X86_TSC:-no})
fi
+dnl Flags for building Linux in Xenomai build tree.
+AC_MSG_CHECKING(whether building Linux in Xenomai build tree)
+AC_ARG_ENABLE(linux-build,
+ AS_HELP_STRING([--enable-linux-build=<linux-src-dir>], [Build Linux in
+Xenomai build tree, copying sources in <linux-src-dir>. If no source directory
+is passed, use, if not cross-compiling, the sources of the running kernel or
+/usr/src/linux.]),
+ [case "$enableval" in
+ y | yes) XENO_LINUX_SRCDIR=y ;;
+ n | no) unset XENO_LINUX_SRCDIR ;;
+ *) XENO_LINUX_SRCDIR="`/bin/bash -c \"echo $enableval\"`";;
+ esac])
+
+if test x"$XENO_LINUX_SRCDIR" = x; then
+ AC_MSG_RESULT(no)
+else
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING(for Linux sources)
+ if test x"$XENO_LINUX_SRCDIR" = xy && test x"$cross_compiling" = xno; then
+ XENO_LINUX_SRCDIR=/lib/modules/`uname -r`/source
+ if test ! -r $XENO_LINUX_SRCDIR/Makefile; then
+ XENO_LINUX_SRCDIR=/usr/src/linux
+ fi
+ fi
+ if test x"$XENO_LINUX_SRCDIR" = xy || test ! -r $XENO_LINUX_SRCDIR/Makefile; then
+ if test -e linux/.xenomai-prepared; then
+ AC_MSG_RESULT(not found)
+ unset XENO_LINUX_SRCDIR
+ else
+ AC_MSG_ERROR([Unable to find Linux kernel sources tree, please pass a valid Linux sources directory to --enable-linux-build])
+ fi
+ fi
+
+ if test x"$XENO_LINUX_SRCDIR" != x; then
+ unset linux_EXTRAVERSION
+ unset linux_PATCHLEVEL
+ unset linux_SUBLEVEL
+ unset linux_VERSION
+
+ eval linux_`grep '^EXTRAVERSION =' $XENO_LINUX_SRCDIR/Makefile | sed -e 's, ,,g'`
+ eval linux_`grep '^PATCHLEVEL =' $XENO_LINUX_SRCDIR/Makefile | sed -e 's, ,,g'`
+ eval linux_`grep '^SUBLEVEL =' $XENO_LINUX_SRCDIR/Makefile | sed -e 's, ,,g'`
+ eval linux_`grep '^VERSION =' $XENO_LINUX_SRCDIR/Makefile | sed -e 's, ,,g'`
+
+ linux_base_version="$linux_VERSION.$linux_PATCHLEVEL.$linux_SUBLEVEL"
+ linux_full_version="$linux_base_version$linux_EXTRAVERSION"
+
+ if test x"$linux_PATCHLEVEL" = x -o x"$linux_SUBLEVEL" = x ||
+ test x"$linux_VERSION" = x; then
+ if test -e linux/.xenomai-prepared; then
+ AC_MSG_RESULT(Unknown version)
+ unset linux_base_version
+ else
+ AC_MSG_ERROR([Unable to get version of $XENO_LINUX_SRCDIR, aborting.])
+ fi
+ else
+ AC_MSG_RESULT([$XENO_LINUX_SRCDIR (kernel ${linux_full_version})])
+ fi
+ fi
+
+ AC_MSG_CHECKING(for Adeos patch)
+ unset ADEOS_PATCH
+ AC_ARG_WITH(adeos-patch,
+ AS_HELP_STRING([--with-adeos-patch],[specify the path to the Adeos
+patch. Default is to infer the patch name from Linux kernel version.]),
+ [ADEOS_PATCH="`/bin/bash -c \"echo $withval\"`"])
+
+ if test x"$ADEOS_PATCH" = x && test x"$linux_base_version" != x; then
+ set -- $srcdir/ksrc/arch/$XENO_TARGET_ARCH/patches/adeos-*$linux_base_version-$XENO_LINUX_ARCH-*
+ ADEOS_PATCH=$1
+ fi
+ if test x"$ADEOS_PATCH" = x || test ! -e $ADEOS_PATCH; then
+ if test -e linux/.xenomai-prepared; then
+ AC_MSG_RESULT(not found)
+ unset ADEOS_PATCH
+ else
+ AC_MSG_ERROR([Unable to find Adeos patch, please use --with-adeos-patch])
+ fi
+ else
+ AC_MSG_RESULT([$ADEOS_PATCH])
+ fi
+ AC_SUBST(ADEOS_PATCH)
+
+ AC_CONFIG_COMMANDS(linux, [
+ if test -e linux/.xenomai-prepared; then
+ . linux/.xenomai-prepared
+ if test x"$XENO_LINUX_VERSION" != x"$PREPARED_LINUX_VERSION" ||
+ test x"`basename $ADEOS_PATCH`" != x"$PREPARED_ADEOS_PATCH"; then
+ echo "*** Warning: built version of linux and requested versions are "
+ echo "*** different. If you want to build the requested version of "
+ echo "*** linux, remove the file: linux/.xenomai-prepared."
+ fi
+ touch linux/.xenomai-prepared
+ else
+ set -e
+ targetdir=$PWD/linux
+ if test \! -e linux || test \! $XENO_LINUX_SRCDIR -ef linux; then
+ if test -e linux; then
+ test -e linux/.config && mv linux/.config .xenomai.config
+ echo $ECHO_N "Removing existing linux directory... $ECHO_C"
+ rm -Rf linux
+ echo "${ECHO_T}done."
+ fi
+ mkdir linux
+ echo $ECHO_N "Making linux a shadow copy of $XENO_LINUX_SRCDIR... $ECHO_C"
+ cd $XENO_LINUX_SRCDIR
+ find . -! -type d | while read f; do
+ d=$targetdir/`dirname $f`
+ mkdir -p $d && ln -sf $XENO_LINUX_SRCDIR/$f $d/`basename $f`
+ done
+ echo "${ECHO_T}done."
+ fi
+ cd $targetdir
+
+ if test -e $XENO_LINUX_SRCDIR/.config; then
+ . $XENO_LINUX_SRCDIR/.config
+ test x"$CONFIG_X86" = xy && cfg_arch=i386 || :
+ test x"$CONFIG_PPC" = xy && cfg_arch=ppc || :
+ test x"$CONFIG_IA64" = xy && cfg_arch=ia64 || :
+ test x"$CONFIG_PPC64" = xy && cfg_arch=ppc64 || :
+ if test $cfg_arch = $XENO_TARGET_ARCH; then
+ cp $XENO_LINUX_SRCDIR/.config .xenomai.config
+ fi
+ echo "Cleaning linux directory..."
+ make ARCH=$cfg_arch distclean
+ test -e .xenomai.config && mv .xenomai.config .config
+ fi
+ cd ..
+ $srcdir/scripts/prepare-kernel.sh \
+ --adeos="$ADEOS_PATCH" --linux=linux --arch=$XENO_LINUX_ARCH
+ test -e .xenomai.config && mv .xenomai.config linux/.config || :
+ cat > linux/.xenomai-prepared.tmp <<EOF
+PREPARED_LINUX_VERSION=$XENO_LINUX_VERSION
+PREPARED_ADEOS_PATCH=`basename $ADEOS_PATCH`
+EOF
+ mv linux/.xenomai-prepared.tmp linux/.xenomai-prepared
+ fi
+ ],[XENO_LINUX_SRCDIR=$XENO_LINUX_SRCDIR
+ XENO_TARGET_ARCH=$XENO_TARGET_ARCH
+ XENO_LINUX_ARCH=$XENO_LINUX_ARCH
+ XENO_LINUX_VERSION=$linux_full_version
+ ADEOS_PATCH=$ADEOS_PATCH])
+fi
+AM_CONDITIONAL(XENO_BUILD_LINUX, [test \! x"$XENO_LINUX_SRCDIR" = x])
+
+
dnl Documentation package.
if test \! -d $srcdir/doc; then
@@ -339,6 +494,7 @@ AC_SUBST(LATEX_BATCHMODE)
AC_SUBST(LATEX_MODE)
AC_SUBST(XENO_TARGET_ARCH)
+AC_SUBST(XENO_LINUX_ARCH)
AC_SUBST(XENO_BUILD_STRING)
AC_SUBST(XENO_HOST_STRING)
AC_SUBST(XENO_USER_CFLAGS)
diff -Nurp --exclude .svn --exclude '*~' --exclude Makefile.in --exclude configure --exclude aclocal.m4 --exclude autom4te.cache trunk/scripts/prepare-kernel.sh branches/build-kernel/scripts/prepare-kernel.sh
--- trunk/scripts/prepare-kernel.sh 2006-01-04 13:12:32.000000000 +0100
+++ branches/build-kernel/scripts/prepare-kernel.sh 2006-01-08 16:49:46.000000000 +0100
@@ -2,12 +2,16 @@
set -e
do_links() {
- rm -fr $2
- ( cd $1 &&
+ ( cd $2 &&
+ find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
+ while read f; do
+ if test ! -e $1/$f; then rm -f $f; fi
+ done &&
+ cd $1 &&
find . \( -name Makefile -o -name $config_file -o -name '*.[chS]' \) |
while read f; do
d=`dirname $f`
- mkdir -p $2/$d && ln -s $1/$f $2/$f
+ mkdir -p $2/$d && ln -sf $1/$f $2/$f
done )
}
next prev parent reply other threads:[~2006-01-08 16:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-07 11:30 [Xenomai-core] [rfc] Building Linux kernel in Xenomai tree Gilles Chanteperdrix
2006-01-07 18:04 ` Gilles Chanteperdrix
2006-01-07 18:38 ` Jan Kiszka
2006-01-07 19:32 ` Gilles Chanteperdrix
2006-01-07 19:58 ` Jan Kiszka
2006-01-07 21:24 ` Gilles Chanteperdrix
2006-01-08 12:08 ` Philippe Gerum
2006-01-08 13:08 ` Gilles Chanteperdrix
2006-01-08 14:17 ` Philippe Gerum
2006-01-08 16:55 ` Gilles Chanteperdrix [this message]
2006-01-08 19:23 ` Philippe Gerum
2006-01-08 20:22 ` Gilles Chanteperdrix
2006-01-08 21:39 ` Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17345.17403.927352.223271@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=rpm@xenomai.org \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.