2007-07-07 20:52:25 +02:00
|
|
|
#
|
|
|
|
# Device Tree Compiler
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Version information will be constructed in this order:
|
|
|
|
# EXTRAVERSION might be "-rc", for example.
|
|
|
|
# LOCAL_VERSION is likely from command line.
|
|
|
|
# CONFIG_LOCALVERSION from some future config system.
|
|
|
|
#
|
|
|
|
VERSION = 1
|
2019-03-06 05:51:37 +01:00
|
|
|
PATCHLEVEL = 5
|
|
|
|
SUBLEVEL = 0
|
2008-07-25 23:17:04 +02:00
|
|
|
EXTRAVERSION =
|
2007-07-07 20:52:25 +02:00
|
|
|
LOCAL_VERSION =
|
2007-09-18 03:44:04 +02:00
|
|
|
CONFIG_LOCALVERSION =
|
2007-07-07 20:52:25 +02:00
|
|
|
|
2011-09-22 19:11:02 +02:00
|
|
|
CPPFLAGS = -I libfdt -I .
|
2015-11-16 13:45:36 +01:00
|
|
|
WARNINGS = -Wall -Wpointer-arith -Wcast-qual -Wnested-externs \
|
2014-01-25 02:19:13 +01:00
|
|
|
-Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wshadow
|
2017-05-19 08:11:48 +02:00
|
|
|
CFLAGS = -g -Os $(SHAREDLIB_CFLAGS) -Werror $(WARNINGS)
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2005-06-16 06:36:37 +02:00
|
|
|
BISON = bison
|
2007-10-04 07:37:43 +02:00
|
|
|
LEX = flex
|
2017-03-17 23:14:30 +01:00
|
|
|
SWIG = swig
|
2017-03-26 21:06:17 +02:00
|
|
|
PKG_CONFIG ?= pkg-config
|
2019-03-29 05:13:10 +01:00
|
|
|
PYTHON ?= python3
|
2005-06-16 06:36:37 +02:00
|
|
|
|
2007-06-29 16:53:23 +02:00
|
|
|
INSTALL = /usr/bin/install
|
2018-01-04 04:49:23 +01:00
|
|
|
INSTALL_PROGRAM = $(INSTALL)
|
|
|
|
INSTALL_LIB = $(INSTALL)
|
|
|
|
INSTALL_DATA = $(INSTALL) -m 644
|
|
|
|
INSTALL_SCRIPT = $(INSTALL)
|
2007-06-29 16:53:23 +02:00
|
|
|
DESTDIR =
|
dtc: Improve the make install target
This patch makes various improvements to dtc's make install target:
- libfdt is also installed. Specifically, libfdt.a and the
two export relevant header files, fdt.h and libfdt.h are installed.
- ftdump is no longer installed. It was only ever a
development debugging tool and may well go away at some point.
- In keeping with normal conventions, there is now a PREFIX
variable, allowing control of where things are installed (in /usr,
/usr/local, /opt, etc.).
- By default, installed into the user's home directory,
instead of /usr. This is friendlier for self-installers, package
builders can easily override PREFIX to restore the old behaviour.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2007-07-24 07:14:52 +02:00
|
|
|
PREFIX = $(HOME)
|
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
LIBDIR = $(PREFIX)/lib
|
|
|
|
INCLUDEDIR = $(PREFIX)/include
|
2007-06-29 16:53:23 +02:00
|
|
|
|
2009-05-26 20:07:26 +02:00
|
|
|
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
|
2017-05-19 11:06:54 +02:00
|
|
|
sed -e 's/\(cygwin\|msys\).*/\1/')
|
2009-05-26 20:07:26 +02:00
|
|
|
|
2018-09-10 08:46:59 +02:00
|
|
|
NO_VALGRIND := $(shell $(PKG_CONFIG) --exists valgrind; echo $$?)
|
|
|
|
ifeq ($(NO_VALGRIND),1)
|
|
|
|
CFLAGS += -DNO_VALGRIND
|
|
|
|
else
|
|
|
|
CFLAGS += $(shell $(PKG_CONFIG) --cflags valgrind)
|
|
|
|
endif
|
|
|
|
|
2018-09-11 22:41:31 +02:00
|
|
|
NO_YAML := $(shell $(PKG_CONFIG) --exists yaml-0.1; echo $$?)
|
|
|
|
ifeq ($(NO_YAML),1)
|
|
|
|
CFLAGS += -DNO_YAML
|
|
|
|
else
|
2019-03-29 06:15:08 +01:00
|
|
|
LDLIBS_dtc += $(shell $(PKG_CONFIG) --libs yaml-0.1)
|
2018-09-11 22:41:31 +02:00
|
|
|
endif
|
|
|
|
|
2009-05-26 20:07:26 +02:00
|
|
|
ifeq ($(HOSTOS),darwin)
|
2017-05-19 08:11:48 +02:00
|
|
|
SHAREDLIB_EXT = dylib
|
|
|
|
SHAREDLIB_CFLAGS = -fPIC
|
|
|
|
SHAREDLIB_LDFLAGS = -fPIC -dynamiclib -Wl,-install_name -Wl,
|
2017-05-19 11:06:54 +02:00
|
|
|
else ifeq ($(HOSTOS),$(filter $(HOSTOS),msys cygwin))
|
|
|
|
SHAREDLIB_EXT = so
|
|
|
|
SHAREDLIB_CFLAGS =
|
|
|
|
SHAREDLIB_LDFLAGS = -shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
|
2009-05-26 20:07:26 +02:00
|
|
|
else
|
2017-05-19 08:11:48 +02:00
|
|
|
SHAREDLIB_EXT = so
|
|
|
|
SHAREDLIB_CFLAGS = -fPIC
|
|
|
|
SHAREDLIB_LDFLAGS = -fPIC -shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
|
2009-05-26 20:07:26 +02:00
|
|
|
endif
|
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
#
|
|
|
|
# Overall rules
|
|
|
|
#
|
|
|
|
ifdef V
|
|
|
|
VECHO = :
|
|
|
|
else
|
|
|
|
VECHO = echo " "
|
|
|
|
ARFLAGS = rc
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
|
|
|
NODEPTARGETS = clean
|
|
|
|
ifeq ($(MAKECMDGOALS),)
|
|
|
|
DEPTARGETS = all
|
|
|
|
else
|
|
|
|
DEPTARGETS = $(filter-out $(NODEPTARGETS),$(MAKECMDGOALS))
|
|
|
|
endif
|
|
|
|
|
|
|
|
#
|
2007-10-04 07:37:43 +02:00
|
|
|
# Rules for versioning
|
2007-06-26 04:45:51 +02:00
|
|
|
#
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-10-04 07:37:43 +02:00
|
|
|
DTC_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
|
|
|
|
VERSION_FILE = version_gen.h
|
2007-07-07 21:18:02 +02:00
|
|
|
|
2007-10-04 07:37:43 +02:00
|
|
|
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
|
|
|
|
else if [ -x /bin/bash ]; then echo /bin/bash; \
|
|
|
|
else echo sh; fi ; fi)
|
|
|
|
|
|
|
|
nullstring :=
|
|
|
|
space := $(nullstring) # end of line
|
|
|
|
|
|
|
|
localver_config = $(subst $(space),, $(string) \
|
|
|
|
$(patsubst "%",%,$(CONFIG_LOCALVERSION)))
|
|
|
|
|
|
|
|
localver_cmd = $(subst $(space),, $(string) \
|
|
|
|
$(patsubst "%",%,$(LOCALVERSION)))
|
|
|
|
|
|
|
|
localver_scm = $(shell $(CONFIG_SHELL) ./scripts/setlocalversion)
|
|
|
|
localver_full = $(localver_config)$(localver_cmd)$(localver_scm)
|
|
|
|
|
|
|
|
dtc_version = $(DTC_VERSION)$(localver_full)
|
|
|
|
|
|
|
|
# Contents of the generated version file.
|
|
|
|
define filechk_version
|
|
|
|
(echo "#define DTC_VERSION \"DTC $(dtc_version)\""; )
|
|
|
|
endef
|
|
|
|
|
|
|
|
define filechk
|
|
|
|
set -e; \
|
|
|
|
echo ' CHK $@'; \
|
|
|
|
mkdir -p $(dir $@); \
|
|
|
|
$(filechk_$(1)) < $< > $@.tmp; \
|
|
|
|
if [ -r $@ ] && cmp -s $@ $@.tmp; then \
|
|
|
|
rm -f $@.tmp; \
|
|
|
|
else \
|
|
|
|
echo ' UPD $@'; \
|
|
|
|
mv -f $@.tmp $@; \
|
|
|
|
fi;
|
|
|
|
endef
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2007-07-07 20:52:25 +02:00
|
|
|
|
2008-10-03 17:49:22 +02:00
|
|
|
include Makefile.convert-dtsv0
|
2007-10-04 07:37:43 +02:00
|
|
|
include Makefile.dtc
|
2011-09-21 22:32:44 +02:00
|
|
|
include Makefile.utils
|
2007-10-04 07:37:43 +02:00
|
|
|
|
2008-10-03 17:49:22 +02:00
|
|
|
BIN += convert-dtsv0
|
2007-10-04 07:37:43 +02:00
|
|
|
BIN += dtc
|
2011-10-25 23:29:24 +02:00
|
|
|
BIN += fdtdump
|
Add fdtget utility to read property values from a device tree
This simply utility makes it easy for scripts to read values from the device
tree. It is written in C and uses the same libfdt as the rest of the dtc
package.
What is it for:
- Reading fdt values from scripts
- Extracting fdt information within build systems
- Looking at particular values without having to dump the entire tree
To use it, specify the fdt binary file on command line followed by a list of
node, property pairs. The utility then looks up each node, finds the property
and displays the value.
Each value is printed on a new line.
fdtget tries to guess the type of each property based on its contents. This
is not always reliable, so you can use the -t option to force fdtget to decode
the value as a string, or byte, etc.
To read from stdin, use - as the file.
Usage:
fdtget <options> <dt file> [<node> <property>]...
Options:
-t <type> Type of data
-h Print this help
<type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-21 19:14:47 +01:00
|
|
|
BIN += fdtget
|
Add fdtput utility to write property values to a device tree
This simple utility allows writing of values into a device tree from the
command line. It aimes to be the opposite of fdtget.
What is it for:
- Updating fdt values when a binary blob already exists
(even though source may be available it might be easier to use this
utility rather than sed, etc.)
- Writing machine-specific fdt values within a build system
To use it, specify the fdt binary file on command line followed by the node
and property to set. Then, provide a list of values to put into that
property. Often there will be just one, but fdtput also supports arrays and
string lists.
fdtput does not try to guess the type of the property based on looking at
the arguments. Instead it always assumes that an integer is provided. To
indicate that you want to write a string, use -ts. You can also provide
hex values with -tx.
The command line arguments are joined together into a single value. For
strings, a nul terminator is placed between each string when it is packed
into the property. To avoid this, pass the string as a single argument.
Usage:
fdtput <options> <dt file> <<node> <property> [<value>...]
Options:
-t <type> Type of data
-v Verbose: display each value decoded from command line
-h Print this help
<type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)
To read from stdin and write to stdout, use - as the file. So you can do:
cat somefile.dtb | fdtput -ts - /node prop "My string value" > newfile.dtb
This commit also adds basic tests to verify the major features.
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-21 19:14:48 +01:00
|
|
|
BIN += fdtput
|
2017-06-14 16:51:11 +02:00
|
|
|
BIN += fdtoverlay
|
2007-10-04 07:37:43 +02:00
|
|
|
|
2010-11-09 23:51:09 +01:00
|
|
|
SCRIPTS = dtdiff
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2017-04-07 23:51:33 +02:00
|
|
|
all: $(BIN) libfdt
|
|
|
|
|
2018-01-05 19:54:12 +01:00
|
|
|
# We need both Python and swig to build/install pylibfdt.
|
|
|
|
# This builds the given make ${target} if those deps are found.
|
|
|
|
check_python_deps = \
|
2018-07-09 12:38:59 +02:00
|
|
|
if $(PKG_CONFIG) --cflags $(PYTHON) >/dev/null 2>&1; then \
|
2017-03-17 23:14:34 +01:00
|
|
|
if which swig >/dev/null 2>&1; then \
|
|
|
|
can_build=yes; \
|
|
|
|
fi; \
|
|
|
|
fi; \
|
2018-01-05 19:54:12 +01:00
|
|
|
if [ "$${can_build}" = "yes" ]; then \
|
|
|
|
$(MAKE) $${target}; \
|
2017-03-17 23:14:34 +01:00
|
|
|
else \
|
2018-01-05 19:54:12 +01:00
|
|
|
echo "\#\# Skipping pylibfdt (install python dev and swig to build)"; \
|
|
|
|
fi ;
|
|
|
|
|
|
|
|
.PHONY: maybe_pylibfdt
|
|
|
|
maybe_pylibfdt: FORCE
|
|
|
|
target=pylibfdt; $(check_python_deps)
|
2017-03-17 23:14:34 +01:00
|
|
|
|
2017-04-07 23:51:33 +02:00
|
|
|
ifeq ($(NO_PYTHON),)
|
|
|
|
all: maybe_pylibfdt
|
|
|
|
endif
|
2008-10-03 17:49:22 +02:00
|
|
|
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-10-04 07:37:43 +02:00
|
|
|
ifneq ($(DEPTARGETS),)
|
|
|
|
-include $(DTC_OBJS:%.o=%.d)
|
2008-10-03 17:49:22 +02:00
|
|
|
-include $(CONVERT_OBJS:%.o=%.d)
|
2011-10-25 23:29:24 +02:00
|
|
|
-include $(FDTDUMP_OBJS:%.o=%.d)
|
Add fdtget utility to read property values from a device tree
This simply utility makes it easy for scripts to read values from the device
tree. It is written in C and uses the same libfdt as the rest of the dtc
package.
What is it for:
- Reading fdt values from scripts
- Extracting fdt information within build systems
- Looking at particular values without having to dump the entire tree
To use it, specify the fdt binary file on command line followed by a list of
node, property pairs. The utility then looks up each node, finds the property
and displays the value.
Each value is printed on a new line.
fdtget tries to guess the type of each property based on its contents. This
is not always reliable, so you can use the -t option to force fdtget to decode
the value as a string, or byte, etc.
To read from stdin, use - as the file.
Usage:
fdtget <options> <dt file> [<node> <property>]...
Options:
-t <type> Type of data
-h Print this help
<type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-21 19:14:47 +01:00
|
|
|
-include $(FDTGET_OBJS:%.o=%.d)
|
Add fdtput utility to write property values to a device tree
This simple utility allows writing of values into a device tree from the
command line. It aimes to be the opposite of fdtget.
What is it for:
- Updating fdt values when a binary blob already exists
(even though source may be available it might be easier to use this
utility rather than sed, etc.)
- Writing machine-specific fdt values within a build system
To use it, specify the fdt binary file on command line followed by the node
and property to set. Then, provide a list of values to put into that
property. Often there will be just one, but fdtput also supports arrays and
string lists.
fdtput does not try to guess the type of the property based on looking at
the arguments. Instead it always assumes that an integer is provided. To
indicate that you want to write a string, use -ts. You can also provide
hex values with -tx.
The command line arguments are joined together into a single value. For
strings, a nul terminator is placed between each string when it is packed
into the property. To avoid this, pass the string as a single argument.
Usage:
fdtput <options> <dt file> <<node> <property> [<value>...]
Options:
-t <type> Type of data
-v Verbose: display each value decoded from command line
-h Print this help
<type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)
To read from stdin and write to stdout, use - as the file. So you can do:
cat somefile.dtb | fdtput -ts - /node prop "My string value" > newfile.dtb
This commit also adds basic tests to verify the major features.
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-21 19:14:48 +01:00
|
|
|
-include $(FDTPUT_OBJS:%.o=%.d)
|
2017-06-14 16:51:11 +02:00
|
|
|
-include $(FDTOVERLAY_OBJS:%.o=%.d)
|
2007-10-04 07:37:43 +02:00
|
|
|
endif
|
|
|
|
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2008-05-15 08:39:12 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
#
|
|
|
|
# Rules for libfdt
|
|
|
|
#
|
2018-11-23 11:58:42 +01:00
|
|
|
LIBFDT_dir = libfdt
|
|
|
|
LIBFDT_archive = $(LIBFDT_dir)/libfdt.a
|
2019-03-29 07:20:16 +01:00
|
|
|
LIBFDT_lib = $(LIBFDT_dir)/$(LIBFDT_LIB)
|
2018-11-23 11:58:42 +01:00
|
|
|
LIBFDT_include = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_INCLUDES))
|
|
|
|
LIBFDT_version = $(addprefix $(LIBFDT_dir)/,$(LIBFDT_VERSION))
|
2008-07-23 17:20:53 +02:00
|
|
|
|
2018-11-23 11:58:42 +01:00
|
|
|
include $(LIBFDT_dir)/Makefile.libfdt
|
2007-06-14 07:05:55 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
.PHONY: libfdt
|
2009-01-02 14:20:34 +01:00
|
|
|
libfdt: $(LIBFDT_archive) $(LIBFDT_lib)
|
2005-06-08 09:18:34 +02:00
|
|
|
|
2018-11-23 11:58:42 +01:00
|
|
|
$(LIBFDT_archive): $(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS))
|
2019-03-29 04:14:46 +01:00
|
|
|
|
|
|
|
$(LIBFDT_lib): $(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS)) $(LIBFDT_version)
|
|
|
|
@$(VECHO) LD $@
|
|
|
|
$(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS)$(LIBFDT_soname) -o $(LIBFDT_lib) \
|
|
|
|
$(addprefix $(LIBFDT_dir)/,$(LIBFDT_OBJS))
|
2019-03-29 07:20:16 +01:00
|
|
|
ln -s $(LIBFDT_LIB) $(LIBFDT_dir)/$(LIBFDT_soname)
|
2007-10-04 07:37:43 +02:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
ifneq ($(DEPTARGETS),)
|
2018-11-23 11:58:42 +01:00
|
|
|
-include $(LIBFDT_OBJS:%.o=$(LIBFDT_dir)/%.d)
|
2007-06-26 04:45:51 +02:00
|
|
|
endif
|
2005-07-11 08:29:25 +02:00
|
|
|
|
2008-10-03 17:49:22 +02:00
|
|
|
# This stops make from generating the lex and bison output during
|
|
|
|
# auto-dependency computation, but throwing them away as an
|
|
|
|
# intermediate target and building them again "for real"
|
|
|
|
.SECONDARY: $(DTC_GEN_SRCS) $(CONVERT_GEN_SRCS)
|
|
|
|
|
2013-08-15 07:49:24 +02:00
|
|
|
install-bin: all $(SCRIPTS)
|
|
|
|
@$(VECHO) INSTALL-BIN
|
2008-10-03 17:49:22 +02:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(BINDIR)
|
2018-01-04 04:49:23 +01:00
|
|
|
$(INSTALL_PROGRAM) $(BIN) $(DESTDIR)$(BINDIR)
|
|
|
|
$(INSTALL_SCRIPT) $(SCRIPTS) $(DESTDIR)$(BINDIR)
|
2013-08-15 07:49:24 +02:00
|
|
|
|
|
|
|
install-lib: all
|
|
|
|
@$(VECHO) INSTALL-LIB
|
2008-10-03 17:49:22 +02:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(LIBDIR)
|
2018-01-04 04:49:23 +01:00
|
|
|
$(INSTALL_LIB) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
|
2011-04-26 12:45:27 +02:00
|
|
|
ln -sf $(notdir $(LIBFDT_lib)) $(DESTDIR)$(LIBDIR)/$(LIBFDT_soname)
|
|
|
|
ln -sf $(LIBFDT_soname) $(DESTDIR)$(LIBDIR)/libfdt.$(SHAREDLIB_EXT)
|
2018-01-04 04:49:23 +01:00
|
|
|
$(INSTALL_DATA) $(LIBFDT_archive) $(DESTDIR)$(LIBDIR)
|
2013-08-15 07:49:24 +02:00
|
|
|
|
|
|
|
install-includes:
|
|
|
|
@$(VECHO) INSTALL-INC
|
2008-10-03 17:49:22 +02:00
|
|
|
$(INSTALL) -d $(DESTDIR)$(INCLUDEDIR)
|
2018-01-04 04:49:23 +01:00
|
|
|
$(INSTALL_DATA) $(LIBFDT_include) $(DESTDIR)$(INCLUDEDIR)
|
2008-10-03 17:49:22 +02:00
|
|
|
|
2017-04-07 23:51:33 +02:00
|
|
|
install: install-bin install-lib install-includes
|
|
|
|
|
2018-01-05 19:54:12 +01:00
|
|
|
.PHONY: maybe_install_pylibfdt
|
|
|
|
maybe_install_pylibfdt: FORCE
|
|
|
|
target=install_pylibfdt; $(check_python_deps)
|
|
|
|
|
2017-04-07 23:51:33 +02:00
|
|
|
ifeq ($(NO_PYTHON),)
|
2018-01-05 19:54:12 +01:00
|
|
|
install: maybe_install_pylibfdt
|
2017-04-07 23:51:33 +02:00
|
|
|
endif
|
2013-08-15 07:49:24 +02:00
|
|
|
|
2008-10-03 17:49:22 +02:00
|
|
|
$(VERSION_FILE): Makefile FORCE
|
|
|
|
$(call filechk,version)
|
|
|
|
|
|
|
|
|
|
|
|
dtc: $(DTC_OBJS)
|
|
|
|
|
|
|
|
convert-dtsv0: $(CONVERT_OBJS)
|
|
|
|
@$(VECHO) LD $@
|
|
|
|
$(LINK.c) -o $@ $^
|
|
|
|
|
2011-10-25 23:29:24 +02:00
|
|
|
fdtdump: $(FDTDUMP_OBJS)
|
2008-10-03 17:49:22 +02:00
|
|
|
|
2019-03-29 07:20:16 +01:00
|
|
|
fdtget: $(FDTGET_OBJS) $(LIBFDT_lib)
|
Add fdtget utility to read property values from a device tree
This simply utility makes it easy for scripts to read values from the device
tree. It is written in C and uses the same libfdt as the rest of the dtc
package.
What is it for:
- Reading fdt values from scripts
- Extracting fdt information within build systems
- Looking at particular values without having to dump the entire tree
To use it, specify the fdt binary file on command line followed by a list of
node, property pairs. The utility then looks up each node, finds the property
and displays the value.
Each value is printed on a new line.
fdtget tries to guess the type of each property based on its contents. This
is not always reliable, so you can use the -t option to force fdtget to decode
the value as a string, or byte, etc.
To read from stdin, use - as the file.
Usage:
fdtget <options> <dt file> [<node> <property>]...
Options:
-t <type> Type of data
-h Print this help
<type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-21 19:14:47 +01:00
|
|
|
|
2019-03-29 07:20:16 +01:00
|
|
|
fdtput: $(FDTPUT_OBJS) $(LIBFDT_lib)
|
Add fdtput utility to write property values to a device tree
This simple utility allows writing of values into a device tree from the
command line. It aimes to be the opposite of fdtget.
What is it for:
- Updating fdt values when a binary blob already exists
(even though source may be available it might be easier to use this
utility rather than sed, etc.)
- Writing machine-specific fdt values within a build system
To use it, specify the fdt binary file on command line followed by the node
and property to set. Then, provide a list of values to put into that
property. Often there will be just one, but fdtput also supports arrays and
string lists.
fdtput does not try to guess the type of the property based on looking at
the arguments. Instead it always assumes that an integer is provided. To
indicate that you want to write a string, use -ts. You can also provide
hex values with -tx.
The command line arguments are joined together into a single value. For
strings, a nul terminator is placed between each string when it is packed
into the property. To avoid this, pass the string as a single argument.
Usage:
fdtput <options> <dt file> <<node> <property> [<value>...]
Options:
-t <type> Type of data
-v Verbose: display each value decoded from command line
-h Print this help
<type> s=string, i=int, u=unsigned, x=hex
Optional modifier prefix:
hh or b=byte, h=2 byte, l=4 byte (default)
To read from stdin and write to stdout, use - as the file. So you can do:
cat somefile.dtb | fdtput -ts - /node prop "My string value" > newfile.dtb
This commit also adds basic tests to verify the major features.
Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-21 19:14:48 +01:00
|
|
|
|
2019-03-29 07:20:16 +01:00
|
|
|
fdtoverlay: $(FDTOVERLAY_OBJS) $(LIBFDT_lib)
|
2017-06-14 16:51:11 +02:00
|
|
|
|
2014-02-03 21:46:28 +01:00
|
|
|
dist:
|
2016-09-03 13:02:30 +02:00
|
|
|
git archive --format=tar --prefix=dtc-$(dtc_version)/ HEAD \
|
|
|
|
> ../dtc-$(dtc_version).tar
|
|
|
|
cat ../dtc-$(dtc_version).tar | \
|
|
|
|
gzip -9 > ../dtc-$(dtc_version).tar.gz
|
|
|
|
|
2017-03-17 23:14:34 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Rules for pylibfdt
|
|
|
|
#
|
2018-11-23 11:58:42 +01:00
|
|
|
PYLIBFDT_dir = pylibfdt
|
2017-03-17 23:14:34 +01:00
|
|
|
|
2018-11-23 11:58:42 +01:00
|
|
|
include $(PYLIBFDT_dir)/Makefile.pylibfdt
|
2017-03-17 23:14:34 +01:00
|
|
|
|
|
|
|
.PHONY: pylibfdt
|
2018-11-23 11:58:42 +01:00
|
|
|
pylibfdt: $(PYLIBFDT_dir)/_libfdt.so
|
2017-03-17 23:14:34 +01:00
|
|
|
|
2016-09-03 13:02:30 +02:00
|
|
|
#
|
|
|
|
# Release signing and uploading
|
|
|
|
# This is for maintainer convenience, don't try this at home.
|
|
|
|
#
|
|
|
|
ifeq ($(MAINTAINER),y)
|
|
|
|
GPG = gpg2
|
|
|
|
KUP = kup
|
|
|
|
KUPDIR = /pub/software/utils/dtc
|
|
|
|
|
|
|
|
kup: dist
|
|
|
|
$(GPG) --detach-sign --armor -o ../dtc-$(dtc_version).tar.sign \
|
|
|
|
../dtc-$(dtc_version).tar
|
|
|
|
$(KUP) put ../dtc-$(dtc_version).tar.gz ../dtc-$(dtc_version).tar.sign \
|
|
|
|
$(KUPDIR)/dtc-$(dtc_version).tar.gz
|
|
|
|
endif
|
2008-10-03 17:49:22 +02:00
|
|
|
|
2017-01-26 19:48:14 +01:00
|
|
|
tags: FORCE
|
|
|
|
rm -f tags
|
|
|
|
find . \( -name tests -type d -prune \) -o \
|
|
|
|
\( ! -name '*.tab.[ch]' ! -name '*.lex.c' \
|
|
|
|
-name '*.[chly]' -type f -print \) | xargs ctags -a
|
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
#
|
|
|
|
# Testsuite rules
|
|
|
|
#
|
|
|
|
TESTS_PREFIX=tests/
|
2012-01-21 22:24:51 +01:00
|
|
|
|
|
|
|
TESTS_BIN += dtc
|
|
|
|
TESTS_BIN += convert-dtsv0
|
|
|
|
TESTS_BIN += fdtput
|
|
|
|
TESTS_BIN += fdtget
|
2014-06-18 13:24:32 +02:00
|
|
|
TESTS_BIN += fdtdump
|
2017-06-14 16:51:11 +02:00
|
|
|
TESTS_BIN += fdtoverlay
|
2017-04-07 23:51:33 +02:00
|
|
|
ifeq ($(NO_PYTHON),)
|
2017-04-07 23:51:32 +02:00
|
|
|
TESTS_PYLIBFDT += maybe_pylibfdt
|
2017-04-07 23:51:33 +02:00
|
|
|
endif
|
2012-01-21 22:24:51 +01:00
|
|
|
|
2007-06-26 04:45:51 +02:00
|
|
|
include tests/Makefile.tests
|
2007-06-29 16:53:23 +02:00
|
|
|
|
2007-10-04 07:37:43 +02:00
|
|
|
#
|
|
|
|
# Clean rules
|
|
|
|
#
|
2011-04-26 12:45:27 +02:00
|
|
|
STD_CLEANFILES = *~ *.o *.$(SHAREDLIB_EXT) *.d *.a *.i *.s core a.out vgcore.* \
|
2007-10-04 07:37:43 +02:00
|
|
|
*.tab.[ch] *.lex.c *.output
|
2007-07-07 21:18:02 +02:00
|
|
|
|
2017-03-17 23:14:34 +01:00
|
|
|
clean: libfdt_clean pylibfdt_clean tests_clean
|
2007-07-07 21:18:02 +02:00
|
|
|
@$(VECHO) CLEAN
|
2008-05-20 06:50:50 +02:00
|
|
|
rm -f $(STD_CLEANFILES)
|
2007-10-04 07:37:43 +02:00
|
|
|
rm -f $(VERSION_FILE)
|
2007-07-07 21:18:02 +02:00
|
|
|
rm -f $(BIN)
|
2014-11-12 04:27:02 +01:00
|
|
|
rm -f dtc-*.tar dtc-*.tar.sign dtc-*.tar.asc
|
2007-07-07 21:18:02 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Generic compile rules
|
|
|
|
#
|
2007-08-31 08:04:27 +02:00
|
|
|
%: %.o
|
|
|
|
@$(VECHO) LD $@
|
2019-03-29 06:15:08 +01:00
|
|
|
$(LINK.c) -o $@ $^ $(LDLIBS_$*)
|
2007-08-31 08:04:27 +02:00
|
|
|
|
2007-07-07 21:18:02 +02:00
|
|
|
%.o: %.c
|
|
|
|
@$(VECHO) CC $@
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
%.o: %.S
|
|
|
|
@$(VECHO) AS $@
|
|
|
|
$(CC) $(CPPFLAGS) $(AFLAGS) -D__ASSEMBLY__ -o $@ -c $<
|
|
|
|
|
|
|
|
%.d: %.c
|
2007-10-04 07:37:43 +02:00
|
|
|
@$(VECHO) DEP $<
|
2007-07-07 21:18:02 +02:00
|
|
|
$(CC) $(CPPFLAGS) -MM -MG -MT "$*.o $@" $< > $@
|
|
|
|
|
2007-11-12 23:52:58 +01:00
|
|
|
%.d: %.S
|
|
|
|
@$(VECHO) DEP $<
|
|
|
|
$(CC) $(CPPFLAGS) -MM -MG -MT "$*.o $@" $< > $@
|
|
|
|
|
2007-07-07 21:18:02 +02:00
|
|
|
%.i: %.c
|
|
|
|
@$(VECHO) CPP $@
|
|
|
|
$(CC) $(CPPFLAGS) -E $< > $@
|
|
|
|
|
|
|
|
%.s: %.c
|
|
|
|
@$(VECHO) CC -S $@
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -S $<
|
|
|
|
|
|
|
|
%.a:
|
|
|
|
@$(VECHO) AR $@
|
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
|
2007-10-04 07:37:43 +02:00
|
|
|
%.lex.c: %.l
|
|
|
|
@$(VECHO) LEX $@
|
2007-12-06 03:07:50 +01:00
|
|
|
$(LEX) -o$@ $<
|
2007-10-04 07:37:43 +02:00
|
|
|
|
|
|
|
%.tab.c %.tab.h %.output: %.y
|
|
|
|
@$(VECHO) BISON $@
|
|
|
|
$(BISON) -d $<
|
|
|
|
|
2007-07-07 20:52:25 +02:00
|
|
|
FORCE:
|