This won’t work the way you expect it to. Everything else here is correct (and very useful), but
sudo is not based on user space (a virtual memory space) versus kernel space (a physical memory space). The “
rootfs/” content location used for flash image creation must be an exact mirror of the installation about to occur, and that includes permissions. Non-root users are never allowed to modify kernel or kernel modules, and so if installing to “
rootfs/” succeeds, then modules are being added to “
rootfs/lib/modules/$(uname -r)/” by a non-root user…should that succeed, the implication is something has gone very wrong (those files, when loaded, become part of the kernel).
An illustration of that point comes when people try to flash from an NTFS or VFAT partition (which contains “
Linux_for_Tegra/rootfs/”). These filesystems have no concept of Linux “group” permissions, and even less concept of “suid” or “guid” or “sticky bit” permissions. The “
sudo” command itself must be correctly set with the right suid permission, or the system will refuse to use it…copying the sudo binary from an NTFS or VFAT partition implies that permission is lost when creating the ext4 image, and flash will succeed, but all use of sudo (or anything requiring root permission) will then fail (you’d have to reflash).
Another example is that if the unpack of the sample rootfs into “
Linux_for_Tegra/rootfs/” were performed without “
sudo”. The same problem would occur, but the end user could then certainly install custom kernel modules directly to this without error (and
sudo would once again fail without knowing why).
Normally one would not work as root/suid when installing software, but if you are able to install modules to any destination which is part of a “lib” directory, or a module directory, then it means something went wrong with permissions.
The reason I mention this is that a number of people have at times done everything else correctly, and the flash succeeded, but then there were odd problems. Different reasons exist why permissions in “
rootfs/” might be wrong, but once it happens, it can take quite some time to figure out why an otherwise perfect procedure still works incorrectly. Always treat “
Linux_for_Tegra/rootfs/” as a complete operating system, including permissions.