Makefile 20 KB

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