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.

64 lines
1.8 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="$INITRD_FLIST_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. *) return 0 ;;
  41. esac
  42. return 1
  43. }
  44. early_adjust_initrd() {
  45. echo_status "Tweaking initrd ..."
  46. for x in var/spool/{locks,mail} \
  47. usr/{doc,info,man,opt,spool} etc/{rc.d/,}init.d usr
  48. do
  49. rm ${rootfs}/$x
  50. done
  51. mkdir "${rootfs}/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 ${rootfs}/sbin/modprobe
  56. }