From owner-p4-projects@FreeBSD.ORG Wed Mar 31 08:16:39 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1CD441065677; Wed, 31 Mar 2010 08:16:39 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D509C1065675 for ; Wed, 31 Mar 2010 08:16:38 +0000 (UTC) (envelope-from raj@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C23388FC13 for ; Wed, 31 Mar 2010 08:16:38 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o2V8GcEI009844 for ; Wed, 31 Mar 2010 08:16:38 GMT (envelope-from raj@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o2V8Gctt009842 for perforce@freebsd.org; Wed, 31 Mar 2010 08:16:38 GMT (envelope-from raj@freebsd.org) Date: Wed, 31 Mar 2010 08:16:38 GMT Message-Id: <201003310816.o2V8Gctt009842@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to raj@freebsd.org using -f From: Rafal Jaworowski To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 176344 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Mar 2010 08:16:39 -0000 http://p4web.freebsd.org/chv.cgi?CH=176344 Change 176344 by raj@raj_fdt on 2010/03/31 08:15:52 Reorg and make FDT support in loader truly conditional. Compiling the support in depends on WITH_FDT. Affected files ... .. //depot/projects/fdt/sys/boot/Makefile#4 edit .. //depot/projects/fdt/sys/boot/arm/uboot/Makefile#3 edit .. //depot/projects/fdt/sys/boot/fdt/Makefile#3 edit .. //depot/projects/fdt/sys/boot/fdt/fdt_loader_cmd.c#1 add .. //depot/projects/fdt/sys/boot/powerpc/uboot/Makefile#4 edit .. //depot/projects/fdt/sys/boot/uboot/common/main.c#5 edit .. //depot/projects/fdt/sys/boot/uboot/common/metadata.c#4 edit .. //depot/projects/fdt/sys/boot/uboot/lib/Makefile#4 edit .. //depot/projects/fdt/sys/boot/uboot/lib/fdt.c#5 delete Differences ... ==== //depot/projects/fdt/sys/boot/Makefile#4 (text+ko) ==== @@ -26,7 +26,9 @@ SUBDIR+= zfs .endif +.if ${MK_FDT} != "no" SUBDIR+= fdt +.endif # Pick the machine-dependent subdir based on the target architecture. ADIR= ${MACHINE:S/amd64/i386/:S/sun4v/sparc64/} ==== //depot/projects/fdt/sys/boot/arm/uboot/Makefile#3 (text+ko) ==== @@ -18,7 +18,11 @@ LOADER_TFTP_SUPPORT?= no LOADER_GZIP_SUPPORT?= no LOADER_BZIP2_SUPPORT?= no -LOADER_FDT_SUPPORT?= yes +.if !defined(WITHOUT_FDT) +LOADER_FDT_SUPPORT= yes +.else +LOADER_FDT_SUPPORT= no +.endif .if ${LOADER_DISK_SUPPORT} == "yes" CFLAGS+= -DLOADER_DISK_SUPPORT @@ -48,7 +52,10 @@ CFLAGS+= -DLOADER_TFTP_SUPPORT .endif .if ${LOADER_FDT_SUPPORT} == "yes" +CFLAGS+= -I${.CURDIR}/../../fdt +CFLAGS+= -I${.OBJDIR}/../../fdt CFLAGS+= -DLOADER_FDT_SUPPORT +LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif .if !defined(NO_FORTH) @@ -64,11 +71,6 @@ CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I. -# FDT support library -LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a -CFLAGS+= -I${.CURDIR}/../../fdt -CFLAGS+= -I${.OBJDIR}/../../fdt - CLEANFILES+= vers.c loader.help CFLAGS+= -ffreestanding ==== //depot/projects/fdt/sys/boot/fdt/Makefile#3 (text+ko) ==== @@ -5,11 +5,14 @@ LIB= fdt INTERNALLIB= +# Vendor sources of libfdt. SRCS+= fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c -#CFLAGS+= -I${.CURDIR}/../common -I${.CURDIR}/../.. -I. -#CFLAGS+= -I${.CURDIR}/../../../lib/libstand -CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ +# Loader's FDT commands. +SRCS+= fdt_loader_cmd.c + +CFLAGS+= -I${.CURDIR}/../../contrib/libfdt/ -I${.CURDIR}/../common/ \ + -I${.CURDIR}/../uboot/lib CFLAGS+= -ffreestanding ==== //depot/projects/fdt/sys/boot/powerpc/uboot/Makefile#4 (text+ko) ==== @@ -18,8 +18,11 @@ LOADER_TFTP_SUPPORT?= no LOADER_GZIP_SUPPORT?= no LOADER_BZIP2_SUPPORT?= no - -LOADER_FDT_SUPPORT?= yes +.if !defined(WITHOUT_FDT) +LOADER_FDT_SUPPORT= yes +.else +LOADER_FDT_SUPPORT= no +.endif .if ${LOADER_DISK_SUPPORT} == "yes" CFLAGS+= -DLOADER_DISK_SUPPORT @@ -49,7 +52,10 @@ CFLAGS+= -DLOADER_TFTP_SUPPORT .endif .if ${LOADER_FDT_SUPPORT} == "yes" +CFLAGS+= -I${.CURDIR}/../../fdt +CFLAGS+= -I${.OBJDIR}/../../fdt CFLAGS+= -DLOADER_FDT_SUPPORT +LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif .if !defined(NO_FORTH) @@ -76,11 +82,6 @@ .include "${.CURDIR}/../../uboot/common/Makefile.inc" CFLAGS+= -I${.CURDIR}/../../uboot/common -# FDT support library -LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a -CFLAGS+= -I${.CURDIR}/../../fdt -CFLAGS+= -I${.OBJDIR}/../../fdt - # U-Boot standalone support library LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a CFLAGS+= -I${.CURDIR}/../../uboot/lib ==== //depot/projects/fdt/sys/boot/uboot/common/main.c#5 (text+ko) ==== @@ -53,7 +53,9 @@ extern unsigned char __sbss_end[]; extern unsigned char _end[]; +#ifdef LOADER_FDT_SUPPORT extern int command_fdt_internal(int argc, char *argv[]); +#endif static void dump_sig(struct api_signature *sig) @@ -272,9 +274,10 @@ return (CMD_OK); } +#ifdef LOADER_FDT_SUPPORT /* - * Since proper fdt command handling function is defined in fdt.c, and - * declaring it as extern is in contradiction with COMMAND_SET() macro + * Since proper fdt command handling function is defined in fdt_loader_cmd.c, + * and declaring it as extern is in contradiction with COMMAND_SET() macro * (which uses static pointer), we're defining wrapper function, which * calls the proper fdt handling routine. */ @@ -286,3 +289,4 @@ } COMMAND_SET(fdt, "fdt", "flattened device tree handling", command_fdt); +#endif ==== //depot/projects/fdt/sys/boot/uboot/common/metadata.c#4 (text+ko) ==== @@ -42,7 +42,9 @@ #include "bootstrap.h" #include "glue.h" +#if defined(LOADER_FDT_SUPPORT) extern int fdt_fixup(void); +#endif /* * Return a 'boothowto' value corresponding to the kernel arguments in @@ -438,10 +440,11 @@ file_addmetadata(kfp, MODINFOMD_BOOTINFO, bisize, bip); file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp); - /* XXX This should be conditional: whether FDT support is enabled */ +#if defined(LOADER_FDT_SUPPORT) /* Handle device tree blob */ fdt_fixup(); bfp = file_findfile(NULL, "dtb"); +#endif dtbp = bfp == NULL ? 0 : bfp->f_addr; file_addmetadata(kfp, MODINFOMD_DTBP, sizeof dtbp, &dtbp); file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); ==== //depot/projects/fdt/sys/boot/uboot/lib/Makefile#4 (text+ko) ==== @@ -7,8 +7,6 @@ SRCS= devicename.c elf_freebsd.c console.c copy.c disk.c \ module.c net.c reboot.c time.c glue.c -SRCS+= fdt.c - CFLAGS+= -ffreestanding -msoft-float CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/