文章目的:
在实际的项目中 需要将应用程序放到源码中重新生成镜像,可以在源码中直接修改再全编译;此次分享一个比较方便的办法,可以通过simg2img命令把ubuntu.img变成可以挂载的img文件,然后通过mount命令挂载,就可以对镜像进行更改了,修改完成之后,再通过img2simg命令把ubuntu_raw.img变回之前的格式就可以了,然后替换镜像烧写
操作
LS1028编译生成的文件系统镜像路径位于:/build/images目录下,将新生成的ubuntu.img文件系统镜像,拷贝到一个新的文件夹test1
forlinx@ubuntu:~/work/OK1028-linux-fs/build/images$ sudo simg2img ubuntu.img ubuntu_raw.img
root@ubuntu:~# cp work/OK1028-linux-fs/build/images/ubuntu_raw.img test1
root@ubuntu:~# cd test1
root@ubuntu:~/test1# ls
ubuntu_raw.img
root@ubuntu:~/test1# mount ubuntu_raw.img /mnt
//对文件系统进行修改
root@ubuntu:/mnt# ls
bin boot dev etc forlinx home include init lib lost+found media mnt opt proc root run sbin share srv sys tmp usr var
root@ubuntu:~#umount /mnt
root@ubuntu:~/test1#img2simg ubuntu_raw.img ubuntu.img
root@ubuntu:~/test1# ls
ubuntu.img ubuntu_raw.img