在ubuntu上挂载QNX 镜像

步骤

1,将QNX imge转换成android sparse镜像

这个QNX镜像可以是直接从QNX分区读取得到或者你的刷机包中的镜像:

root@ubuntu:~/workspace/$ file qnx_img.img
qnx_img.img: DOS/MBR boot sector

使用python tools/mksparse.py $镜像文件 转换为android sparse镜像

mksparse.py通常位于QNX 源码路径下的target目录中

root@ubuntu:~/workspace/$ file qnx_img.img.sparse
qnx_img.img.sparse: Android sparse image, version: 1.0, Total of 786432 4096-byte output blocks in 1674 input chunks.

2,android sparse镜像转换为qnx6镜像,这个工具需要安装一下,通过apt-get就可以安装

simg2img $image_file.sparse $image_file.sparse.qnx6

3, 通过loop设备挂载qnx6 镜像

sudo losetup $loop_device $image_file.sparse.qnx6
sudo mount -t qnx6 $loop_device $mount_path

脚本

#!/bin/bash

# Function to display help information
display_help() {
    echo "Usage: $0 mount/umount image_file loop_device mount_path"
    echo "Example: $0 mount qnx.img /dev/loop27 /mnt"
    echo "Example:" $0 umount /dev/loop27 /mnt
}

# Parse command line arguments
action=$1

# Perform the specified action
case $action in
    "mount")
        if [ "$#" -ne 4 ]; then
          echo "Error: Insufficient number of arguments for 'mount'."
          display_help
          exit 1
        fi

        image_file=$2
        loop_device=$3
        mount_path=$4
        sudo umount $mount_path
        echo "================step1: create spare imge"
        python tools/mksparse.py $2
        echo "================step2: create qnx6 imge"
        simg2img $image_file.sparse $image_file.sparse.qnx6
        echo "================step3: map to loop devices"
        sudo losetup -d $loop_device
        sudo losetup $loop_device $image_file.sparse.qnx6
        echo "================step4: mount devices!"
        sudo mount -o rw -t qnx6 $loop_device $mount_path
        echo "Mounted $image_file on $loop_device at $mount_path"
        ;;
    "umount")
        if [ "$#" -ne 3 ]; then
          echo "Error: Insufficient number of arguments for 'mount'."
          display_help
          exit 1
        fi
        loop_device=$2
        mount_path=$3
        sudo umount $mount_path
        sudo losetup -d $loop_device
        echo "Unmounted $image_file from $loop_device at $mount_path"
        ;;
    *)
        echo "Error: Unknown action '$action'."
        display_help
        exit 1
        ;;
esac

exit 0

相关推荐

  1. ubuntu挂载QNX 镜像

    2023-12-30 15:14:03       42 阅读
  2. 制作ubuntu的python容器镜像

    2023-12-30 15:14:03       42 阅读
  3. Nexus配置Docker镜像仓库

    2023-12-30 15:14:03       34 阅读
  4. ubuntu 永久 磁盘挂载

    2023-12-30 15:14:03       6 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-30 15:14:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-30 15:14:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-30 15:14:03       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-30 15:14:03       20 阅读

热门阅读

  1. AJAX:整理1: 了解AJAX的相关知识

    2023-12-30 15:14:03       37 阅读
  2. Vue3.2 自定义指令详解与实战

    2023-12-30 15:14:03       39 阅读
  3. 猴子摘香蕉python

    2023-12-30 15:14:03       41 阅读
  4. 80 BFS和DFS两种方式解岛屿数量

    2023-12-30 15:14:03       40 阅读
  5. HTML5简介与基础骨架

    2023-12-30 15:14:03       38 阅读
  6. numpy数组追加元素

    2023-12-30 15:14:03       42 阅读
  7. Linux 命令 ifconfig 全面解析!

    2023-12-30 15:14:03       69 阅读
  8. git、gitee、github、gitlab 区别以及功能

    2023-12-30 15:14:03       44 阅读
  9. 一些与漏洞相关的面试题

    2023-12-30 15:14:03       31 阅读
  10. 服务器故障重启可以解决大部分问题

    2023-12-30 15:14:03       37 阅读