Makefile 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. #
  2. # This file is subject to the terms and conditions of the GNU General Public
  3. # License. See the file "COPYING" in the main directory of this archive
  4. # for more details.
  5. #
  6. # Copyright (C) 1994, 95, 96, 2003 by Ralf Baechle
  7. # DECStation modifications by Paul M. Antoine, 1996
  8. # Copyright (C) 2002, 2003, 2004 Maciej W. Rozycki
  9. #
  10. # This file is included by the global makefile so that you can add your own
  11. # architecture-specific flags and dependencies. Remember to do have actions
  12. # for "archclean" cleaning up for this architecture.
  13. #
  14. archscripts: scripts_basic
  15. $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs
  16. KBUILD_DEFCONFIG := 32r2el_defconfig
  17. KBUILD_DTBS := dtbs
  18. #
  19. # Select the object file format to substitute into the linker script.
  20. #
  21. ifdef CONFIG_CPU_LITTLE_ENDIAN
  22. 32bit-tool-archpref = mipsel
  23. 64bit-tool-archpref = mips64el
  24. 32bit-bfd = elf32-tradlittlemips
  25. 64bit-bfd = elf64-tradlittlemips
  26. 32bit-emul = elf32ltsmip
  27. 64bit-emul = elf64ltsmip
  28. else
  29. 32bit-tool-archpref = mips
  30. 64bit-tool-archpref = mips64
  31. 32bit-bfd = elf32-tradbigmips
  32. 64bit-bfd = elf64-tradbigmips
  33. 32bit-emul = elf32btsmip
  34. 64bit-emul = elf64btsmip
  35. endif
  36. ifdef CONFIG_32BIT
  37. tool-archpref = $(32bit-tool-archpref)
  38. UTS_MACHINE := mips
  39. endif
  40. ifdef CONFIG_64BIT
  41. tool-archpref = $(64bit-tool-archpref)
  42. UTS_MACHINE := mips64
  43. endif
  44. ifneq ($(SUBARCH),$(ARCH))
  45. ifeq ($(CROSS_COMPILE),)
  46. CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux- $(tool-archpref)-linux-gnu- $(tool-archpref)-unknown-linux-gnu-)
  47. endif
  48. endif
  49. ifdef CONFIG_FUNCTION_GRAPH_TRACER
  50. ifndef KBUILD_MCOUNT_RA_ADDRESS
  51. ifeq ($(call cc-option-yn,-mmcount-ra-address), y)
  52. cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS
  53. endif
  54. endif
  55. endif
  56. cflags-y += $(call cc-option, -mno-check-zero-division)
  57. ifdef CONFIG_32BIT
  58. ld-emul = $(32bit-emul)
  59. vmlinux-32 = vmlinux
  60. vmlinux-64 = vmlinux.64
  61. cflags-y += -mabi=32
  62. endif
  63. ifdef CONFIG_64BIT
  64. ld-emul = $(64bit-emul)
  65. vmlinux-32 = vmlinux.32
  66. vmlinux-64 = vmlinux
  67. cflags-y += -mabi=64
  68. endif
  69. all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32)
  70. all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64)
  71. all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
  72. #
  73. # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
  74. # code since it only slows down the whole thing. At some point we might make
  75. # use of global pointer optimizations but their use of $28 conflicts with
  76. # the current pointer optimization.
  77. #
  78. # The DECStation requires an ECOFF kernel for remote booting, other MIPS
  79. # machines may also. Since BFD is incredibly buggy with respect to
  80. # crossformat linking we rely on the elf2ecoff tool for format conversion.
  81. #
  82. cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
  83. cflags-y += -msoft-float
  84. LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
  85. KBUILD_AFLAGS_MODULE += -mlong-calls
  86. KBUILD_CFLAGS_MODULE += -mlong-calls
  87. ifeq ($(CONFIG_RELOCATABLE),y)
  88. LDFLAGS_vmlinux += --emit-relocs
  89. endif
  90. #
  91. # pass -msoft-float to GAS if it supports it. However on newer binutils
  92. # (specifically newer than 2.24.51.20140728) we then also need to explicitly
  93. # set ".set hardfloat" in all files which manipulate floating point registers.
  94. #
  95. ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
  96. cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
  97. endif
  98. cflags-y += -ffreestanding
  99. #
  100. # We explicitly add the endianness specifier if needed, this allows
  101. # to compile kernels with a toolchain for the other endianness. We
  102. # carefully avoid to add it redundantly because gcc 3.3/3.4 complains
  103. # when fed the toolchain default!
  104. #
  105. # Certain gcc versions up to gcc 4.1.1 (probably 4.2-subversion as of
  106. # 2006-10-10 don't properly change the predefined symbols if -EB / -EL
  107. # are used, so we kludge that here. A bug has been filed at
  108. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413.
  109. #
  110. # clang doesn't suffer from these issues and our checks against -dumpmachine
  111. # don't work so well when cross compiling, since without providing --target
  112. # clang's output will be based upon the build machine. So for clang we simply
  113. # unconditionally specify -EB or -EL as appropriate.
  114. #
  115. ifeq ($(cc-name),clang)
  116. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
  117. cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -EL
  118. else
  119. undef-all += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__
  120. undef-all += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__
  121. predef-be += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__
  122. predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
  123. cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
  124. cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
  125. endif
  126. cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
  127. -fno-omit-frame-pointer
  128. # Some distribution-specific toolchains might pass the -fstack-check
  129. # option during the build, which adds a simple stack-probe at the beginning
  130. # of every function. This stack probe is to ensure that there is enough
  131. # stack space, else a SEGV is generated. This is not desirable for MIPS
  132. # as kernel stacks are small, placed in unmapped virtual memory, and do not
  133. # grow when overflowed. Especially on SGI IP27 platforms, this check will
  134. # lead to a NULL pointer dereference in _raw_spin_lock_irq.
  135. #
  136. # In disassembly, this stack probe appears at the top of a function as:
  137. # sd zero,<offset>(sp)
  138. # Where <offset> is a negative value.
  139. #
  140. cflags-y += -fno-stack-check
  141. #
  142. # CPU-dependent compiler/assembler options for optimization.
  143. #
  144. cflags-$(CONFIG_CPU_R3000) += -march=r3000
  145. cflags-$(CONFIG_CPU_TX39XX) += -march=r3900
  146. cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap
  147. cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap
  148. cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
  149. cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
  150. cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
  151. cflags-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,--trap
  152. cflags-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,--trap -modd-spreg
  153. cflags-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,--trap
  154. cflags-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,--trap
  155. cflags-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,--trap
  156. cflags-$(CONFIG_CPU_R5000) += -march=r5000 -Wa,--trap
  157. cflags-$(CONFIG_CPU_R5432) += $(call cc-option,-march=r5400,-march=r5000) \
  158. -Wa,--trap
  159. cflags-$(CONFIG_CPU_R5500) += $(call cc-option,-march=r5500,-march=r5000) \
  160. -Wa,--trap
  161. cflags-$(CONFIG_CPU_NEVADA) += $(call cc-option,-march=rm5200,-march=r5000) \
  162. -Wa,--trap
  163. cflags-$(CONFIG_CPU_RM7000) += $(call cc-option,-march=rm7000,-march=r5000) \
  164. -Wa,--trap
  165. cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-march=sb1,-march=r5000) \
  166. -Wa,--trap
  167. cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mdmx)
  168. cflags-$(CONFIG_CPU_SB1) += $(call cc-option,-mno-mips3d)
  169. cflags-$(CONFIG_CPU_R8000) += -march=r8000 -Wa,--trap
  170. cflags-$(CONFIG_CPU_R10000) += $(call cc-option,-march=r10000,-march=r8000) \
  171. -Wa,--trap
  172. cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap
  173. ifeq (,$(findstring march=octeon, $(cflags-$(CONFIG_CPU_CAVIUM_OCTEON))))
  174. cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon
  175. endif
  176. cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
  177. cflags-$(CONFIG_CPU_BMIPS) += -march=mips32 -Wa,-mips32 -Wa,--trap
  178. cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,)
  179. cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,)
  180. cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,)
  181. # For smartmips configurations, there are hundreds of warnings due to ISA overrides
  182. # in assembly and header files. smartmips is only supported for MIPS32r1 onwards
  183. # and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or
  184. # similar directives in the kernel will spam the build logs with the following warnings:
  185. # Warning: the `smartmips' extension requires MIPS32 revision 1 or greater
  186. # or
  187. # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
  188. # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
  189. # been fixed properly.
  190. mips-cflags := $(cflags-y)
  191. ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y)
  192. smartmips-ase := $(call cc-option-yn,$(mips-cflags) -msmartmips)
  193. cflags-$(smartmips-ase) += -msmartmips -Wa,--no-warn
  194. endif
  195. ifeq ($(CONFIG_CPU_MICROMIPS),y)
  196. micromips-ase := $(call cc-option-yn,$(mips-cflags) -mmicromips)
  197. cflags-$(micromips-ase) += -mmicromips
  198. endif
  199. ifeq ($(CONFIG_CPU_HAS_MSA),y)
  200. toolchain-msa := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa)
  201. cflags-$(toolchain-msa) += -DTOOLCHAIN_SUPPORTS_MSA
  202. endif
  203. toolchain-virt := $(call cc-option-yn,$(mips-cflags) -mvirt)
  204. cflags-$(toolchain-virt) += -DTOOLCHAIN_SUPPORTS_VIRT
  205. # For -mmicromips, use -Wa,-fatal-warnings to catch unsupported -mxpa which
  206. # only warns
  207. xpa-cflags-y := $(mips-cflags)
  208. xpa-cflags-$(micromips-ase) += -mmicromips -Wa$(comma)-fatal-warnings
  209. toolchain-xpa := $(call cc-option-yn,$(xpa-cflags-y) -mxpa)
  210. cflags-$(toolchain-xpa) += -DTOOLCHAIN_SUPPORTS_XPA
  211. toolchain-crc := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc)
  212. cflags-$(toolchain-crc) += -DTOOLCHAIN_SUPPORTS_CRC
  213. #
  214. # Firmware support
  215. #
  216. libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/
  217. libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/
  218. libs-$(CONFIG_FW_SNIPROM) += arch/mips/fw/sni/
  219. libs-y += arch/mips/fw/lib/
  220. #
  221. # Kernel compression
  222. #
  223. ifdef CONFIG_SYS_SUPPORTS_ZBOOT
  224. COMPRESSION_FNAME = vmlinuz
  225. else
  226. COMPRESSION_FNAME = vmlinux
  227. endif
  228. #
  229. # Board-dependent options and extra files
  230. #
  231. include arch/mips/Kbuild.platforms
  232. ifdef CONFIG_PHYSICAL_START
  233. load-y = $(CONFIG_PHYSICAL_START)
  234. endif
  235. # Sign-extend the entry point to 64 bits if retrieved as a 32-bit number.
  236. entry-y = $(shell $(OBJDUMP) -f vmlinux 2>/dev/null \
  237. | sed -n '/^start address / { \
  238. s/^.* //; \
  239. s/0x\([0-7].......\)$$/0x00000000\1/; \
  240. s/0x\(........\)$$/0xffffffff\1/; p }')
  241. cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
  242. drivers-$(CONFIG_PCI) += arch/mips/pci/
  243. #
  244. # Automatically detect the build format. By default we choose
  245. # the elf format according to the load address.
  246. # We can always force a build with a 64-bits symbol format by
  247. # passing 'KBUILD_SYM32=no' option to the make's command line.
  248. #
  249. ifdef CONFIG_64BIT
  250. ifndef KBUILD_SYM32
  251. ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
  252. KBUILD_SYM32 = y
  253. endif
  254. endif
  255. ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy)
  256. cflags-y += -msym32 -DKBUILD_64BIT_SYM32
  257. else
  258. ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
  259. $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
  260. endif
  261. endif
  262. endif
  263. KBUILD_AFLAGS += $(cflags-y)
  264. KBUILD_CFLAGS += $(cflags-y)
  265. KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
  266. KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
  267. bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \
  268. VMLINUX_ENTRY_ADDRESS=$(entry-y) \
  269. PLATFORM="$(platform-y)" \
  270. ITS_INPUTS="$(its-y)"
  271. ifdef CONFIG_32BIT
  272. bootvars-y += ADDR_BITS=32
  273. endif
  274. ifdef CONFIG_64BIT
  275. bootvars-y += ADDR_BITS=64
  276. endif
  277. # This is required to get dwarf unwinding tables into .debug_frame
  278. # instead of .eh_frame so we don't discard them.
  279. KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
  280. KBUILD_LDFLAGS += -m $(ld-emul)
  281. ifdef CONFIG_MIPS
  282. CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
  283. egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
  284. sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
  285. endif
  286. OBJCOPYFLAGS += --remove-section=.reginfo
  287. head-y := arch/mips/kernel/head.o
  288. libs-y += arch/mips/lib/
  289. libs-y += arch/mips/math-emu/
  290. # See arch/mips/Kbuild for content of core part of the kernel
  291. core-y += arch/mips/
  292. drivers-$(CONFIG_MIPS_CRC_SUPPORT) += arch/mips/crypto/
  293. drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
  294. # suspend and hibernation support
  295. drivers-$(CONFIG_PM) += arch/mips/power/
  296. # boot image targets (arch/mips/boot/)
  297. boot-y := vmlinux.bin
  298. boot-y += vmlinux.ecoff
  299. boot-y += vmlinux.srec
  300. ifeq ($(shell expr $(load-y) \< 0xffffffff80000000 2> /dev/null), 0)
  301. boot-y += uImage
  302. boot-y += uImage.bin
  303. boot-y += uImage.bz2
  304. boot-y += uImage.gz
  305. boot-y += uImage.lzma
  306. boot-y += uImage.lzo
  307. endif
  308. boot-y += vmlinux.itb
  309. boot-y += vmlinux.gz.itb
  310. boot-y += vmlinux.bz2.itb
  311. boot-y += vmlinux.lzma.itb
  312. boot-y += vmlinux.lzo.itb
  313. # compressed boot image targets (arch/mips/boot/compressed/)
  314. bootz-y := vmlinuz
  315. bootz-y += vmlinuz.bin
  316. bootz-y += vmlinuz.ecoff
  317. bootz-y += vmlinuz.srec
  318. ifeq ($(shell expr $(zload-y) \< 0xffffffff80000000 2> /dev/null), 0)
  319. bootz-y += uzImage.bin
  320. endif
  321. ifdef CONFIG_LASAT
  322. rom.bin rom.sw: vmlinux
  323. $(Q)$(MAKE) $(build)=arch/mips/lasat/image \
  324. $(bootvars-y) $@
  325. endif
  326. #
  327. # Some machines like the Indy need 32-bit ELF binaries for booting purposes.
  328. # Other need ECOFF, so we build a 32-bit ELF binary for them which we then
  329. # convert to ECOFF using elf2ecoff.
  330. #
  331. quiet_cmd_32 = OBJCOPY $@
  332. cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
  333. vmlinux.32: vmlinux
  334. $(call cmd,32)
  335. #
  336. # The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
  337. # ELF files from 32-bit files by conversion.
  338. #
  339. quiet_cmd_64 = OBJCOPY $@
  340. cmd_64 = $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
  341. vmlinux.64: vmlinux
  342. $(call cmd,64)
  343. all: $(all-y) $(KBUILD_DTBS)
  344. # boot
  345. $(boot-y): $(vmlinux-32) FORCE
  346. $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \
  347. $(bootvars-y) arch/mips/boot/$@
  348. ifdef CONFIG_SYS_SUPPORTS_ZBOOT
  349. # boot/compressed
  350. $(bootz-y): $(vmlinux-32) FORCE
  351. $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
  352. $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@
  353. else
  354. vmlinuz: FORCE
  355. @echo ' CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
  356. /bin/false
  357. endif
  358. CLEAN_FILES += vmlinux.32 vmlinux.64
  359. # device-trees
  360. core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
  361. %.dtb %.dtb.S %.dtb.o: | scripts
  362. $(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
  363. PHONY += dtbs
  364. dtbs: scripts
  365. $(Q)$(MAKE) $(build)=arch/mips/boot/dts
  366. PHONY += dtbs_install
  367. dtbs_install:
  368. $(Q)$(MAKE) $(dtbinst)=arch/mips/boot/dts
  369. archprepare:
  370. ifdef CONFIG_MIPS32_N32
  371. @$(kecho) ' Checking missing-syscalls for N32'
  372. $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
  373. endif
  374. ifdef CONFIG_MIPS32_O32
  375. @$(kecho) ' Checking missing-syscalls for O32'
  376. $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
  377. endif
  378. install:
  379. $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
  380. ifdef CONFIG_SYS_SUPPORTS_ZBOOT
  381. $(Q)install -D -m 755 vmlinuz $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
  382. endif
  383. $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
  384. $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
  385. archclean:
  386. $(Q)$(MAKE) $(clean)=arch/mips/boot
  387. $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed
  388. $(Q)$(MAKE) $(clean)=arch/mips/boot/tools
  389. $(Q)$(MAKE) $(clean)=arch/mips/lasat
  390. define archhelp
  391. echo ' install - install kernel into $(INSTALL_PATH)'
  392. echo ' vmlinux.ecoff - ECOFF boot image'
  393. echo ' vmlinux.bin - Raw binary boot image'
  394. echo ' vmlinux.srec - SREC boot image'
  395. echo ' vmlinux.32 - 64-bit boot image wrapped in 32bits (IP22/IP32)'
  396. echo ' vmlinuz - Compressed boot(zboot) image'
  397. echo ' vmlinuz.ecoff - ECOFF zboot image'
  398. echo ' vmlinuz.bin - Raw binary zboot image'
  399. echo ' vmlinuz.srec - SREC zboot image'
  400. echo ' uImage - U-Boot image'
  401. echo ' uImage.bin - U-Boot image (uncompressed)'
  402. echo ' uImage.bz2 - U-Boot image (bz2)'
  403. echo ' uImage.gz - U-Boot image (gzip)'
  404. echo ' uImage.lzma - U-Boot image (lzma)'
  405. echo ' uImage.lzo - U-Boot image (lzo)'
  406. echo ' uzImage.bin - U-Boot image (self-extracting)'
  407. echo ' dtbs - Device-tree blobs for enabled boards'
  408. echo ' dtbs_install - Install dtbs to $(INSTALL_DTBS_PATH)'
  409. echo
  410. echo ' These will be default as appropriate for a configured platform.'
  411. echo
  412. echo ' If you are targeting a system supported by generic kernels you may'
  413. echo ' configure the kernel for a given architecture target like so:'
  414. echo
  415. echo ' {micro32,32,64}{r1,r2,r6}{el,}_defconfig <BOARDS="list of boards">'
  416. echo
  417. echo ' Where BOARDS is some subset of the following:'
  418. for board in $(sort $(BOARDS)); do echo " $${board}"; done
  419. echo
  420. echo ' Specifically the following generic default configurations are'
  421. echo ' supported:'
  422. echo
  423. $(foreach cfg,$(generic_defconfigs),
  424. printf " %-24s - Build generic kernel for $(call describe_generic_defconfig,$(cfg))\n" $(cfg);)
  425. echo
  426. echo ' The following legacy default configurations have been converted to'
  427. echo ' generic and can still be used:'
  428. echo
  429. $(foreach cfg,$(sort $(legacy_defconfigs)),
  430. printf " %-24s - Build $($(cfg)-y)\n" $(cfg);)
  431. echo
  432. echo ' Otherwise, the following default configurations are available:'
  433. endef
  434. generic_config_dir = $(srctree)/arch/$(ARCH)/configs/generic
  435. generic_defconfigs :=
  436. #
  437. # If the user generates a generic kernel configuration without specifying a
  438. # list of boards to include the config fragments for, default to including all
  439. # available board config fragments.
  440. #
  441. ifeq ($(BOARDS),)
  442. BOARDS = $(patsubst board-%.config,%,$(notdir $(wildcard $(generic_config_dir)/board-*.config)))
  443. endif
  444. #
  445. # Generic kernel configurations which merge generic_defconfig with the
  446. # appropriate config fragments from arch/mips/configs/generic/, resulting in
  447. # the ability to easily configure the kernel for a given architecture,
  448. # endianness & set of boards without duplicating the needed configuration in
  449. # hundreds of defconfig files.
  450. #
  451. define gen_generic_defconfigs
  452. $(foreach bits,$(1),$(foreach rev,$(2),$(foreach endian,$(3),
  453. target := $(bits)$(rev)$(filter el,$(endian))_defconfig
  454. generic_defconfigs += $$(target)
  455. $$(target): $(generic_config_dir)/$(bits)$(rev).config
  456. $$(target): $(generic_config_dir)/$(endian).config
  457. )))
  458. endef
  459. $(eval $(call gen_generic_defconfigs,32 64,r1 r2 r6,eb el))
  460. $(eval $(call gen_generic_defconfigs,micro32,r2,eb el))
  461. define describe_generic_defconfig
  462. $(subst 32r,MIPS32 r,$(subst 64r,MIPS64 r,$(subst el, little endian,$(patsubst %_defconfig,%,$(1)))))
  463. endef
  464. .PHONY: $(generic_defconfigs)
  465. $(generic_defconfigs):
  466. $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
  467. -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/generic_defconfig $^ | \
  468. grep -Ev '^#'
  469. $(Q)cp $(KCONFIG_CONFIG) $(objtree)/.config.$@
  470. $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig \
  471. KCONFIG_CONFIG=$(objtree)/.config.$@ >/dev/null
  472. $(Q)$(CONFIG_SHELL) $(srctree)/arch/$(ARCH)/tools/generic-board-config.sh \
  473. $(srctree) $(objtree) $(objtree)/.config.$@ $(KCONFIG_CONFIG) \
  474. "$(origin BOARDS)" $(BOARDS)
  475. $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
  476. #
  477. # Prevent generic merge_config rules attempting to merge single fragments
  478. #
  479. $(generic_config_dir)/%.config: ;
  480. #
  481. # Prevent direct use of generic_defconfig, which is intended to be used as the
  482. # basis of the various ISA-specific targets generated above.
  483. #
  484. .PHONY: generic_defconfig
  485. generic_defconfig:
  486. $(Q)echo "generic_defconfig is not intended for direct use, but should instead be"
  487. $(Q)echo "used via an ISA-specific target from the following list:"
  488. $(Q)echo
  489. $(Q)for cfg in $(generic_defconfigs); do echo " $${cfg}"; done
  490. $(Q)echo
  491. $(Q)false
  492. #
  493. # Legacy defconfig compatibility - these targets used to be real defconfigs but
  494. # now that the boards have been converted to use the generic kernel they are
  495. # wrappers around the generic rules above.
  496. #
  497. legacy_defconfigs += ocelot_defconfig
  498. ocelot_defconfig-y := 32r2el_defconfig BOARDS=ocelot
  499. legacy_defconfigs += sead3_defconfig
  500. sead3_defconfig-y := 32r2el_defconfig BOARDS=sead-3
  501. legacy_defconfigs += sead3micro_defconfig
  502. sead3micro_defconfig-y := micro32r2el_defconfig BOARDS=sead-3
  503. legacy_defconfigs += xilfpga_defconfig
  504. xilfpga_defconfig-y := 32r2el_defconfig BOARDS=xilfpga
  505. .PHONY: $(legacy_defconfigs)
  506. $(legacy_defconfigs):
  507. $(Q)$(MAKE) -f $(srctree)/Makefile $($@-y)