Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 69688C433F5 for ; Sun, 27 Mar 2022 15:33:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 35ABA839B3; Sun, 27 Mar 2022 17:32:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gvcKgdH5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 048B88395B; Sun, 27 Mar 2022 17:32:25 +0200 (CEST) Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8E6D0836A9 for ; Sun, 27 Mar 2022 17:32:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-ed1-x52f.google.com with SMTP id a17so14330193edm.9 for ; Sun, 27 Mar 2022 08:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GnqHri317SlaV1PGcxVfGu/eK3Gnb9CpcaeykC/2mCU=; b=gvcKgdH5gBc3ftbDgrimzNYOlvy+sj8BEtwACDmboDP+azux54ShAznwA2m9pAaY5u PuKSWwW+zqnNeUTbLkT26Ppxm2MO32l7/L5FK+PvbZn8L4qkGQNuVo+5pehe1WCnG/bM eGNXgFp4OD8jnkO7B+n/r0GVh8pj3iGX5B1oDmiOk+xkVNOo28fepI79EaMfPIi07UzM Ou0zm6+wmkuq0Ld+GvE3IuSD5948rYRaOkJ0PFtd2u1+S5xeCG4kAHPV0JoTW68nmtp4 TV7gMfwGueanqSHtzydh2wlEiqjWgjMrN/r7G5Wl8KT3naZisDejjt3P4ax+66aP9Oet q2LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GnqHri317SlaV1PGcxVfGu/eK3Gnb9CpcaeykC/2mCU=; b=Q69lhRlDiBsWTra59xUgrz9W1vbAlz+Fnnx8r3j6xhX3e4uEQgvBJdf3D1O3481FON oyd8TSYviiMR0snnTH6uLjWf7tZ04baydUXR68eANfC44/Kuu8KY2nCC8bDOoZxRoCUf wRhK02Bwtzr9EHT08low2A4dyUSpVdHzt2XsQbl9YE7ePUnfT6GY4iGLcwPm9vbuRsf3 XidmrITqBbadRumSakqFGViE37KbDRslhSk/5/MMwDHpct1WpOIG4L7+B9gUMU7cdRJv /XCbiDQk3cejNLQWrON7ge4OeGGJq5fw7/p9Aj1OgIV/cSpDJp0wEnlReCoEoKTYW4hf e57w== X-Gm-Message-State: AOAM530nfn5Exah36sXZgIJ5rsNQyrZIbPcW93sTTYuhmmWlYYomNAOG 89V/6FB0nVCDy/jOWu8j61+utHQ5xpA= X-Google-Smtp-Source: ABdhPJzy7bI9IxF1LEH8mHIm85BbgSWDkQAP8VUkoUNvad4+xtYqEMEPprm8CkKRjc9NL9pp8QgPDA== X-Received: by 2002:a05:6402:35c5:b0:419:2c72:66c3 with SMTP id z5-20020a05640235c500b004192c7266c3mr11032311edc.343.1648395139131; Sun, 27 Mar 2022 08:32:19 -0700 (PDT) Received: from localhost.localdomain ([178.233.26.119]) by smtp.gmail.com with ESMTPSA id jg22-20020a170907971600b006df9ff416ccsm4639763ejc.137.2022.03.27.08.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Mar 2022 08:32:18 -0700 (PDT) From: Alper Nebi Yasak To: u-boot@lists.denx.de Cc: Simon Glass , Heiko Thiery , Jan Kiszka , Alper Nebi Yasak Subject: [PATCH 4/7] binman: Remove '/images/' fragment from FIT subentry paths Date: Sun, 27 Mar 2022 18:31:47 +0300 Message-Id: <20220327153151.15912-5-alpernebiyasak@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220327153151.15912-1-alpernebiyasak@gmail.com> References: <20220327153151.15912-1-alpernebiyasak@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Binman FIT entry nodes describe their subentries in an 'images' subnode, same as how they would be written for the mkimage executable. The entry type initially manually managed its subentries keyed by their node paths relative to its base node. It was later converted to a proper section while still keeping the same keys for subentries. These subentry keys of sections are used as path fragments, so they must not contain the path separator character '/'. Otherwise, they won't be addressable by binman extract/replace commands. Change these keys from the '/images/foo' forms to the subentry node names. Extend the simple FIT tests to check for this. Signed-off-by: Alper Nebi Yasak --- tools/binman/etype/fit.py | 13 ++++++++----- tools/binman/ftest.py | 7 +++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py index e0407715d819..035719871e04 100644 --- a/tools/binman/etype/fit.py +++ b/tools/binman/etype/fit.py @@ -384,7 +384,8 @@ def _add_entries(base_node, depth, node): entry.ReadNode() # The hash subnodes here are for mkimage, not binman. entry.SetUpdateHash(False) - self._entries[rel_path] = entry + image_name = rel_path[len('/images/'):] + self._entries[image_name] = entry for subnode in node.subnodes: _add_entries(base_node, depth + 1, subnode) @@ -630,7 +631,8 @@ def _add_node(base_node, depth, node): has_images = depth == 2 and in_images if has_images: - entry = self._priv_entries[rel_path] + image_name = rel_path[len('/images/'):] + entry = self._priv_entries[image_name] data = entry.GetData() fsw.property('data', bytes(data)) @@ -643,12 +645,12 @@ def _add_node(base_node, depth, node): # fsw.add_node() or _add_node() for it. pass elif self.GetImage().generate and subnode.name.startswith('@'): - entry = self._priv_entries.get(subnode_path) + entry = self._priv_entries.get(subnode.name) _gen_node(base_node, subnode, depth, in_images, entry) # This is a generator (template) entry, so remove it from # the list of entries used by PackEntries(), etc. Otherwise # it will appear in the binman output - to_remove.append(subnode_path) + to_remove.append(subnode.name) else: with fsw.add_node(subnode.name): _add_node(base_node, depth + 1, subnode) @@ -693,7 +695,8 @@ def SetImagePos(self, image_pos): fdt = Fdt.FromData(self.GetData()) fdt.Scan() - for path, section in self._entries.items(): + for image_name, section in self._entries.items(): + path = f"/images/{image_name}" node = fdt.GetNode(path) data_prop = node.props.get("data") diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 3d79f82dff43..87c072ef9c9c 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -3761,6 +3761,13 @@ def _CheckSimpleFitData(self, fit_data, kernel_data, fdt1_data): self.assertEqual(len(kernel_data), int(data_sizes[0].split()[0])) self.assertEqual(len(fdt1_data), int(data_sizes[1].split()[0])) + # Check if entry listing correctly omits /images/ + image = control.images['image'] + fit_entry = image.GetEntries()['fit'] + subentries = list(fit_entry.GetEntries().keys()) + expected = ['kernel', 'fdt-1'] + self.assertEqual(expected, subentries) + def testSimpleFit(self): """Test an image with a FIT inside""" data = self._DoReadFile('161_fit.dts') -- 2.35.1