Mount TX2 as mass storage

Hi,

I can mount TX1/24.2 as a mass storage device in Ubuntu PC, by the following U-boot command:

ums 0 mmc 0

But the same cannot be done in TX2. How to do the same in TX2 (27.1/28.1)?

Hi ramprasadrp2412,

Please refer below topic and run the “configfs_msc_l4t.sh” script.
https://devtalk.nvidia.com/default/topic/1014096/jetson-tx2/how-to-set-tx2-otg-usb-as-device-mode-/post/5192587/#5192587

Thanks carolyuu.

The script that you provided exposes a part of the emmc as storage device. But, I need to access the rootfs of Jetson when I connect it to Host PC. This is achieved in TX1/24.2 using the above mentioned u-boot commands.

I have not attempted this, but try editing the script lines involving creating/formatting msc.ext4.img and remove them…then instead of using echo to name the full path of msc.ext4.img instead name “/dev/mmcblk0p1”. Normally one would only use a secure subset of the disk via the loopback formatted file, but there probably isn’t anything stopping access to the actual root partition (I haven’t tested…there are probably some risks associated with doing this).

@linuxdev Thanks, it is working. As you mentioned, I removed the script lines associated with “msc.ext4.img” and replaced “/home/ubuntu/msc.ext4.img” with “/dev/mmcblk0p1”. Now I can access the TX2 rootfs from host PC.

I have 2 more questions:
1.

Can you explain this?
2. How can I mount the rootfs during boot, like in TX1/24.2 using u-boot cmd?

Thanks

Security comes to mind first. There is no login management associated with this…I think whoever the process of the driver is run by probably owns everything it does. You could for example, from the host accessing over USB:

touch /tmp/testme.txt
ls -l /tmp/testme.txt

…who is the owner? What permissions were granted (implying umask)? Does a random user have the ability to replace a kernel module in “/lib/modules/$(uname -r)/”? Can device special files be added or removed in “/dev/”?

If this is just for yourself for development this isn’t a problem. If this goes to someone who may not understand the problem of recursively deleting “/lib”, then it is a huge risk.

I’m not sure I understand the question about mounting during boot. If you mean how do you select from multiple boot entries, then you have to use serial console (interrupt with a key stroke at the proper point, then type in the number of the boot entry…type “boot” if you interrupt too soon). If you mean you want to name an alternate rootfs, then you change the “rootfs=” in “/boot/extlinux/extlinux.conf”. Note that U-Boot will find a particular extlinux.conf no matter what the rootfs entry is…it is upon the kernel taking over and overwriting U-Boot that the extlinux.conf rootfs entry is honored. Prior to this it is a case of where U-Boot was told to find extlinux.conf during flash.