skeleton.mk 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ################################################################################
  2. #
  3. # skeleton
  4. #
  5. ################################################################################
  6. # The skeleton can't depend on the toolchain, since all packages depends on the
  7. # skeleton and the toolchain is a target package, as is skeleton.
  8. # Hence, skeleton would depends on the toolchain and the toolchain would depend
  9. # on skeleton.
  10. SKELETON_ADD_TOOLCHAIN_DEPENDENCY = NO
  11. SKELETON_ADD_SKELETON_DEPENDENCY = NO
  12. # The skeleton also handles the merged /usr case in the sysroot
  13. SKELETON_INSTALL_STAGING = YES
  14. ifeq ($(BR2_PACKAGE_SKELETON_CUSTOM),y)
  15. SKELETON_DEPENDENCIES = skeleton-custom
  16. else # ! custom skeleton
  17. SKELETON_PATH = system/skeleton
  18. define SKELETON_INSTALL_TARGET_CMDS
  19. $(call SYSTEM_RSYNC,$(SKELETON_PATH),$(TARGET_DIR))
  20. $(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(TARGET_DIR))
  21. $(call SYSTEM_LIB_SYMLINK,$(TARGET_DIR))
  22. $(INSTALL) -m 0644 support/misc/target-dir-warning.txt \
  23. $(TARGET_DIR_WARNING_FILE)
  24. endef
  25. # For the staging dir, we don't really care about /bin and /sbin.
  26. # But for consistency with the target dir, and to simplify the code,
  27. # we still handle them for the merged or non-merged /usr cases.
  28. # Since the toolchain is not yet available, the staging is not yet
  29. # populated, so we need to create the directories in /usr
  30. define SKELETON_INSTALL_STAGING_CMDS
  31. $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/lib
  32. $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/bin
  33. $(INSTALL) -d -m 0755 $(STAGING_DIR)/usr/sbin
  34. $(call SYSTEM_USR_SYMLINKS_OR_DIRS,$(STAGING_DIR))
  35. $(call SYSTEM_LIB_SYMLINK,$(STAGING_DIR))
  36. endef
  37. SKELETON_TARGET_GENERIC_HOSTNAME = $(call qstrip,$(BR2_TARGET_GENERIC_HOSTNAME))
  38. SKELETON_TARGET_GENERIC_ISSUE = $(call qstrip,$(BR2_TARGET_GENERIC_ISSUE))
  39. SKELETON_TARGET_GENERIC_ROOT_PASSWD = $(call qstrip,$(BR2_TARGET_GENERIC_ROOT_PASSWD))
  40. SKELETON_TARGET_GENERIC_PASSWD_METHOD = $(call qstrip,$(BR2_TARGET_GENERIC_PASSWD_METHOD))
  41. SKELETON_TARGET_GENERIC_BIN_SH = $(call qstrip,$(BR2_SYSTEM_BIN_SH))
  42. ifneq ($(SKELETON_TARGET_GENERIC_HOSTNAME),)
  43. define SKELETON_SET_HOSTNAME
  44. mkdir -p $(TARGET_DIR)/etc
  45. echo "$(SKELETON_TARGET_GENERIC_HOSTNAME)" > $(TARGET_DIR)/etc/hostname
  46. $(SED) '$$a \127.0.1.1\t$(SKELETON_TARGET_GENERIC_HOSTNAME)' \
  47. -e '/^127.0.1.1/d' $(TARGET_DIR)/etc/hosts
  48. endef
  49. TARGET_FINALIZE_HOOKS += SKELETON_SET_HOSTNAME
  50. endif
  51. ifneq ($(SKELETON_TARGET_GENERIC_ISSUE),)
  52. define SKELETON_SET_ISSUE
  53. mkdir -p $(TARGET_DIR)/etc
  54. echo "$(SKELETON_TARGET_GENERIC_ISSUE)" > $(TARGET_DIR)/etc/issue
  55. endef
  56. TARGET_FINALIZE_HOOKS += SKELETON_SET_ISSUE
  57. endif
  58. ifeq ($(BR2_TARGET_ENABLE_ROOT_LOGIN),y)
  59. ifeq ($(SKELETON_TARGET_GENERIC_ROOT_PASSWD),)
  60. SKELETON_ROOT_PASSWORD =
  61. else ifneq ($(filter $$1$$% $$5$$% $$6$$%,$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)),)
  62. SKELETON_ROOT_PASSWORD = '$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)'
  63. else
  64. # This variable will only be evaluated in the finalize stage, so we can
  65. # be sure that host-mkpasswd will have already been built by that time.
  66. SKELETON_ROOT_PASSWORD = "`$(MKPASSWD) -m "$(SKELETON_TARGET_GENERIC_PASSWD_METHOD)" "$(SKELETON_TARGET_GENERIC_ROOT_PASSWD)"`"
  67. endif
  68. else # !BR2_TARGET_ENABLE_ROOT_LOGIN
  69. SKELETON_ROOT_PASSWORD = "*"
  70. endif
  71. define SKELETON_SET_ROOT_PASSWD
  72. $(SED) s,^root:[^:]*:,root:$(SKELETON_ROOT_PASSWORD):, $(TARGET_DIR)/etc/shadow
  73. endef
  74. TARGET_FINALIZE_HOOKS += SKELETON_SET_ROOT_PASSWD
  75. ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
  76. define SKELETON_BIN_SH
  77. rm -f $(TARGET_DIR)/bin/sh
  78. endef
  79. else
  80. ifneq ($(SKELETON_TARGET_GENERIC_BIN_SH),)
  81. define SKELETON_BIN_SH
  82. ln -sf $(SKELETON_TARGET_GENERIC_BIN_SH) $(TARGET_DIR)/bin/sh
  83. endef
  84. endif
  85. endif
  86. TARGET_FINALIZE_HOOKS += SKELETON_BIN_SH
  87. endif # BR2_ROOTFS_SKELETON_DEFAULT
  88. $(eval $(generic-package))