Skip to contentSkip to conversation

Update libfdt to v1.6.1

PATCH Superseded Vikram Garhwal 2 participants 4 messages Nov 5, 2021 – Nov 9, 2021

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Update libfdt to v1.6.1

This update is done to support device tree overlays functionality. This is taken from David Gibson's DTC git: github.com/dgibson/dtc.

Change log:
v2 -> v3:
Include version.lds changes.

v1 -> v2:
Correct the compilation issue due to incorrect lib.h path.

Regards,
Vikram

Vikram Garhwal (1):
Update libfdt to v1.6.1

 xen/common/libfdt/Makefile.libfdt   |  10 +-
 xen/common/libfdt/fdt.c             | 226 ++++++---
 xen/common/libfdt/fdt_addresses.c   | 101 ++++
 xen/common/libfdt/fdt_check.c       |  93 ++++
 xen/common/libfdt/fdt_empty_tree.c  |  46 +-
 xen/common/libfdt/fdt_overlay.c     | 884 ++++++++++++++++++++++++++++++++++++
 xen/common/libfdt/fdt_ro.c          | 514 ++++++++++++++++-----
 xen/common/libfdt/fdt_rw.c          | 249 +++++-----
 xen/common/libfdt/fdt_strerror.c    |  55 +--
 xen/common/libfdt/fdt_sw.c          | 312 +++++++++----
 xen/common/libfdt/fdt_wip.c         |  88 ++--
 xen/common/libfdt/libfdt_internal.h | 223 ++++++---
 xen/common/libfdt/version.lds       |  24 +-
 xen/include/xen/libfdt/fdt.h        |  51 +--
 xen/include/xen/libfdt/libfdt.h     | 858 +++++++++++++++++++++++++++++-----
 xen/include/xen/libfdt/libfdt_env.h | 100 +++-
 16 files changed, 3048 insertions(+), 786 deletions(-)
 create mode 100644 xen/common/libfdt/fdt_addresses.c
 create mode 100644 xen/common/libfdt/fdt_check.c
 create mode 100644 xen/common/libfdt/fdt_overlay.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v3 1/1 Update libfdt to v1.6.1

Update libfdt to v1.6.1 of libfdt taken from git://github.com/dgibson/dtc.
This update is done to support device tree overlays.

A few minor changes are done to make it compatible with Xen:
fdt_overlay.c: overlay_fixup_phandle()

Replace strtoul() with simple_strtoul() as strtoul() is not available in Xen lib and included lib.h.

Change char *endptr to const char *endptr.

libfdt_env.h:
Changed path for config.h and stdbool.h. Remaining Xen changes to libfdt_env.h carried over from existing libfdt (v1.4.0)

---
 xen/common/libfdt/Makefile.libfdt   |  10 +-
 xen/common/libfdt/fdt.c             | 226 ++++++---
 xen/common/libfdt/fdt_addresses.c   | 101 ++++
 xen/common/libfdt/fdt_check.c       |  93 ++++
 xen/common/libfdt/fdt_empty_tree.c  |  46 +-
 xen/common/libfdt/fdt_overlay.c     | 884 ++++++++++++++++++++++++++++++++++++
 xen/common/libfdt/fdt_ro.c          | 514 ++++++++++++++++-----
 xen/common/libfdt/fdt_rw.c          | 249 +++++-----
 xen/common/libfdt/fdt_strerror.c    |  55 +--
 xen/common/libfdt/fdt_sw.c          | 312 +++++++++----
 xen/common/libfdt/fdt_wip.c         |  88 ++--
 xen/common/libfdt/libfdt_internal.h | 223 ++++++---
 xen/common/libfdt/version.lds       |  24 +-
 xen/include/xen/libfdt/fdt.h        |  51 +--
 xen/include/xen/libfdt/libfdt.h     | 858 +++++++++++++++++++++++++++++-----
 xen/include/xen/libfdt/libfdt_env.h | 100 +++-
 16 files changed, 3048 insertions(+), 786 deletions(-)
 create mode 100644 xen/common/libfdt/fdt_addresses.c
 create mode 100644 xen/common/libfdt/fdt_check.c
 create mode 100644 xen/common/libfdt/fdt_overlay.c
xen/common/libfdt/Makefile.libfdt +9 -1
index 91126c0..b6d8fc0 100644
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
 # Makefile.libfdt
 #
 # This is not a complete Makefile of itself.  Instead, it is designed to
@@ -6,5 +7,12 @@
 LIBFDT_soname = libfdt.$(SHAREDLIB_EXT).1
 LIBFDT_INCLUDES = fdt.h libfdt.h libfdt_env.h
 LIBFDT_VERSION = version.lds
-LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c
+LIBFDT_SRCS = fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c fdt_empty_tree.c \
+	fdt_addresses.c fdt_overlay.c fdt_check.c
 LIBFDT_OBJS = $(LIBFDT_SRCS:%.c=%.o)
+LIBFDT_LIB = libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT)
+
+libfdt_clean:
+	@$(VECHO) CLEAN "(libfdt)"
+	rm -f $(STD_CLEANFILES:%=$(LIBFDT_dir)/%)
+	rm -f $(LIBFDT_dir)/$(LIBFDT_soname)
xen/common/libfdt/fdt.c +156 -70

312 lines not on this page · raw message

xen/common/libfdt/fdt_addresses.c new file +101 -0

101 lines not on this page · raw message

xen/common/libfdt/fdt_check.c new file +93 -0

93 lines not on this page · raw message

xen/common/libfdt/fdt_empty_tree.c +1 -45

55 lines not on this page · raw message

xen/common/libfdt/fdt_overlay.c new file +884 -0

884 lines not on this page · raw message

xen/common/libfdt/fdt_ro.c +401 -113

728 lines not on this page · raw message

xen/common/libfdt/fdt_rw.c +129 -120

514 lines not on this page · raw message

xen/common/libfdt/fdt_strerror.c +10 -45

80 lines not on this page · raw message

xen/common/libfdt/fdt_sw.c +221 -91

216 lines not on this page · raw message

xen/common/libfdt/fdt_wip.c +33 -55

88 lines not on this page · raw message

xen/common/libfdt/libfdt_internal.h +161 -62

223 lines not on this page · raw message

xen/common/libfdt/version.lds +23 -1
index 80b322b..7ab85f1 100644

Lines of this file are not shown. View the raw message.

xen/include/xen/libfdt/fdt.h +4 -47

51 lines not on this page · raw message

xen/include/xen/libfdt/libfdt.h +734 -124

858 lines not on this page · raw message

xen/include/xen/libfdt/libfdt_env.h +88 -12

100 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.7.4

Part of the diff is not shown here. View the raw message.

#2 lore raw

Hi Vikram,

Quoted 10 lines · Vikram Garhwal

Update libfdt to v1.6.1 of libfdt taken from git://github.com/dgibson/dtc.
This update is done to support device tree overlays.

A few minor changes are done to make it compatible with Xen:
fdt_overlay.c: overlay_fixup_phandle()

Replace strtoul() with simple_strtoul() as strtoul() is not available in Xen lib and included lib.h.

Change char *endptr to const char *endptr.

I would clarify this is a requirement to use simple_strtoul().

[...]

Quoted 7 lines
xen/include/xen/libfdt/libfdt_env.h +0 -2
index 035bf75..03380d5 100644
@@ -1,22 +1,98 @@
-#ifndef _LIBFDT_ENV_H
-#define _LIBFDT_ENV_H

xen/include/xen/libfdt/libfdt_env.h line 10

Quoted 10 lines
xen/include/xen/libfdt/libfdt_env.h +9 -0
+/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
+#ifndef LIBFDT_ENV_H
+#define LIBFDT_ENV_H
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ * Copyright 2012 Kim Phillips, Freescale Semiconductor.
+ */
 
+#include <xen/config.h>

The build system should always include <xen/config.h> automagically. So can you clarify why this is necessary?

xen/include/xen/libfdt/libfdt_env.h line 14

Quoted 4 lines
xen/include/xen/libfdt/libfdt_env.h +1 -0
  #include <xen/types.h>
  #include <xen/string.h>
  #include <asm/byteorder.h>
+#include <xen/stdbool.h>

We usually order the headers so <xen/...> are first and then <asm/...>. They are then ordered alphabetically within themself.

But it is not clear why you are adding <xen/stdbool.h> as AFAICT it is already going to be included by existing headers. Did you see an error without including it?

Cheers,

Signature · 1 line
Julien Grall
#3 lore raw

On Mon, Nov 08, 2021 at 10:37:31AM +0000, Julien Grall wrote:
Hi Julien,

Quoted 9 lines

Hi Vikram,

Quoted 6 lines · Vikram Garhwal

Update libfdt to v1.6.1 of libfdt taken from git://github.com/dgibson/dtc.
This update is done to support device tree overlays.

A few minor changes are done to make it compatible with Xen:
fdt_overlay.c: overlay_fixup_phandle()

Quoted 6 lines
Quoted 4 lines

Replace strtoul() with simple_strtoul() as strtoul() is not available in Xen lib and included lib.h.

Change char *endptr to const char *endptr.

I would clarify this is a requirement to use simple_strtoul().

Will add it in next version.

Quoted 14 lines

[...]

Quoted 11 lines
xen/include/xen/libfdt/libfdt_env.h +4 -2
index 035bf75..03380d5 100644
@@ -1,22 +1,98 @@
-#ifndef _LIBFDT_ENV_H
-#define _LIBFDT_ENV_H
+/* SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) */
+#ifndef LIBFDT_ENV_H
+#define LIBFDT_ENV_H
+/*
Quoted 8 lines

xen/include/xen/libfdt/libfdt_env.h line 10

Quoted 5 lines
xen/include/xen/libfdt/libfdt_env.h +5 -0
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2006 David Gibson, IBM Corporation.
+ * Copyright 2012 Kim Phillips, Freescale Semiconductor.
+ */
+#include <xen/config.h>

The build system should always include <xen/config.h> automagically. So can you clarify why this is necessary?

You are right. This was something got carried over from v1.4. I can build without this. Will remove it in v4 patch.

Quoted 6 lines

xen/include/xen/libfdt/libfdt_env.h line 14

Quoted 5 lines
xen/include/xen/libfdt/libfdt_env.h +1 -0
 #include <xen/types.h>
 #include <xen/string.h>
 #include <asm/byteorder.h>
+#include <xen/stdbool.h>
Quoted 6 lines

We usually order the headers so <xen/...> are first and then <asm/...>. They are then ordered alphabetically within themself.

But it is not clear why you are adding <xen/stdbool.h> as AFAICT it is already going to be included by existing headers. Did you see an error without including it?

Perhaps my build was messed up then. I tried just now and can build without it. Will remove this one too in v4.

Thanks for corrections!

Regards,
Vikram

Quoted 5 lines

Cheers,

Signature · 1 line
Julien Grall