Makefile 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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:= 10
  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. ifeq (${ADK_TARGET_PACKAGE_OPKG},y)
  32. $(CP) ./files/ipkg.conf $(IDIR_BASE_FILES)/etc/
  33. $(SED) 's,@ARCH@,$(ADK_TARGET_CPU_ARCH),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  34. $(SED) 's,@SYSTEM@,$(ADK_TARGET_SYSTEM),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  35. $(SED) 's,@LIBC@,$(ADK_TARGET_LIBC),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  36. $(SED) 's,@HOST@,$(ADK_HOST),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  37. $(SED) 's,@VENDOR@,$(ADK_VENDOR),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  38. mkdir -p $(IDIR_BASE_FILES)/usr/lib/opkg/lists
  39. endif
  40. echo /bin/sh >${IDIR_BASE_FILES}/etc/shells
  41. echo /bin/mksh >>${IDIR_BASE_FILES}/etc/shells
  42. ifneq (${ADK_PACKAGE_ASH},)
  43. echo /bin/ash >>${IDIR_BASE_FILES}/etc/shells
  44. endif
  45. ifneq (${ADK_PACKAGE_HUSH},)
  46. echo /bin/hush >>${IDIR_BASE_FILES}/etc/shells
  47. endif
  48. ifneq (${ADK_PACKAGE_BASH},)
  49. echo /bin/bash >>${IDIR_BASE_FILES}/etc/shells
  50. endif
  51. ifneq (${ADK_PACKAGE_ZSH},)
  52. echo /bin/zsh >>${IDIR_BASE_FILES}/etc/shells
  53. endif
  54. mkdir -p $(IDIR_BASE_FILES)/etc/crontabs
  55. mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt,media}
  56. mkdir -p $(IDIR_BASE_FILES)/etc/network/{if-pre-up.d,if-up.d,if-down.d,if-post-down.d}
  57. mkdir -p $(IDIR_BASE_FILES)/usr/{lib,bin}
  58. chmod 600 $(IDIR_BASE_FILES)/etc/shadow
  59. chmod 600 $(IDIR_BASE_FILES)/etc/network/interfaces
  60. ifeq (${ADK_TARGET_ROOTFS_NFSROOT},y)
  61. (cd $(IDIR_BASE_FILES)/etc; ln -sf ../proc/net/pnp resolv.conf)
  62. else
  63. (cd $(IDIR_BASE_FILES)/etc; ln -sf ../tmp/resolv.conf .)
  64. endif
  65. chmod 1777 ${IDIR_BASE_FILES}/tmp
  66. ln -sf ../proc/mounts $(IDIR_BASE_FILES)/etc/mtab
  67. rm -rf $(IDIR_BASE_FILES)/var
  68. ln -sf tmp $(IDIR_BASE_FILES)/var
  69. test -z $(ADK_RUNTIME_SHELL) || \
  70. cat ./files/inittab.shell >> $(IDIR_BASE_FILES)/etc/inittab
  71. ifeq ($(ADK_TARGET_WITH_VGA),y)
  72. test -z $(ADK_RUNTIME_SHELL) || \
  73. cat ./files/inittab.shellvga >> $(IDIR_BASE_FILES)/etc/inittab
  74. endif
  75. test -z $(ADK_RUNTIME_GETTY_VGA) || \
  76. cat ./files/inittab.vga >> $(IDIR_BASE_FILES)/etc/inittab
  77. test -z $(ADK_RUNTIME_GETTY_SERIAL) || \
  78. cat ./files/inittab.serial >> $(IDIR_BASE_FILES)/etc/inittab
  79. $(SED) 's#@DEVICE@#$(ADK_RUNTIME_CONSOLE_SERIAL_DEVICE)#g' $(IDIR_BASE_FILES)/etc/inittab
  80. $(SED) 's#@SPEED@#$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)#' $(IDIR_BASE_FILES)/etc/inittab
  81. test -z $(ADK_RUNTIME_HOSTNAME) || \
  82. echo $(ADK_RUNTIME_HOSTNAME) > $(IDIR_BASE_FILES)/etc/hostname; \
  83. echo "127.0.0.1 localhost" > $(IDIR_BASE_FILES)/etc/hosts
  84. echo "127.0.1.1 $(ADK_RUNTIME_HOSTNAME)" >> $(IDIR_BASE_FILES)/etc/hosts
  85. echo "::1 ip6-localhost ip6-loopback" >> $(IDIR_BASE_FILES)/etc/hosts
  86. echo "fe00::0 ip6-localnet" >> $(IDIR_BASE_FILES)/etc/hosts
  87. echo "ff00::0 ip6-mcastprefix" >> $(IDIR_BASE_FILES)/etc/hosts
  88. echo "ff02::1 ip6-allnodes" >> $(IDIR_BASE_FILES)/etc/hosts
  89. echo "ff02::2 ip6-allrouters" >> $(IDIR_BASE_FILES)/etc/hosts
  90. echo "ff02::3 ip6-allhosts" >> $(IDIR_BASE_FILES)/etc/hosts
  91. test -z '$(ADK_RUNTIME_PASSWORD)' || \
  92. $(SED) 's,\*NP\*,'"$$($(STAGING_HOST_DIR)/usr/bin/mkcrypt \
  93. $$(awk -F\= '/^ADK_RUNTIME_PASSWORD/ { print $$2 }' $(ADK_TOPDIR)/.config|sed -e 's^\"^^g')),g" \
  94. $(IDIR_BASE_FILES)/etc/shadow
  95. echo $(ADK_RUNTIME_TMPFS_SIZE) > $(IDIR_BASE_FILES)/etc/tmpfs
  96. ifeq ($(ADK_TARGET_WITH_ROOT_RW),y)
  97. echo 'export IPKGTMPDIR=/root/.ipkg' >> $(IDIR_BASE_FILES)/etc/profile
  98. else
  99. echo 'export IPKGTMPDIR=/tmp' >> $(IDIR_BASE_FILES)/etc/profile
  100. endif
  101. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  102. echo 'export LD_LIBRARY_PATH=/opt/vc/lib' >> $(IDIR_BASE_FILES)/etc/profile
  103. endif
  104. # simple network configuration
  105. ifneq (${ADK_SIMPLE_NETWORK_CONFIG},)
  106. ${INSTALL_DIR} ${IDIR_BASE_FILES}/etc/network
  107. printf "auto lo\niface lo inet loopback\n" > ${IDIR_BASE_FILES}/etc/network/interfaces
  108. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_DHCP},y)
  109. printf "\nauto eth0\niface eth0 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  110. endif
  111. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_STATIC},y)
  112. printf "\nauto eth0\niface eth0 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  113. printf " address ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  114. printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  115. printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  116. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_ETH0_GW},)
  117. printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_ETH0_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  118. endif
  119. endif
  120. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_DHCP},y)
  121. printf "\nauto wlan0\niface wlan0 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  122. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2},y)
  123. printf " wireless-mode sta\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  124. printf " wireless-ssid ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_SSID}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  125. printf " wireless-security wpa2\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  126. printf " wireless-passphrase ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_PW}\n\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  127. endif
  128. endif
  129. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_STATIC},y)
  130. printf "\nauto wlan0\niface wlan0 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  131. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2},y)
  132. printf " wireless-mode sta\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  133. printf " wireless-ssid ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_SSID}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  134. printf " wireless-security wpa2\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  135. printf " wireless-passphrase ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_WPA2_PW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  136. endif
  137. printf " address ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  138. printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  139. printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  140. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_GW},)
  141. printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_WLAN0_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  142. endif
  143. endif
  144. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_DHCP},y)
  145. printf "\nauto eth1\niface eth1 inet dhcp\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  146. endif
  147. ifeq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_STATIC},y)
  148. printf "\nauto eth1\niface eth1 inet static\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  149. printf " address ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_IP}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  150. printf " netmask ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_NM}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  151. printf " broadcast +\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  152. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_ETH1_GW},)
  153. printf " gateway ${ADK_SIMPLE_NETWORK_CONFIG_ETH1_GW}\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  154. endif
  155. endif
  156. printf "\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  157. rm ${IDIR_BASE_FILES}/etc/resolv.conf
  158. printf "nameserver ${ADK_SIMPLE_NETWORK_CONFIG_NS}\n" > ${IDIR_BASE_FILES}/etc/resolv.conf
  159. ifneq (${ADK_SIMPLE_NETWORK_CONFIG_PROXY},)
  160. printf "http_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
  161. printf "https_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
  162. printf "ftp_proxy=${ADK_SIMPLE_NETWORK_CONFIG_PROXY}\n" >> ${IDIR_BASE_FILES}/etc/profile
  163. endif
  164. endif
  165. include ${ADK_TOPDIR}/mk/pkg-bottom.mk