Back to home page

OSCL-LXR

 
 

    


0001 #
0002 # This file is subject to the terms and conditions of the GNU General Public
0003 # License.  See the file "COPYING" in the main directory of this archive
0004 # for more details.
0005 #
0006 # Copyright (C) 1994, 95, 96, 2003 by Ralf Baechle
0007 # DECStation modifications by Paul M. Antoine, 1996
0008 # Copyright (C) 2002, 2003, 2004  Maciej W. Rozycki
0009 #
0010 # This file is included by the global makefile so that you can add your own
0011 # architecture-specific flags and dependencies.
0012 #
0013 
0014 archscripts: scripts_basic
0015         $(Q)$(MAKE) $(build)=arch/mips/tools elf-entry
0016 ifeq ($(CONFIG_CPU_LOONGSON3_WORKAROUNDS),y)
0017         $(Q)$(MAKE) $(build)=arch/mips/tools loongson3-llsc-check
0018 endif
0019         $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs
0020 
0021 KBUILD_DEFCONFIG := 32r2el_defconfig
0022 KBUILD_DTBS      := dtbs
0023 
0024 #
0025 # Select the object file format to substitute into the linker script.
0026 #
0027 ifdef CONFIG_CPU_LITTLE_ENDIAN
0028 32bit-tool-archpref     = mipsel
0029 64bit-tool-archpref     = mips64el
0030 32bit-bfd               = elf32-tradlittlemips
0031 64bit-bfd               = elf64-tradlittlemips
0032 32bit-emul              = elf32ltsmip
0033 64bit-emul              = elf64ltsmip
0034 else
0035 32bit-tool-archpref     = mips
0036 64bit-tool-archpref     = mips64
0037 32bit-bfd               = elf32-tradbigmips
0038 64bit-bfd               = elf64-tradbigmips
0039 32bit-emul              = elf32btsmip
0040 64bit-emul              = elf64btsmip
0041 endif
0042 
0043 ifdef CONFIG_32BIT
0044 tool-archpref           = $(32bit-tool-archpref)
0045 UTS_MACHINE             := mips
0046 endif
0047 ifdef CONFIG_64BIT
0048 tool-archpref           = $(64bit-tool-archpref)
0049 UTS_MACHINE             := mips64
0050 endif
0051 
0052 ifdef cross_compiling
0053   ifeq ($(CROSS_COMPILE),)
0054     CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux-  $(tool-archpref)-linux-gnu-  $(tool-archpref)-unknown-linux-gnu-)
0055   endif
0056 endif
0057 
0058 ifdef CONFIG_FUNCTION_GRAPH_TRACER
0059   ifndef KBUILD_MCOUNT_RA_ADDRESS
0060     ifeq ($(call cc-option-yn,-mmcount-ra-address), y)
0061       cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS
0062     endif
0063   endif
0064 endif
0065 cflags-y += $(call cc-option, -mno-check-zero-division)
0066 
0067 ifdef CONFIG_32BIT
0068 ld-emul                 = $(32bit-emul)
0069 vmlinux-32              = vmlinux
0070 vmlinux-64              = vmlinux.64
0071 
0072 cflags-y                += -mabi=32
0073 endif
0074 
0075 ifdef CONFIG_64BIT
0076 ld-emul                 = $(64bit-emul)
0077 vmlinux-32              = vmlinux.32
0078 vmlinux-64              = vmlinux
0079 
0080 cflags-y                += -mabi=64
0081 endif
0082 
0083 all-$(CONFIG_BOOT_ELF32)        := $(vmlinux-32)
0084 all-$(CONFIG_BOOT_ELF64)        := $(vmlinux-64)
0085 all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
0086 
0087 #
0088 # GCC uses -G 0 -mabicalls -fpic as default.  We don't want PIC in the kernel
0089 # code since it only slows down the whole thing.  At some point we might make
0090 # use of global pointer optimizations but their use of $28 conflicts with
0091 # the current pointer optimization.
0092 #
0093 # The DECStation requires an ECOFF kernel for remote booting, other MIPS
0094 # machines may also.  Since BFD is incredibly buggy with respect to
0095 # crossformat linking we rely on the elf2ecoff tool for format conversion.
0096 #
0097 cflags-y                        += -G 0 -mno-abicalls -fno-pic -pipe
0098 cflags-y                        += -msoft-float
0099 LDFLAGS_vmlinux                 += -G 0 -static -n -nostdlib
0100 KBUILD_AFLAGS_MODULE            += -mlong-calls
0101 KBUILD_CFLAGS_MODULE            += -mlong-calls
0102 
0103 ifeq ($(CONFIG_RELOCATABLE),y)
0104 LDFLAGS_vmlinux                 += --emit-relocs
0105 endif
0106 
0107 #
0108 # pass -msoft-float to GAS if it supports it.  However on newer binutils
0109 # (specifically newer than 2.24.51.20140728) we then also need to explicitly
0110 # set ".set hardfloat" in all files which manipulate floating point registers.
0111 #
0112 ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
0113         cflags-y                += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
0114 endif
0115 
0116 cflags-y += -ffreestanding
0117 
0118 cflags-$(CONFIG_CPU_BIG_ENDIAN)         += -EB
0119 cflags-$(CONFIG_CPU_LITTLE_ENDIAN)      += -EL
0120 
0121 cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
0122                                    -fno-omit-frame-pointer
0123 
0124 # Some distribution-specific toolchains might pass the -fstack-check
0125 # option during the build, which adds a simple stack-probe at the beginning
0126 # of every function.  This stack probe is to ensure that there is enough
0127 # stack space, else a SEGV is generated.  This is not desirable for MIPS
0128 # as kernel stacks are small, placed in unmapped virtual memory, and do not
0129 # grow when overflowed.  Especially on SGI IP27 platforms, this check will
0130 # lead to a NULL pointer dereference in _raw_spin_lock_irq.
0131 #
0132 # In disassembly, this stack probe appears at the top of a function as:
0133 #    sd         zero,<offset>(sp)
0134 # Where <offset> is a negative value.
0135 #
0136 cflags-y += -fno-stack-check
0137 
0138 # binutils from v2.35 when built with --enable-mips-fix-loongson3-llsc=yes,
0139 # supports an -mfix-loongson3-llsc flag which emits a sync prior to each ll
0140 # instruction to work around a CPU bug (see __SYNC_loongson3_war in asm/sync.h
0141 # for a description).
0142 #
0143 # We disable this in order to prevent the assembler meddling with the
0144 # instruction that labels refer to, ie. if we label an ll instruction:
0145 #
0146 # 1: ll v0, 0(a0)
0147 #
0148 # ...then with the assembler fix applied the label may actually point at a sync
0149 # instruction inserted by the assembler, and if we were using the label in an
0150 # exception table the table would no longer contain the address of the ll
0151 # instruction.
0152 #
0153 # Avoid this by explicitly disabling that assembler behaviour.
0154 #
0155 cflags-y += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,)
0156 
0157 #
0158 # CPU-dependent compiler/assembler options for optimization.
0159 #
0160 cflags-$(CONFIG_CPU_R3000)      += -march=r3000
0161 cflags-$(CONFIG_CPU_R4300)      += -march=r4300 -Wa,--trap
0162 cflags-$(CONFIG_CPU_R4X00)      += -march=r4600 -Wa,--trap
0163 cflags-$(CONFIG_CPU_TX49XX)     += -march=r4600 -Wa,--trap
0164 cflags-$(CONFIG_CPU_MIPS32_R1)  += -march=mips32 -Wa,--trap
0165 cflags-$(CONFIG_CPU_MIPS32_R2)  += -march=mips32r2 -Wa,--trap
0166 cflags-$(CONFIG_CPU_MIPS32_R5)  += -march=mips32r5 -Wa,--trap -modd-spreg
0167 cflags-$(CONFIG_CPU_MIPS32_R6)  += -march=mips32r6 -Wa,--trap -modd-spreg
0168 cflags-$(CONFIG_CPU_MIPS64_R1)  += -march=mips64 -Wa,--trap
0169 cflags-$(CONFIG_CPU_MIPS64_R2)  += -march=mips64r2 -Wa,--trap
0170 cflags-$(CONFIG_CPU_MIPS64_R5)  += -march=mips64r5 -Wa,--trap
0171 cflags-$(CONFIG_CPU_MIPS64_R6)  += -march=mips64r6 -Wa,--trap
0172 cflags-$(CONFIG_CPU_P5600)      += -march=p5600 -Wa,--trap -modd-spreg
0173 cflags-$(CONFIG_CPU_R5000)      += -march=r5000 -Wa,--trap
0174 cflags-$(CONFIG_CPU_R5500)      += $(call cc-option,-march=r5500,-march=r5000) \
0175                         -Wa,--trap
0176 cflags-$(CONFIG_CPU_NEVADA)     += $(call cc-option,-march=rm5200,-march=r5000) \
0177                         -Wa,--trap
0178 cflags-$(CONFIG_CPU_RM7000)     += $(call cc-option,-march=rm7000,-march=r5000) \
0179                         -Wa,--trap
0180 cflags-$(CONFIG_CPU_SB1)        += $(call cc-option,-march=sb1,-march=r5000) \
0181                         -Wa,--trap
0182 cflags-$(CONFIG_CPU_SB1)        += $(call cc-option,-mno-mdmx)
0183 cflags-$(CONFIG_CPU_SB1)        += $(call cc-option,-mno-mips3d)
0184 cflags-$(CONFIG_CPU_R10000)     += $(call cc-option,-march=r10000,-march=r8000) \
0185                         -Wa,--trap
0186 cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap
0187 ifeq (,$(findstring march=octeon, $(cflags-$(CONFIG_CPU_CAVIUM_OCTEON))))
0188 cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon
0189 endif
0190 cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
0191 cflags-$(CONFIG_CPU_BMIPS)      += -march=mips32 -Wa,-mips32 -Wa,--trap
0192 
0193 cflags-$(CONFIG_CPU_R4000_WORKAROUNDS)  += $(call cc-option,-mfix-r4000,)
0194 cflags-$(CONFIG_CPU_R4400_WORKAROUNDS)  += $(call cc-option,-mfix-r4400,)
0195 cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS)  += $(call cc-option,-mno-daddi,)
0196 
0197 # For smartmips configurations, there are hundreds of warnings due to ISA overrides
0198 # in assembly and header files. smartmips is only supported for MIPS32r1 onwards
0199 # and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or
0200 # similar directives in the kernel will spam the build logs with the following warnings:
0201 # Warning: the `smartmips' extension requires MIPS32 revision 1 or greater
0202 # or
0203 # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
0204 # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
0205 # been fixed properly.
0206 mips-cflags                             := $(cflags-y)
0207 ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y)
0208 smartmips-ase                           := $(call cc-option-yn,$(mips-cflags) -msmartmips)
0209 cflags-$(smartmips-ase)                 += -msmartmips -Wa,--no-warn
0210 endif
0211 ifeq ($(CONFIG_CPU_MICROMIPS),y)
0212 micromips-ase                           := $(call cc-option-yn,$(mips-cflags) -mmicromips)
0213 cflags-$(micromips-ase)                 += -mmicromips
0214 endif
0215 ifeq ($(CONFIG_CPU_HAS_MSA),y)
0216 toolchain-msa                           := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa)
0217 cflags-$(toolchain-msa)                 += -DTOOLCHAIN_SUPPORTS_MSA
0218 endif
0219 toolchain-virt                          := $(call cc-option-yn,$(mips-cflags) -mvirt)
0220 cflags-$(toolchain-virt)                += -DTOOLCHAIN_SUPPORTS_VIRT
0221 # For -mmicromips, use -Wa,-fatal-warnings to catch unsupported -mxpa which
0222 # only warns
0223 xpa-cflags-y                            := $(mips-cflags)
0224 xpa-cflags-$(micromips-ase)             += -mmicromips -Wa$(comma)-fatal-warnings
0225 toolchain-xpa                           := $(call cc-option-yn,$(xpa-cflags-y) -mxpa)
0226 cflags-$(toolchain-xpa)                 += -DTOOLCHAIN_SUPPORTS_XPA
0227 toolchain-crc                           := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mcrc)
0228 cflags-$(toolchain-crc)                 += -DTOOLCHAIN_SUPPORTS_CRC
0229 toolchain-dsp                           := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mdsp)
0230 cflags-$(toolchain-dsp)                 += -DTOOLCHAIN_SUPPORTS_DSP
0231 toolchain-ginv                          := $(call cc-option-yn,$(mips-cflags) -Wa$(comma)-mginv)
0232 cflags-$(toolchain-ginv)                += -DTOOLCHAIN_SUPPORTS_GINV
0233 
0234 #
0235 # Firmware support
0236 #
0237 libs-$(CONFIG_FW_ARC)           += arch/mips/fw/arc/
0238 libs-$(CONFIG_FW_CFE)           += arch/mips/fw/cfe/
0239 libs-$(CONFIG_FW_SNIPROM)       += arch/mips/fw/sni/
0240 libs-y                          += arch/mips/fw/lib/
0241 
0242 #
0243 # Kernel compression
0244 #
0245 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0246 COMPRESSION_FNAME               = vmlinuz
0247 else
0248 COMPRESSION_FNAME               = vmlinux
0249 endif
0250 
0251 #
0252 # Board-dependent options and extra files
0253 #
0254 include $(srctree)/arch/mips/Kbuild.platforms
0255 
0256 ifdef CONFIG_PHYSICAL_START
0257 load-y                                  = $(CONFIG_PHYSICAL_START)
0258 endif
0259 
0260 entry-y                         = $(shell $(objtree)/arch/mips/tools/elf-entry vmlinux)
0261 cflags-y                        += -I$(srctree)/arch/mips/include/asm/mach-generic
0262 drivers-$(CONFIG_PCI)           += arch/mips/pci/
0263 
0264 #
0265 # Automatically detect the build format. By default we choose
0266 # the elf format according to the load address.
0267 # We can always force a build with a 64-bits symbol format by
0268 # passing 'KBUILD_SYM32=no' option to the make's command line.
0269 #
0270 ifdef CONFIG_64BIT
0271   ifndef KBUILD_SYM32
0272     ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
0273       KBUILD_SYM32 = y
0274     endif
0275   endif
0276 
0277   ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy)
0278     cflags-y += -msym32 -DKBUILD_64BIT_SYM32
0279   else
0280     ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
0281       $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
0282     endif
0283   endif
0284 endif
0285 
0286 # When linking a 32-bit executable the LLVM linker cannot cope with a
0287 # 32-bit load address that has been sign-extended to 64 bits.  Simply
0288 # remove the upper 32 bits then, as it is safe to do so with other
0289 # linkers.
0290 ifdef CONFIG_64BIT
0291         load-ld                 = $(load-y)
0292 else
0293         load-ld                 = $(subst 0xffffffff,0x,$(load-y))
0294 endif
0295 
0296 KBUILD_AFLAGS   += $(cflags-y)
0297 KBUILD_CFLAGS   += $(cflags-y)
0298 KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -DLINKER_LOAD_ADDRESS=$(load-ld)
0299 KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
0300 
0301 bootvars-y      = VMLINUX_LOAD_ADDRESS=$(load-y) \
0302                   LINKER_LOAD_ADDRESS=$(load-ld) \
0303                   VMLINUX_ENTRY_ADDRESS=$(entry-y) \
0304                   PLATFORM="$(platform-y)" \
0305                   ITS_INPUTS="$(its-y)"
0306 ifdef CONFIG_32BIT
0307 bootvars-y      += ADDR_BITS=32
0308 endif
0309 ifdef CONFIG_64BIT
0310 bootvars-y      += ADDR_BITS=64
0311 endif
0312 
0313 # This is required to get dwarf unwinding tables into .debug_frame
0314 # instead of .eh_frame so we don't discard them.
0315 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
0316 
0317 KBUILD_LDFLAGS          += -m $(ld-emul)
0318 
0319 ifdef CONFIG_MIPS
0320 CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
0321         egrep -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \
0322         sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
0323 endif
0324 
0325 OBJCOPYFLAGS            += --remove-section=.reginfo
0326 
0327 head-y := arch/mips/kernel/head.o
0328 
0329 libs-y                  += arch/mips/lib/
0330 libs-$(CONFIG_MIPS_FP_SUPPORT) += arch/mips/math-emu/
0331 
0332 drivers-y                       += arch/mips/crypto/
0333 
0334 # suspend and hibernation support
0335 drivers-$(CONFIG_PM)    += arch/mips/power/
0336 
0337 # boot image targets (arch/mips/boot/)
0338 boot-y                  := vmlinux.bin
0339 boot-y                  += vmlinux.ecoff
0340 boot-y                  += vmlinux.srec
0341 boot-y                  += uImage
0342 boot-y                  += uImage.bin
0343 boot-y                  += uImage.bz2
0344 boot-y                  += uImage.gz
0345 boot-y                  += uImage.lzma
0346 boot-y                  += uImage.lzo
0347 boot-y                  += vmlinux.itb
0348 boot-y                  += vmlinux.gz.itb
0349 boot-y                  += vmlinux.bz2.itb
0350 boot-y                  += vmlinux.lzma.itb
0351 boot-y                  += vmlinux.lzo.itb
0352 
0353 # compressed boot image targets (arch/mips/boot/compressed/)
0354 bootz-y                 := vmlinuz
0355 bootz-y                 += vmlinuz.bin
0356 bootz-y                 += vmlinuz.ecoff
0357 bootz-y                 += vmlinuz.srec
0358 bootz-y                 += uzImage.bin
0359 bootz-y                 += vmlinuz.itb
0360 
0361 #
0362 # Some machines like the Indy need 32-bit ELF binaries for booting purposes.
0363 # Other need ECOFF, so we build a 32-bit ELF binary for them which we then
0364 # convert to ECOFF using elf2ecoff.
0365 #
0366 quiet_cmd_32 = OBJCOPY $@
0367         cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
0368 vmlinux.32: vmlinux
0369         $(call cmd,32)
0370 
0371 #
0372 # The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
0373 # ELF files from 32-bit files by conversion.
0374 #
0375 quiet_cmd_64 = OBJCOPY $@
0376         cmd_64 = $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
0377 vmlinux.64: vmlinux
0378         $(call cmd,64)
0379 
0380 all:    $(all-y) $(KBUILD_DTBS)
0381 
0382 # boot
0383 $(boot-y): $(vmlinux-32) FORCE
0384         $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \
0385                 $(bootvars-y) arch/mips/boot/$@
0386 
0387 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0388 # boot/compressed
0389 $(bootz-y): $(vmlinux-32) FORCE
0390         $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
0391                 $(bootvars-y) 32bit-bfd=$(32bit-bfd) arch/mips/boot/$@
0392 else
0393 vmlinuz: FORCE
0394         @echo '   CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
0395         /bin/false
0396 endif
0397 
0398 
0399 CLEAN_FILES += vmlinux.32 vmlinux.64
0400 
0401 # device-trees
0402 core-y += arch/mips/boot/dts/
0403 
0404 archprepare:
0405 ifdef CONFIG_MIPS32_N32
0406         @$(kecho) '  Checking missing-syscalls for N32'
0407         $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
0408 endif
0409 ifdef CONFIG_MIPS32_O32
0410         @$(kecho) '  Checking missing-syscalls for O32'
0411         $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
0412 endif
0413 
0414 install:
0415         $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
0416 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0417         $(Q)install -D -m 755 vmlinuz $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
0418 endif
0419         $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
0420         $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
0421 
0422 archheaders:
0423         $(Q)$(MAKE) $(build)=arch/mips/kernel/syscalls all
0424 
0425 define archhelp
0426         echo '  install              - install kernel into $(INSTALL_PATH)'
0427         echo '  vmlinux.ecoff        - ECOFF boot image'
0428         echo '  vmlinux.bin          - Raw binary boot image'
0429         echo '  vmlinux.srec         - SREC boot image'
0430         echo '  vmlinux.32           - 64-bit boot image wrapped in 32bits (IP22/IP32)'
0431         echo '  vmlinuz              - Compressed boot(zboot) image'
0432         echo '  vmlinuz.ecoff        - ECOFF zboot image'
0433         echo '  vmlinuz.bin          - Raw binary zboot image'
0434         echo '  vmlinuz.srec         - SREC zboot image'
0435         echo '  uImage               - U-Boot image'
0436         echo '  uImage.bin           - U-Boot image (uncompressed)'
0437         echo '  uImage.bz2           - U-Boot image (bz2)'
0438         echo '  uImage.gz            - U-Boot image (gzip)'
0439         echo '  uImage.lzma          - U-Boot image (lzma)'
0440         echo '  uImage.lzo           - U-Boot image (lzo)'
0441         echo '  uzImage.bin          - U-Boot image (self-extracting)'
0442         echo
0443         echo '  These will be default as appropriate for a configured platform.'
0444         echo
0445         echo '  If you are targeting a system supported by generic kernels you may'
0446         echo '  configure the kernel for a given architecture target like so:'
0447         echo
0448         echo '  {micro32,32,64}{r1,r2,r6}{el,}_defconfig <BOARDS="list of boards">'
0449         echo
0450         echo '  Where BOARDS is some subset of the following:'
0451         for board in $(sort $(BOARDS)); do echo "    $${board}"; done
0452         echo
0453         echo '  Specifically the following generic default configurations are'
0454         echo '  supported:'
0455         echo
0456         $(foreach cfg,$(generic_defconfigs),
0457           printf "  %-24s - Build generic kernel for $(call describe_generic_defconfig,$(cfg))\n" $(cfg);)
0458         echo
0459         echo '  The following legacy default configurations have been converted to'
0460         echo '  generic and can still be used:'
0461         echo
0462         $(foreach cfg,$(sort $(legacy_defconfigs)),
0463           printf "  %-24s - Build $($(cfg)-y)\n" $(cfg);)
0464         echo
0465         echo '  Otherwise, the following default configurations are available:'
0466 endef
0467 
0468 generic_config_dir = $(srctree)/arch/$(ARCH)/configs/generic
0469 generic_defconfigs :=
0470 
0471 #
0472 # If the user generates a generic kernel configuration without specifying a
0473 # list of boards to include the config fragments for, default to including all
0474 # available board config fragments.
0475 #
0476 ifeq ($(BOARDS),)
0477 BOARDS = $(patsubst board-%.config,%,$(notdir $(wildcard $(generic_config_dir)/board-*.config)))
0478 endif
0479 
0480 #
0481 # Generic kernel configurations which merge generic_defconfig with the
0482 # appropriate config fragments from arch/mips/configs/generic/, resulting in
0483 # the ability to easily configure the kernel for a given architecture,
0484 # endianness & set of boards without duplicating the needed configuration in
0485 # hundreds of defconfig files.
0486 #
0487 define gen_generic_defconfigs
0488 $(foreach bits,$(1),$(foreach rev,$(2),$(foreach endian,$(3),
0489 target := $(bits)$(rev)$(filter el,$(endian))_defconfig
0490 generic_defconfigs += $$(target)
0491 $$(target): $(generic_config_dir)/$(bits)$(rev).config
0492 $$(target): $(generic_config_dir)/$(endian).config
0493 )))
0494 endef
0495 
0496 $(eval $(call gen_generic_defconfigs,32 64,r1 r2 r6,eb el))
0497 $(eval $(call gen_generic_defconfigs,micro32,r2,eb el))
0498 
0499 define describe_generic_defconfig
0500 $(subst 32r,MIPS32 r,$(subst 64r,MIPS64 r,$(subst el, little endian,$(patsubst %_defconfig,%,$(1)))))
0501 endef
0502 
0503 .PHONY: $(generic_defconfigs)
0504 $(generic_defconfigs):
0505         $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
0506                 -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/generic_defconfig $^ | \
0507                 grep -Ev '^#'
0508         $(Q)cp $(KCONFIG_CONFIG) $(objtree)/.config.$@
0509         $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig \
0510                 KCONFIG_CONFIG=$(objtree)/.config.$@ >/dev/null
0511         $(Q)$(CONFIG_SHELL) $(srctree)/arch/$(ARCH)/tools/generic-board-config.sh \
0512                 $(srctree) $(objtree) $(objtree)/.config.$@ $(KCONFIG_CONFIG) \
0513                 "$(origin BOARDS)" $(BOARDS)
0514         $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
0515 
0516 #
0517 # Prevent generic merge_config rules attempting to merge single fragments
0518 #
0519 $(generic_config_dir)/%.config: ;
0520 
0521 #
0522 # Prevent direct use of generic_defconfig, which is intended to be used as the
0523 # basis of the various ISA-specific targets generated above.
0524 #
0525 .PHONY: generic_defconfig
0526 generic_defconfig:
0527         $(Q)echo "generic_defconfig is not intended for direct use, but should instead be"
0528         $(Q)echo "used via an ISA-specific target from the following list:"
0529         $(Q)echo
0530         $(Q)for cfg in $(generic_defconfigs); do echo "  $${cfg}"; done
0531         $(Q)echo
0532         $(Q)false
0533 
0534 #
0535 # Legacy defconfig compatibility - these targets used to be real defconfigs but
0536 # now that the boards have been converted to use the generic kernel they are
0537 # wrappers around the generic rules above.
0538 #
0539 legacy_defconfigs               += ocelot_defconfig
0540 ocelot_defconfig-y              := 32r2el_defconfig BOARDS=ocelot
0541 
0542 legacy_defconfigs               += sead3_defconfig
0543 sead3_defconfig-y               := 32r2el_defconfig BOARDS=sead-3
0544 
0545 legacy_defconfigs               += sead3micro_defconfig
0546 sead3micro_defconfig-y          := micro32r2el_defconfig BOARDS=sead-3
0547 
0548 legacy_defconfigs               += xilfpga_defconfig
0549 xilfpga_defconfig-y             := 32r2el_defconfig BOARDS=xilfpga
0550 
0551 legacy_defconfigs               += pistachio_defconfig
0552 pistachio_defconfig-y           := 32r2el_defconfig BOARDS=marduk
0553 
0554 .PHONY: $(legacy_defconfigs)
0555 $(legacy_defconfigs):
0556         $(Q)$(MAKE) -f $(srctree)/Makefile $($@-y)