From 4092180662ec62cf28b9283a020f1ff7f0892c19 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 17 Dec 2020 16:06:26 +0100 Subject: [PATCH] tools/lxterm/json: json file provide relative path, add json file directory to image names. Allow sharing same json file between serial boot and Ethernet/SDCard/SATAboot: boot.json: { "Image": "0x40000000", "rv32.dtb": "0x40ef0000", "rootfs.cpio": "0x41000000", "opensbi.bin": "0x40f00000" } If boot.json and images are located in images directory, using lxterm --images=images/boot.json will now work. --- litex/tools/litex_term.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litex/tools/litex_term.py b/litex/tools/litex_term.py index 7b4612954..a81a97870 100755 --- a/litex/tools/litex_term.py +++ b/litex/tools/litex_term.py @@ -229,7 +229,9 @@ class LiteXTerm: self.boot_address = kernel_address if json_images is not None: f = open(json_images, "r") - self.mem_regions.update(json.load(f)) + json_dir = os.path.dirname(json_images) + for k, v in json.load(f).items(): + self.mem_regions[os.path.join(json_dir, k)] = v self.boot_address = self.mem_regions[list(self.mem_regions.keys())[-1]] f.close() self.flash = flash