Flash static IP address onto Jetson Nano

Hello,

I am trying to flash a static IP address onto a target Nano board. I know we can edit the ethernet profile on the target Nano AFTER flashing and set a static IP address, but I want to have one on the Nano pre-loaded after flashing.

Is there a way to bypass the MAC address?

I couldn’t tell you all files which need to change for this, but the following will probably give you a good start…

Whenever you perform a fresh flash the actual flash commands on the host PC will be at:
~/nvidia/nvidia_sdk/JetPack_...version.../Linux_for_Tegra/

Within this is subdirectory “rootfs/”. Most of the generated image for the rootfs partition is an exact duplicate of this. By default this is a purely Ubuntu reference install, plus NVIDIA-specific drivers on top of it. The part which gets edited is basically only the “rootfs/boot/” content…things which are part of the boot chain, but not the final running content. Edits depend on options passed to the flash software, e.g., for different Jetson modules and different carrier boards or revisions.

Content within “rootfs/etc/” will be copied in from this default setup, or from what you’ve edited. As an example, some people do not want to use first boot to set up their first login credentials, and a script available here uses QEMU to chroot and edit using Ubuntu commands.

The only reason that script is needed to make edits is because the database cannot be edited with a simple editor; commands for installing actual packages using apt and dpkg require using the arm64 version of the programs from an amd64 host PC. Almost all other content can be performed with a simple editor and not use such a script. If you were to use a tool such as “nm-connection-editor”, then perhaps QEMU would be useful (and that script is human readable…you could see how it works and make your own version of the script, but likely you won’t need to go that far).

If you have a Jetson with IP address set up the way you want, and can find the files which were edited to create that change, then you could simply copy those files into the “rootfs/etc/” and it would flash this by default. Or you could use a simple editor to directly edit those files.

The part where MAC addresses usually come into play is when udev is responsible for renaming devices. The configuration for customizing a particular system’s udev is (assuming you are working on the rootfs from the host PC) “rootfs/etc/udev/”. If the ethernet interface is not being renamed by udev, then you won’t find anything there with the MAC address. If the interface is being renamed or customized based on the specific MAC address, then it is very likely you will find the MAC address in one of the “rootfs/etc/udev/rules.d/*” files.

The two common cases of using the MAC address there are (A) the one I already mentioned, renaming the interface to a non-default naming convention, and (B) if there are firewall rules referring to MAC address.

The files used for setting up address can be a bit tricky though, especially as soon as NetworkManager gets involved. As WiFi goes up or down it might rewrite a file. Files in “rootfs/etc/network/” might not do what you want (NetworkManager might ignore those files, or it might use those files). Systems with and without NetworkManager tend to change which files of “rootfs/etc/” will do what you want.

If you happen to have a clone, and loopback mount it on “Linux_for_Tegra/rootfs/”, then you can expect the “rootfs/boot/” content to be altered at each flash, but the rest of the network setup and login names/passwords and timezone to be a perfect duplicate of the other Jetson (which is mostly good, but perhaps MAC address needs to be fixed in “rootfs/etc/udev/rules.d/”, or maybe you don’t want a thousand installs using the same name/pass).

For the most part MAC address won’t be involved in setting up a static address. By default the device name (such as eth0) is how a device is found for IP address configuration. YMMV.