Makefile 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(ADK_TOPDIR)/rules.mk
  4. include $(ADK_TOPDIR)/mk/rootfs.mk
  5. PKG_NAME:= base-files
  6. PKG_VERSION:= 1.1
  7. PKG_RELEASE:= 5
  8. PKG_SECTION:= base/apps
  9. PKG_DESCR:= basic files and scripts
  10. WRKDIST= ${WRKDIR}/base-files
  11. NO_DISTFILES:= 1
  12. include $(ADK_TOPDIR)/mk/package.mk
  13. $(eval $(call PKG_template,BASE_FILES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},force_etc))
  14. CONFIG_STYLE:= manual
  15. BUILD_STYLE:= manual
  16. INSTALL_STYLE:= manual
  17. do-install:
  18. $(CP) ./src/* $(IDIR_BASE_FILES)
  19. ifeq (${ADK_TARGET_ROOTFS_NFSROOT},y)
  20. @echo "#" > $(IDIR_BASE_FILES)/etc/network/interfaces
  21. endif
  22. ifeq (${ADK_TARGET_PACKAGE_IPKG},y)
  23. $(CP) ./files/ipkg.conf $(IDIR_BASE_FILES)/etc/
  24. $(SED) 's,@ARCH@,$(ADK_TARGET_CPU_ARCH),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  25. $(SED) 's,@SYSTEM@,$(ADK_TARGET_SYSTEM),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  26. $(SED) 's,@LIBC@,$(ADK_TARGET_LIBC),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  27. $(SED) 's,@HOST@,$(ADK_HOST),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  28. $(SED) 's,@VENDOR@,$(ADK_VENDOR),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  29. mkdir -p $(IDIR_BASE_FILES)/usr/lib/ipkg/lists
  30. endif
  31. echo /bin/sh >${IDIR_BASE_FILES}/etc/shells
  32. echo /bin/mksh >>${IDIR_BASE_FILES}/etc/shells
  33. ifneq (${ADK_PACKAGE_ASH},)
  34. echo /bin/ash >>${IDIR_BASE_FILES}/etc/shells
  35. endif
  36. ifneq (${ADK_PACKAGE_HUSH},)
  37. echo /bin/hush >>${IDIR_BASE_FILES}/etc/shells
  38. endif
  39. ifneq (${ADK_PACKAGE_BASH},)
  40. echo /bin/bash >>${IDIR_BASE_FILES}/etc/shells
  41. endif
  42. ifneq (${ADK_PACKAGE_ZSH},)
  43. echo /bin/zsh >>${IDIR_BASE_FILES}/etc/shells
  44. endif
  45. mkdir -p $(IDIR_BASE_FILES)/etc/crontabs
  46. mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt,media}
  47. mkdir -p $(IDIR_BASE_FILES)/etc/network/{if-pre-up.d,if-up.d,if-down.d,if-post-down.d}
  48. mkdir -p $(IDIR_BASE_FILES)/usr/{lib,bin}
  49. chmod 600 $(IDIR_BASE_FILES)/etc/shadow
  50. chmod 600 $(IDIR_BASE_FILES)/etc/network/interfaces
  51. (cd $(IDIR_BASE_FILES)/etc; ln -sf ../tmp/resolv.conf .)
  52. chmod 1777 ${IDIR_BASE_FILES}/tmp
  53. ln -sf ../proc/mounts $(IDIR_BASE_FILES)/etc/mtab
  54. rm -rf $(IDIR_BASE_FILES)/var
  55. ln -sf tmp $(IDIR_BASE_FILES)/var
  56. test -z $(ADK_RUNTIME_SHELL) || \
  57. cat ./files/inittab.shell >> $(IDIR_BASE_FILES)/etc/inittab
  58. ifeq ($(ADK_TARGET_WITH_VGA),y)
  59. test -z $(ADK_RUNTIME_SHELL) || \
  60. cat ./files/inittab.shellvga >> $(IDIR_BASE_FILES)/etc/inittab
  61. endif
  62. test -z $(ADK_RUNTIME_GETTY_VGA) || \
  63. cat ./files/inittab.vga >> $(IDIR_BASE_FILES)/etc/inittab
  64. test -z $(ADK_RUNTIME_GETTY_SERIAL) || \
  65. cat ./files/inittab.serial >> $(IDIR_BASE_FILES)/etc/inittab
  66. $(SED) 's#@DEVICE@#$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE)#g' $(IDIR_BASE_FILES)/etc/inittab
  67. $(SED) 's#@SPEED@#$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)#' $(IDIR_BASE_FILES)/etc/inittab
  68. test -z $(ADK_RUNTIME_HOSTNAME) || \
  69. echo $(ADK_RUNTIME_HOSTNAME) > $(IDIR_BASE_FILES)/etc/hostname; \
  70. echo "127.0.0.1 localhost" > $(IDIR_BASE_FILES)/etc/hosts
  71. echo "::1 localhost" >> $(IDIR_BASE_FILES)/etc/hosts
  72. echo "127.0.1.1 $(ADK_RUNTIME_HOSTNAME)" >> $(IDIR_BASE_FILES)/etc/hosts
  73. test -z $(ADK_RUNTIME_PASSWORD) || \
  74. $(SED) 's,\*NP\*,'"$$($(STAGING_HOST_DIR)/usr/bin/mkcrypt \
  75. ${ADK_RUNTIME_PASSWORD}),g" $(IDIR_BASE_FILES)/etc/shadow
  76. echo $(ADK_RUNTIME_TMPFS_SIZE) > $(IDIR_BASE_FILES)/etc/tmpfs
  77. ifeq ($(ADK_TARGET_WITH_ROOT_RW),y)
  78. echo 'export IPKGTMPDIR=/root/.ipkg' >> $(IDIR_BASE_FILES)/etc/profile
  79. else
  80. echo 'export IPKGTMPDIR=/tmp' >> $(IDIR_BASE_FILES)/etc/profile
  81. endif
  82. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  83. echo 'export LD_LIBRARY_PATH=/opt/vc/lib' >> $(IDIR_BASE_FILES)/etc/profile
  84. endif
  85. # simple network configuration
  86. ifneq (${ADK_SIMPLE_NETWORK_CONFIG},)
  87. ${INSTALL_DIR} ${IDIR_BASE_FILES}/etc/network
  88. printf "auto lo\niface lo inet loopback\n" > ${IDIR_BASE_FILES}/etc/network/interfaces
  89. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_DHCP},y)
  90. printf "\nauto eth0\niface eth0 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  91. endif
  92. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_STATIC},y)
  93. printf "\nauto eth0\niface eth0 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  94. printf " address ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  95. printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  96. printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  97. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_GW},)
  98. printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  99. endif
  100. endif
  101. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_DHCP},y)
  102. printf "\nauto wlan0\niface wlan0 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  103. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2},y)
  104. printf "\twireless-mode sta\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  105. printf "\twireless-ssid ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_SSID}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  106. printf "\twireless-security wpa2\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  107. printf "\twireless-passphrase ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_PW}\n\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  108. endif
  109. endif
  110. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_STATIC},y)
  111. printf "\nauto wlan0\niface wlan0 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  112. printf " address ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  113. printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  114. printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  115. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_GW},)
  116. printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  117. endif
  118. endif
  119. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_DHCP},y)
  120. printf "\nauto eth1\niface eth1 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  121. endif
  122. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_STATIC},y)
  123. printf "\nauto eth1\niface eth1 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  124. printf " address ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  125. printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  126. printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  127. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_GW},)
  128. printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  129. endif
  130. endif
  131. printf "\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  132. rm ${IDIR_BASE_FILES}/etc/resolv.conf
  133. printf "nameserver ${ADK_SIMPLE_NETWORK_CONFIG_NS}\n" > ${IDIR_BASE_FILES}/etc/resolv.conf
  134. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_PROXY},)
  135. printf "http_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
  136. printf "https_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
  137. printf "ftp_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
  138. endif
  139. endif
  140. include ${ADK_TOPDIR}/mk/pkg-bottom.mk