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.

87 lines
2.2 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 - 2008 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. INITRAMFS_POSTINSTALL_HOOK='early_adjust_initrd'
  15. # flatten
  16. ln -s . ${rootfs}/usr
  17. # don't break /tmp when flattening
  18. INITRAMFS_INSTALL_PATTERN="$INITRAMFS_INSTALL_PATTERN -e '/ usr\/tmp/d;'"
  19. INITRAMFS_EMPTY_PATTERN="-e '/\.\/rootfs/d;'"
  20. # initramfs_install <pkg_name> <sandbox> <rootfs>
  21. initramfs_install() {
  22. local root="$2" initrddir="$3"
  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}.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. dietlibc)
  41. # skip
  42. ;;
  43. *) return 0 ;;
  44. esac
  45. return 1
  46. }
  47. early_adjust_initrd() {
  48. echo_status "Tweaking initrd ..."
  49. for x in var/spool/{locks,mail} \
  50. usr/{doc,info,man,opt,spool} etc/{rc.d/,}init.d usr
  51. do
  52. rm ${rootfs}/$x
  53. done
  54. mkdir "${rootfs}/rootfs"
  55. # HACK: bb's modprobe needs insmod on PATH, but udev clears it
  56. # HACK: additionaly bb's modprobe doesn't handle MODALIAS properly
  57. # HACK: so we use our own wrapper on top of bb's
  58. rm ${rootfs}/sbin/modprobe
  59. }
  60. initramfs_install_pattern() {
  61. local pkg_name="$1"; shift
  62. case "$pkg_name" in
  63. udev)
  64. echo -n "-n -e '/etc\/udev\//p;' -e '/lib\/udev\/devices\//p;' -e '/lib\/udev\/.*_id$/p;' "
  65. echo "-e '/sbin\/\(udevd\|udevsettle\|udevtrigger\|udevadm\)$/P'"
  66. ;;
  67. lvm2)
  68. echo "$@ -e '/sbin\/lvmdump$/d;'"
  69. ;;
  70. fhs)
  71. echo "-e '/\/local\(\|\/.*\)$/d;' $@"
  72. ;;
  73. *)
  74. echo "$@"
  75. ;;
  76. esac
  77. }