首先在VM虚拟机中安装qemu相关环境 forlinx@ubuntu:$ sudo apt-get install qemu-user-static 将Forlinx Desktop源码目录下OK3399-desktop-release/rootfs/ubuntu.img文件扩容后挂载() forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo fsck.ext3 -f IMAGE forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo resize2fs IMAGE SIZE (IMAGE为要修改的镜像名称,SIZE为块的数量、一个块的大小为4K(即当SIZE为783770时,783770*4=3135080,大概为3.2G,1250000时为5G))按需求扩容对应的容量大小,ubuntu.img镜像大小与开发板rootfs分区有关,扩容为5G没有问题,再往上扩容需要查看开发板rootfs分区大小,ubuntu.img ≤ rootfs分区大小,rootfs分区修改方法可参考我司论坛识库描述:http://bbs.witech.com.cn/portal.php?mod=view&aid=410 扩容后将ubuntu.img文件挂载到target目录下 forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo mount ubuntu.img target/ forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ cd target 修改配置 forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ sudo cp /usr/bin/qemu-arm-static usr/bin/ 拷贝PC主机端的dns配置,因为待会安装程序时要用网络: forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ sudo cp -b /etc/resolv.conf etc/resolv.conf forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ sudo vim etc/apt/source.list 添加 deb http://ports.ubuntu.com/ubuntu-ports/ xenial main universe deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main universe
创建qemu挂载脚本 forlinx@ubuntu:~/OK3399-desktop-release/rootfs/target$ cd .. forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ touch mount.sh forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ vi mount.sh 添加以下内容: #!/bin/bash function mnt() { echo "MOUNTING" sudo mount -t proc /proc ${2}proc sudo mount -t sysfs /sys ${2}sys sudo mount -o bind /dev ${2}dev sudo chroot ${2} } function umnt() { echo "UNMOUNTING" sudo umount ${2}proc sudo umount ${2}sys sudo umount ${2}dev } if [ "$1" == "-m" ] && [ -n "$2" ] ; then mnt $1 $2 elif [ "$1" == "-u" ] && [ -n "$2" ]; then umnt $1 $2 else echo "" echo "Either 1'st, 2'nd or both parameters were missing" echo "" echo "1'st parameter can be one of these: -m(mount) OR -u(umount)" echo "2'nd parameter is the full path of rootfs directory(with trailing '/')" echo "" echo "For example: ch-mount -m /media/sdcard/" echo "" echo 1st parameter : ${1} echo 2nd parameter : ${2} fi 保存退出 forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ chmod +x mount.sh forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo ./mount.sh -m target/ 到此,成功将ubuntu.img挂载到qemu上,虚拟机操作用户应该变为root@ubuntu:/# ,此时执行apt等操作会保留在ubuntu.img文件中 做对应的修改即可 退出 exit 取消挂载 forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo ./mount.sh -u target/ forlinx@ubuntu:~/OK3399-desktop-release/rootfs$ sudo umount target/
然后运行编译脚本生成update.img即可。 |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-22 04:12
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.