i have already cloned system.img and system.img.raw from Jeton-TX2 device…
Now, i want to modify the files in system.img, then flash to board again…
What should i do to achive that?
you may install QEMU utility on your host for a prerequisites.
$ sudo apt-get install qemu $ sudo apt-get install qemu-user-static
please mount the raw image to your host machine, after that, you should also enable chroot for modification.
once complete, exit chroot and also unmount the chroot mount points, generating another new tarball for your customize rootfs.
please check below,
it show the steps for creating a custom rootfs on your host device for reference,
How to copy whole rootfs of Jetson TX2 to PC - #2 by JerryChang
you must include
-r options to skip building system.img; reuse the existing one. when you restore the image via
please check Flash Script Usage for reference,
Some added notes…
system.img.raw” is the one you can mount and modify. “
system.img” is faster to flash since it is a “sparse” image (think of it as “poor man’s compression”). As the system fills up with content the
system.img will begin to approach the size of the
system.img.raw. There is the “
mksparse” tool (using “
0” as the fill pattern) to create a sparse image from a raw image. Either sparse or raw will flash equally well, though smaller sparse images will be faster.
To examine or manipulate a raw image you can loopback mount it. For example, if you want to mount it on “
/mnt”, and let the mount command itself apply the loopback device:
sudo mount -o loop ./system.img.raw /mnt cd /mnt ls # ...do things... # Before umount the device must not be in use, so: cd sudo umount /mnt
losetup” command is performed for you with the above, but you could apply this manually:
sudo losetup --find --show ./system.img.raw # Assuming it finds and uses "/dev/loop0": lsblk -f /dev/loop0 sudo mount /dev/loop0 /mnt # Explore and work on the partition at "/mnt". cd sudo umount /dev/loop0 # Detach loop0 so you don't "leak" loop devices: sudo losetup -d /dev/loop0
- Do not flash a system.img from one release into another release.
- If you forget the “
-r” argument to
flash.sh, then it will overwrite your “
Linux_for_Tegra/bootloader/system.img”. Use a copy or be certain you don’t flash without “
-r”. It is a large file so a copy it takes a long time and a lot of space.
- It is best to flash everything, not just the
system.img. A lot of boot related content is added and not just the
system.img, but the time required is very short and it guarantees it matches the release.
- If the
system.imgis a non-default size, then you probably need to use the “
-S size” option so that the partition fits correctly.
Thank you for your useful solution!
Thank you for your useful solution and tips!