Makefile 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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. $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs
  17. KBUILD_DEFCONFIG := 32r2el_defconfig
  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. ifdef CONFIG_CC_IS_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. toolchain-dsp := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp)
  214. cflags-$(toolchain-dsp) += -DTOOLCHAIN_SUPPORTS_DSP
  215. #
  216. # Firmware support
  217. #
  218. libs-$(CONFIG_FW_ARC) += arch/mips/fw/arc/
  219. libs-$(CONFIG_FW_CFE) += arch/mips/fw/cfe/
  220. libs-$(CONFIG_FW_SNIPROM) += arch/mips/fw/sni/
  221. libs-y += arch/mips/fw/lib/
  222. #
  223. # Kernel compression
  224. #
  225. ifdef CONFIG_SYS_SUPPORTS_ZBOOT
  226. COMPRESSION_FNAME = vmlinuz
  227. else
  228. COMPRESSION_FNAME = vmlinux
  229. endif
  230. #
  231. # Board-dependent options and extra files
  232. #
  233. include arch/mips/Kbuild.platforms
  234. ifdef CONFIG_PHYSICAL_START
  235. load-y = $(CONFIG_PHYSICAL_START)
  236. endif
  237. entry-y = $(shell $(objtree)/arch/mips/tools/elf-entry vmlinux)
  238. cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
  239. drivers-$(CONFIG_PCI) += arch/mips/pci/
  240. #
  241. # Automatically detect the build format. By default we choose
  242. # the elf format according to the load address.
  243. # We can always force a build with a 64-bits symbol format by
  244. # passing 'KBUILD_SYM32=no' option to the make's command line.
  245. #
  246. ifdef CONFIG_64BIT
  247. ifndef KBUILD_SYM32
  248. ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
  249. KBUILD_SYM32 = y
  250. endif
  251. endif
  252. ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy)
  253. cflags-y += -msym32 -DKBUILD_64BIT_SYM32
  254. else
  255. ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
  256. $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
  257. endif
  258. endif
  259. endif
  260. KBUILD_AFLAGS += $(cflags-y)
  261. KBUILD_CFLAGS += $(cflags-y)
  262. KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
  263. KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
  264. bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \
  265. VMLINUX_ENTRY_ADDRESS=$(entry-y) \
  266. PLATFORM="$(platform-y)" \
  267. ITS_INPUTS="$(its-y)"
  268. ifdef CONFIG_32BIT
  269. bootvars-y += ADDR_BITS=32
  270. endif
  271. ifdef CONFIG_64BIT
  272. bootvars-y += ADDR_BITS=64
  273. endif
  274. # This is required to get dwarf unwinding tables into .debug_frame
  275. # instead of .eh_frame so we don't discard them.
  276. KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
  277. KBUILD_LDFLAGS += -m $(ld-emul)
  278. ifdef CONFIG_MIPS
  279. CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
  280. egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
  281. sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
  282. endif
  283. OBJCOPYFLAGS += --remove-section=.reginfo
  284. head-y := arch/mips/kernel/head.o
  285. libs-y += arch/mips/lib/
  286. libs-y += arch/mips/math-emu/
  287. # See arch/mips/Kbuild for content of core part of the kernel
  288. core-y += arch/mips/
  289. drivers-$(CONFIG_MIPS_CRC_SUPPORT) += arch/mips/crypto/
  290. drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
  291. # suspend and hibernation support
  292. drivers-$(CONFIG_PM) += arch/mips/power/
  293. # boot image targets (arch/mips/boot/)
  294. boot-y := vmlinux.bin
  295. boot-y += vmlinux.ecoff
  296. boot-y += vmlinux.srec
  297. ifeq ($(shell expr $(load-y) \< 0xffffffff80000000 2> /dev/null), 0)
  298. boot-y += uImage
  299. boot-y += uImage.bin
  300. boot-y += uImage.bz2
  301. boot-y += uImage.gz
  302. boot-y += uImage.lzma
  303. boot-y += uImage.lzo
  304. endif
  305. boot-y += vmlinux.itb
  306. boot-y += vmlinux.gz.itb
  307. boot-y += vmlinux.bz2.itb
  308. boot-y += vmlinux.lzma.itb
  309. boot-y += vmlinux.lzo.itb
  310. # compressed boot image targets (arch/mips/boot/compressed/)
  311. bootz-y := vmlinuz
  312. bootz-y += vmlinuz.bin
  313. bootz-y += vmlinuz.ecoff
  314. bootz-y += vmlinuz.srec
  315. ifeq ($(shell expr $(zload-y) \< 0xffffffff80000000 2> /dev/null), 0)
  316. bootz-y += uzImage.bin
  317. endif
  318. ifdef CONFIG_LASAT
  319. rom.bin rom.sw: vmlinux
  320. $(Q)$(MAKE) $(build)=arch/mips/lasat/image \
  321. $(bootvars-y) $@
  322. endif
  323. #
  324. # Some machines like the Indy need 32-bit ELF binaries for booting purposes.
  325. # Other need ECOFF, so we build a 32-bit ELF binary for them which we then
  326. # convert to ECOFF using elf2ecoff.
  327. #
  328. quiet_cmd_32 = OBJCOPY $@
  329. cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
  330. vmlinux.32: vmlinux
  331. $(call cmd,32)
  332. #
  333. # The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
  334. # ELF files from 32-bit files by conversion.
  335. #
  336. quiet_cmd_64 = OBJCOPY $@
  337. cmd_64 = $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
  338. vmlinux.64: vmlinux
  339. $(call cmd,64)
  340. all: $(all-y)
  341. # boot
  342. $(boot-y): $(vmlinux-32) FORCE
  343. $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \
  344. $(bootvars-y) arch/mips/boot/$@
  345. ifdef CONFIG_SYS_SUPPORTS_ZBOOT
  346. # boot/compressed
  347. $(bootz-y): $(vmlinux-32) FORCE
  348. $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
  349. $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@
  350. else
  351. vmlinuz: FORCE
  352. @echo ' CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
  353. /bin/false
  354. endif
  355. CLEAN_FILES += vmlinux.32 vmlinux.64
  356. # device-trees
  357. core-y += arch/mips/boot/dts/
  358. archprepare:
  359. ifdef CONFIG_MIPS32_N32
  360. @$(kecho) ' Checking missing-syscalls for N32'
  361. $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
  362. endif
  363. ifdef CONFIG_MIPS32_O32
  364. @$(kecho) ' Checking missing-syscalls for O32'
  365. $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
  366. endif
  367. install:
  368. $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
  369. ifdef CONFIG_SYS_SUPPORTS_ZBOOT
  370. $(Q)install -D -m 755 vmlinuz $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
  371. endif
  372. $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
  373. $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
  374. archclean:
  375. $(Q)$(MAKE) $(clean)=arch/mips/boot
  376. $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed
  377. $(Q)$(MAKE) $(clean)=arch/mips/boot/tools
  378. $(Q)$(MAKE) $(clean)=arch/mips/lasat
  379. define archhelp
  380. echo ' install - install kernel into $(INSTALL_PATH)'
  381. echo ' vmlinux.ecoff - ECOFF boot image'
  382. echo ' vmlinux.bin - Raw binary boot image'
  383. echo ' vmlinux.srec - SREC boot image'
  384. echo ' vmlinux.32 - 64-bit boot image wrapped in 32bits (IP22/IP32)'
  385. echo ' vmlinuz - Compressed boot(zboot) image'
  386. echo ' vmlinuz.ecoff - ECOFF zboot image'
  387. echo ' vmlinuz.bin - Raw binary zboot image'
  388. echo ' vmlinuz.srec - SREC zboot image'
  389. echo ' uImage - U-Boot image'
  390. echo ' uImage.bin - U-Boot image (uncompressed)'
  391. echo ' uImage.bz2 - U-Boot image (bz2)'
  392. echo ' uImage.gz - U-Boot image (gzip)'
  393. echo ' uImage.lzma - U-Boot image (lzma)'
  394. echo ' uImage.lzo - U-Boot image (lzo)'
  395. echo ' uzImage.bin - U-Boot image (self-extracting)'
  396. echo
  397. echo ' These will be default as appropriate for a configured platform.'
  398. echo
  399. echo ' If you are targeting a system supported by generic kernels you may'
  400. echo ' configure the kernel for a given architecture target like so:'
  401. echo
  402. echo ' {micro32,32,64}{r1,r2,r6}{el,}_defconfig <BOARDS="list of boards">'
  403. echo
  404. echo ' Where BOARDS is some subset of the following:'
  405. for board in $(sort $(BOARDS)); do echo " $${board}"; done
  406. echo
  407. echo ' Specifically the following generic default configurations are'
  408. echo ' supported:'
  409. echo
  410. $(foreach cfg,$(generic_defconfigs),
  411. printf " %-24s - Build generic kernel for $(call describe_generic_defconfig,$(cfg))\n" $(cfg);)
  412. echo
  413. echo ' The following legacy default configurations have been converted to'
  414. echo ' generic and can still be used:'
  415. echo
  416. $(foreach cfg,$(sort $(legacy_defconfigs)),
  417. printf " %-24s - Build $($(cfg)-y)\n" $(cfg);)
  418. echo
  419. echo ' Otherwise, the following default configurations are available:'
  420. endef
  421. generic_config_dir = $(srctree)/arch/$(ARCH)/configs/generic
  422. generic_defconfigs :=
  423. #
  424. # If the user generates a generic kernel configuration without specifying a
  425. # list of boards to include the config fragments for, default to including all
  426. # available board config fragments.
  427. #
  428. ifeq ($(BOARDS),)
  429. BOARDS = $(patsubst board-%.config,%,$(notdir $(wildcard $(generic_config_dir)/board-*.config)))
  430. endif
  431. #
  432. # Generic kernel configurations which merge generic_defconfig with the
  433. # appropriate config fragments from arch/mips/configs/generic/, resulting in
  434. # the ability to easily configure the kernel for a given architecture,
  435. # endianness & set of boards without duplicating the needed configuration in
  436. # hundreds of defconfig files.
  437. #
  438. define gen_generic_defconfigs
  439. $(foreach bits,$(1),$(foreach rev,$(2),$(foreach endian,$(3),
  440. target := $(bits)$(rev)$(filter el,$(endian))_defconfig
  441. generic_defconfigs += $$(target)
  442. $$(target): $(generic_config_dir)/$(bits)$(rev).config
  443. $$(target): $(generic_config_dir)/$(endian).config
  444. )))
  445. endef
  446. $(eval $(call gen_generic_defconfigs,32 64,r1 r2 r6,eb el))
  447. $(eval $(call gen_generic_defconfigs,micro32,r2,eb el))
  448. define describe_generic_defconfig
  449. $(subst 32r,MIPS32 r,$(subst 64r,MIPS64 r,$(subst el, little endian,$(patsubst %_defconfig,%,$(1)))))
  450. endef
  451. .PHONY: $(generic_defconfigs)
  452. $(generic_defconfigs):
  453. $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
  454. -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/generic_defconfig $^ | \
  455. grep -Ev '^#'
  456. $(Q)cp $(KCONFIG_CONFIG) $(objtree)/.config.$@
  457. $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig \
  458. KCONFIG_CONFIG=$(objtree)/.config.$@ >/dev/null
  459. $(Q)$(CONFIG_SHELL) $(srctree)/arch/$(ARCH)/tools/generic-board-config.sh \
  460. $(srctree) $(objtree) $(objtree)/.config.$@ $(KCONFIG_CONFIG) \
  461. "$(origin BOARDS)" $(BOARDS)
  462. $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
  463. #
  464. # Prevent generic merge_config rules attempting to merge single fragments
  465. #
  466. $(generic_config_dir)/%.config: ;
  467. #
  468. # Prevent direct use of generic_defconfig, which is intended to be used as the
  469. # basis of the various ISA-specific targets generated above.
  470. #
  471. .PHONY: generic_defconfig
  472. generic_defconfig:
  473. $(Q)echo "generic_defconfig is not intended for direct use, but should instead be"
  474. $(Q)echo "used via an ISA-specific target from the following list:"
  475. $(Q)echo
  476. $(Q)for cfg in $(generic_defconfigs); do echo " $${cfg}"; done
  477. $(Q)echo
  478. $(Q)false
  479. #
  480. # Legacy defconfig compatibility - these targets used to be real defconfigs but
  481. # now that the boards have been converted to use the generic kernel they are
  482. # wrappers around the generic rules above.
  483. #
  484. legacy_defconfigs += ocelot_defconfig
  485. ocelot_defconfig-y := 32r2el_defconfig BOARDS=ocelot
  486. legacy_defconfigs += sead3_defconfig
  487. sead3_defconfig-y := 32r2el_defconfig BOARDS=sead-3
  488. legacy_defconfigs += sead3micro_defconfig
  489. sead3micro_defconfig-y := micro32r2el_defconfig BOARDS=sead-3
  490. legacy_defconfigs += xilfpga_defconfig
  491. xilfpga_defconfig-y := 32r2el_defconfig BOARDS=xilfpga
  492. .PHONY: $(legacy_defconfigs)
  493. $(legacy_defconfigs):
  494. $(Q)$(MAKE) -f $(srctree)/Makefile $($@-y)