怎么将安装了各种软件环境 的ubantu 系统 制作成一个新的镜像文件

本帖最后由 leaez 于 2016-11-3 18:01 编辑

wiki有参考固化系统 http://wiki.t-firefly.com/index. … 6.E7.B3.BB.E7.BB.9F
我知道前面几步生产空的镜像
到这里:
mount -o loop linuxroot.img /opt
cp -a /mnt/ubuntu/ /opt/
umount /opt
拷贝这个文件系统到 镜像。
我的系统是烧录的,怎么拷贝的呢。

wiki里面有提到:
下载和解压 ubuntu-core
ubuntu-core 是最小的根文件系统,在安装之后根据需要再设置桌面或服务器环境。

下载并解压到 /mnt :

miniroot# cd /mnt
miniroot# wget -P /mnt http://cdimage.ubuntu.com/ubuntu-core/releases/14.04/release/ubuntu-core-14.04-core-armhf.tar.gz
miniroot# mkdir /mnt/ubuntu
miniroot# tar -xpzf /mnt/ubuntu-core-14.04-core-armhf.tar.gz -C /mnt/ubuntu

zhansb 发表于 2015-12-25 08:57
wiki里面有提到:
下载和解压 ubuntu-core
ubuntu-core 是最小的根文件系统,在安装之后根据需要再设置桌 …

我的ubantu是通过AndroidTool里的升级固件烧写的,然后再里边安装了python qt … 的很多库。
也就是 我是对已经的安装系统,并安装了多个环境工具的系统做成image。

leaez 发表于 2015-12-25 13:49
我的ubantu是通过AndroidTool里的升级固件烧写的,然后再里边安装了python qt … 的很多库。
也就是 我 …

你好 ,你这个问题解决了吗???最后是怎么解决的 可以请教一下吗??

哪位高手分享一下经验啊?这个挺常用。@zhangsb @leaez

dd 这个命令

yly123ycyn 发表于 2016-5-4 16:49
dd 这个命令

我试过
sudo dd if=/dev/mmcblk0 of=/mnt/xxx.img bs=1MB

when a SD card with enough space is mounted on /mnt.

但是这样做的image,用在sudo upgrad_tool uf xxx.img上不行。

我想问的是怎么做这个工具可以用的image。否则做备份再复原还是不方便。

解决方法在这:http://developer.t-firefly.com/thread-8384-1-1.html

hongyin 发表于 2016-5-13 13:46
解决方法在这:http://developer.t-firefly.com/thread-8384-1-1.html

谢了

  1. 解包:
    afptool -unpack update.img update

  2. 制作根文件系统镜像
    dd if=/dev/zero of=linuxroot.img bs=1M count=4096 //创建一个大小4G(根据自己需求调整)的空镜像文件
    mkfs.ext4 -F -L linuxroot linuxroot.img //将*.img格式化成ext4文件系统格式,卷标为linuxroot
    mount -o loop linuxroot.img /opt/img //挂载空镜像到 /opt/img 文件, loop: 把一个文件当成硬盘分区挂接上系统
    mount /dev/mmcblk0p5 /mnt/rootfs //整个跟文件系统就在mmcblk0p5下 就是把跟文件系统挂载在/mnt/rootfs
    cp -a /mnt/rootfs/* /opt/img //拷贝整个跟文件系统到linuxroot.img 中 */
    touch /opt/img/firstboot //创建一个启动标记文件
    umount /opt/img umount /mnt/rootfs //卸载挂载点。

  3. 调整大小
    参考牛头
    http://developer.t-firefly.com/thread-10963-1-1.html
    e2fsck -p -f linuxroot.img
    resize2fs -M linuxroot.img

  4. 替换&打包
    将第一步解包的system.img 替换为 linuxroot.img
    afptool -pack . ../update_new.img

解包打包参考
http://wiki.t-firefly.com/index.php/Firefly-RK3288/Customize_android_firmware

Ubuntu14.04 的镜像测试可用。