Hi David, On Mon, Sep 19, 2011 at 6:08 PM, David Gibson <[email protected]> wrote: > On Mon, Sep 19, 2011 at 01:21:03PM -0700, Simon Glass wrote: >> This adds a new utility library for performing libfdt operations. >> >> This is a separate library from libfdt because it performs OS operations, >> like open/close/read/write, while libfdt is OS-neutral. These utility >> functions are useful within the dtc package, and could potentially even >> be generally useful, but should not be part of libfdt. >> >> Signed-off-by: Simon Glass <[email protected]> >> --- >> Changes in v2: >> - Remove util_decode_key >> - Add utilfdt_decode_type to be used by fdtget/put >> - Remove limits on device tree binary size >> >> Changes in v3: >> - Change format of -t argument to be more like printf >> - Move utilfdt into its own directory and make it a library >> - Use code closer to testutils.c implementation >> - Use open/close instead of fopen/fclose > > [snip] >> diff --git a/Makefile b/Makefile >> index 380a705..4f5ccdd 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -15,7 +15,7 @@ EXTRAVERSION = >> LOCAL_VERSION = >> CONFIG_LOCALVERSION = >> >> -CPPFLAGS = -I libfdt >> +CPPFLAGS = -I libfdt -I utilfdt >> WARNINGS = -Werror -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \ >> -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls >> CFLAGS = -g -Os -fPIC -Werror $(WARNINGS) >> @@ -151,6 +151,35 @@ ifneq ($(DEPTARGETS),) >> -include $(LIBFDT_OBJS:%.o=$(LIBFDT_objdir)/%.d) >> endif >> >> +# >> +# Rules for utilfdt >> +# >> +UTILFDT_objdir = utilfdt >> +UTILFDT_srcdir = utilfdt >> +UTILFDT_archive = $(UTILFDT_objdir)/libutilfdt.a >> +UTILFDT_lib = $(UTILFDT_objdir)/libutilfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) >> +UTILFDT_include = $(addprefix $(UTILFDT_srcdir)/,$(UTILFDT_INCLUDES)) >> + >> +include $(UTILFDT_srcdir)/Makefile.utilfdt >> + >> +.PHONY: utilfdt >> +utilfdt: $(UTILFDT_archive) $(UTILFDT_lib) >> + >> +$(UTILFDT_archive): $(addprefix $(UTILFDT_objdir)/,$(UTILFDT_OBJS)) >> +$(UTILFDT_lib): $(addprefix $(UTILFDT_objdir)/,$(UTILFDT_OBJS)) > > Building a shared library out of this is complete overkill. In fact, > so is building a .a of it. This is not an exported library for > general use, but just an internal mini-"library" for use by the fdtget > and fdtput functions. Just have them both link with utilfdt.o.
I guess I misunderstood your comment on this patch in v2, referring I thought to the function to read an fdt: > Yes, you'll need to fix that for a general library version. It > should indeed return an error rather than dying. I took that to me it should be in a library, and of course it couldn't be in libfdt due to the OS use... It is used by the tests, ftdump, fdtget and fdtput. I didn't really want the tests to have to have -I.. and linking ../utilfdt.o. So should I just make in an object file in the root that everything except dtc links with? Regards, Simon > > -- > David Gibson | I'll have my music baroque, and my code > david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ > | _way_ _around_! > http://www.ozlabs.org/~dgibson > _______________________________________________ devicetree-discuss mailing list [email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
