Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2010 00:49:22 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r209920 - in head/sys/boot: . common fdt ficl ofw ofw/libofw powerpc powerpc/boot1.chrp powerpc/ofw powerpc/uboot uboot
Message-ID:  <201007120049.o6C0nM06040056@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Mon Jul 12 00:49:22 2010
New Revision: 209920
URL: http://svn.freebsd.org/changeset/base/209920

Log:
  Provide support in loader for booting 64-bit PowerPC kernels. Like amd64,
  64-bit PowerPC kernels are loaded by a 32-bit loader, since nearly all
  powerpc64 firmwares execute in 32-bit mode.

Added:
  head/sys/boot/ofw/libofw/ppc64_elf_freebsd.c   (contents, props changed)
Modified:
  head/sys/boot/Makefile
  head/sys/boot/common/Makefile.inc
  head/sys/boot/fdt/Makefile
  head/sys/boot/ficl/Makefile
  head/sys/boot/ofw/Makefile.inc
  head/sys/boot/ofw/libofw/Makefile
  head/sys/boot/ofw/libofw/libofw.h
  head/sys/boot/powerpc/Makefile.inc
  head/sys/boot/powerpc/boot1.chrp/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ofw/conf.c
  head/sys/boot/powerpc/ofw/ldscript.powerpc
  head/sys/boot/powerpc/ofw/metadata.c
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/powerpc/uboot/ldscript.powerpc
  head/sys/boot/uboot/Makefile.inc

Modified: head/sys/boot/Makefile
==============================================================================
--- head/sys/boot/Makefile	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/Makefile	Mon Jul 12 00:49:22 2010	(r209920)
@@ -13,12 +13,12 @@ SUBDIR+=		efi
 .endif
 
 # Build Open Firmware library.
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "sparc64"
 SUBDIR+=		ofw
 .endif
 
 # Build U-Boot library.
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "arm"
 SUBDIR+=		uboot
 .endif
 
@@ -31,7 +31,7 @@ SUBDIR+=		fdt
 .endif
 
 # Pick the machine-dependent subdir based on the target architecture.
-ADIR=			${MACHINE:S/amd64/i386/:S/sun4v/sparc64/}
+ADIR=			${MACHINE:S/amd64/i386/:S/sun4v/sparc64/:S/powerpc64/powerpc/}
 .if exists(${.CURDIR}/${ADIR}/.)
 SUBDIR+=		${ADIR}
 .endif

Modified: head/sys/boot/common/Makefile.inc
==============================================================================
--- head/sys/boot/common/Makefile.inc	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/common/Makefile.inc	Mon Jul 12 00:49:22 2010	(r209920)
@@ -9,8 +9,11 @@ SRCS+=	load_elf32.c load_elf32_obj.c rel
 SRCS+=	load_elf64.c load_elf64_obj.c reloc_elf64.c
 .elif ${MACHINE} == "pc98"
 SRCS+=	load_elf32.c load_elf32_obj.c reloc_elf32.c
-.elif ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm"
+.elif ${MACHINE_ARCH} == "arm"
 SRCS+=	load_elf32.c reloc_elf32.c
+.elif ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
+SRCS+=	load_elf32.c reloc_elf32.c
+SRCS+=	load_elf64.c reloc_elf64.c
 .elif ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "ia64"
 SRCS+=	load_elf64.c reloc_elf64.c
 .endif

Modified: head/sys/boot/fdt/Makefile
==============================================================================
--- head/sys/boot/fdt/Makefile	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/fdt/Makefile	Mon Jul 12 00:49:22 2010	(r209920)
@@ -16,10 +16,14 @@ CFLAGS+=	-I${.CURDIR}/../../contrib/libf
 
 CFLAGS+=	-ffreestanding
 
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm"
+.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm"
 CFLAGS+=	-msoft-float
 .endif
 
+.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+=	-m32
+.endif
+
 CFLAGS+=	-Wformat -Wall
 
 .include <bsd.lib.mk>

Modified: head/sys/boot/ficl/Makefile
==============================================================================
--- head/sys/boot/ficl/Makefile	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/ficl/Makefile	Mon Jul 12 00:49:22 2010	(r209920)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 #
-.PATH: ${.CURDIR}/${MACHINE_ARCH:S/amd64/i386/}
+.PATH: ${.CURDIR}/${MACHINE_ARCH:S/amd64/i386/:S/powerpc64/powerpc/}
 BASE_SRCS=	dict.c ficl.c fileaccess.c float.c loader.c math64.c \
 		prefix.c search.c stack.c tools.c vm.c words.c
 
@@ -14,7 +14,7 @@ CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -m
 .if ${MACHINE_ARCH} == "i386"
 CFLAGS+=	-mno-sse3
 .endif
-.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "arm" 
 CFLAGS+=	-msoft-float
 .endif
 .if ${MACHINE} == "pc98"
@@ -45,7 +45,11 @@ SOFTWORDS=	softcore.fr jhlocal.fr marker
 CFLAGS+=	-m32 -march=i386 -I.
 .endif
 
-CFLAGS+=	-I${.CURDIR} -I${.CURDIR}/${MACHINE_ARCH:S/amd64/i386/} \
+.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+=	-m32 -mcpu=powerpc -I.
+.endif
+
+CFLAGS+=	-I${.CURDIR} -I${.CURDIR}/${MACHINE_ARCH:S/amd64/i386/:S/powerpc64/powerpc/} \
 		-I${.CURDIR}/../common
 
 softcore.c: ${SOFTWORDS} softcore.awk

Modified: head/sys/boot/ofw/Makefile.inc
==============================================================================
--- head/sys/boot/ofw/Makefile.inc	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/ofw/Makefile.inc	Mon Jul 12 00:49:22 2010	(r209920)
@@ -1,3 +1,8 @@
 # $FreeBSD$
 
+.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+=	-m32 -mcpu=powerpc
+LDFLAGS+=	-m elf32ppc
+.endif
+
 .include "../Makefile.inc"

Modified: head/sys/boot/ofw/libofw/Makefile
==============================================================================
--- head/sys/boot/ofw/libofw/Makefile	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/ofw/libofw/Makefile	Mon Jul 12 00:49:22 2010	(r209920)
@@ -13,8 +13,9 @@ CFLAGS+=	-I${.CURDIR}/../../../../lib/li
 CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
 
 CFLAGS+=	-ffreestanding
-.if ${MACHINE_ARCH} == "powerpc"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
 CFLAGS+=	-msoft-float
+SRCS+=		ppc64_elf_freebsd.c
 .endif
 
 .ifdef(BOOT_DISK_DEBUG)

Modified: head/sys/boot/ofw/libofw/libofw.h
==============================================================================
--- head/sys/boot/ofw/libofw/libofw.h	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/ofw/libofw/libofw.h	Mon Jul 12 00:49:22 2010	(r209920)
@@ -62,6 +62,9 @@ int	ofw_elf_loadfile(char *, vm_offset_t
 int	ofw_elf_exec(struct preloaded_file *);
 
 extern struct file_format	ofw_elf;
+#ifdef __powerpc__
+extern struct file_format	ofw_elf64;
+#endif
 
 extern void	reboot(void);
 

Added: head/sys/boot/ofw/libofw/ppc64_elf_freebsd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/boot/ofw/libofw/ppc64_elf_freebsd.c	Mon Jul 12 00:49:22 2010	(r209920)
@@ -0,0 +1,101 @@
+/*-
+ * Copyright (c) 2001 Benno Rice <benno@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#define __ELF_WORD_SIZE 64
+
+#include <sys/param.h>
+#include <sys/linker.h>
+
+#include <machine/metadata.h>
+#include <machine/elf.h>
+
+#include <stand.h>
+
+#include "bootstrap.h"
+#include "libofw.h"
+#include "openfirm.h"
+
+extern char		end[];
+extern vm_offset_t	reloc;	/* From <arch>/conf.c */
+
+int
+ppc64_ofw_elf_loadfile(char *filename, u_int64_t dest,
+    struct preloaded_file **result)
+{
+	int	r;
+
+	r = __elfN(loadfile)(filename, dest, result);
+	if (r != 0)
+		return (r);
+
+	/*
+	 * No need to sync the icache for modules: this will
+	 * be done by the kernel after relocation.
+	 */
+	if (!strcmp((*result)->f_type, "elf kernel"))
+		__syncicache((void *) (*result)->f_addr, (*result)->f_size);
+	return (0);
+}
+
+int
+ppc64_ofw_elf_exec(struct preloaded_file *fp)
+{
+	struct file_metadata	*fmp;
+	vm_offset_t		mdp;
+	Elf_Ehdr		*e;
+	int			error;
+	intptr_t		entry;
+
+	if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
+		return(EFTYPE);
+	}
+	e = (Elf_Ehdr *)&fmp->md_data;
+	
+	/* Handle function descriptor */
+	entry = *(uint64_t *)e->e_entry;
+
+	if ((error = md_load64(fp->f_args, &mdp)) != 0)
+		return (error);
+
+	printf("Kernel entry at 0x%lx ...\n", entry);
+
+	dev_cleanup();
+	ofw_release_heap();
+
+	OF_chain((void *)reloc, end - (char *)reloc, (void *)entry,
+	    (void *)mdp, sizeof(mdp));
+
+	panic("exec returned");
+}
+
+struct file_format	ofw_elf64 =
+{
+	ppc64_ofw_elf_loadfile,
+	ppc64_ofw_elf_exec
+};

Modified: head/sys/boot/powerpc/Makefile.inc
==============================================================================
--- head/sys/boot/powerpc/Makefile.inc	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/Makefile.inc	Mon Jul 12 00:49:22 2010	(r209920)
@@ -1,3 +1,8 @@
 # $FreeBSD$
 
+.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+=	-m32 -mcpu=powerpc
+LDFLAGS+=	-m elf32ppc
+.endif
+
 .include "../Makefile.inc"

Modified: head/sys/boot/powerpc/boot1.chrp/Makefile
==============================================================================
--- head/sys/boot/powerpc/boot1.chrp/Makefile	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/boot1.chrp/Makefile	Mon Jul 12 00:49:22 2010	(r209920)
@@ -13,7 +13,7 @@ SRCS=		boot1.c ashldi3.c
 INTERNALPROG=
 NO_MAN=
 
-CFLAGS= -ffreestanding -msoft-float -Os -D_KERNEL \
+CFLAGS= -ffreestanding -msoft-float -Os \
 	-I${.CURDIR}/../../common -I${.CURDIR}/../../../
 LDFLAGS=-nostdlib -static -N
 

Modified: head/sys/boot/powerpc/ofw/Makefile
==============================================================================
--- head/sys/boot/powerpc/ofw/Makefile	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/ofw/Makefile	Mon Jul 12 00:49:22 2010	(r209920)
@@ -10,6 +10,7 @@ INSTALLFLAGS=	-b
 
 # Architecture-specific loader code
 SRCS=		conf.c metadata.c vers.c start.c
+SRCS+=		ucmpdi2.c
 
 LOADER_DISK_SUPPORT?=	yes
 LOADER_UFS_SUPPORT?=	yes
@@ -62,9 +63,9 @@ LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 CFLAGS+=	-DNETIF_OPEN_CLOSE_ONCE
 
 # Always add MI sources
-.PATH:		${.CURDIR}/../../common
+.PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
 .include	"${.CURDIR}/../../common/Makefile.inc"
-CFLAGS+=	-I${.CURDIR}/../../common
+CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../..
 CFLAGS+=	-I.
 
 CLEANFILES+=	vers.c loader.help

Modified: head/sys/boot/powerpc/ofw/conf.c
==============================================================================
--- head/sys/boot/powerpc/ofw/conf.c	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/ofw/conf.c	Mon Jul 12 00:49:22 2010	(r209920)
@@ -96,6 +96,7 @@ struct netif_driver *netif_drivers[] = {
 
 struct file_format *file_formats[] = {
     &ofw_elf,
+    &ofw_elf64,
     NULL
 };
 

Modified: head/sys/boot/powerpc/ofw/ldscript.powerpc
==============================================================================
--- head/sys/boot/powerpc/ofw/ldscript.powerpc	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/ofw/ldscript.powerpc	Mon Jul 12 00:49:22 2010	(r209920)
@@ -1,7 +1,7 @@
 /* $FreeBSD$ */
 
 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
-OUTPUT_ARCH(powerpc)
+OUTPUT_ARCH(powerpc:common)
 ENTRY(_start)
 SEARCH_DIR(/usr/lib);
 /* Do we need any of these for elf?

Modified: head/sys/boot/powerpc/ofw/metadata.c
==============================================================================
--- head/sys/boot/powerpc/ofw/metadata.c	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/ofw/metadata.c	Mon Jul 12 00:49:22 2010	(r209920)
@@ -175,6 +175,9 @@ md_copyenv(vm_offset_t addr)
  * MOD_SIZE	sizeof(size_t)		module size
  * MOD_METADATA	(variable)		type-specific metadata
  */
+
+static int align;
+
 #define COPY32(v, a, c) {			\
     u_int32_t	x = (v);			\
     if (c)					\
@@ -187,7 +190,7 @@ md_copyenv(vm_offset_t addr)
     COPY32(strlen(s) + 1, a, c)			\
     if (c)					\
         archsw.arch_copyin(s, a, strlen(s) + 1);\
-    a += roundup(strlen(s) + 1, sizeof(u_long));\
+    a += roundup(strlen(s) + 1, align);		\
 }
 
 #define MOD_NAME(a, s, c)	MOD_STR(MODINFO_NAME, a, s, c)
@@ -199,7 +202,7 @@ md_copyenv(vm_offset_t addr)
     COPY32(sizeof(s), a, c);			\
     if (c)					\
         archsw.arch_copyin(&s, a, sizeof(s));	\
-    a += roundup(sizeof(s), sizeof(u_long));	\
+    a += roundup(sizeof(s), align);		\
 }
 
 #define MOD_ADDR(a, s, c)	MOD_VAR(MODINFO_ADDR, a, s, c)
@@ -210,7 +213,7 @@ md_copyenv(vm_offset_t addr)
     COPY32(mm->md_size, a, c);			\
     if (c)					\
         archsw.arch_copyin(mm->md_data, a, mm->md_size);\
-    a += roundup(mm->md_size, sizeof(u_long));	\
+    a += roundup(mm->md_size, align);		\
 }
 
 #define MOD_END(a, c) {				\
@@ -219,10 +222,11 @@ md_copyenv(vm_offset_t addr)
 }
 
 vm_offset_t
-md_copymodules(vm_offset_t addr)
+md_copymodules(vm_offset_t addr, int kern64)
 {
     struct preloaded_file	*fp;
     struct file_metadata	*md;
+    uint64_t			scratch64;
     int				c;
 
     c = addr != 0;
@@ -233,8 +237,15 @@ md_copymodules(vm_offset_t addr)
 	MOD_TYPE(addr, fp->f_type, c);
 	if (fp->f_args)
 	    MOD_ARGS(addr, fp->f_args, c);
-	MOD_ADDR(addr, fp->f_addr, c);
-	MOD_SIZE(addr, fp->f_size, c);
+	if (kern64) {
+		scratch64 = fp->f_addr;
+		MOD_ADDR(addr, scratch64, c);
+		scratch64 = fp->f_size;
+		MOD_SIZE(addr, scratch64, c);
+	} else {
+		MOD_ADDR(addr, fp->f_addr, c);
+		MOD_SIZE(addr, fp->f_size, c);
+	}
 	for (md = fp->f_metadata; md != NULL; md = md->md_next) {
 	    if (!(md->md_type & MODINFOMD_NOCOPY)) {
 		MOD_METADATA(addr, md, c);
@@ -254,7 +265,7 @@ md_copymodules(vm_offset_t addr)
  * - Module metadata are formatted and placed in kernel space.
  */
 int
-md_load(char *args, vm_offset_t *modulep)
+md_load_dual(char *args, vm_offset_t *modulep, int kern64)
 {
     struct preloaded_file	*kfp;
     struct preloaded_file	*xp;
@@ -263,11 +274,11 @@ md_load(char *args, vm_offset_t *modulep
     vm_offset_t			addr;
     vm_offset_t			envp;
     vm_offset_t			size;
+    uint64_t			scratch64;
     char			*rootdevname;
     int				howto;
-    int				dtlb_slots;
-    int				itlb_slots;
 
+    align = kern64 ? 8 : 4;
     howto = md_getboothowto(args);
 
     /* 
@@ -298,23 +309,48 @@ md_load(char *args, vm_offset_t *modulep
     addr = roundup(addr, PAGE_SIZE);
 
     kernend = 0;
-    kfp = file_findfile(NULL, "elf32 kernel");
+    kfp = file_findfile(NULL, kern64 ? "elf64 kernel" : "elf32 kernel");
     if (kfp == NULL)
 	kfp = file_findfile(NULL, "elf kernel");
     if (kfp == NULL)
 	panic("can't find kernel file");
     file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto);
-    file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp);
-    file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend);
+    if (kern64) {
+	scratch64 = envp;
+	file_addmetadata(kfp, MODINFOMD_ENVP, sizeof scratch64, &scratch64);
+	scratch64 = kernend;
+	file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof scratch64, &scratch64);
+    } else {
+	file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp);
+	file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend);
+    }
 
     *modulep = addr;
-    size = md_copymodules(0);
+    size = md_copymodules(0, kern64);
     kernend = roundup(addr + size, PAGE_SIZE);
 
     md = file_findmetadata(kfp, MODINFOMD_KERNEND);
-    bcopy(&kernend, md->md_data, sizeof kernend);
-
-    (void)md_copymodules(addr);
+    if (kern64) {
+	scratch64 = kernend;
+	bcopy(&scratch64, md->md_data, sizeof scratch64);
+    } else {
+	bcopy(&kernend, md->md_data, sizeof kernend);
+    }
+	
+    (void)md_copymodules(addr, kern64);
 
     return(0);
 }
+
+int
+md_load(char *args, vm_offset_t *modulep)
+{
+    return (md_load_dual(args, modulep, 0));
+}
+
+int
+md_load64(char *args, vm_offset_t *modulep)
+{
+    return (md_load_dual(args, modulep, 1));
+}
+

Modified: head/sys/boot/powerpc/uboot/Makefile
==============================================================================
--- head/sys/boot/powerpc/uboot/Makefile	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/uboot/Makefile	Mon Jul 12 00:49:22 2010	(r209920)
@@ -10,6 +10,7 @@ NO_MAN=
 
 # Architecture-specific loader code
 SRCS=		start.S conf.c vers.c
+SRCS+=		ucmpdi2.c
 
 LOADER_DISK_SUPPORT?=	yes
 LOADER_UFS_SUPPORT?=	yes
@@ -68,9 +69,9 @@ LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
 .endif
 
 # Always add MI sources
-.PATH:		${.CURDIR}/../../common
+.PATH:		${.CURDIR}/../../common ${.CURDIR}/../../../libkern
 .include	"${.CURDIR}/../../common/Makefile.inc"
-CFLAGS+=	-I${.CURDIR}/../../common
+CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../../..
 CFLAGS+=	-I.
 
 CLEANFILES+=	vers.c ${PROG}.help

Modified: head/sys/boot/powerpc/uboot/ldscript.powerpc
==============================================================================
--- head/sys/boot/powerpc/uboot/ldscript.powerpc	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/powerpc/uboot/ldscript.powerpc	Mon Jul 12 00:49:22 2010	(r209920)
@@ -1,7 +1,7 @@
 /* $FreeBSD$ */
 
 OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
-OUTPUT_ARCH(powerpc)
+OUTPUT_ARCH(powerpc:common)
 ENTRY(_start)
 SEARCH_DIR(/usr/lib);
 PROVIDE (__stack = 0);

Modified: head/sys/boot/uboot/Makefile.inc
==============================================================================
--- head/sys/boot/uboot/Makefile.inc	Mon Jul 12 00:17:29 2010	(r209919)
+++ head/sys/boot/uboot/Makefile.inc	Mon Jul 12 00:49:22 2010	(r209920)
@@ -1,3 +1,8 @@
 # $FreeBSD$
 
+.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+=	-m32 -mcpu=powerpc
+LDFLAGS+=	-m elf32ppc
+.endif
+
 .include "../Makefile.inc"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007120049.o6C0nM06040056>