Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Mar 2010 08:16:38 GMT
From:      Rafal Jaworowski <raj@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 176344 for review
Message-ID:  <201003310816.o2V8Gctt009842@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/



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