Signed-off-by: Jon Ringle <[email protected]>
---
 bin/ptxdist                            |   19 +++-
 patches/klibc-1.5.15/series            |    7 +
 rules/Kconfig                          |    4 +
 rules/klibc.in                         |   15 ++-
 rules/klibc.make                       |  220 +++++++++++++++----------------
 scripts/lib/ptxd_make_world_install.sh |   14 ++-
 scripts/ptxdist_vars.sh                |    1 +
 7 files changed, 160 insertions(+), 120 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 5ca2553..e01faae 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -796,6 +796,7 @@ Misc:
                                <type> can be one of:
                                target, host, host-existing-target,
                                cross, cross-existing-target, source,
+                               klibc, klibc-existing-target,
                                kernel_driver, font, simple
   print <var>                  print the contents of a variable, in the way
                                it is known by "make"
@@ -1001,6 +1002,12 @@ newpacket() {
                class=cross-
                autoconf_class=HOST_CROSS_
                ;;
+       klibc)
+               template=template-klibc
+               template_src="${PTXDIST_TOPDIR}/rules/templates/src-cmake-prog"
+               class=
+               autoconf_class=
+               ;;
        src-cmake-prog)
                template=template-src-cmake
                template_src="${PTXDIST_TOPDIR}/rules/templates/src-cmake-prog"
@@ -1054,6 +1061,7 @@ newpacket() {
                echo "  host                     create package for development 
host"
                echo "  target                   create package for embedded 
target"
                echo "  cross                    create cross development 
package"
+               echo "  klibc                    create package for initramfs 
built agains klibc"
                echo
                echo "  src-cmake-prog           create cmake binary"
                echo "  src-autoconf-prog        create autotoolized binary"
@@ -1102,12 +1110,19 @@ newpacket() {
                autoconf_class=HOST_CROSS_
        fi
 
+       if [ "$action" = "klibc" ]  && [ -n "$exists" ]; then
+               action=klibc-existing-target
+               template=template-klibc-existing-target
+               class=klibc-
+               autoconf_class=KLIBC_
+       fi
+
        #
        # more questions ...
        #
 
        case "$action" in
-       host-existing-target|cross-existing-target)
+       host-existing-target|cross-existing-target|klibc-existing-target)
                ;;
        *)
                echo -n "${PROMPT}enter version number....: "
@@ -1116,7 +1131,7 @@ newpacket() {
        esac
 
        case "$action" in
-       host|target|cross)
+       host|target|cross|klibc)
                echo -n "${PROMPT}enter URL of basedir....: "
                read url
                echo -n "${PROMPT}enter suffix............: "
diff --git a/patches/klibc-1.5.15/series b/patches/klibc-1.5.15/series
index 6268d03..dc43f94 100644
--- a/patches/klibc-1.5.15/series
+++ b/patches/klibc-1.5.15/series
@@ -1 +1,8 @@
+# This series applies on GIT commit 3cf17996ea464e29ee5def45e06139f0f9e303e6
+fstype-sane-vfat-and-jffs2-for-1.5.patch
 0001-add-linux-arch-ARCH-include-to-search-path.patch
+use-headers_install.patch
+define-socklen_t_defined.patch
+fix-warning-SIGRTMAX-not-defined.patch
+fix-must_inline-gcc-4.3.patch
+fix-no_previous_prototype-ctype.patch
diff --git a/rules/Kconfig b/rules/Kconfig
index 7166aa1..d8391ef 100644
--- a/rules/Kconfig
+++ b/rules/Kconfig
@@ -38,6 +38,10 @@ menu "Core (libc, locales)          "
 source "generated/core.in"
 endmenu
 
+menu "Core (initramfs)              "
+source "generated/initramfs.in"
+endmenu
+
 comment "------------------------------------"
 
 menu "Shell & Console Tools         "
diff --git a/rules/klibc.in b/rules/klibc.in
index 1d07446..dcede4f 100644
--- a/rules/klibc.in
+++ b/rules/klibc.in
@@ -1,4 +1,4 @@
-## SECTION=core
+## SECTION=initramfs
 
 #
 # rules/klibc.in
@@ -247,6 +247,17 @@ if KLIBC_DYNAMIC_LIB
 #comment "Select shared linked commands to install"
 
 ######
+comment "Static  dash shell is selected!"
+       depends on KLIBC_STATIC_DASH
+
+config KLIBC_SHARED_DASH
+       depends on !KLIBC_STATIC_DASH
+       bool
+       prompt "dash"
+       help
+         install a minimum shared shell (dash) under /bin/sh
+
+######
 comment "Static cat command is selected!"
        depends on KLIBC_STATIC_CAT
 
@@ -478,6 +489,7 @@ comment "Static reboot command is selected!"
        depends on KLIBC_STATIC_REBOOT
 
 config KLIBC_SHARED_REBOOT
+       depends on !KLIBC_STATIC_REBOOT
        bool
        prompt "reboot"
        help
@@ -488,6 +500,7 @@ comment "Static resume command is selected!"
        depends on KLIBC_STATIC_RESUME
 
 config KLIBC_SHARED_RESUME
+       depends on !KLIBC_STATIC_REBOOT
        bool
        prompt "resume"
        help
diff --git a/rules/klibc.make b/rules/klibc.make
index 9bb5e60..e794ddf 100644
--- a/rules/klibc.make
+++ b/rules/klibc.make
@@ -27,7 +27,7 @@ KLIBC_SOURCE  := $(SRCDIR)/$(KLIBC).$(KLIBC_SUFFIX)
 KLIBC_DIR      := $(BUILDDIR)/$(KLIBC)
 
 ifdef PTXCONF_KLIBC
-$(STATEDIR)/kernel.compile: $(STATEDIR)/klibc.install
+$(STATEDIR)/kernel.compile: $(STATEDIR)/klibc.targetinstall
 endif
 
 # ----------------------------------------------------------------------------
@@ -42,9 +42,6 @@ $(KLIBC_SOURCE):
 # Prepare
 # ----------------------------------------------------------------------------
 
-KLIBC_PATH     := PATH=$(CROSS_PATH)
-KLIBC_ENV      := $(CROSS_ENV)
-
 $(STATEDIR)/klibc.prepare: $(STATEDIR)/kernel.prepare
        @$(call targetinfo)
        @echo                                   >  $(KLIBC_DIR)/defconfig
@@ -72,14 +69,13 @@ endif
 KLIBC_MAKEVARS := \
        $(PARALLELMFLAGS) \
        KLIBCARCH=$(PTXCONF_ARCH_STRING) \
-       CROSS_COMPILE=$(COMPILER_PREFIX) \
-       INSTALLROOT=$(SYSROOT)
+       CROSS_COMPILE=$(COMPILER_PREFIX)
 
 $(STATEDIR)/klibc.compile:
        @$(call targetinfo)
        rm -f $(KLIBC_DIR)/.config
        ln -sf $(KERNEL_DIR) $(KLIBC_DIR)/linux
-       cd $(KLIBC_DIR) && $(MAKE) $(KLIBC_MAKEVARS)
+       cd $(KLIBC_DIR) && $(MAKE) $(KLIBC_MAKEVARS) 
INSTALLDIR=$(SYSROOT)/usr/lib/klibc
        @$(call touch)
 
 # ----------------------------------------------------------------------------
@@ -105,250 +101,245 @@ KLIBC_CONTROL := $(KLIBC_DIR)/initramfs_spec
 $(STATEDIR)/klibc.install:
        @$(call targetinfo)
 
-       @echo "dir /dev/ 755 0 0"               >  $(KLIBC_CONTROL)
-       @echo "dir /proc/ 755 0 0"              >> $(KLIBC_CONTROL)
-       @echo "dir /sys/ 755 0 0"               >> $(KLIBC_CONTROL)
-       @echo "dir /bin/ 755 0 0"               >> $(KLIBC_CONTROL)
-       @echo "nod /dev/console 644 0 0 c 5 1"  >> $(KLIBC_CONTROL)
-       @echo "nod /dev/loop0 644 0 0 b 7 0"    >> $(KLIBC_CONTROL)
+#
+# install the compiler wrapper to be used to link programs against klibc
+#
+       install $(KLIBC_DIR)/klcc/klcc $(PTXCONF_SYSROOT_CROSS)/bin/klcc
+#
+# install a few commands to the local architecture directory
+# but important is the klibc.a only to link programs against it
+#
+       cd $(KLIBC_DIR) && $(MAKE) $(KLIBC_MAKEVARS) INSTALLROOT=$(SYSROOT) 
install
+
+#
+# make sure the kernel regenerates the initramfs image
+#
+       rm -f $(KERNEL_DIR)/usr/initramfs_data.cpio.gz
+
+       @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/klibc.targetinstall:
+       @$(call targetinfo)
+
+       @echo "# Generated initramfs" > $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, /dev);
+       @$(call install_initramfs, klibc, 0, 0, 0755, /proc);
+       @$(call install_initramfs, klibc, 0, 0, 0755, /sys);
+       @$(call install_initramfs, klibc, 0, 0, 0755, /bin);
+       @$(call install_initramfs, klibc, 0, 0, 0755, /sbin);
+       @$(call install_initramfs, klibc, 0, 0, 0755, /etc);
+       @$(call install_initramfs, klibc, 0, 0, 0755, /lib);
+       @$(call install_initramfs_node, klibc, 0, 0, 0600, c, 5, 1, 
/dev/console);
 #
 # select the static parts first
 #
 ifdef PTXCONF_KLIBC_STATIC_CAT
-       @echo "file /bin/cat $(KLIBC_BINSRC)/utils/static/cat 755 0 0"          
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/cat, /bin/cat);
 endif
 ifdef PTXCONF_KLIBC_STATIC_CHROOT
-       @echo "file /bin/chroot $(KLIBC_BINSRC)/utils/static/chroot 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/chroot, /bin/chroot);
 endif
 ifdef PTXCONF_KLIBC_STATIC_CPIO
-       @echo "file /bin/cpio $(KLIBC_BINSRC)/utils/static/cpio 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/cpio, /bin/cpio);
 endif
 ifdef PTXCONF_KLIBC_STATIC_DD
-       @echo "file /bin/dd $(KLIBC_BINSRC)/utils/static/dd 755 0 0"            
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/dd, /bin/dd);
 endif
 ifdef PTXCONF_KLIBC_STATIC_DMESG
-       @echo "file /bin/dmesg $(KLIBC_BINSRC)/utils/static/dmesg 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/dmesg, /bin/dmesg);
 endif
 ifdef PTXCONF_KLIBC_STATIC_FALSE
-       @echo "file /bin/false $(KLIBC_BINSRC)/utils/static/false 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/false, /bin/false);
 endif
 ifdef PTXCONF_KLIBC_STATIC_FSTYPE
-       @echo "file /bin/fstype $(KLIBC_BINSRC)/kinit/fstype/static/fstype 755 
0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/fstype, /bin/fstype);
 endif
 ifdef PTXCONF_KLIBC_STATIC_HALT
-       @echo "file /bin/halt $(KLIBC_BINSRC)/utils/static/halt 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/halt, /bin/halt);
 endif
 ifdef PTXCONF_KLIBC_STATIC_IPCONIFG
-       @echo "file /bin/ipconfig 
$(KLIBC_BINSRC)/kinit/ipconfig/static/ipconfig 755 0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/ipconfig, /bin/ipconfig);
 endif
 ifdef PTXCONF_KLIBC_STATIC_KILL
-       @echo "file /bin/kill $(KLIBC_BINSRC)/utils/static/kill 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/kill, /bin/kill);
 endif
 ifdef PTXCONF_KLIBC_STATIC_LN
-       @echo "file /bin/ln $(KLIBC_BINSRC)/utils/static/ln 755 0 0"            
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/ln, /bin/ln);
 endif
 ifdef PTXCONF_KLIBC_STATIC_MINIPS
-       @echo "file /bin/minips $(KLIBC_BINSRC)/utils/static/minips 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/minips, /bin/minips);
 endif
 ifdef PTXCONF_KLIBC_STATIC_MKDIR
-       @echo "file /bin/mkdir $(KLIBC_BINSRC)/utils/static/mkdir 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/mkdir, /bin/mkdir);
 endif
 ifdef PTXCONF_KLIBC_STATIC_MKFIFO
-       @echo "file /bin/mkfifo $(KLIBC_BINSRC)/utils/static/mkfifo 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/mkfifo, /bin/mkfifo);
 endif
 ifdef PTXCONF_KLIBC_STATIC_MKNOD
-       @echo "file /bin/mknod $(KLIBC_BINSRC)/utils/static/mknod 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/mknod, /bin/mknod);
 endif
 ifdef PTXCONF_KLIBC_STATIC_MOUNT
-       @echo "file /bin/mount $(KLIBC_BINSRC)/utils/static/mount 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/mount, /bin/mount);
 endif
 ifdef PTXCONF_KLIBC_STATIC_NFSMOUNT
-       @echo "file /bin/nfsmount 
$(KLIBC_BINSRC)/kinit/nfsmount/static/nfsmount 755 0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/nfsmount, /bin/nfsmount);
 endif
 ifdef PTXCONF_KLIBC_STATIC_NUKE
-       @echo "file /bin/nuke $(KLIBC_BINSRC)/utils/static/nuke 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/nuke, /bin/nuke);
 endif
 ifdef PTXCONF_KLIBC_STATIC_PIVOT_ROOT
-       @echo "file /bin/pivot_root $(KLIBC_BINSRC)/utils/static/pivot_root 755 
0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/pivot_root, /bin/pivot_root);
 endif
 ifdef PTXCONF_KLIBC_STATIC_POWEROFF
-       @echo "file /bin/poweroff $(KLIBC_BINSRC)/utils/static/poweroff 755 0 
0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/poweroff, /bin/poweroff);
 endif
 ifdef PTXCONF_KLIBC_STATIC_READLINK
-       @echo "file /bin/readlink $(KLIBC_BINSRC)/utils/static/readlink 755 0 
0">> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/readlink, /bin/readlink);
 endif
 ifdef PTXCONF_KLIBC_STATIC_REBOOT
-       @echo "file /bin/reboot $(KLIBC_BINSRC)/utils/static/reboot 755 0 0" >> 
$(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/reboot, /bin/reboot);
 endif
 ifdef PTXCONF_KLIBC_STATIC_RESUME
-       @echo "file /bin/resume $(KLIBC_BINSRC)/kinit/resume/static/resume 755 
0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/resume, /bin/resume);
 endif
 ifdef PTXCONF_KLIBC_STATIC_RUN_INIT
-       @echo "file /bin/run-init 
$(KLIBC_BINSRC)/kinit/run-init/static/run-init 755 0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/run-init, /bin/run-init);
 endif
 ifdef PTXCONF_KLIBC_STATIC_SLEEP
-       @echo "file /bin/sleep $(KLIBC_BINSRC)/utils/static/sleep 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/sleep, /bin/sleep);
 endif
 ifdef PTXCONF_KLIBC_STATIC_SYNC
-       @echo "file /bin/sync $(KLIBC_BINSRC)/utils/static/sync 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/sync, /bin/sync);
 endif
 ifdef PTXCONF_KLIBC_STATIC_TRUE
-       @echo "file /bin/true $(KLIBC_BINSRC)/utils/static/true 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/true, /bin/true);
 endif
 ifdef PTXCONF_KLIBC_STATIC_UMOUNT
-       @echo "file /bin/umount $(KLIBC_BINSRC)/utils/static/umount 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/umount, /bin/umount);
 endif
 ifdef PTXCONF_KLIBC_STATIC_UNAME
-       @echo "file /bin/uname $(KLIBC_BINSRC)/utils/static/uname 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/static/uname, /bin/uname);
 endif
 
 ifdef PTXCONF_KLIBC_STATIC_DASH
-       @echo "file /bin/sh $(KLIBC_BINSRC)/dash/sh 755 0 0"                    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, $(KLIBC_BINSRC)/dash/sh, 
/bin/sh);
+endif
+ifdef PTXCONF_KLIBC_SHARED_DASH
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/dash/sh.shared, /bin/sh);
 endif
 
 ifdef PTXCONF_KLIBC_KINIT
-       @echo "file /kinit $(KLIBC_BINSRC)/kinit/kinit 755 0 0"                 
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/kinit/kinit, /kinit);
 endif
 
 #
 # select the dynamics
-# FIXME: Untested and not fully supported yet!
 #
 ifdef PTXCONF_KLIBC_DYNAMIC_LIB
-       @echo "dir /lib/ 755 0 0" >> $(KLIBC_CONTROL)
-       @echo "file /lib/klibc.so $(KLIBC_BINSRC)/utils/klibc/klibc.so 755 0 0" 
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, /lib);
+       @for f in `ls $(KLIBC_BINSRC)/klibc/klibc-*.so`; do \
+               $(call install_initramfs, klibc, 0, 0, 0755, $$f, 
/lib/$$(basename $$f)); \
+       done
 endif
 ifdef PTXCONF_KLIBC_SHARED_CAT
-       @echo "file /bin/cat $(KLIBC_BINSRC)/utils/shared/cat 755 0 0"          
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/cat, /bin/cat);
 endif
 ifdef PTXCONF_KLIBC_SHARED_CHROOT
-       @echo "file /bin/chroot $(KLIBC_BINSRC)/utils/shared/chroot 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/chroot, /bin/chroot);
 endif
 ifdef PTXCONF_KLIBC_SHARED_CPIO
-       @echo "file /bin/cpio $(KLIBC_BINSRC)/utils/shared/cpio 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/cpio, /bin/cpio);
 endif
 ifdef PTXCONF_KLIBC_SHARED_DD
-       @echo "file /bin/dd $(KLIBC_BINSRC)/utils/shared/dd 755 0 0"            
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/dd, /bin/dd);
 endif
 ifdef PTXCONF_KLIBC_SHARED_DMESG
-       @echo "file /bin/dmesg $(KLIBC_BINSRC)/utils/shared/dmesg 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/dmesg, /bin/dmesg);
 endif
 ifdef PTXCONF_KLIBC_SHARED_FALSE
-       @echo "file /bin/false $(KLIBC_BINSRC)/utils/shared/false 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/false, /bin/false);
 endif
 ifdef PTXCONF_KLIBC_SHARED_FSTYPE
-       @echo "file /bin/fstype $(KLIBC_BINSRC)/kinit/fstype/shared/fstype 755 
0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/kinit/fstype/shared/fstype, /bin/fstype);
 endif
 ifdef PTXCONF_KLIBC_SHARED_HALT
-       @echo "file /bin/halt $(KLIBC_BINSRC)/utils/shared/halt 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/halt, /bin/halt);
 endif
 ifdef PTXCONF_KLIBC_SHARED_IPCONIFG
-       @echo "file /bin/ipconfig 
$(KLIBC_BINSRC)/kinit/ipconfig/shared/ipconfig 755 0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/kinit/ipconfig/shared/ipconfig, /bin/ipconfig);
 endif
 ifdef PTXCONF_KLIBC_SHARED_KILL
-       @echo "file /bin/kill $(KLIBC_BINSRC)/utils/shared/kill 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/kill, /bin/kill);
 endif
 ifdef PTXCONF_KLIBC_SHARED_LN
-       @echo "file /bin/ln $(KLIBC_BINSRC)/utils/shared/ln 755 0 0"            
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/ln, /bin/ln);
 endif
 ifdef PTXCONF_KLIBC_SHARED_MINIPS
-       @echo "file /bin/minips $(KLIBC_BINSRC)/utils/shared/minips 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/minips, /bin/minips);
 endif
 ifdef PTXCONF_KLIBC_SHARED_MKDIR
-       @echo "file /bin/mkdir $(KLIBC_BINSRC)/utils/shared/mkdir 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/mkdir, /bin/mkdir);
 endif
 ifdef PTXCONF_KLIBC_SHARED_MKFIFO
-       @echo "file /bin/mkfifo $(KLIBC_BINSRC)/utils/shared/mkfifo 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/mkfifo, /bin/mkfifo);
 endif
 ifdef PTXCONF_KLIBC_SHARED_MKNOD
-       @echo "file /bin/mknod $(KLIBC_BINSRC)/utils/shared/mknod 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/mknod, /bin/mknod);
 endif
 ifdef PTXCONF_KLIBC_SHARED_MOUNT
-       @echo "file /bin/mount $(KLIBC_BINSRC)/utils/shared/mount 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/mount, /bin/mount);
 endif
 ifdef PTXCONF_KLIBC_SHARED_NFSMOUNT
-       @echo "file /bin/nfsmount 
$(KLIBC_BINSRC)/kinit/nfsmount/shared/nfsmount 755 0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/kinit/nfsmount/shared/nfsmount, /bin/nfsmount);
 endif
 ifdef PTXCONF_KLIBC_SHARED_NUKE
-       @echo "file /bin/nuke $(KLIBC_BINSRC)/utils/shared/nuke 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/nuke, /bin/nuke);
 endif
 ifdef PTXCONF_KLIBC_SHARED_PIVOT_ROOT
-       @echo "file /bin/pivot_root $(KLIBC_BINSRC)/utils/shared/pivot_root 755 
0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/pivot_root, /bin/pivot_root);
 endif
 ifdef PTXCONF_KLIBC_SHARED_POWEROFF
-       @echo "file /bin/poweroff $(KLIBC_BINSRC)/utils/shared/poweroff 755 0 
0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/poweroff, /bin/poweroff);
 endif
 ifdef PTXCONF_KLIBC_SHARED_READLINK
-       @echo "file /bin/readlink $(KLIBC_BINSRC)/utils/shared/readlink 755 0 
0">> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/readlink, /bin/readlink);
 endif
 ifdef PTXCONF_KLIBC_SHARED_REBOOT
-       @echo "file /bin/reboot $(KLIBC_BINSRC)/utils/shared/reboot 755 0 0" >> 
$(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/reboot, /bin/reboot);
 endif
 ifdef PTXCONF_KLIBC_SHARED_RESUME
-       @echo "file /bin/resume $(KLIBC_BINSRC)/kinit/resume/shared/resume 755 
0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/kinit/resume/shared/resume, /bin/resume);
 endif
 ifdef PTXCONF_KLIBC_SHARED_RUN_INIT
-       @echo "file /bin/run-init 
$(KLIBC_BINSRC)/kinit/run-init/shared/run-init 755 0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/kinit/run-init/shared/run-init, /bin/run-init);
 endif
 ifdef PTXCONF_KLIBC_SHARED_SLEEP
-       @echo "file /bin/sleep $(KLIBC_BINSRC)/utils/shared/sleep 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/sleep, /bin/sleep);
 endif
 ifdef PTXCONF_KLIBC_SHARED_SYNC
-       @echo "file /bin/sync $(KLIBC_BINSRC)/utils/shared/sync 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/sync, /bin/sync);
 endif
 ifdef PTXCONF_KLIBC_SHARED_TRUE
-       @echo "file /bin/true $(KLIBC_BINSRC)/utils/shared/true 755 0 0"        
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/true, /bin/true);
 endif
 ifdef PTXCONF_KLIBC_SHARED_UMOUNT
-       @echo "file /bin/umount $(KLIBC_BINSRC)/utils/shared/umount 755 0 0"    
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/umount, /bin/umount);
 endif
 ifdef PTXCONF_KLIBC_SHARED_UNAME
-       @echo "file /bin/uname $(KLIBC_BINSRC)/utils/shared/uname 755 0 0"      
>> $(KLIBC_CONTROL)
+       @$(call install_initramfs, klibc, 0, 0, 0755, 
$(KLIBC_BINSRC)/utils/shared/uname, /bin/uname);
 endif
 
 #
 # add the link when enabled
 #
 ifneq ($(call remove_quotes,$(PTXCONF_KLIBC_INIT)),)
-       @echo "slink /init $(PTXCONF_KLIBC_INIT) 755 0 0" >> $(KLIBC_CONTROL)
+       @$(call install_initramfs_link, klibc, /init, $(PTXCONF_KLIBC_INIT));
 endif
-#
-# adding user specific files to the list
-# Note: files without a leading '/' get a prefix path of the current project
-#
-ifdef PTXCONF_KLIBC_USER_SPEC
-       cat $(PTXDIST_WORKSPACE)/initramfs_spec | while read type target source 
rest; do        \
-               if [ "$$type" == "file" ]; then                                 
                \
-                       if [ "$$(echo "$$source" | grep "^/")" == "" ]; then    
                \
-                               source=$(PTXDIST_WORKSPACE)/$$source;           
                \
-                       fi;                                                     
                \
-               fi;                                                             
                \
-               echo "$$type $$target $$source $$rest" >> $(KLIBC_CONTROL);     
                \
-       done
-endif
-#
-# install the compiler wrapper to be used to link programs against klibc
-#
-       install $(KLIBC_DIR)/klcc/klcc $(PTXCONF_SYSROOT_CROSS)/bin/klcc
-#
-# install a few commands to the local architecture directory
-# but important is the klibc.a only to link programs against it
-#
-       cd $(KLIBC_DIR) && $(MAKE) $(KLIBC_MAKEVARS) install
 
-#
-# make sure the kernel regenerates the initramfs image
-#
-       rm -f $(KERNEL_DIR)/usr/initramfs_data.cpio.gz
-
-       @$(call touch)
-
-# ----------------------------------------------------------------------------
-# Target-Install
-# ----------------------------------------------------------------------------
-
-$(STATEDIR)/klibc.targetinstall:
-       @$(call targetinfo)
        @$(call touch)
 
 # ----------------------------------------------------------------------------
@@ -357,8 +348,9 @@ $(STATEDIR)/klibc.targetinstall:
 
 klibc_clean:
        rm -rf $(STATEDIR)/klibc.*
-       rm -rf $(PKGDIR)/klibc_*
+       rm -rf $(PKGDIR)/klibc{-,_}*
        rm -rf $(KLIBC_DIR)
        rm -rf $(PTXCONF_SYSROOT_CROSS)/bin/klcc
+       rm -rf $(SYSROOT)/usr/lib/klibc
 
 # vim: syntax=make
diff --git a/scripts/lib/ptxd_make_world_install.sh 
b/scripts/lib/ptxd_make_world_install.sh
index d089227..3a3d8fa 100644
--- a/scripts/lib/ptxd_make_world_install.sh
+++ b/scripts/lib/ptxd_make_world_install.sh
@@ -54,11 +54,19 @@ ptxd_make_world_install_target() {
        return
     fi &&
 
+    #local sysroot=${PTXDIST_SYSROOT_TARGET}
+
+    local sysroot
+    case "${pkg_stamp}" in
+       initramfs-*|klibc-*) sysroot=${PTXDIST_SYSROOT_TARGET}/usr/lib/klibc ;;
+       *)       sysroot=${PTXDIST_SYSROOT_TARGET} ;;
+    esac
+
     # prefix paths in la files with sysroot
     find "${pkg_pkgdir}" -name "*.la" -print0 | xargs -r -0 -- \
        sed -i \
-       -e "/^dependency_libs/s:\( 
\)\(/lib\|/usr/lib\):\1${PTXDIST_SYSROOT_TARGET}\2:g" \
-       -e 
"/^libdir=/s:\(libdir='\)\(/lib\|/usr/lib\):\1${PTXDIST_SYSROOT_TARGET}\2:g" &&
+       -e "/^dependency_libs/s:\( \)\(/lib\|/usr/lib\):\1${sysroot}\2:g" \
+       -e "/^libdir=/s:\(libdir='\)\(/lib\|/usr/lib\):\1${sysroot}\2:g" &&
     check_pipe_status &&
 
     # make pkgconfig's pc files relocatable
@@ -66,7 +74,7 @@ ptxd_make_world_install_target() {
        xargs -r -0 gawk -f 
"${PTXDIST_LIB_DIR}/ptxd_make_world_install_mangle_pc.awk"
     check_pipe_status &&
 
-    cp -dprf -- "${pkg_pkgdir}"/* "${PTXDIST_SYSROOT_TARGET}"
+    cp -dprf -- "${pkg_pkgdir}"/* "${sysroot}"
 }
 export -f ptxd_make_world_install_target
 
diff --git a/scripts/ptxdist_vars.sh b/scripts/ptxdist_vars.sh
index feb395b..35dbdd5 100644
--- a/scripts/ptxdist_vars.sh
+++ b/scripts/ptxdist_vars.sh
@@ -15,6 +15,7 @@ PROJECTPOSTRULESDIR=${PTXDIST_WORKSPACE}/rules/post
 
 # created dirs during build
 BUILDDIR=${PTXDIST_PLATFORMDIR}/build-target
+KLIBC_BUILDDIR=${PTXDIST_PLATFORMDIR}/build-target-klibc
 CROSS_BUILDDIR=${PTXDIST_PLATFORMDIR}/build-cross
 HOST_BUILDDIR=${PTXDIST_PLATFORMDIR}/build-host
 PKGDIR=${PTXDIST_PLATFORMDIR}/packages
-- 
1.6.3.3.334.g916e1


--
ptxdist mailing list
[email protected]

Reply via email to