[ptxdist] [PATCH 2/2] kernel: Use host-elf-h-compat

2012-01-24 Thread Bernhard Walle
Set the host include flags of the Linux kernel so that it finds elf.h in
sysroot-host/include. It's required to specify HOST_EXTRACFLAGS in the
environment rather than as make argument because otherwise += doesn't
work which ends in other build errors (gettext problems).

See also http://article.gmane.org/gmane.linux.kbuild.devel/5210 for a
discussion about HOST_EXTRACFLAGS.

Signed-off-by: Bernhard Walle 
---
 rules/kernel.make |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/rules/kernel.make b/rules/kernel.make
index a445182..336b76d 100644
--- a/rules/kernel.make
+++ b/rules/kernel.make
@@ -43,13 +43,12 @@ KERNEL_SOURCE   := 
$(SRCDIR)/$(KERNEL).$(KERNEL_SUFFIX)
 # 
 
 KERNEL_PATH:= PATH=$(CROSS_PATH)
-KERNEL_ENV := KCONFIG_NOTIMESTAMP=1
+KERNEL_ENV := KCONFIG_NOTIMESTAMP=1 HOST_EXTRACFLAGS="$(HOST_CPPFLAGS)"
 KERNEL_MAKEVARS := \
$(PARALLELMFLAGS) \
HOSTCC=$(HOSTCC) \
ARCH=$(PTXCONF_KERNEL_ARCH_STRING) \
CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) \
-   \
INSTALL_MOD_PATH=$(KERNEL_PKGDIR) \
PTX_KERNEL_DIR=$(KERNEL_DIR) \
$(call remove_quotes,$(PTXCONF_KERNEL_EXTRA_MAKEVARS))
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de


[ptxdist] [PATCH 1/2] Add host-elf-h-compat package

2012-01-24 Thread Bernhard Walle
This package should provide  on host operating systems that have
no /usr/include/elf.h. The header is copied from glibc, modified a bit
to remove GNU dependencies and is sufficient to compile the Linux kernel
and module-init-tools.

The package itself only checks if elf.h is present. If yes, it does
nothing on "make install". If not, it installs its own copy of elf.h in
"make install" to the include directory set in autoconf.

We add this package as base package so that it gets built before the
packages which need it. Also, the package only gets required when
ptxdist is executed not on Linux (per uname -s output). This makes
maintaining the dependencies easier than requiring it in any packages
that need elf.h.

Signed-off-by: Bernhard Walle 
---
 rules/host-elf-h-compat.in   |5 +
 rules/host-elf-h-compat.make |   36 
 2 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 rules/host-elf-h-compat.in
 create mode 100644 rules/host-elf-h-compat.make

diff --git a/rules/host-elf-h-compat.in b/rules/host-elf-h-compat.in
new file mode 100644
index 000..9310216
--- /dev/null
+++ b/rules/host-elf-h-compat.in
@@ -0,0 +1,5 @@
+## SECTION=hosttools_noprompt
+
+config HOST_ELF_H_COMPAT
+   default y
+   bool
diff --git a/rules/host-elf-h-compat.make b/rules/host-elf-h-compat.make
new file mode 100644
index 000..9bd9a1d
--- /dev/null
+++ b/rules/host-elf-h-compat.make
@@ -0,0 +1,36 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2012 by Bernhard Walle 
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+LAZY_PACKAGES-$(PTXCONF_HOST_ELF_H_COMPAT) += host-elf-h-compat
+
+#
+# Paths and names
+#
+HOST_ELF_H_COMPAT_VERSION  := 0.2
+HOST_ELF_H_COMPAT_MD5  := a2a21551133c9278014f71cdb983564a
+HOST_ELF_H_COMPAT  := elf-h-compat-$(HOST_ELF_H_COMPAT_VERSION)
+HOST_ELF_H_COMPAT_SUFFIX   := tar.bz2
+HOST_ELF_H_COMPAT_URL  := 
http://bwalle.de/programme/$(HOST_ELF_H_COMPAT).$(HOST_ELF_H_COMPAT_SUFFIX)
+HOST_ELF_H_COMPAT_SOURCE   := 
$(SRCDIR)/$(HOST_ELF_H_COMPAT).$(HOST_ELF_H_COMPAT_SUFFIX)
+HOST_ELF_H_COMPAT_DIR  := $(HOST_BUILDDIR)/$(HOST_ELF_H_COMPAT)
+
+#
+# autoconf
+#
+HOST_ELF_H_COMPAT_CONF_TOOL:= autoconf
+
+ifneq ($(shell uname -s),Linux)
+$(STATEDIR)/base.prepare: $(STATEDIR)/host-elf-h-compat.install.post
+endif
+
+# vim: syntax=make
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de


[ptxdist] Fix missing elf.h on Darwin (v2)

2012-01-24 Thread Bernhard Walle
This is the second version of the patches. The third patch is not needed any
more because host-elf-h-compat is now built as base package rather than as
dependency. All other remarks of the review have been integrated in the patch
series.

The package is maintained at https://bitbucket.org/bwalle/elf-h-compat but
unfortunately it cannot be downloaded from there automatically because Bitbucket
forwards http to https and that gives certificate errors on some hosts
(depending which certificates are available to wget). That's why I still have my
domain in the source URL of the package. Well, in the past it was much more
reliable compared to Berlios, so it shouldn't be a practical problem.


-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] Report bug : Qt , Xorg

2012-01-24 Thread Juergen Beisert
Hi Barhoumi,

barhoumi mohtadi wrote:
> I'm trying to re-build an embedded kernel with this time adding Xorg and Qt
> as new libraries ( i have succeded to run a minimal kernel before) But the
> problem, is that i have received this error when running PTXdist images
>
> last lines from the logfile
>
> g++ -o
> "/home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/build
>-target/qt-everywhere-opensource-src-4.7.4-build/bin/qmake" project.o
> property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o option.o
> winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o
> xmloutput.o pbuilder_pbx.o borland_bmake.o msvc_vcproj.o msvc_vcxproj.o
> msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o symmake.o
> initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o symbiancommon.o
> registry.o epocroot.o qtextcodec.o qutfcodec.o qstring.o qtextstream.o
> qiodevice.o qmalloc.o qglobal.o qbytearray.o qbytearraymatcher.o
> qdatastream.o qbuffer.o qlist.o qfile.o qfsfileengine_unix.o
> qfsfileengine_iterator_unix.o qfsfileengine.o qfsfileengine_iterator.o
> qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o
> qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o
> qtemporaryfile.o qmap.o qmetatype.o qsettings.o qlibraryinfo.o qvariant.o
> qvsnprintf.o qlocale.o qlinkedlist.o qurl.o qnumeric.o qcryptographichash.o
> qxmlstream.o qxmlutils.o make[1]: Leaving directory
> `/home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/build
>-target/qt-everywhere-opensource-src-4.7.4-build/qmake' Basic XLib
> functionality test failed!
>  You might need to modify the include and library search paths by editing
>  QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in
> /home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/build-
>target/qt-everywhere-opensource-src-4.7.4/mkspecs/linux-ptx-g++. make: ***
> [/home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/state
>/qt4.prepare] Error 1
>
> }}} 2012-01-24T12:06:54+0100 /usr/local/lib/ptxdist-2011.11.0/bin/ptxdist
> images; (exit value: 2)
>
>
> I must also precise that there is no such folder ( qt-everywhere) in
> the build target folder.
>
> Can you see the cause of the problem.?

You last comment on the IRC was: "it works" after enabling Qt's X support???

Did you configure your Qt to use the X environment instead of the plain 
framebuffer?

$ ptxdist menuconfig
Graphics & Multimedia --->
   qt ---> 
  <*> qt --->
 build options --->
platform (X11 )  --->

This should do the job.

Regards,
Juergen

-- 
Pengutronix e.K.  | Juergen Beisert |
Linux Solutions for Science and Industry  | http://www.pengutronix.de/  |

-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] X.org on mini2440

2012-01-24 Thread Juergen Beisert
Hi Guillermo,

Guillermo Rodriguez wrote:
> I am playing with ptxdist (2011.12.0) on a mini2440 board and wanted to
> test X.org on it.
>
> After some tweaking I have managed to successfully run X, but wanted to
> share some issues I've found along the way.
>
> I enabled X.org with the framebuffer driver, evdev for touchscreen input,
> and "void" for keyboard input. I also added the xinit package (for startx
> and xinit), built everything, and booted the target. I then tried startx,
> but got an error message saying that a cookie could not be generated.
>
> Upon inspecting /usr/bin/startx I see that the following has leaked
> through:
>
> 
mcookie=`/home/grodriguez/work/ptxdist/OSELAS.BSP-Pengutronix-Mini2440-2011.12.0/platform-mini2440/sysroot-host/bin/mcookie`

This should help:

$ ptxdist menuconfig
  Shell & Console Tools --->
   util-linux-ng -> 
  [*] mcookie

> Not sure whether this is a bug in the configure script in the xinit
> package, and/or something that can be fixed in ptxdist itself. In my case,
> I fixed this by manually editing the startx script and replacing the above
> with a pregenerated mcookie value.

Maybe a missing dependency from the xinit package into the util-linux-ng 
package.

@Michael: what do you think?

> Next thing was that X.org would not start if the kernel is not compiled
> with support for virtual terminals. While obvious in retrospect, I wonder
> whether it is possible for ptxdist to detect this kind of dependencies
> (e.g. detect that a required kernel option is not set in the current kernel
> configuration). While this wouldn't help when ptxdist is used to generate a
> rootfs only, it would certainly be useful if ptxdist is also generating the
> kernel for the target platform. Rebuilt and reflashed the kernel and the
> problem went away.

No, PTXdist cannot detect it automatically. The Kernel is part of the 
platform, Xorg is part of the userland. It's up to you as the developer to 
get the configuration in a way that matches your requirements.

Our Mini2440 BSP can only act as a template for you. I did not configure it 
for maximum features, because I cannot test everything ;-)

> Finally I found that even when I had configured X.org to use the "void"
> driver for the keyboard, it would keep complaining about keymaps and
> keyboard initialisation until I added xkeyboard-config (presumably for
> /usr/lib/X11/xkb/rules/base) and xkbcomp (for the latter I had to enable
> the "Keyboard mappings" option in ptxdist). Not sure whether these two are
> actually required for all X.org installations but I could not find any
> other way around. If this is really a requirement perhaps these
> dependencies should be forced.

Same here: @Michael: what do you think?

> After this I could run X on the target device. Used fluxbox as a WM.
>
> I can provide more information on any of the above issues if required.

If you know what dependencies should be met (if the user want them), patches 
are welcome at the PTXdist mailing list.
I cannot comment on this, as its long time ago, that I worked with Xorg on any 
kind of embedded device.

Regards,
Juergen

-- 
Pengutronix e.K.  | Juergen Beisert |
Linux Solutions for Science and Industry  | http://www.pengutronix.de/  |

-- 
ptxdist mailing list
ptxdist@pengutronix.de


[ptxdist] [PATCH] Support reading number of CPUs on Darwin and BSDs

2012-01-24 Thread Bernhard Walle
Tested on Mac OS 10.7 (Lion).

Signed-off-by: Bernhard Walle 
---
v2: Use /usr/sbin/sysctl instead of relying on the $PATH and don't check
for the operating system but just try it out.

 bin/ptxdist |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 74a52ad..52e9c76 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -2088,12 +2088,14 @@ setup_config() {
local pmf_extern="-j1"
local cpus
 
+   # this one is for Linux
if [ -r /proc/cpuinfo ]; then
cpus="$(egrep '^(processor|cpu  )' /proc/cpuinfo | wc -l)"
if [ ${cpus} -eq 0 ]; then
cpus=1
fi
-   else
+   # and this one is tested on Darwin and should work on BSDs
+   elif ! cpus="$(/usr/sbin/sysctl -n hw.ncpu)" 2> /dev/null; then
cpus=1
fi
local pmf_intern="-j$(( ${cpus} * 2 ))"
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de


[ptxdist] X.org on mini2440

2012-01-24 Thread Guillermo Rodriguez
Dear all,

I am playing with ptxdist (2011.12.0) on a mini2440 board and wanted to test 
X.org on it.

After some tweaking I have managed to successfully run X, but wanted to share 
some issues I've found along the way.

I enabled X.org with the framebuffer driver, evdev for touchscreen input, and 
"void" for keyboard input. I also added the xinit package (for startx and 
xinit), built everything, and booted the target. I then tried startx, but got 
an error message saying that a cookie could not be generated.

Upon inspecting /usr/bin/startx I see that the following has leaked through:

mcookie=`/home/grodriguez/work/ptxdist/OSELAS.BSP-Pengutronix-Mini2440-2011.12.0/platform-mini2440/sysroot-host/bin/mcookie`

Not sure whether this is a bug in the configure script in the xinit package, 
and/or something that can be fixed in ptxdist itself.
In my case, I fixed this by manually editing the startx script and replacing 
the above with a pregenerated mcookie value.

Next thing was that X.org would not start if the kernel is not compiled with 
support for virtual terminals. While obvious in retrospect, I wonder whether it 
is possible for ptxdist to detect this kind of dependencies (e.g. detect that a 
required kernel option is not set in the current kernel configuration). While 
this wouldn't help when ptxdist is used to generate a rootfs only, it would 
certainly be useful if ptxdist is also generating the kernel for the target 
platform. Rebuilt and reflashed the kernel and the problem went away.

Finally I found that even when I had configured X.org to use the "void" driver 
for the keyboard, it would keep complaining about keymaps and keyboard 
initialisation until I added xkeyboard-config (presumably for 
/usr/lib/X11/xkb/rules/base) and xkbcomp (for the latter I had to enable the 
"Keyboard mappings" option in ptxdist). Not sure whether these two are actually 
required for all X.org installations but I could not find any other way around. 
If this is really a requirement perhaps these dependencies should be forced.

After this I could run X on the target device. Used fluxbox as a WM.

I can provide more information on any of the above issues if required.

Thanks and best regards,

Guillermo Rodriguez


-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] [PATCH] Support reading number of CPUs on Mac OS X

2012-01-24 Thread Bernhard Walle
Hi Michael,

Am 24.01.12 10:19, schrieb Michael Olbrich:
> 
> - Is sysctl alwyas in $PATH? On Linux it's in sbin.

I think so, but it's in /usr/sbin, so I can use /usr/sbin/syctl to be
more safe.

> - the value should be quoted.

ok.

> - Does this _always_ and _only_ work on Mac OS X?

Good point. I have no other system than Linux and Mac OS here, but
according to http://systhread.net/texts/28sysctl.php it should work
on all BSDs, so yes, your solution is better.

Will create a new version of the patch later in the evening.


Regards,
Bernhard

-- 
ptxdist mailing list
ptxdist@pengutronix.de


[ptxdist] Report bug : Qt , Xorg

2012-01-24 Thread barhoumi mohtadi

Hello, 

I'm trying to re-build an embedded kernel with this time adding Xorg and Qt as 
new libraries ( i have succeded to run a minimal kernel before)
But the problem, is that i have received this error when running PTXdist images 

last lines from the logfile

g++ -o 
"/home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/build-target/qt-everywhere-opensource-src-4.7.4-build/bin/qmake"
 project.o property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o 
option.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o 
xmloutput.o pbuilder_pbx.o borland_bmake.o msvc_vcproj.o msvc_vcxproj.o 
msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o symmake.o 
initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o symbiancommon.o 
registry.o epocroot.o qtextcodec.o qutfcodec.o qstring.o qtextstream.o 
qiodevice.o qmalloc.o qglobal.o qbytearray.o qbytearraymatcher.o qdatastream.o 
qbuffer.o qlist.o qfile.o qfsfileengine_unix.o qfsfileengine_iterator_unix.o 
qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o 
qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o 
qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o 
qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlinkedlist.o qurl.o 
qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o  
make[1]: Leaving directory 
`/home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/build-target/qt-everywhere-opensource-src-4.7.4-build/qmake'
Basic XLib functionality test failed!
 You might need to modify the include and library search paths by editing
 QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in 
/home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/build-target/qt-everywhere-opensource-src-4.7.4/mkspecs/linux-ptx-g++.
make: *** 
[/home/c2a/OSELAS.BSP-Pengutronix-Generic-2011.11.0/platform-Poseidon/state/qt4.prepare]
 Error 1

}}} 2012-01-24T12:06:54+0100 /usr/local/lib/ptxdist-2011.11.0/bin/ptxdist 
images; (exit value: 2)


I must also precise that there is no such folder ( qt-everywhere) in the 
build target folder.

Can you see the cause of the problem.?

Thnaks a lot 


  -- 
ptxdist mailing list
ptxdist@pengutronix.de


[ptxdist] [PATCH] Add tslib dependency to SDL

2012-01-24 Thread Juergen Beisert
The SDL configure stage guesses if the tslib is available. So, if touchscreen
support is available at runtime or not depends on the build order. This patch
fixes the build order on demand.

Reported-by: Wingston Sharon 
Signed-off-by: Juergen Beisert 

diff --git a/rules/sdl.in b/rules/sdl.in
index 1dbb2ab..9a6b4ad 100644
--- a/rules/sdl.in
+++ b/rules/sdl.in
@@ -17,6 +17,7 @@ menuconfig SDL
select ALSA_LIB if SDL_ALSA
select DIRECTFB if SDL_DIRECTFB
select CROSS_NASM   if SDL_NASM
+   select TSLIBif SDL_TSLIB
help
  Simple DirectMedia Layer is a cross-platform multimedia
  library designed to provide low level access to audio,
@@ -252,4 +253,10 @@ config SDL_PTH
help
  Turn on support for GNU Portable Threads
 
+config SDL_TSLIB
+   bool
+   prompt "tslib Support"
+   help
+ Turn on support for the touchscreen library 'tslib'
+
 endif
diff --git a/rules/sdl.make b/rules/sdl.make
index 17f2e68..d96b279 100644
--- a/rules/sdl.make
+++ b/rules/sdl.make
@@ -43,7 +43,9 @@ SDL_ENV   := $(CROSS_ENV)
 #
 # autoconf
 #
-SDL_AUTOCONF := $(CROSS_AUTOCONF_USR)
+SDL_AUTOCONF := \
+   $(CROSS_AUTOCONF_USR) \
+   --$(call ptx/endis,PTXCONF_SDL_TSLIB)-input-tslib \
 
 ifdef PTXCONF_SDL_SHARED
 SDL_AUTOCONF += --enable-shared

-- 
Pengutronix e.K.  | Juergen Beisert |
Linux Solutions for Science and Industry  | http://www.pengutronix.de/  |

-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] [PATCH 2/3] kernel: Use host-elf-h-compat

2012-01-24 Thread Michael Olbrich
On Sun, Jan 22, 2012 at 12:43:14PM +0100, Bernhard Walle wrote:
> Add a dependency to the host tool and set the include flags properly.
> 
> Signed-off-by: Bernhard Walle 
> ---
>  platforms/hosttools.in |1 +
>  platforms/kernel.in|1 +
>  rules/kernel.make  |1 +
>  3 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/platforms/hosttools.in b/platforms/hosttools.in
> index 155b30b..0435545 100644
> --- a/platforms/hosttools.in
> +++ b/platforms/hosttools.in
> @@ -5,6 +5,7 @@ source "rules/host-cmake.in"
>  source "rules/host-cramfs.in"
>  source "rules/host-dosfstools.in"
>  source "rules/host-e2fsprogs.in"
> +source "rules/host-elf-h-compat.in"

this should be in the first patch, if at all (see my other mail).

>  source "rules/host-genext2fs.in"
>  source "rules/host-genpart.in"
>  source "rules/host-gettext.in"
> diff --git a/platforms/kernel.in b/platforms/kernel.in
> index b601284..4391e79 100644
> --- a/platforms/kernel.in
> +++ b/platforms/kernel.in
> @@ -2,6 +2,7 @@ menuconfig KERNEL
>   bool
>   default y
>   select IMAGE_KERNEL
> + select HOST_ELF_H_COMPAT
>   select HOST_UMKIMAGEif KERNEL_IMAGE_U
>   select HOST_XZ  if KERNEL_XZ
>   select HOST_LZOPif KERNEL_LZOP
> diff --git a/rules/kernel.make b/rules/kernel.make
> index a445182..f125a69 100644
> --- a/rules/kernel.make
> +++ b/rules/kernel.make
> @@ -47,6 +47,7 @@ KERNEL_ENV  := KCONFIG_NOTIMESTAMP=1
>  KERNEL_MAKEVARS := \
>   $(PARALLELMFLAGS) \
>   HOSTCC=$(HOSTCC) \
> + HOSTCFLAGS=$(HOST_CPPFLAGS) $(HOST_CFLAGS) \

- add quotes
- This overwrites the defaults, so I'm not sure that's the right thing to
  do. Maybe use HOST_EXTRACFLAGS?
- HOST_CFLAGS is not used in ptxdist and should be empty.

So

HOSTCFLAGS="$(HOST_CPPFLAGS)" \
or
HOST_EXTRACFLAGS="$(HOST_CPPFLAGS)" \

Maybe there are some kernel developers here, that can comment on that?

Michael


>   ARCH=$(PTXCONF_KERNEL_ARCH_STRING) \
>   CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) \
>   \
> -- 
> 1.7.7.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

-- 
ptxdist mailing list
ptxdist@pengutronix.de


Re: [ptxdist] [PATCH] Support reading number of CPUs on Mac OS X

2012-01-24 Thread Michael Olbrich
On Sun, Jan 22, 2012 at 09:47:47PM +0100, Bernhard Walle wrote:
> Tested on 10.7 (Lion).
> 
> Signed-off-by: Bernhard Walle 
> ---
>  bin/ptxdist |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 74a52ad..4edbac3 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -2093,6 +2093,8 @@ setup_config() {
>   if [ ${cpus} -eq 0 ]; then
>   cpus=1
>   fi
> + elif [ "$(uname -s)" = Darwin ] ; then
> + cpus=$(sysctl -n hw.ncpu)

- Is sysctl alwyas in $PATH? On Linux it's in sbin.
- the value should be quoted.
- Does this _always_ and _only_ work on Mac OS X?

Maybe something like this:

elfi ! cpus="$(sysctl -n hw.ncpu)" 2> /dev/null; then
cpus=1
fi

Michael

>   else
>   cpus=1
>   fi
> -- 
> 1.7.7.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

-- 
ptxdist mailing list
ptxdist@pengutronix.de