Skip to content

Commit

Permalink
Merge pull request #1895 from trabucayre/json2dts_linux_fill_network
Browse files Browse the repository at this point in the history
tools/litex_json2dts_linux.py: adding ip= bootarg when localip and remoteip are provided
  • Loading branch information
enjoy-digital authored Feb 22, 2024
2 parents 63f9935 + a6d015a commit dc229f8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions litex/tools/litex_json2dts_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,23 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
initrd_enabled = True
initrd_size = os.path.getsize(initrd)

# if json constants contains localip ethernet has been enabled
if "localip1" in d["constants"]:
localip = '.'.join([str(d["constants"][f"localip{i}"]) for i in range(1,5)])
remoteip = '.'.join([str(d["constants"][f"remoteip{i}"]) for i in range(1,5)])
ip = f" ip={localip}:{remoteip}:{remoteip}:255.255.255.0::eth0:off:::"
else:
ip = ""

if root_device is None:
root_device = "ram0"

dts += """
chosen {{
bootargs = "{console} {rootfs}";""".format(
bootargs = "{console} {rootfs}{ip}";""".format(
console = "console=liteuart earlycon=liteuart,0x{:x}".format(d["csr_bases"]["uart"]),
rootfs = "rootwait root=/dev/{}".format(root_device))
rootfs = "rootwait root=/dev/{}".format(root_device),
ip = ip)

if initrd_enabled is True:
dts += """
Expand Down

0 comments on commit dc229f8

Please sign in to comment.