Makefile 20 KB

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