[klibc] Make building dash O= friendly

- dash was broken with make O=.. - fixet
- fix bug in vanilla kbuild so arguments to hostprogs are properly
  passed also with make O=..

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] Smart default for _KLIBC_NO_MMU

Assume we have an MMU if either sys_mmap or sys_mmap2 exist; otherwise not.
This can of course be overridden by <klibc/archconfig.h> still.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] Fix comment: __getpageshift not __getpagesize

Fix a mistaken reference to __getpagesize() in a comment (there is no such
function.)  It is supposed to be __getpageshift().

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1.3.4 released, next version is 1.3.5
[klibc] kinit support for mounting MTDs as root

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Merge with git+ssh://master.kernel.org/pub/scm/libs/klibc/klibc.git
[klibc] Handle dependencies on bison output correctly

Bison produces both arith.c and arith.h from arith.y.  make doesn't
handle this properly for an explicit rule, running the program twice
in parallel, causing havoc.  Instead of the hack used previously to
make this running in parallel safe, use a pattern rule which makes
make behave correctly.  Also, kbuild-ize the bison rule.

Based on a bug report and patch by Andrew Morton <akpm@osdl.org>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] Prevent multiple inclusion of header files

From: Andrew Morton <akpm@osdl.org>

In file included from usr/dash/arith_yylex.c:37:
usr/dash/expand.h: At top level:
usr/dash/expand.h:37: error: redefinition of `struct strlist'
usr/dash/expand.h:43: error: redefinition of `struct arglist'
In file included from usr/dash/arith_yylex.c:38:
usr/dash/error.h:59: error: redefinition of `struct jmploc'

Signed-off-by: Andrew Morton <akpm@osdl.org>
Modified-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] More portable use of mktemp

Just plain "mktemp" apparently doesn't work on all platforms.  Also
honour $TMPDIR if it's set.

Based on a patch from Andrew Morton <akpm@osdl.org>, with corrections
from Bodo Eggert <7eggert@gmx.de>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] dash: clean up mksyntax rules; remove mksignames

mksyntax was run twice for no good reason (and possible to the
detriment of parallel execution); use a dummy rule like for
mknodes.

mksignames isn't used (and it was never cross-compile correct.)
Remove it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] dash: More Kbuild rule cleanup

Use "&&" after cd instead of ";"; invoke mksyntax by name.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Merge with git+ssh://hera.kernel.org/pub/scm/libs/klibc/klibc.git
[klibc] Add missing #includes

<klibc/sysconfig.h> needs <asm/unistd.h> since many of the defaults
are keyed on the existence of specific system calls.

malloc.c needs <unistd.h> in case _KLIBC_NO_MMU is defined.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1.3.5 released, next version is 1.3.6
kbuild: fix usr/Kbuild to use new usr/gen_initramfs.sh

Fix usr/Kbuild so it utilise the new gen_initramfs.sh script
which will rebuild initramfs when the content has changed.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
[klibc] dash: force signedness where needed to make cross-compile-safe

dash used to rely on mksyntax being run on the same architecture as
the final binary in order to determine signedness of "char".  This
doesn't work for cross-compiling.

Hi Peter:

Here is the patch.  I chose signed char instead of unsigned char as
the canonical form as that generates better/smaller code on x86.

I've verified that the assembly output is identical on x86 except
for a real bug fix in expand.c.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Merge with git+ssh://master.kernel.org/pub/scm/libs/klibc/klibc.git
[klibc] Correct support for uClinux

uClinux DOES have mmap et al;
uClinux DOES NOT have fork and brk.

Also update porting guide.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] kinit: use vfork() rather than fork(), for the benefit of uClinux

uClinux doesn't have fork().  Replace fork() with vfork() where it is
legal to do so.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
[klibc] nfsmount: portmap spoofer cleanups

Clean up the code surrounding the portmap spoofer, and disable the
portmap spoofer on uClinux (no fork).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>