%define name klibc %define version 1.5.21 %define release %mkrel 5 Summary: A minimal libc subset for use with initramfs Name: %name Version: %version Release: %release License: BSD/GPL Group: System/Libraries URL: http://www.zytor.com/mailman/listinfo/klibc Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.bz2 Patch0: klibc-1.5.21-ipconfig.patch BuildRequires: kernel-source-latest %define klibcdir %{_prefix}/lib/klibc %define libdocdir %{_docdir}/%{name}-%{version}-%{release} %define bindocdir %{_docdir}/%{name}-utils-%{version}-%{release} %description %{name} is intended to be a minimalistic libc subset for use with initramfs. It is deliberately written for small size, minimal entanglement, and portability, not speed. %package devel Summary: Libraries and tools needed to compile applications against klibc Group: Development/Kernel Requires: klibc = %{version}-%{release} %description devel This package contains the link libraries, header files, and gcc wrapper scripts needed to compile applications against klibc. %package utils Summary: Small utilities built with klibc Group: System/Base Requires: klibc = %{version}-%{release} %description utils This package contains a collection of programs that are linked against klibc. These duplicate some of the functionality of a regular Linux toolset, but are typically much smaller than their full-function counterparts. They are intended for inclusion in initramfs images and embedded systems. %prep %setup -q %patch0 -p1 # We have to build against the latest kernel from the repository # The running kernel doesn't count. So let's found what's the release # of the kernel just installed with kernel-source-latest KERNEL_VER=$(rpm -qa --last | grep kernel-source-latest | awk {'print $1'} | sed -e "s/kernel\-source\-latest-\(.*mga\).*/\1/g") echo "Linux kernel version $KERNEL_VER detected" cp -dRs /usr/src/linux-$KERNEL_VER/ ./linux # Shouldn't need this when getting the build tree from /lib/modules # make -C linux defconfig ARCH=%{_target_cpu} # make -C linux prepare ARCH=%{_target_cpu} # Deal with braindamage in RedHat's kernel-source RPM rm -f linux/include/linux/config.h cat <<EOF > linux/include/linux/config.h #ifndef _LINUX_CONFIG_H #define _LINUX_CONFIG_H #include <linux/autoconf.h> #endif EOF mkdir -p %{buildroot} %build make %{_smp_mflags} \ KLIBCARCH=%{_arch} prefix=%{_prefix} bindir=%{_bindir} \ INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} %install rm -rf %{buildroot} make KLIBCARCH=%{_arch} prefix=%{_prefix} bindir=%{_bindir} \ INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} \ install # Make the .so file in /lib a hardlink (they will be expanded as two # files automatically if it crosses filesystems when extracted.) ln -f %{buildroot}%{klibcdir}/lib/klibc-*.so %{buildroot}/lib # Install the docs mkdir -p %{buildroot}%{bindocdir} %{buildroot}%{libdocdir} install -m 444 README %{buildroot}%{libdocdir} install -m 444 usr/klibc/README.klibc %{buildroot}%{libdocdir} install -m 444 usr/klibc/arch/README.klibc.arch %{buildroot}%{libdocdir} install -m 444 usr/gzip/COPYING %{buildroot}%{bindocdir}/COPYING.gzip install -m 444 usr/gzip/README %{buildroot}%{bindocdir}/README.gzip install -m 444 usr/kinit/ipconfig/README.ipconfig %{buildroot}%{bindocdir} install -m 444 usr/kinit/README %{buildroot}%{bindocdir}/README.kinit %clean rm -rf $RPM_BUILD_ROOT # # Note: libc.so and interp.o are technically -devel files, but # put them in this package until we can make really, really sure # the dependency system can avoid confusion. (In fact, it would be # good to eventually get them out of here, so that multiple runtimes # can be installed should it be necessary.) # %files %defattr(-,root,root,-) /lib/klibc-*.so %{klibcdir}/lib/*.so %{klibcdir}/lib/interp.o %files devel %defattr(-,root,root,-) %{klibcdir}/include %{klibcdir}/lib/*.a %{klibcdir}/lib/crt0.o %{_bindir}/klcc %doc %{_mandir}/man1/* %doc %{libdocdir}/* %files utils %defattr(-,root,root,-) %{klibcdir}/bin %doc %{bindocdir}/* %changelog * Fri May 20 2011 tmb <tmb> 1.5.21-5.mga1 + Revision: 99899 - drop buildroot - drop _target_cpu hack and use _arch directly * Thu May 19 2011 tmb <tmb> 1.5.21-4.mga1 + Revision: 99803 - dont override _target_cpu during build + erwan <erwan> - Fixing release numbering.. silly me. - Related to CVE-2011-0997 & CVE-2011-1930 ipconfig vulnerability for malicious dhcpd if $DNSDOMAIN is later used unquoted, than proof of concept involves DNSDOMAIN="\\\"\$(echo owned; touch /tmp/owned)" The applied patch went from upstream and fix this issue. * Sun Apr 03 2011 wally <wally> 1.5.21-2.mga1 + Revision: 79957 - fix groups (mga#509) * Thu Jan 27 2011 erwan <erwan> 1.5.21-1.mga1 + Revision: 42165 - new release 1.5.21 * Sat Jan 22 2011 dmorgan <dmorgan> 1.5.20-1.mga1 + Revision: 30758 - Fix summary + erwan <erwan> - Fixing patch inclusion - Preventing infinite loop with make 3.82 - Fixing kernel detection - Fixing description - imported package klibc * Tue Mar 1 2005 H. Peter Anvin <hpa@zytor.com> - New "make install" scheme, klcc * Tue Jul 6 2004 H. Peter Anvin <hpa@zytor.com> - Update to use kernel-source RPM for the kernel symlink. * Sat Nov 29 2003 Bryan O'Sullivan <bos@serpentine.com> - - Initial build.