TX2i : Modify rootfs to create new user during flashing

It works. Just make sure to copy or bind mount the qemu static binary for aarch64 as well as any requisite special filesystems. Here is a script that does it. It’s good enough to run apt, build stuff, and add users. I have only tested it with system users, however ( < uid 1000).

There is also my tegrity python package, which has a similar chroot scripts and some smarter handling of mounts.

Just do:

sudo tegrity-qemu --enter path/to/rootfs

The rest of the package is targeted towards Nano exclusively for the moment, but I plan on supporting more boards in the future. In any case, those are two options for editing the rootfs.

Lastly, for apt to work, you’ll want to ensure apply_binaries.sh has already been run (installs the key and some other stuff) and this file looks like this:

 $ cat ...rootfs/etc/apt/sources.list.d/nvidia-l4t-apt-source.list 
deb https://repo.download.nvidia.com/jetson/common r32 main
deb https://repo.download.nvidia.com/jetson/t194 r32 main

It will say <SOC> on the default file, which is filled in on first boot by /etc/systemd/nvfb.sh on first boot, but it doesn’t hurt to fill it in beforehand. The values for each board are as follows:

... rest of /etc/systemd/nvfb.sh ...
# Update chipid to apt source list file
SOURCE="/etc/apt/sources.list.d/nvidia-l4t-apt-source.list"
if [ -e "${SOURCE}" ]; then
	CHIP="$(cat /proc/device-tree/compatible)"
	if [[ "${CHIP}" =~ "tegra210" ]]; then
		sed -i "s/<SOC>/t210/g" "${SOURCE}"
	elif [[ "${CHIP}" =~ "tegra186" ]]; then
		sed -i "s/<SOC>/t186/g" "${SOURCE}"
	elif [[ "${CHIP}" =~ "tegra194" ]]; then
		sed -i "s/<SOC>/t194/g" "${SOURCE}"
	else
		logger "nvfb: Updating apt source list failed with exit code: 1"
	fi
fi

eg. for tegra210 replace <SOC> with t210. Then save, run apt-get update and so on and so forth. It’s possible to update the system and install stuff like deepstream this way before first boot, saving update time, and your network if you’re deploying a whole bunch of devices at once.

1 Like