Modifying the Root Filesystem
This document describes how to modify the root filesystem by mounting the image. The detailed procedure is as follows.
This example uses linaro-rootfs.img.
1 Mount the root filesystem 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/bashAfter running the commands above, you enter the mounted root directory, as shown in the figure.

You can then download and install the packages you need inside it.
2 Adding files
2.1 Add files under the root directory
To add a file under the root directory, first mount the root filesystem image, then copy the file into the mount directory. Then enter the mount directory to see the added file. You can modify files inside the mount directory, such as changing file permissions.
# 在根目录下添加文件
sudo mv /home/ubuntu/test.txt /mnt/GM_3568JHF_root
# 进入挂载目录
sudo chroot /mnt/GM_3568JHF_root /bin/bash
# 在挂载目录下对文件进行修改
chmod 777 ./test.txt2.2 Add files outside the root directory
To add a file outside the root directory (e.g. the Desktop directory), proceed as follows:
# 创建需要添加文件的目录
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.txt3 Unmount after modification
After completing the modifications, run the following command to unmount.
# 取消挂载
sudo umount -l /mnt/GM_3568JHF_root