busybox.spec 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. %define debug_package %{nil}
  25. %package petitboot
  26. Group: System Environment/Shells
  27. Summary: Version of busybox configured for use with petitboot
  28. %description
  29. Busybox is a single binary which includes versions of a large number
  30. of system commands, including a shell. This package can be very
  31. useful for recovering from certain types of system failures,
  32. particularly those involving broken shared libraries.
  33. %description petitboot
  34. Busybox is a single binary which includes versions of a large number
  35. of system commands, including a shell. The version contained in this
  36. package is a minimal configuration intended for use with the Petitboot
  37. bootloader used on PlayStation 3. The busybox package provides a binary
  38. better suited to normal use.
  39. %prep
  40. %setup -q -a3
  41. %patch16 -b .ia64 -p1
  42. cat %{SOURCE4} >uClibc-0.9.30.1/.config1
  43. %patch22 -b .getline -p1
  44. %build
  45. # create static busybox - the executable is kept as busybox-static
  46. # We use uclibc instead of system glibc, uclibc is several times
  47. # smaller, this is important for static build.
  48. # Build uclibc first.
  49. cd uClibc-0.9.30.1
  50. # fixme:
  51. mkdir kernel-include
  52. cp -a /usr/include/asm kernel-include
  53. cp -a /usr/include/asm-generic kernel-include
  54. cp -a /usr/include/linux kernel-include
  55. # uclibc can't be built on ppc64,s390,ia64, we set $arch to "" in this case
  56. 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.*//'`
  57. echo "TARGET_$arch=y" >.config
  58. echo "TARGET_ARCH=\"$arch\"" >>.config
  59. cat .config1 >>.config
  60. if test "$arch"; then yes "" | make oldconfig; fi
  61. if test "$arch"; then cat .config; fi
  62. if test "$arch"; then make V=1; fi
  63. if test "$arch"; then make install; fi
  64. if test "$arch"; then make install_kernel_headers; fi
  65. cd ..
  66. # we are back in busybox-NN.MM dir now
  67. cp %{SOURCE1} .config
  68. # set all new options to defaults
  69. yes "" | make oldconfig
  70. # gcc needs to be convinced to use neither system headers, nor libs,
  71. # nor startfiles (i.e. crtXXX.o files)
  72. if test "$arch"; then \
  73. mv .config .config1 && \
  74. grep -v ^CONFIG_SELINUX .config1 >.config && \
  75. yes "" | make oldconfig && \
  76. cat .config && \
  77. make V=1 \
  78. EXTRA_CFLAGS="-isystem uClibc-0.9.30.1/installed/include" \
  79. 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"; \
  80. else \
  81. cat .config && \
  82. make V=1 CC="gcc $RPM_OPT_FLAGS"; \
  83. fi
  84. cp busybox busybox.static
  85. # create busybox optimized for petitboot
  86. make clean
  87. # copy new configuration file
  88. cp %{SOURCE2} .config
  89. # set all new options to defaults
  90. yes "" | make oldconfig
  91. make V=1 CC="%__cc $RPM_OPT_FLAGS"
  92. cp busybox busybox.petitboot
  93. %install
  94. rm -rf $RPM_BUILD_ROOT
  95. mkdir -p $RPM_BUILD_ROOT/sbin
  96. install -m 755 busybox.static $RPM_BUILD_ROOT/sbin/busybox
  97. install -m 755 busybox.petitboot $RPM_BUILD_ROOT/sbin/busybox.petitboot
  98. %clean
  99. rm -rf $RPM_BUILD_ROOT
  100. %files
  101. %defattr(-,root,root,-)
  102. %doc LICENSE docs/busybox.net/*.html
  103. /sbin/busybox
  104. %files petitboot
  105. %defattr(-,root,root,-)
  106. %doc LICENSE
  107. /sbin/busybox.petitboot
  108. %changelog