Back to home page

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. Remember to do have actions
0012 # for "archclean" cleaning up for this architecture.
0013 #
0014 
0015 archscripts: scripts_basic
0016         $(Q)$(MAKE) $(build)=arch/mips/boot/tools relocs
0017 
0018 KBUILD_DEFCONFIG := ip22_defconfig
0019 
0020 #
0021 # Select the object file format to substitute into the linker script.
0022 #
0023 ifdef CONFIG_CPU_LITTLE_ENDIAN
0024 32bit-tool-archpref     = mipsel
0025 64bit-tool-archpref     = mips64el
0026 32bit-bfd               = elf32-tradlittlemips
0027 64bit-bfd               = elf64-tradlittlemips
0028 32bit-emul              = elf32ltsmip
0029 64bit-emul              = elf64ltsmip
0030 else
0031 32bit-tool-archpref     = mips
0032 64bit-tool-archpref     = mips64
0033 32bit-bfd               = elf32-tradbigmips
0034 64bit-bfd               = elf64-tradbigmips
0035 32bit-emul              = elf32btsmip
0036 64bit-emul              = elf64btsmip
0037 endif
0038 
0039 ifdef CONFIG_32BIT
0040 tool-archpref           = $(32bit-tool-archpref)
0041 UTS_MACHINE             := mips
0042 endif
0043 ifdef CONFIG_64BIT
0044 tool-archpref           = $(64bit-tool-archpref)
0045 UTS_MACHINE             := mips64
0046 endif
0047 
0048 ifneq ($(SUBARCH),$(ARCH))
0049   ifeq ($(CROSS_COMPILE),)
0050     CROSS_COMPILE := $(call cc-cross-prefix, $(tool-archpref)-linux-  $(tool-archpref)-linux-gnu-  $(tool-archpref)-unknown-linux-gnu-)
0051   endif
0052 endif
0053 
0054 ifdef CONFIG_FUNCTION_GRAPH_TRACER
0055   ifndef KBUILD_MCOUNT_RA_ADDRESS
0056     ifeq ($(call cc-option-yn,-mmcount-ra-address), y)
0057       cflags-y += -mmcount-ra-address -DKBUILD_MCOUNT_RA_ADDRESS
0058     endif
0059   endif
0060 endif
0061 cflags-y += $(call cc-option, -mno-check-zero-division)
0062 
0063 ifdef CONFIG_32BIT
0064 ld-emul                 = $(32bit-emul)
0065 vmlinux-32              = vmlinux
0066 vmlinux-64              = vmlinux.64
0067 
0068 cflags-y                += -mabi=32
0069 endif
0070 
0071 ifdef CONFIG_64BIT
0072 ld-emul                 = $(64bit-emul)
0073 vmlinux-32              = vmlinux.32
0074 vmlinux-64              = vmlinux
0075 
0076 cflags-y                += -mabi=64
0077 endif
0078 
0079 all-$(CONFIG_BOOT_ELF32)        := $(vmlinux-32)
0080 all-$(CONFIG_BOOT_ELF64)        := $(vmlinux-64)
0081 all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
0082 
0083 #
0084 # GCC uses -G 0 -mabicalls -fpic as default.  We don't want PIC in the kernel
0085 # code since it only slows down the whole thing.  At some point we might make
0086 # use of global pointer optimizations but their use of $28 conflicts with
0087 # the current pointer optimization.
0088 #
0089 # The DECStation requires an ECOFF kernel for remote booting, other MIPS
0090 # machines may also.  Since BFD is incredibly buggy with respect to
0091 # crossformat linking we rely on the elf2ecoff tool for format conversion.
0092 #
0093 cflags-y                        += -G 0 -mno-abicalls -fno-pic -pipe
0094 cflags-y                        += -msoft-float
0095 LDFLAGS_vmlinux                 += -G 0 -static -n -nostdlib
0096 KBUILD_AFLAGS_MODULE            += -mlong-calls
0097 KBUILD_CFLAGS_MODULE            += -mlong-calls
0098 
0099 ifeq ($(CONFIG_RELOCATABLE),y)
0100 LDFLAGS_vmlinux                 += --emit-relocs
0101 endif
0102 
0103 #
0104 # pass -msoft-float to GAS if it supports it.  However on newer binutils
0105 # (specifically newer than 2.24.51.20140728) we then also need to explicitly
0106 # set ".set hardfloat" in all files which manipulate floating point registers.
0107 #
0108 ifneq ($(call as-option,-Wa$(comma)-msoft-float,),)
0109         cflags-y                += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float
0110 endif
0111 
0112 cflags-y += -ffreestanding
0113 
0114 #
0115 # We explicitly add the endianness specifier if needed, this allows
0116 # to compile kernels with a toolchain for the other endianness. We
0117 # carefully avoid to add it redundantly because gcc 3.3/3.4 complains
0118 # when fed the toolchain default!
0119 #
0120 # Certain gcc versions up to gcc 4.1.1 (probably 4.2-subversion as of
0121 # 2006-10-10 don't properly change the predefined symbols if -EB / -EL
0122 # are used, so we kludge that here.  A bug has been filed at
0123 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29413.
0124 #
0125 undef-all += -UMIPSEB -U_MIPSEB -U__MIPSEB -U__MIPSEB__
0126 undef-all += -UMIPSEL -U_MIPSEL -U__MIPSEL -U__MIPSEL__
0127 predef-be += -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__
0128 predef-le += -DMIPSEL -D_MIPSEL -D__MIPSEL -D__MIPSEL__
0129 cflags-$(CONFIG_CPU_BIG_ENDIAN)         += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' && echo -EB $(undef-all) $(predef-be))
0130 cflags-$(CONFIG_CPU_LITTLE_ENDIAN)      += $(shell $(CC) -dumpmachine |grep -q 'mips.*el-.*' || echo -EL $(undef-all) $(predef-le))
0131 
0132 cflags-$(CONFIG_SB1XXX_CORELIS) += $(call cc-option,-mno-sched-prolog) \
0133                                    -fno-omit-frame-pointer
0134 #
0135 # CPU-dependent compiler/assembler options for optimization.
0136 #
0137 cflags-$(CONFIG_CPU_R3000)      += -march=r3000
0138 cflags-$(CONFIG_CPU_TX39XX)     += -march=r3900
0139 cflags-$(CONFIG_CPU_R6000)      += -march=r6000 -Wa,--trap
0140 cflags-$(CONFIG_CPU_R4300)      += -march=r4300 -Wa,--trap
0141 cflags-$(CONFIG_CPU_VR41XX)     += -march=r4100 -Wa,--trap
0142 cflags-$(CONFIG_CPU_R4X00)      += -march=r4600 -Wa,--trap
0143 cflags-$(CONFIG_CPU_TX49XX)     += -march=r4600 -Wa,--trap
0144 cflags-$(CONFIG_CPU_MIPS32_R1)  += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
0145                         -Wa,-mips32 -Wa,--trap
0146 cflags-$(CONFIG_CPU_MIPS32_R2)  += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
0147                         -Wa,-mips32r2 -Wa,--trap
0148 cflags-$(CONFIG_CPU_MIPS32_R6)  += -march=mips32r6 -Wa,--trap
0149 cflags-$(CONFIG_CPU_MIPS64_R1)  += $(call cc-option,-march=mips64,-mips64 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \
0150                         -Wa,-mips64 -Wa,--trap
0151 cflags-$(CONFIG_CPU_MIPS64_R2)  += $(call cc-option,-march=mips64r2,-mips64r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS64) \
0152                         -Wa,-mips64r2 -Wa,--trap
0153 cflags-$(CONFIG_CPU_MIPS64_R6)  += -march=mips64r6 -Wa,--trap
0154 cflags-$(CONFIG_CPU_R5000)      += -march=r5000 -Wa,--trap
0155 cflags-$(CONFIG_CPU_R5432)      += $(call cc-option,-march=r5400,-march=r5000) \
0156                         -Wa,--trap
0157 cflags-$(CONFIG_CPU_R5500)      += $(call cc-option,-march=r5500,-march=r5000) \
0158                         -Wa,--trap
0159 cflags-$(CONFIG_CPU_NEVADA)     += $(call cc-option,-march=rm5200,-march=r5000) \
0160                         -Wa,--trap
0161 cflags-$(CONFIG_CPU_RM7000)     += $(call cc-option,-march=rm7000,-march=r5000) \
0162                         -Wa,--trap
0163 cflags-$(CONFIG_CPU_SB1)        += $(call cc-option,-march=sb1,-march=r5000) \
0164                         -Wa,--trap
0165 cflags-$(CONFIG_CPU_SB1)        += $(call cc-option,-mno-mdmx)
0166 cflags-$(CONFIG_CPU_SB1)        += $(call cc-option,-mno-mips3d)
0167 cflags-$(CONFIG_CPU_R8000)      += -march=r8000 -Wa,--trap
0168 cflags-$(CONFIG_CPU_R10000)     += $(call cc-option,-march=r10000,-march=r8000) \
0169                         -Wa,--trap
0170 cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap
0171 ifeq (,$(findstring march=octeon, $(cflags-$(CONFIG_CPU_CAVIUM_OCTEON))))
0172 cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon
0173 endif
0174 cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
0175 cflags-$(CONFIG_CPU_BMIPS)      += -march=mips32 -Wa,-mips32 -Wa,--trap
0176 
0177 cflags-$(CONFIG_CPU_R4000_WORKAROUNDS)  += $(call cc-option,-mfix-r4000,)
0178 cflags-$(CONFIG_CPU_R4400_WORKAROUNDS)  += $(call cc-option,-mfix-r4400,)
0179 cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS)  += $(call cc-option,-mno-daddi,)
0180 
0181 # For smartmips configurations, there are hundreds of warnings due to ISA overrides
0182 # in assembly and header files. smartmips is only supported for MIPS32r1 onwards
0183 # and there is no support for 64-bit. Various '.set mips2' or '.set mips3' or
0184 # similar directives in the kernel will spam the build logs with the following warnings:
0185 # Warning: the `smartmips' extension requires MIPS32 revision 1 or greater
0186 # or
0187 # Warning: the 64-bit MIPS architecture does not support the `smartmips' extension
0188 # Pass -Wa,--no-warn to disable all assembler warnings until the kernel code has
0189 # been fixed properly.
0190 mips-cflags                             := $(cflags-y)
0191 ifeq ($(CONFIG_CPU_HAS_SMARTMIPS),y)
0192 smartmips-ase                           := $(call cc-option-yn,$(mips-cflags) -msmartmips)
0193 cflags-$(smartmips-ase)                 += -msmartmips -Wa,--no-warn
0194 endif
0195 ifeq ($(CONFIG_CPU_MICROMIPS),y)
0196 micromips-ase                           := $(call cc-option-yn,$(mips-cflags) -mmicromips)
0197 cflags-$(micromips-ase)                 += -mmicromips
0198 endif
0199 ifeq ($(CONFIG_CPU_HAS_MSA),y)
0200 toolchain-msa                           := $(call cc-option-yn,$(mips-cflags) -mhard-float -mfp64 -Wa$(comma)-mmsa)
0201 cflags-$(toolchain-msa)                 += -DTOOLCHAIN_SUPPORTS_MSA
0202 endif
0203 toolchain-virt                          := $(call cc-option-yn,$(mips-cflags) -mvirt)
0204 cflags-$(toolchain-virt)                += -DTOOLCHAIN_SUPPORTS_VIRT
0205 
0206 #
0207 # Firmware support
0208 #
0209 libs-$(CONFIG_FW_ARC)           += arch/mips/fw/arc/
0210 libs-$(CONFIG_FW_CFE)           += arch/mips/fw/cfe/
0211 libs-$(CONFIG_FW_SNIPROM)       += arch/mips/fw/sni/
0212 libs-y                          += arch/mips/fw/lib/
0213 
0214 #
0215 # Kernel compression
0216 #
0217 ifdef SYS_SUPPORTS_ZBOOT
0218 COMPRESSION_FNAME               = vmlinuz
0219 else
0220 COMPRESSION_FNAME               = vmlinux
0221 endif
0222 
0223 #
0224 # Board-dependent options and extra files
0225 #
0226 include arch/mips/Kbuild.platforms
0227 
0228 ifdef CONFIG_PHYSICAL_START
0229 load-y                                  = $(CONFIG_PHYSICAL_START)
0230 endif
0231 entry-y                         = 0x$(shell $(NM) vmlinux 2>/dev/null \
0232                                         | grep "\bkernel_entry\b" | cut -f1 -d \ )
0233 
0234 cflags-y                        += -I$(srctree)/arch/mips/include/asm/mach-generic
0235 drivers-$(CONFIG_PCI)           += arch/mips/pci/
0236 
0237 #
0238 # Automatically detect the build format. By default we choose
0239 # the elf format according to the load address.
0240 # We can always force a build with a 64-bits symbol format by
0241 # passing 'KBUILD_SYM32=no' option to the make's command line.
0242 #
0243 ifdef CONFIG_64BIT
0244   ifndef KBUILD_SYM32
0245     ifeq ($(shell expr $(load-y) \< 0xffffffff80000000), 0)
0246       KBUILD_SYM32 = y
0247     endif
0248   endif
0249 
0250   ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy)
0251     cflags-y += -msym32 -DKBUILD_64BIT_SYM32
0252   else
0253     ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
0254       $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
0255     endif
0256   endif
0257 endif
0258 
0259 KBUILD_AFLAGS   += $(cflags-y)
0260 KBUILD_CFLAGS   += $(cflags-y)
0261 KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y)
0262 KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)
0263 
0264 bootvars-y      = VMLINUX_LOAD_ADDRESS=$(load-y) \
0265                   VMLINUX_ENTRY_ADDRESS=$(entry-y) \
0266                   PLATFORM="$(platform-y)"
0267 ifdef CONFIG_32BIT
0268 bootvars-y      += ADDR_BITS=32
0269 endif
0270 ifdef CONFIG_64BIT
0271 bootvars-y      += ADDR_BITS=64
0272 endif
0273 
0274 LDFLAGS                 += -m $(ld-emul)
0275 
0276 ifdef CONFIG_MIPS
0277 CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \
0278         egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
0279         sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g')
0280 ifdef CONFIG_64BIT
0281 CHECKFLAGS              += -m64
0282 endif
0283 endif
0284 
0285 OBJCOPYFLAGS            += --remove-section=.reginfo
0286 
0287 head-y := arch/mips/kernel/head.o
0288 
0289 libs-y                  += arch/mips/lib/
0290 libs-y                  += arch/mips/math-emu/
0291 
0292 # See arch/mips/Kbuild for content of core part of the kernel
0293 core-y += arch/mips/
0294 
0295 drivers-$(CONFIG_OPROFILE)      += arch/mips/oprofile/
0296 
0297 # suspend and hibernation support
0298 drivers-$(CONFIG_PM)    += arch/mips/power/
0299 
0300 # boot image targets (arch/mips/boot/)
0301 boot-y                  := vmlinux.bin
0302 boot-y                  += vmlinux.ecoff
0303 boot-y                  += vmlinux.srec
0304 ifeq ($(shell expr $(load-y) \< 0xffffffff80000000 2> /dev/null), 0)
0305 boot-y                  += uImage
0306 boot-y                  += uImage.bin
0307 boot-y                  += uImage.bz2
0308 boot-y                  += uImage.gz
0309 boot-y                  += uImage.lzma
0310 boot-y                  += uImage.lzo
0311 endif
0312 boot-y                  += vmlinux.itb
0313 boot-y                  += vmlinux.gz.itb
0314 boot-y                  += vmlinux.bz2.itb
0315 boot-y                  += vmlinux.lzma.itb
0316 boot-y                  += vmlinux.lzo.itb
0317 
0318 # compressed boot image targets (arch/mips/boot/compressed/)
0319 bootz-y                 := vmlinuz
0320 bootz-y                 += vmlinuz.bin
0321 bootz-y                 += vmlinuz.ecoff
0322 bootz-y                 += vmlinuz.srec
0323 
0324 ifdef CONFIG_LASAT
0325 rom.bin rom.sw: vmlinux
0326         $(Q)$(MAKE) $(build)=arch/mips/lasat/image \
0327                 $(bootvars-y) $@
0328 endif
0329 
0330 CMD_RELOCS = arch/mips/boot/tools/relocs
0331 quiet_cmd_relocs = RELOCS  $<
0332       cmd_relocs = $(CMD_RELOCS) $<
0333 
0334 #
0335 # Some machines like the Indy need 32-bit ELF binaries for booting purposes.
0336 # Other need ECOFF, so we build a 32-bit ELF binary for them which we then
0337 # convert to ECOFF using elf2ecoff.
0338 #
0339 quiet_cmd_32 = OBJCOPY $@
0340         cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
0341 vmlinux.32: vmlinux
0342 ifeq ($(CONFIG_RELOCATABLE)$(CONFIG_64BIT),yy)
0343 # Currently, objcopy fails to handle the relocations in the elf64
0344 # So the relocs tool must be run here to remove them first
0345         $(call cmd,relocs)
0346 endif
0347         $(call cmd,32)
0348 
0349 #
0350 # The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
0351 # ELF files from 32-bit files by conversion.
0352 #
0353 quiet_cmd_64 = OBJCOPY $@
0354         cmd_64 = $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
0355 vmlinux.64: vmlinux
0356         $(call cmd,64)
0357 
0358 all:    $(all-y)
0359 
0360 # boot
0361 $(boot-y): $(vmlinux-32) FORCE
0362 ifeq ($(CONFIG_RELOCATABLE)$(CONFIG_32BIT),yy)
0363         $(call cmd,relocs)
0364 endif
0365         $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) \
0366                 $(bootvars-y) arch/mips/boot/$@
0367 
0368 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0369 # boot/compressed
0370 $(bootz-y): $(vmlinux-32) FORCE
0371         $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
0372                 $(bootvars-y) 32bit-bfd=$(32bit-bfd) $@
0373 else
0374 vmlinuz: FORCE
0375         @echo '   CONFIG_SYS_SUPPORTS_ZBOOT is not enabled'
0376         /bin/false
0377 endif
0378 
0379 
0380 CLEAN_FILES += vmlinux.32 vmlinux.64
0381 
0382 # device-trees
0383 core-$(CONFIG_BUILTIN_DTB) += arch/mips/boot/dts/
0384 
0385 %.dtb %.dtb.S %.dtb.o: | scripts
0386         $(Q)$(MAKE) $(build)=arch/mips/boot/dts arch/mips/boot/dts/$@
0387 
0388 PHONY += dtbs
0389 dtbs: scripts
0390         $(Q)$(MAKE) $(build)=arch/mips/boot/dts
0391 
0392 PHONY += dtbs_install
0393 dtbs_install:
0394         $(Q)$(MAKE) $(dtbinst)=arch/mips/boot/dts
0395 
0396 archprepare:
0397 ifdef CONFIG_MIPS32_N32
0398         @echo '  Checking missing-syscalls for N32'
0399         $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
0400 endif
0401 ifdef CONFIG_MIPS32_O32
0402         @echo '  Checking missing-syscalls for O32'
0403         $(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
0404 endif
0405 
0406 install:
0407         $(Q)install -D -m 755 vmlinux $(INSTALL_PATH)/vmlinux-$(KERNELRELEASE)
0408 ifdef CONFIG_SYS_SUPPORTS_ZBOOT
0409         $(Q)install -D -m 755 vmlinuz $(INSTALL_PATH)/vmlinuz-$(KERNELRELEASE)
0410 endif
0411         $(Q)install -D -m 644 .config $(INSTALL_PATH)/config-$(KERNELRELEASE)
0412         $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
0413 
0414 archclean:
0415         $(Q)$(MAKE) $(clean)=arch/mips/boot
0416         $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed
0417         $(Q)$(MAKE) $(clean)=arch/mips/boot/tools
0418         $(Q)$(MAKE) $(clean)=arch/mips/lasat
0419 
0420 define archhelp
0421         echo '  install              - install kernel into $(INSTALL_PATH)'
0422         echo '  vmlinux.ecoff        - ECOFF boot image'
0423         echo '  vmlinux.bin          - Raw binary boot image'
0424         echo '  vmlinux.srec         - SREC boot image'
0425         echo '  vmlinux.32           - 64-bit boot image wrapped in 32bits (IP22/IP32)'
0426         echo '  vmlinuz              - Compressed boot(zboot) image'
0427         echo '  vmlinuz.ecoff        - ECOFF zboot image'
0428         echo '  vmlinuz.bin          - Raw binary zboot image'
0429         echo '  vmlinuz.srec         - SREC zboot image'
0430         echo '  uImage               - U-Boot image'
0431         echo '  uImage.bin           - U-Boot image (uncompressed)'
0432         echo '  uImage.bz2           - U-Boot image (bz2)'
0433         echo '  uImage.gz            - U-Boot image (gzip)'
0434         echo '  uImage.lzma          - U-Boot image (lzma)'
0435         echo '  uImage.lzo           - U-Boot image (lzo)'
0436         echo '  dtbs                 - Device-tree blobs for enabled boards'
0437         echo '  dtbs_install         - Install dtbs to $(INSTALL_DTBS_PATH)'
0438         echo
0439         echo '  These will be default as appropriate for a configured platform.'
0440         echo
0441         echo '  If you are targeting a system supported by generic kernels you may'
0442         echo '  configure the kernel for a given architecture target like so:'
0443         echo
0444         echo '  {micro32,32,64}{r1,r2,r6}{el,}_defconfig <BOARDS="list of boards">'
0445         echo
0446         echo '  Otherwise, the following default configurations are available:'
0447 endef
0448 
0449 generic_config_dir = $(srctree)/arch/$(ARCH)/configs/generic
0450 generic_defconfigs :=
0451 
0452 #
0453 # If the user generates a generic kernel configuration without specifying a
0454 # list of boards to include the config fragments for, default to including all
0455 # available board config fragments.
0456 #
0457 ifeq ($(BOARDS),)
0458 BOARDS = $(patsubst board-%.config,%,$(notdir $(wildcard $(generic_config_dir)/board-*.config)))
0459 endif
0460 
0461 #
0462 # Generic kernel configurations which merge generic_defconfig with the
0463 # appropriate config fragments from arch/mips/configs/generic/, resulting in
0464 # the ability to easily configure the kernel for a given architecture,
0465 # endianness & set of boards without duplicating the needed configuration in
0466 # hundreds of defconfig files.
0467 #
0468 define gen_generic_defconfigs
0469 $(foreach bits,$(1),$(foreach rev,$(2),$(foreach endian,$(3),
0470 target := $(bits)$(rev)$(filter el,$(endian))_defconfig
0471 generic_defconfigs += $$(target)
0472 $$(target): $(generic_config_dir)/$(bits)$(rev).config
0473 $$(target): $(generic_config_dir)/$(endian).config
0474 )))
0475 endef
0476 
0477 $(eval $(call gen_generic_defconfigs,32 64,r1 r2 r6,eb el))
0478 $(eval $(call gen_generic_defconfigs,micro32,r2,eb el))
0479 
0480 .PHONY: $(generic_defconfigs)
0481 $(generic_defconfigs):
0482         $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
0483                 -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/generic_defconfig $^ \
0484                 $(foreach board,$(BOARDS),$(generic_config_dir)/board-$(board).config)
0485         $(Q)$(MAKE) olddefconfig
0486 
0487 #
0488 # Prevent generic merge_config rules attempting to merge single fragments
0489 #
0490 $(generic_config_dir)/%.config: ;
0491 
0492 #
0493 # Legacy defconfig compatibility - these targets used to be real defconfigs but
0494 # now that the boards have been converted to use the generic kernel they are
0495 # wrappers around the generic rules above.
0496 #
0497 .PHONY: sead3_defconfig
0498 sead3_defconfig:
0499         $(Q)$(MAKE) 32r2el_defconfig BOARDS=sead-3
0500 
0501 .PHONY: sead3micro_defconfig
0502 sead3micro_defconfig:
0503         $(Q)$(MAKE) micro32r2el_defconfig BOARDS=sead-3