From 8bb2397180def600773651080beafe1dcaa71ffe Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Tue, 13 Jul 2010 21:19:59 +0000 Subject: [PATCH] Connect powerpc64 to the build. It is not presently part of make universe, which will be added soon. Reviewed by: imp --- Makefile.inc1 | 53 +++++++++++++++++++++++++++++++++--------------- include/Makefile | 6 +++--- release/Makefile | 20 +++++++++++------- 3 files changed, 53 insertions(+), 26 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index d292ea97d621..d93928086b22 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -128,7 +128,7 @@ TARGET= ${TARGET_ARCH} TARGET?= ${MACHINE} TARGET_ARCH?= ${MACHINE_ARCH} -KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc sparc64 sparc64/sun4v +KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v .if ${TARGET} == ${TARGET_ARCH} _t= ${TARGET} .else @@ -262,34 +262,47 @@ WMAKEENV+= NO_CTF=1 .endif WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} -.if ${TARGET_ARCH} == "amd64" +.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" # 32 bit world LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 +.if ${TARGET_ARCH} == "amd64" .if empty(TARGET_CPUTYPE) LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif -LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \ +LIB32CPUFLAGS+= -mfancy-math-387 +LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ + MACHINE_CPU="i686 mmx sse sse2" \ + LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ + AS="${AS} --32" + +.elif ${TARGET_ARCH} == "powerpc64" +.if empty(TARGET_CPUTYPE) +LIB32CPUFLAGS= -mcpu=powerpc +.else +LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} +.endif +LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \ + LD="${LD} -m elf32ppc" +.endif + + +LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ -isystem ${LIB32TMP}/usr/include/ \ -L${LIB32TMP}/usr/lib32 \ -B${LIB32TMP}/usr/lib32 # Yes, the flags are redundant. -LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ +LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ _SHLIBDIRPREFIX=${LIB32TMP} \ VERSION="${VERSION}" \ - MACHINE=i386 \ - MACHINE_ARCH=i386 \ - MACHINE_CPU="i686 mmx sse sse2" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} \ CC="${CC} ${LIB32FLAGS}" \ CXX="${CXX} ${LIB32FLAGS}" \ OBJC="${OBJC} ${LIB32FLAGS}" \ - LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ - AS="${AS} --32" \ LIBDIR=/usr/lib32 \ SHLIBDIR=/usr/lib32 @@ -336,7 +349,7 @@ _worldtmp: @echo "--------------------------------------------------------------" .if !defined(NO_CLEAN) rm -rf ${WORLDTMP} -.if ${TARGET_ARCH} == "amd64" +.if defined(LIB32TMP) rm -rf ${LIB32TMP} .endif .else @@ -380,7 +393,7 @@ _cleanobj: @echo ">>> stage 2.1: cleaning up the object tree" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} -.if ${TARGET_ARCH} == "amd64" +.if defined(LIB32TMP) ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} .endif .endif @@ -428,7 +441,7 @@ everything: @echo ">>> stage 4.4: building everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${WMAKE} par-all -.if ${TARGET_ARCH} == "amd64" +.if defined(LIB32TMP) build32: @echo @echo "--------------------------------------------------------------" @@ -510,7 +523,7 @@ WMAKE_TGTS+= _cleanobj _obj _build-tools WMAKE_TGTS+= _cross-tools .endif WMAKE_TGTS+= _includes _libraries _depend everything -.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" +.if defined(LIB32TMP) && ${MK_LIB32} != "no" WMAKE_TGTS+= build32 .endif @@ -660,7 +673,7 @@ reinstall: @echo ">>> Installing everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install -.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" +.if defined(LIB32TMP) && ${MK_LIB32} != "no" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 .endif @@ -669,7 +682,7 @@ redistribute: @echo ">>> Distributing everything" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute -.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" +.if defined(LIB32TMP) && ${MK_LIB32} != "no" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ DISTRIBUTION=lib32 .endif @@ -705,8 +718,12 @@ KERNCONF=${KERNFAST} KERNCONF= ${KERNEL} KERNWARN= .else +.if ${TARGET_ARCH} == "powerpc64" +KERNCONF?= GENERIC64 +.else KERNCONF?= GENERIC .endif +.endif INSTKERNNAME?= kernel KERNSRCDIR?= ${.CURDIR}/sys @@ -1108,8 +1125,12 @@ _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc # all shared libraries for ELF. # _startup_libs= gnu/lib/csu -.if exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf) +.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) +_startup_libs+= lib/csu/${MACHINE_ARCH}-elf +.elif exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf) _startup_libs+= lib/csu/${MACHINE_CPUARCH}-elf +.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) +_startup_libs+= lib/csu/${MACHINE_ARCH} .else _startup_libs+= lib/csu/${MACHINE_CPUARCH} .endif diff --git a/include/Makefile b/include/Makefile index 96690adb5155..0ba8b17d54ba 100644 --- a/include/Makefile +++ b/include/Makefile @@ -56,7 +56,7 @@ LSUBDIRS= cam/ata cam/scsi \ LSUBSUBDIRS= dev/mpt/mpilib -.if ${MACHINE_ARCH} == "powerpc" +.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" _dev_powermac_nvram= dev/powermac_nvram .endif @@ -189,7 +189,7 @@ copies: ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${DESTDIR}${INCLUDEDIR}/machine/pc .endif -.if defined(_MARCH) +.if defined(_MARCH) && exists(${.CURDIR}/../sys/${_MARCH}/include) ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${.CURDIR}/../sys/${_MARCH}/include; \ @@ -276,7 +276,7 @@ symlinks: ${DESTDIR}${INCLUDEDIR}/machine/pc; \ done .endif -.if defined(_MARCH) +.if defined(_MARCH) && exists(${.CURDIR}/../sys/${_MARCH}/include) ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \ ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${.CURDIR}/../sys/${_MARCH}/include; \ diff --git a/release/Makefile b/release/Makefile index 6144fdd4dca4..ced18ac9318c 100644 --- a/release/Makefile +++ b/release/Makefile @@ -203,10 +203,16 @@ DISTRIBUTIONS?= ${BASE_DISTS} ${OTHER_DISTS} # Build and package both GENERIC and SMP kernels if the target # has both configuration files. Otherwise only GENERIC is done. # -.if exists(${.CURDIR}/../sys/${TARGET}/conf/SMP) -KERNELS_BASE?= GENERIC SMP +.if ${TARGET_ARCH} == "powerpc64" +KERN_GENERIC?= GENERIC64 .else -KERNELS_BASE?= GENERIC +KERN_GENERIC?= GENERIC +.endif + +.if exists(${.CURDIR}/../sys/${TARGET}/conf/SMP) +KERNELS_BASE?= ${KERN_GENERIC} SMP +.else +KERNELS_BASE?= ${KERN_GENERIC} .endif # mountpoint for filesystems. @@ -851,7 +857,7 @@ SMALLMFSROOTFLOPPYSET= ${RD}/floppyset/mfsroot-small/mfsroot.gz # Build boot and install floppies. floppies.1: - @${ZIPPER} -c ${RD}/kernels/GENERIC/kernel > ${RD}/kernels/kernel.gz + @${ZIPPER} -c ${RD}/kernels/${KERN_GENERIC}/kernel > ${RD}/kernels/kernel.gz @echo "Making the kernel boot floppies..." @cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \ FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz @@ -985,7 +991,7 @@ cdrom.1: done .endif @echo "Copy GENERIC kernel to boot area" - @cp -Rp ${RD}/kernels/GENERIC/ ${CD_LIVEFS}/boot/kernel + @cp -Rp ${RD}/kernels/${KERN_GENERIC}/ ${CD_LIVEFS}/boot/kernel @rm -f ${CD_LIVEFS}/boot/kernel/*.symbols @rm -f ${CD_LIVEFS}/.profile @cp ${.CURDIR}/fixit.profile ${CD_LIVEFS}/.profile @@ -1003,7 +1009,7 @@ cdrom.1: .endif @echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf .if defined(MAKE_DVD) - @cp -Rp ${RD}/kernels/GENERIC/ ${CD_DVD1}/boot/kernel + @cp -Rp ${RD}/kernels/${KERN_GENERIC}/ ${CD_DVD1}/boot/kernel @rm -f ${CD_DVD1}/boot/kernel/*.symbols @rm -f ${CD_DVD1}/.profile @cp ${.CURDIR}/fixit.profile ${CD_DVD1}/.profile @@ -1321,7 +1327,7 @@ makeFloppySet: IMAGEDIR= ${RD}/image.${FSIMAGE} BOOTDIR= ${RD}/trees/base/boot HINTSFILE= ${BOOTDIR}/device.hints -ACPI_KO= ${RD}/kernels/GENERIC/acpi.ko +ACPI_KO= ${RD}/kernels/${KERN_GENERIC}/acpi.ko IMAGEFILE= ${RD}/floppies/${FSIMAGE}.flp .if defined(FDSIZE) && ${FDSIZE} == "SMALL" FLPSIZE= ${SMALLFLOPPYSIZE}