OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.4 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: target/early/build-initramfs.in
  5. # Copyright (C) 2007 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- SDE-COPYRIGHT-NOTE-END ---
  14. INITRD_POSTFLIST_HOOK='early_adjust_initrd'
  15. # flatten
  16. ln -s . ${initrddir}/usr
  17. # don't break /tmp when flattening
  18. INITRD_FLIST_PATTERN="$INITRD_FLIST_PATTERN -e '/ usr\/tmp/d;'"
  19. INITRD_FLIST_PATTERN="$INITRD_FLIST_PATTERN -e '/ lib\/udev\/devices/d;'"
  20. INITRD_EMPTY_PATTERN="-e '/\.\/rootfs/d;'"
  21. initrd_flist_install_filter() {
  22. local root="build/${SDECFG_ID}/"
  23. case "$1" in
  24. udev) cp -a "$root/lib/udev/devices"/* "$initrddir/dev/"
  25. return 0 ;;
  26. hotplug2)
  27. cp "$root/sbin/hotplug2-modwrap" "$initrddir/sbin/"
  28. ;;
  29. strace)
  30. cp "$root/usr/bin/strace" "$initrddir/bin/"
  31. ;;
  32. sysfiles)
  33. for x in etc/{,SDE-}VERSION etc/{passwd,group} etc/rc.d/functions{,-ansi,-std}.in; do
  34. cp "$root/$x" "$initrddir/$x"
  35. done
  36. for x in etc/{fstab,hosts,resolv.conf}; do
  37. touch "$initrddir/$x"
  38. done
  39. ;;
  40. *) return 0 ;;
  41. esac
  42. return 1
  43. }
  44. early_adjust_initrd() {
  45. echo_status "Tweaking initrd ..."
  46. for x in var/state/pkgtool var/spool/{locks,mail} \
  47. usr/{doc,info,man,opt,spool} etc/{rc.d/,}init.d usr
  48. do
  49. rm ${initrddir}/$x
  50. done
  51. mkdir "${initrddir}/rootfs"
  52. # HACK: bb's modprobe needs insmod on PATH, but udev clears it
  53. # HACK: additionaly bb's modprobe doesn't handle MODALIAS properly
  54. # HACK: so we use our own wrapper on top of bb's
  55. rm ${initrddir}/sbin/modprobe
  56. for x in $( ls -1 target/$target/initrd/*.exec 2> /dev/null ); do
  57. y="${x##*/}"; y="$( echo ${y%.exec} | tr '_%' '/_' )"
  58. echo_status "injecting $y*"
  59. cp -f "$x" "${initrddir}/$y"
  60. chmod +x "${initrddir}/$y"
  61. done
  62. for x in $( ls -1 target/$target/initrd/*.txt 2> /dev/null ); do
  63. y="${x##*/}"; y="$( echo ${y%.txt} | tr '_%' '/_' )"
  64. echo_status "injecting $y"
  65. cp -f "$x" "${initrddir}/$y"
  66. done
  67. for x in $( ls -1 target/$target/initrd/*.patch 2> /dev/null ); do
  68. echo_status "$(patch -p1 -d "${initrddir}" 2>&1 < $x )"
  69. done
  70. }