01 Modification of the root directory file system
The method provided in this document is to modify the root directory file system by mounting img. The detailed operation tutorial is as follows
Take modifying linaro-rootfs.img as an example
1 Mount the root directory file system image
# 创建挂载文件夹
mkdir /mnt/GM_3568JHF_root
# 挂载
sudo mount -o loop /home/ubuntu/SDK/debain/linaro-rootfs.img /mnt/GM_3568JHF_root
# /home/ubuntu/SDK/debain/linaro-rootfs.img:是 linaro-rootfs.img 所在路径
# 进入挂载目录
sudo chroot /mnt/GM_3568JHF_root /bin/bash
After executing the above command, you will enter the mounted root directory interface, as shown in the figure

You can then download the required installation package
2 Add files
2.1 Add files to the root directory
To add files to the root directory, you first need to mount the root directory file system image, and then copy the files to the mounted directory. Then enter the mounted directory to see the added files. Users can modify files in the mounted directory, such as modifying file permissions.
# 在根目录下添加文件
sudo mv /home/ubuntu/test.txt /mnt/GM_3568JHF_root
# 进入挂载目录
sudo chroot /mnt/GM_3568JHF_root /bin/bash
# 在挂载目录下对文件进行修改
chmod 777 ./test.txt
2.2 Add files in non-root directories
To add files to a non-root directory (such as the desktop directory), follow these steps:
# 创建需要添加文件的目录
sudo mkdir -p /mnt/GM_3568JHF_root/home
sudo mkdir -p /mnt/GM_3568JHF_root/home/linaro
sudo mkdir -p /mnt/GM_3568JHF_root/home/linaro/Desktop
# 移动文件到挂载的指定目录
sudo mv /home/ubuntu/test.txt /mnt/GM_3568JHF_root/home/linaro/Desktop
# 进入挂载目录
sudo chroot /mnt/GM_3568JHF_root /bin/bash
# 在挂载目录下对文件进行修改
cd /home/linaro/Desktop
chmod 777 ./test.txt
3. Cancel the mount after modification is completed
After the modification is completed, execute the following command to cancel the mount operation
# 取消挂载
sudo umount -l /mnt/GM_3568JHF_root