Makefile 19 KB

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