Makefile 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 $(TOPDIR)/rules.mk
  4. include $(TOPDIR)/mk/rootfs.mk
  5. PKG_NAME:= base-files
  6. PKG_VERSION:= 1.0
  7. PKG_RELEASE:= 66
  8. PKG_SECTION:= base
  9. PKG_DESCR:= basic files and scripts
  10. PKG_BUILDDEP:= pkgconf-host file-host
  11. WRKDIST= ${WRKDIR}/base-files
  12. NO_DISTFILES:= 1
  13. include $(TOPDIR)/mk/package.mk
  14. $(eval $(call PKG_template,BASE_FILES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION},force_etc))
  15. CONFIG_STYLE:= manual
  16. BUILD_STYLE:= manual
  17. INSTALL_STYLE:= manual
  18. do-install:
  19. $(CP) ./src/* $(IDIR_BASE_FILES)
  20. ifeq (${ADK_TARGET_ROOTFS_NFSROOT},y)
  21. @echo "#" > $(IDIR_BASE_FILES)/etc/network/interfaces
  22. endif
  23. $(SED) 's,@ARCH@,$(ADK_TARGET_CPU_ARCH),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  24. $(SED) 's,@SYSTEM@,$(ADK_TARGET_SYSTEM),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  25. $(SED) 's,@LIBC@,$(ADK_TARGET_LIBC),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  26. $(SED) 's,@HOST@,$(ADK_HOST),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  27. $(SED) 's,@VENDOR@,$(ADK_VENDOR),g' $(IDIR_BASE_FILES)/etc/ipkg.conf
  28. echo /bin/sh >${IDIR_BASE_FILES}/etc/shells
  29. echo /bin/ash >>${IDIR_BASE_FILES}/etc/shells
  30. ifneq (${ADK_PACKAGE_BASH},)
  31. echo /bin/bash >>${IDIR_BASE_FILES}/etc/shells
  32. endif
  33. ifneq (${ADK_PACKAGE_MKSH},)
  34. echo /bin/mksh >>${IDIR_BASE_FILES}/etc/shells
  35. endif
  36. ifneq (${ADK_PACKAGE_ZSH},)
  37. echo /bin/zsh >>${IDIR_BASE_FILES}/etc/shells
  38. endif
  39. mkdir -p $(IDIR_BASE_FILES)/usr/lib/ipkg/lists
  40. mkdir -p $(IDIR_BASE_FILES)/etc/crontabs
  41. mkdir -p $(IDIR_BASE_FILES)/{dev,boot,root,sys,proc,tmp,mnt}
  42. mkdir -p $(IDIR_BASE_FILES)/etc/network/{if-pre-up.d,if-up.d,if-down.d,if-post-down.d}
  43. mkdir -p $(IDIR_BASE_FILES)/usr/{lib,bin}
  44. chmod 755 $(IDIR_BASE_FILES)/lib/mdev/init
  45. chmod 600 $(IDIR_BASE_FILES)/etc/shadow
  46. chmod 600 $(IDIR_BASE_FILES)/etc/network/interfaces
  47. chmod 1777 ${IDIR_BASE_FILES}/tmp
  48. ln -sf ../proc/mounts $(IDIR_BASE_FILES)/etc/mtab
  49. rm -rf $(IDIR_BASE_FILES)/var
  50. ln -sf tmp $(IDIR_BASE_FILES)/var
  51. test -z $(ADK_RUNTIME_CONSOLE_VGA) || \
  52. cat ./files/inittab.vga >> $(IDIR_BASE_FILES)/etc/inittab
  53. test -z $(ADK_RUNTIME_CONSOLE_SERIAL) || \
  54. cat ./files/inittab.serial >> $(IDIR_BASE_FILES)/etc/inittab
  55. test -z $(ADK_RUNTIME_CONSOLE_BOTH) || \
  56. cat ./files/inittab.serial >> $(IDIR_BASE_FILES)/etc/inittab
  57. test -z $(ADK_RUNTIME_CONSOLE_BOTH) || \
  58. cat ./files/inittab.vga >> $(IDIR_BASE_FILES)/etc/inittab
  59. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB),y)
  60. $(SED) 's#ttyS#ttyAMA#g' $(IDIR_BASE_FILES)/etc/inittab
  61. endif
  62. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
  63. $(SED) 's#ttyS#ttyAMA#g' $(IDIR_BASE_FILES)/etc/inittab
  64. endif
  65. ifeq ($(ADK_TARGET_SYSTEM_ARANYM_M68K),y)
  66. $(SED) 's#ttyS#nfcon#g' $(IDIR_BASE_FILES)/etc/inittab
  67. endif
  68. ifeq ($(ADK_TARGET_SYSTEM_QEMU_PPC64),y)
  69. $(SED) 's#ttyS#hvc#g' $(IDIR_BASE_FILES)/etc/inittab
  70. endif
  71. ifeq ($(ADK_TARGET_QEMU_MICROBLAZE_MODEL_S3ADSP1800),y)
  72. $(SED) 's#ttyS#ttyUL#g' $(IDIR_BASE_FILES)/etc/inittab
  73. endif
  74. $(SED) 's#@SPEED@#$(ADK_RUNTIME_CONSOLE_SERIAL_SPEED)#' $(IDIR_BASE_FILES)/etc/inittab
  75. test -z $(ADK_RUNTIME_HOSTNAME) || \
  76. echo $(ADK_RUNTIME_HOSTNAME) > $(IDIR_BASE_FILES)/etc/hostname; \
  77. echo "127.0.0.1 localhost" > $(IDIR_BASE_FILES)/etc/hosts
  78. echo "::1 localhost" >> $(IDIR_BASE_FILES)/etc/hosts
  79. echo "127.0.1.1 $(ADK_RUNTIME_HOSTNAME)" >> $(IDIR_BASE_FILES)/etc/hosts
  80. test -z $(ADK_RUNTIME_PASSWORD) || \
  81. $(SED) 's,\*NP\*,'"$$($(STAGING_HOST_DIR)/usr/bin/mkcrypt \
  82. ${ADK_RUNTIME_PASSWORD}),g" $(IDIR_BASE_FILES)/etc/shadow
  83. git log -1|head -1|sed -e 's#commit ##' \
  84. > $(IDIR_BASE_FILES)/etc/adkversion
  85. test -z $(ADK_TARGET_SYSTEM) || \
  86. echo $(ADK_TARGET_SYSTEM) > $(IDIR_BASE_FILES)/etc/adktarget
  87. echo $(ADK_RUNTIME_TMPFS_SIZE) > $(IDIR_BASE_FILES)/etc/tmpfs
  88. ifneq (${ADK_PACKAGE_CONFIG_IN_ETC},)
  89. gzip -9c ${TOPDIR}/.config >$(IDIR_BASE_FILES)/etc/adkconfig.gz
  90. chmod 600 $(IDIR_BASE_FILES)/etc/adkconfig.gz
  91. endif
  92. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  93. echo 'export LD_LIBRARY_PATH=/opt/vc/lib' >> $(IDIR_BASE_FILES)/etc/profile
  94. ifneq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI)$(ADK_TARGET_SYSTEM_IBM_X40)$(ADK_TARGET_SYSTEM_LEMOTE_YEELONG),)
  95. echo 'export IPKGTMPDIR=/root/.ipkg' >> $(IDIR_BASE_FILES)/etc/profile
  96. else
  97. echo 'export IPKGTMPDIR=/tmp >> $(IDIR_BASE_FILES)/etc/profile
  98. endif
  99. endif
  100. # simple network configuration
  101. ifneq (${ADK_SIMPLE_NETWORK_CONFIG},)
  102. ${INSTALL_DIR} ${IDIR_BASE_FILES}/etc/network
  103. # network config local
  104. echo -e "auto lo\niface lo inet loopback" > ${IDIR_BASE_FILES}/etc/network/interfaces
  105. # network config eth0
  106. # configure nic with dhcp
  107. ifeq (${SIMPLE_NETWORK_CONFIG_ETH0_TYPE_NIC},y)
  108. echo -e "\nauto eth0\niface eth0 inet dhcp" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  109. endif
  110. # configure nic with manual ip
  111. ifeq (${SIMPLE_NETWORK_CONFIG_ETH0_TYPE_NIC_MANUAL},y)
  112. echo -e "\nauto eth0\niface eth0 inet static" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  113. echo -e " address ${SIMPLE_NETWORK_CONFIG_ETH0_IP}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  114. echo -e " netmask ${SIMPLE_NETWORK_CONFIG_ETH0_NM}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  115. echo -e " broadcast ${SIMPLE_NETWORK_CONFIG_ETH0_BC}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  116. echo -e " gateway ${SIMPLE_NETWORK_CONFIG_ETH0_GW}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  117. endif
  118. # configure bridge
  119. ifeq (${SIMPLE_NETWORK_CONFIG_ETH0_TYPE_BRIDGE},y)
  120. echo -e "\nauto br0\niface br0 inet manual" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  121. echo -e " bridge-ports ${SIMPLE_NETWORK_CONFIG_ETH0_BRIDGE}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  122. endif
  123. #configure bridge with ip
  124. ifeq (${SIMPLE_NETWORK_CONFIG_ETH0_TYPE_BRIDGE_IP},y)
  125. echo -e "\nauto br0\niface br0 inet static" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  126. echo -e " address ${SIMPLE_NETWORK_CONFIG_ETH0_IP}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  127. echo -e " netmask ${SIMPLE_NETWORK_CONFIG_ETH0_NM}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  128. echo -e " broadcast ${SIMPLE_NETWORK_CONFIG_ETH0_BC}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  129. echo -e " bridge-ports ${SIMPLE_NETWORK_CONFIG_ETH0_BRIDGE}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  130. endif
  131. # network config wlan0
  132. ifeq (${SIMPLE_NETWORK_CONFIG_WLAN0_TYPE_NIC},y)
  133. echo -e "\nauto wlan0\niface wlan0 inet dhcp" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  134. endif
  135. # network config eth1
  136. # configure nic with dhcp
  137. ifeq (${SIMPLE_NETWORK_CONFIG_ETH1_TYPE_NIC},y)
  138. echo -e "\nauto eth1\niface eth1 inet dhcp" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  139. endif
  140. # configure nic with manual ip
  141. ifeq (${SIMPLE_NETWORK_CONFIG_ETH1_TYPE_NIC_MANUAL},y)
  142. echo -e "\nauto eth1\niface eth1 inet static" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  143. echo -e " address ${SIMPLE_NETWORK_CONFIG_ETH1_IP}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  144. echo -e " netmask ${SIMPLE_NETWORK_CONFIG_ETH1_NM}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  145. echo -e " broadcast ${SIMPLE_NETWORK_CONFIG_ETH1_BC}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  146. echo -e " gateway ${SIMPLE_NETWORK_CONFIG_ETH1_GW}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  147. endif
  148. # configure bridge
  149. ifeq (${SIMPLE_NETWORK_CONFIG_ETH1_TYPE_BRIDGE},y)
  150. echo -e "\nauto br0\niface br1 inet manual" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  151. echo -e " bridge-ports ${SIMPLE_NETWORK_CONFIG_ETH1_BRIDGE}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  152. endif
  153. #configure bridge with ip
  154. ifeq (${SIMPLE_NETWORK_CONFIG_ETH1_TYPE_BRIDGE_IP},y)
  155. echo -e "\nauto br0\niface br1 inet static" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  156. echo -e " address ${SIMPLE_NETWORK_CONFIG_ETH1_IP}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  157. echo -e " netmask ${SIMPLE_NETWORK_CONFIG_ETH1_NM}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  158. echo -e " broadcast ${SIMPLE_NETWORK_CONFIG_ETH1_BC}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  159. echo -e " bridge-ports ${SIMPLE_NETWORK_CONFIG_ETH1_BRIDGE}" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  160. endif
  161. # newline at the end of interfaces file
  162. echo -en "\n" >> ${IDIR_BASE_FILES}/etc/network/interfaces
  163. # resolver config
  164. echo -e "nameserver ${SIMPLE_NETWORK_CONFIG_RESOLV}" > ${IDIR_BASE_FILES}/etc/resolv.conf
  165. endif
  166. include ${TOPDIR}/mk/pkg-bottom.mk