memtest86+-4.20-r1.ebuild 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit mount-boot eutils toolchain-funcs
  5. DESCRIPTION="Memory tester based on memtest86"
  6. HOMEPAGE="http://www.memtest.org/"
  7. SRC_URI="http://www.memtest.org/download/${PV}/${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="-* amd64 x86"
  11. IUSE="floppy serial"
  12. BOOTDIR=/boot/memtest86plus
  13. QA_PRESTRIPPED="${BOOTDIR}/memtest.netbsd"
  14. RDEPEND="floppy? ( >=sys-boot/grub-0.95:0 sys-fs/mtools )"
  15. DEPEND=""
  16. src_prepare() {
  17. epatch "${FILESDIR}"/${PN}-4.20-hardcoded_cc.patch
  18. sed -i -e 's,0x10000,0x100000,' memtest.lds || die
  19. if use serial ; then
  20. sed -i \
  21. -e '/^#define SERIAL_CONSOLE_DEFAULT/s:0:1:' \
  22. config.h \
  23. || die "sed failed"
  24. fi
  25. cat - > "${T}"/39_${PN} <<EOF
  26. #!/bin/sh
  27. exec tail -n +3 \$0
  28. menuentry "${PN} ${PV}" {
  29. linux16 ${BOOTDIR}/memtest
  30. }
  31. menuentry "${PN} ${PV} (netbsd)" {
  32. insmod bsd
  33. knetbsd ${BOOTDIR}/memtest.netbsd
  34. }
  35. EOF
  36. tc-export AS CC LD
  37. }
  38. src_test() { :; }
  39. src_install() {
  40. insinto ${BOOTDIR}
  41. newins memtest.bin memtest
  42. newins memtest memtest.netbsd
  43. dosym memtest ${BOOTDIR}/memtest.bin
  44. exeinto /etc/grub.d
  45. doexe "${T}"/39_${PN}
  46. dodoc README README.build-process FAQ changelog
  47. if use floppy ; then
  48. dobin "${FILESDIR}"/make-memtest86+-boot-floppy
  49. doman "${FILESDIR}"/make-memtest86+-boot-floppy.1
  50. fi
  51. }
  52. pkg_postinst() {
  53. mount-boot_pkg_postinst
  54. elog
  55. elog "memtest has been installed in ${BOOTDIR}/"
  56. elog "You may wish to update your bootloader configs"
  57. elog "by adding these lines:"
  58. elog " - For grub2 just run grub-mkconfig, a configuration file is installed"
  59. elog " as /etc/grub.d/39_${PN}"
  60. elog " - For grub legacy: (replace '?' with correct numbers for your boot partition)"
  61. elog " > title=${PN}"
  62. elog " > root (hd?,?)"
  63. elog " > kernel ${BOOTDIR}/memtest"
  64. elog " - For lilo:"
  65. elog " > image = ${BOOTDIR}/memtest"
  66. elog " > label = ${PN}"
  67. elog
  68. }