[3320] | 1 | Summary: Statically linked binary providing simplified versions of system commands
|
---|
| 2 | Name: busybox
|
---|
| 3 | Version: 1.15.1
|
---|
| 4 | Release: 1%{?dist}
|
---|
| 5 | Epoch: 1
|
---|
| 6 | License: GPLv2
|
---|
| 7 | Group: System Environment/Shells
|
---|
| 8 | Source: http://www.busybox.net/downloads/%{name}-%{version}.tar.bz2
|
---|
| 9 | Source1: busybox-static.config
|
---|
| 10 | Source2: busybox-petitboot.config
|
---|
| 11 | Source3: http://www.uclibc.org/downloads/uClibc-0.9.30.1.tar.bz2
|
---|
| 12 | Source4: uClibc.config
|
---|
| 13 | Patch16: busybox-1.10.1-hwclock.patch
|
---|
| 14 | # patch to avoid conflicts with getline() from stdio.h, already present in upstream VCS
|
---|
| 15 | Patch22: uClibc-0.9.30.1-getline.patch
|
---|
| 16 | Obsoletes: busybox-anaconda
|
---|
| 17 | URL: http://www.busybox.net
|
---|
| 18 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
---|
| 19 | BuildRequires: libselinux-devel >= 1.27.7-2
|
---|
| 20 | BuildRequires: libsepol-devel
|
---|
| 21 | BuildRequires: libselinux-static
|
---|
| 22 | BuildRequires: libsepol-static
|
---|
| 23 | BuildRequires: glibc-static
|
---|
| 24 |
|
---|
| 25 | %define debug_package %{nil}
|
---|
| 26 |
|
---|
| 27 | %package petitboot
|
---|
| 28 | Group: System Environment/Shells
|
---|
| 29 | Summary: Version of busybox configured for use with petitboot
|
---|
| 30 |
|
---|
| 31 | %description
|
---|
| 32 | Busybox is a single binary which includes versions of a large number
|
---|
| 33 | of system commands, including a shell. This package can be very
|
---|
| 34 | useful for recovering from certain types of system failures,
|
---|
| 35 | particularly those involving broken shared libraries.
|
---|
| 36 |
|
---|
| 37 | %description petitboot
|
---|
| 38 | Busybox is a single binary which includes versions of a large number
|
---|
| 39 | of system commands, including a shell. The version contained in this
|
---|
| 40 | package is a minimal configuration intended for use with the Petitboot
|
---|
| 41 | bootloader used on PlayStation 3. The busybox package provides a binary
|
---|
| 42 | better suited to normal use.
|
---|
| 43 |
|
---|
| 44 | %prep
|
---|
| 45 | %setup -q -a3
|
---|
| 46 | %patch16 -b .ia64 -p1
|
---|
| 47 | cat %{SOURCE4} >uClibc-0.9.30.1/.config1
|
---|
| 48 | %patch22 -b .getline -p1
|
---|
| 49 |
|
---|
| 50 | %build
|
---|
| 51 | # create static busybox - the executable is kept as busybox-static
|
---|
| 52 | # We use uclibc instead of system glibc, uclibc is several times
|
---|
| 53 | # smaller, this is important for static build.
|
---|
| 54 | # Build uclibc first.
|
---|
| 55 | cd uClibc-0.9.30.1
|
---|
| 56 | # fixme:
|
---|
| 57 | mkdir kernel-include
|
---|
| 58 | cp -a /usr/include/asm kernel-include
|
---|
| 59 | cp -a /usr/include/asm-generic kernel-include
|
---|
| 60 | cp -a /usr/include/linux kernel-include
|
---|
| 61 | # uclibc can't be built on ppc64,s390,ia64, we set $arch to "" in this case
|
---|
| 62 | arch=`uname -m | sed -e 's/i.86/i386/' -e 's/ppc/powerpc/' -e 's/ppc64//' -e 's/powerpc64//' -e 's/ia64//' -e 's/s390.*//'`
|
---|
| 63 | echo "TARGET_$arch=y" >.config
|
---|
| 64 | echo "TARGET_ARCH=\"$arch\"" >>.config
|
---|
| 65 | cat .config1 >>.config
|
---|
| 66 | if test "$arch"; then yes "" | make oldconfig; fi
|
---|
| 67 | if test "$arch"; then cat .config; fi
|
---|
| 68 | if test "$arch"; then make V=1; fi
|
---|
| 69 | if test "$arch"; then make install; fi
|
---|
| 70 | if test "$arch"; then make install_kernel_headers; fi
|
---|
| 71 | cd ..
|
---|
| 72 | # we are back in busybox-NN.MM dir now
|
---|
| 73 | cp %{SOURCE1} .config
|
---|
| 74 | # set all new options to defaults
|
---|
| 75 | yes "" | make oldconfig
|
---|
| 76 | # gcc needs to be convinced to use neither system headers, nor libs,
|
---|
| 77 | # nor startfiles (i.e. crtXXX.o files)
|
---|
| 78 | if test "$arch"; then \
|
---|
| 79 | mv .config .config1 && \
|
---|
| 80 | grep -v ^CONFIG_SELINUX .config1 >.config && \
|
---|
| 81 | yes "" | make oldconfig && \
|
---|
| 82 | cat .config && \
|
---|
| 83 | make V=1 \
|
---|
| 84 | EXTRA_CFLAGS="-isystem uClibc-0.9.30.1/installed/include" \
|
---|
| 85 | CFLAGS_busybox="-static -nostartfiles -LuClibc-0.9.30.1/installed/lib uClibc-0.9.30.1/installed/lib/crt1.o uClibc-0.9.30.1/installed/lib/crti.o uClibc-0.9.30.1/installed/lib/crtn.o"; \
|
---|
| 86 | else \
|
---|
| 87 | cat .config && \
|
---|
| 88 | make V=1 CC="gcc $RPM_OPT_FLAGS"; \
|
---|
| 89 | fi
|
---|
| 90 | cp busybox busybox.static
|
---|
| 91 |
|
---|
| 92 | # create busybox optimized for petitboot
|
---|
| 93 | make clean
|
---|
| 94 | # copy new configuration file
|
---|
| 95 | cp %{SOURCE2} .config
|
---|
| 96 | # set all new options to defaults
|
---|
| 97 | yes "" | make oldconfig
|
---|
| 98 | make V=1 CC="%__cc $RPM_OPT_FLAGS"
|
---|
| 99 | cp busybox busybox.petitboot
|
---|
| 100 |
|
---|
| 101 | %install
|
---|
| 102 | rm -rf $RPM_BUILD_ROOT
|
---|
| 103 | mkdir -p $RPM_BUILD_ROOT/sbin
|
---|
| 104 | install -m 755 busybox.static $RPM_BUILD_ROOT/sbin/busybox
|
---|
| 105 | install -m 755 busybox.petitboot $RPM_BUILD_ROOT/sbin/busybox.petitboot
|
---|
| 106 |
|
---|
| 107 | %clean
|
---|
| 108 | rm -rf $RPM_BUILD_ROOT
|
---|
| 109 |
|
---|
| 110 | %files
|
---|
| 111 | %defattr(-,root,root,-)
|
---|
| 112 | %doc LICENSE docs/busybox.net/*.html
|
---|
| 113 | /sbin/busybox
|
---|
| 114 |
|
---|
| 115 | %files petitboot
|
---|
| 116 | %defattr(-,root,root,-)
|
---|
| 117 | %doc LICENSE
|
---|
| 118 | /sbin/busybox.petitboot
|
---|
| 119 |
|
---|
| 120 | %changelog
|
---|