# Rewritten by Cort Dougan and Paul Mackerras
#
-# This must match PAGE_OFFSET in include/asm-powerpc/page.h.
-KERNELLOAD := $(CONFIG_KERNEL_START)
-
HAS_BIARCH := $(call cc-option-yn, -m32)
ifeq ($(CONFIG_PPC64),y)
+OLDARCH := ppc64
SZ := 64
# Set default 32 bits cross compilers for vdso and boot wrapper
endif
else
+OLDARCH := ppc
SZ := 32
endif
+UTS_MACHINE := $(OLDARCH)
+
ifeq ($(HAS_BIARCH),y)
override AS += -a$(SZ)
override LD += -m elf$(SZ)ppc
override CC += -m$(SZ)
endif
-LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic -e $(KERNELLOAD)
+LDFLAGS_vmlinux := -Bstatic
# The -Iarch/$(ARCH)/include is temporary while we are merging
CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
AFLAGS += -Iarch/$(ARCH)
CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe
-ifeq ($(CONFIG_PPC64),y)
-CFLAGS += -mminimal-toc -mtraceback=none -mcall-aixdesc
-else
-CFLAGS += -ffixed-r2 -mmultiple
-endif
+CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
+CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
+CFLAGS += $(CFLAGS-y)
CPP = $(CC) -E $(CFLAGS)
# Temporary hack until we have migrated to asm-powerpc
LINUXINCLUDE += -Iarch/$(ARCH)/include
endif
endif
+# No AltiVec instruction when building kernel
+CFLAGS += $(call cc-option,-mno-altivec)
+
# Enable unit-at-a-time mode when possible. It shrinks the
# kernel considerably.
CFLAGS += $(call cc-option,-funit-at-a-time)
# Default to the common case.
KBUILD_DEFCONFIG := common_defconfig
-head-y := arch/powerpc/kernel/head.o
+head-y := arch/powerpc/kernel/head_32.o
head-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o
head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o
head-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o
head-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o
head-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o
-ifeq ($(CONFIG_PPC32),y)
-head-$(CONFIG_6xx) += arch/powerpc/kernel/idle_6xx.o
-head-$(CONFIG_POWER4) += arch/powerpc/kernel/idle_power4.o
+head-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o
head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o
-endif
core-y += arch/powerpc/kernel/ \
+ arch/$(OLDARCH)/kernel/ \
arch/powerpc/mm/ \
arch/powerpc/lib/ \
- arch/powerpc/sysdev/
-core-$(CONFIG_PPC32) += arch/ppc/kernel/ \
- arch/ppc/syslib/
-core-$(CONFIG_PPC64) += arch/ppc64/kernel/
-core-$(CONFIG_PPC_PMAC) += arch/powerpc/platforms/powermac/
-core-$(CONFIG_4xx) += arch/ppc/platforms/4xx/
-core-$(CONFIG_83xx) += arch/ppc/platforms/83xx/
-core-$(CONFIG_85xx) += arch/ppc/platforms/85xx/
+ arch/powerpc/sysdev/ \
+ arch/powerpc/platforms/
core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/
core-$(CONFIG_XMON) += arch/powerpc/xmon/
core-$(CONFIG_APUS) += arch/ppc/amiga/
drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
-
-.PHONY: $(BOOT_TARGETS)
-
-all: uImage zImage
+defaultimage-$(CONFIG_PPC32) := uImage zImage
+defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
+defaultimage-$(CONFIG_PPC_PSERIES) := zImage
+KBUILD_IMAGE := $(defaultimage-y)
+all: $(KBUILD_IMAGE)
CPPFLAGS_vmlinux.lds := -Upowerpc
# All the instructions talk about "make bzImage".
bzImage: zImage
-boot := arch/$(ARCH)/boot
+BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
+.PHONY: $(BOOT_TARGETS)
+
+boot := arch/$(OLDARCH)/boot
+
+# urk
+ifeq ($(CONFIG_PPC64),y)
$(BOOT_TARGETS): vmlinux
- $(Q)$(MAKE) $(build)=$(boot) $@
+ $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
+else
+$(BOOT_TARGETS): vmlinux
+ $(Q)$(MAKE) ARCH=ppc $(build)=$(boot) $@
+endif
uImage: vmlinux
- $(Q)$(MAKE) $(build)=$(boot)/images $(boot)/images/$@
+ $(Q)$(MAKE) ARCH=$(OLDARCH) $(build)=$(boot)/images $(boot)/images/$@
define archhelp
@echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/images/zImage.*)'
endef
archclean:
- $(Q)$(MAKE) $(clean)=arch/ppc/boot
+ $(Q)$(MAKE) $(clean)=$(boot)
# Temporary hack until we have migrated to asm-powerpc
$(Q)rm -rf arch/$(ARCH)/include
archprepare: checkbin
# Temporary hack until we have migrated to asm-powerpc
-ifeq ($(CONFIG_PPC64),y)
-include/asm: arch/$(ARCH)/include/asm
-arch/$(ARCH)/include/asm:
- $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
- $(Q)ln -fsn $(srctree)/include/asm-ppc64 arch/$(ARCH)/include/asm
-else
include/asm: arch/$(ARCH)/include/asm
arch/$(ARCH)/include/asm:
$(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
- $(Q)ln -fsn $(srctree)/include/asm-ppc arch/$(ARCH)/include/asm
-endif
+ $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm
# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
# to stdout and these checks are run even on install targets.