All of lore.kernel.org
 help / color / mirror / Atom feed
From: Walter Lozano <walter.lozano@collabora.com>
To: u-boot@lists.denx.de
Subject: [RFC 2/4] dtoc: add initial support for deleting DTB nodes
Date: Fri, 19 Jun 2020 18:11:38 -0300	[thread overview]
Message-ID: <20200619211140.5081-3-walter.lozano@collabora.com> (raw)
In-Reply-To: <20200619211140.5081-1-walter.lozano@collabora.com>

This patch introduce a test for deleting DTB nodes using Python library.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
 tools/dtoc/dtb_platdata.py | 28 ++++++++++++++++++++++++++++
 tools/dtoc/fdt.py          |  3 +++
 2 files changed, 31 insertions(+)

diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 1df13b2cd2..d3fb4dcbf2 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -831,6 +831,30 @@ class DtbPlatdata(object):
 
         return
 
+    def test_del_node(self):
+        """Test the support of node deletion'
+
+        This function tests the support of node removal by deleting a specific
+        node name
+        """
+        for n in self._fdt.GetRoot().subnodes:
+            print('Name', n.name)
+            #print('Props', n.props)
+            if n.name == 'board-detect':
+                n.DelNode()
+                #self._fdt.GetRoot().subnodes.remove(n)
+        self._fdt.Scan()
+        print('')
+        for n in self._fdt.GetRoot().subnodes:
+            print('Name', n.name)
+            #print('Props', n.props)
+            if n.name == 'serial':
+                self._fdt.GetRoot().subnodes.remove(n)
+
+        self._fdt.Pack()
+        self._fdt.Flush()
+        self._fdt.Sync()
+
 def run_steps(args, dtb_file, config_file, include_disabled, output):
     """Run all the steps of the dtoc tool
 
@@ -848,6 +872,8 @@ def run_steps(args, dtb_file, config_file, include_disabled, output):
     skip_scan = False
     if args == ['shrink']:
         skip_scan = True
+    if args == ['test_del_node']:
+        skip_scan = True
 
     plat = DtbPlatdata(dtb_file, config_file, include_disabled)
     plat.scan_drivers()
@@ -867,6 +893,8 @@ def run_steps(args, dtb_file, config_file, include_disabled, output):
             plat.generate_tables()
         elif cmd == 'shrink':
             plat.shrink()
+        elif cmd == 'test_del_node':
+            plat.test_del_node()
         else:
             raise ValueError("Unknown command '%s': (use: struct, platdata)" %
                              cmd)
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 3d4bc3b2ef..b3b626cd4d 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -502,6 +502,9 @@ class Node:
         for prop in prop_list:
             prop.Sync(auto_resize)
 
+    def DelNode(self):
+        fdt_obj = self._fdt._fdt_obj
+        fdt_obj.del_node(self._offset)
 
 class Fdt:
     """Provides simple access to a flat device tree blob using libfdts.
-- 
2.20.1

  parent reply	other threads:[~2020-06-19 21:11 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 21:11 [RFC 0/4] drivers: footprint reduction proposal Walter Lozano
2020-06-19 21:11 ` [RFC 1/4] dtoc: add POC for dtb shrink Walter Lozano
2020-07-06 19:21   ` Simon Glass
2020-07-07 13:57     ` Walter Lozano
2020-07-07 14:15   ` Rasmus Villemoes
2020-07-07 14:32     ` Walter Lozano
2020-07-07 14:53       ` Rasmus Villemoes
2020-07-07 16:14         ` Walter Lozano
2020-06-19 21:11 ` Walter Lozano [this message]
2020-07-06 19:21   ` [RFC 2/4] dtoc: add initial support for deleting DTB nodes Simon Glass
2020-07-07 13:44     ` Walter Lozano
2020-06-19 21:11 ` [RFC 3/4] dtoc: add support for generate stuct udevice_id Walter Lozano
2020-07-06 19:21   ` Simon Glass
2020-07-07 14:08     ` Walter Lozano
2020-07-26 14:53       ` Simon Glass
2020-07-27  2:16         ` Walter Lozano
2020-07-29  2:42           ` Simon Glass
2020-07-29 16:00             ` Walter Lozano
2020-08-07 16:23               ` Simon Glass
2020-08-07 17:23                 ` Walter Lozano
2020-09-07  1:44                   ` Simon Glass
2020-09-07 19:10                     ` Walter Lozano
2020-06-19 21:11 ` [RFC 4/4] mmc: fsl_esdhc_imx: make use of dtoc to generate struct udevice_id Walter Lozano
2020-06-19 21:48 ` [RFC 0/4] drivers: footprint reduction proposal Tom Rini
2020-06-22 14:12   ` Walter Lozano
2020-06-22 14:20     ` Tom Rini
2020-06-22 15:25       ` Walter Lozano
2020-06-26 19:17         ` Walter Lozano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200619211140.5081-3-walter.lozano@collabora.com \
    --to=walter.lozano@collabora.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.