IMX6ULL - 移植linux-imx_5.4.70_2.3.0

2021/10/25 7:12:43

本文主要是介绍IMX6ULL - 移植linux-imx_5.4.70_2.3.0,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

作者:zzssdd2

E-mail:zzssdd2@foxmail.com

一、说明

  • 主机系统:Ubuntu 20.04.3 LTS

  • 开发板:TOPEET-IMX6ULL

  • Linux版本:linux-imx_5.4.70_2.3.0

  • 交叉编译器:gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf

  • 有了前面IMX6ULL-移植uboot-imx_v2020.04_5.4.70_2.3.0的基础再进行Linux移植就会方便很多。因为Linux的移植更多的是对设备树的修改,而在Uboot移植时已经修改过设备树,所以接下来会省不少事。

二、环境搭建

2.1、Linux源码

  1. 获取NXP维护的Linux内核源码:

    git clone https://source.codeaurora.org/external/imx/linux-imx
    
  2. 使用命令git tag -a查看版本然后git checkout -b <tag name>切换到目标版本:

    git checkout -b rel_imx_5.4.70_2.3.0
    
  3. 接下来就基于版本源码进行linux内核移植

2.2、交叉编译器

参考IMX6ULL-移植uboot-imx_v2020.04_5.4.70_2.3.0的2.2小节

三、编译源码

  1. linux源码根目录下创建编译脚本make.sh内容如下:

    #!/bin/bash
    
    # 若之前已经导入到环境变量则不需要
    export PATH=$PATH:/usr/local/arm/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin
    # 若已经在顶层Makefile文件中指定则不需要
    export ARCH=arm
    # 若已经在顶层Makefile文件中指定则不需要
    export CROSS_COMPILE=arm-none-linux-gnueabihf-
    
    make distclean
    # make mrproper
    
    # For I.MX6 --> imx_v7_defconfig
    # For I.MX7 --> imx_v7_defconfig
    # For I.MX8 --> imx_v8_defconfig
    make imx_v7_defconfig
    
    # make menuconfig
     make -j $(nproc) all
    
    
  2. 执行编译./make.sh并等待编译完成,如果没有错误出现说明搭建环境OK。

  3. 补充说明:

    1. make命令

      /imx6ull/kernel/linux-imx_5.4.70_2.3.0$ make help
      Cleaning targets:
        clean		  - Remove most generated files but keep the config and
                          enough build support to build external modules
        mrproper	  - Remove all generated files + config + various backup files
        distclean	  - mrproper + remove editor backup and patch files
      
      Configuration targets:
        config	  - Update current config utilising a line-oriented program
        nconfig         - Update current config utilising a ncurses menu based program
        menuconfig	  - Update current config utilising a menu based program
        xconfig	  - Update current config utilising a Qt based front-end
        gconfig	  - Update current config utilising a GTK+ based front-end
        oldconfig	  - Update current config utilising a provided .config as base
        localmodconfig  - Update current config disabling modules not loaded
        localyesconfig  - Update current config converting local mods to core
        defconfig	  - New config with default from ARCH supplied defconfig
        savedefconfig   - Save current config as ./defconfig (minimal config)
        allnoconfig	  - New config where all options are answered with no
        allyesconfig	  - New config where all options are accepted with yes
        allmodconfig	  - New config selecting modules when possible
        alldefconfig    - New config with all symbols set to default
        randconfig	  - New config with random answer to all options
        listnewconfig   - List new options
        olddefconfig	  - Same as oldconfig but sets new symbols to their
                          default value without prompting
        kvmconfig	  - Enable additional options for kvm guest kernel support
        xenconfig       - Enable additional options for xen dom0 and guest kernel support
        tinyconfig	  - Configure the tiniest possible kernel
        testconfig	  - Run Kconfig unit tests (requires python3 and pytest)
      
      Other generic targets:
        all		  - Build all targets marked with [*]
      * vmlinux	  - Build the bare kernel
      * modules	  - Build all modules
        modules_install - Install all modules to INSTALL_MOD_PATH (default: /)
        dir/            - Build all files in dir and below
        dir/file.[ois]  - Build specified target only
        dir/file.ll     - Build the LLVM assembly file
                          (requires compiler support for LLVM assembly generation)
        dir/file.lst    - Build specified mixed source/assembly target only
                          (requires a recent binutils and recent build (System.map))
        dir/file.ko     - Build module including final link
        modules_prepare - Set up for building external modules
        tags/TAGS	  - Generate tags file for editors
        cscope	  - Generate cscope index
        gtags           - Generate GNU GLOBAL index
        kernelrelease	  - Output the release version string (use with make -s)
        kernelversion	  - Output the version stored in Makefile (use with make -s)
        image_name	  - Output the image name (use with make -s)
        headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH
                          (default: ./usr)
      
      Static analysers:
        checkstack      - Generate a list of stack hogs
        namespacecheck  - Name space analysis on compiled kernel
        versioncheck    - Sanity check on version.h usage
        includecheck    - Check for duplicate included header files
        export_report   - List the usages of all exported symbols
        headerdep       - Detect inclusion cycles in headers
        coccicheck      - Check with Coccinelle
      
      Tools:
        nsdeps          - Generate missing symbol namespace dependencies
      
      Kernel selftest:
        kselftest       - Build and run kernel selftest (run as root)
                          Build, install, and boot kernel before
                          running kselftest on it
        kselftest-clean - Remove all generated kselftest files
        kselftest-merge - Merge all the config dependencies of kselftest to existing
                          .config.
      
      Userspace tools targets:
        use "make tools/help"
        or  "cd tools; make help"
      
      Kernel packaging:
        rpm-pkg             - Build both source and binary RPM kernel packages
        binrpm-pkg          - Build only the binary kernel RPM package
        deb-pkg             - Build both source and binary deb kernel packages
        bindeb-pkg          - Build only the binary kernel deb package
        snap-pkg            - Build only the binary kernel snap package (will connect to external hosts)
        tar-pkg             - Build the kernel as an uncompressed tarball
        targz-pkg           - Build the kernel as a gzip compressed tarball
        tarbz2-pkg          - Build the kernel as a bzip2 compressed tarball
        tarxz-pkg           - Build the kernel as a xz compressed tarball
        perf-tar-src-pkg    - Build perf-5.4.70.tar source tarball
        perf-targz-src-pkg  - Build perf-5.4.70.tar.gz source tarball
        perf-tarbz2-src-pkg - Build perf-5.4.70.tar.bz2 source tarball
        perf-tarxz-src-pkg  - Build perf-5.4.70.tar.xz source tarball
      
      Documentation targets:
       Linux kernel internal documentation in different formats from ReST:
        htmldocs        - HTML
        latexdocs       - LaTeX
        pdfdocs         - PDF
        epubdocs        - EPUB
        xmldocs         - XML
        linkcheckdocs   - check for broken external links (will connect to external hosts)
        refcheckdocs    - check for references to non-existing files under Documentation
        cleandocs       - clean all generated files
      
        make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2
        valid values for SPHINXDIRS are: 
      
        make SPHINX_CONF={conf-file} [target] use *additional* sphinx-build
        configuration. This is e.g. useful to build with nit-picking config.
      
        Default location for the generated documents is Documentation/output
      
      Architecture specific targets (x86):
      * bzImage      - Compressed kernel image (arch/x86/boot/bzImage)
        install      - Install kernel using
                        (your) ~/bin/installkernel or
                        (distribution) /sbin/installkernel or
                        install to $(INSTALL_PATH) and run lilo
        fdimage      - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
        fdimage144   - Create 1.4MB boot floppy image (arch/x86/boot/fdimage)
        fdimage288   - Create 2.8MB boot floppy image (arch/x86/boot/fdimage)
        isoimage     - Create a boot CD-ROM image (arch/x86/boot/image.iso)
                        bzdisk/fdimage*/isoimage also accept:
                        FDARGS="..."  arguments for the booted kernel
                        FDINITRD=file initrd for the booted kernel
      
        i386_defconfig           - Build for i386
        x86_64_defconfig         - Build for x86_64
      
        make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build
        make V=2   [targets] 2 => give reason for rebuild of target
        make O=dir [targets] Locate all output files in "dir", including .config
        make C=1   [targets] Check re-compiled c source with $CHECK (sparse by default)
        make C=2   [targets] Force check of all c source with $CHECK
        make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections
        make W=n   [targets] Enable extra build checks, n=1,2,3 where
      		1: warnings which may be relevant and do not occur too often
      		2: warnings which occur quite often but may still be relevant
      		3: more obscure warnings, can most likely be ignored
      		Multiple levels can be combined with W=12 or W=123
      
      Execute "make" or "make all" to build all targets marked with [*] 
      For further info see the ./README file
      
      
    2. nproc命令

      $ nproc --help
       用法:nproc [选项]...
       打印当前进程可用的处理器数,
       此数目可能小于实际工作数
         --all      打印所拥有的处理器数目
         --ignore=N  可能的话,排除 N 个处理单元
         --help		显示此帮助信息并退出
         --version		显示版本信息并退出
      
    3. openssl/bio.h错误

        DTC     arch/arm/boot/dts/imx6dl-gw560x.dtb
         HOSTCC  scripts/extract-cert
       scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: 没有那个文件或目录
          21 | #include <openssl/bio.h>
             |          ^~~~~~~~~~~~~~~
       compilation terminated.
       make[1]: *** [scripts/Makefile.host:107:scripts/extract-cert] 错误 1
       make: *** [Makefile:1123:scripts] 错误 2
       

      解决方法:

      缺少相关依赖库,安装即可

      sudo apt install libssl-dev
      

四、移植

参考NXP官方imx6ull-14x14-evk开发板移植

4.1、源码管理

  1. 安装VScode

  2. 打开VScode,然后选择文件->打开文件夹...选择linux源码文件夹

  3. 在源码根目录创建文件夹.vscode,然后选择文件->将工作区另存为...保存文件名linux.code-workspace在.vscode文件夹下,文件内容如下:

    {
    	"folders": [
    		{
    			"path": ".."
    		}
    	],
    	
    	"settings": {
    		"files.exclude": {
    			"**/.git": true,
    			"**/.svn": true,
    			"**/.hg": true,
    			"**/CVS": true,
    			"**/.DS_Store": true,
    			"**/Thumbs.db": true,
    
    			"arch/[!a]*": true,
    			"arch/a[!r]*": true,
    			"arch/ar[!m]*": true,
    			"arch/arm64": true,
    			"arch/arm/mach-[!i]*": true,
    			"arch/arm/mach-i[!m]*": true,
    			"arch/arm/configs/[!i]*": true,
    			"arch/arm/configs/i[!m]*": true,
    			"arch/arm/configs/im[!x]*": true,
    			"arch/arm/boot/dts/.*": true,
    			"arch/arm/boot/dts/[!i]*.dt*": true,
    			"arch/arm/boot/dts/i[!m]*.dt*": true,
    			"arch/arm/boot/dts/im[!x]*.dt*": true,
    			"arch/arm/boot/dts/imx[!6]*.dt*": true,
    			"arch/arm/boot/dts/imx6[!u]*.dt*": true,
    		},
    
    		"search.exclude": {
    			"**/node_modules": true,
    			"**/bower_components": true,
    			"**/*.code-search": true,
    
    			"arch/[!a]*": true,
    			"arch/a[!r]*": true,
    			"arch/ar[!m]*": true,
    			"arch/arm64": true,
    			"arch/arm/mach-[!i]*": true,
    			"arch/arm/mach-i[!m]*": true,
    			"arch/arm/configs/[!i]*": true,
    			"arch/arm/configs/i[!m]*": true,
    			"arch/arm/configs/im[!x]*": true,
    			"arch/arm/boot/dts/.*": true,
    			"arch/arm/boot/dts/[!i]*.dt*": true,
    			"arch/arm/boot/dts/i[!m]*.dt*": true,
    			"arch/arm/boot/dts/im[!x]*.dt*": true,
    			"arch/arm/boot/dts/imx[!6]*.dt*": true,
    			"arch/arm/boot/dts/imx6[!u]*.dt*": true,
    		}
    	}
    }
    

    该文件"settings"内容用来排除部分用不到的文件,以便查阅代码。

4.2、添加文件

  1. imx6ull-14x14-topeet-emmc.dts

    cp arch/arm/boot/dts/imx6ull-14x14-evk-emmc.dts arch/arm/boot/dts/imx6ull-14x14-topeet-emmc.dts
    
  2. imx6ull-14x14-topeet.dts

    cp arch/arm/boot/dts/imx6ull-14x14-evk.dts arch/arm/boot/dts/imx6ull-14x14-topeet.dts
    
  3. imx6ul-14x14-topeet.dtsi

    cp arch/arm/boot/dts/imx6ul-14x14-evk.dtsi arch/arm/boot/dts/imx6ul-14x14-topeet.dtsi
    

4.3、修改文件

  1. 设备树

    参考IMX6ULL-移植uboot-imx_v2020.04_5.4.70_2.3.0文章的4.3.4节内容

    补充:

    imx6ul-14x14-topeet.dtsi文件ov5640节点修改pwn-gpiosrst-gpios为自己开发板所使用的引脚(官方evk开发板使用74lv595芯片控制):

    	ov5640: ov5640@3c {
    		compatible = "ovti,ov5640";
    		reg = <0x3c>;
    		pinctrl-names = "default";
    		pinctrl-0 = <&pinctrl_csi1>;
    		clocks = <&clks IMX6UL_CLK_CSI>;
    		clock-names = "csi_mclk";
    		/*
    		pwn-gpios = <&gpio_spi 6 1>;
    		rst-gpios = <&gpio_spi 5 0>;
    		*/
    		pwn-gpios = <&gpio1 4 1>;
    		rst-gpios = <&gpio1 2 0>;
    		csi_id = <0>;
    		mclk = <24000000>;
    		mclk_source = <0>;
    		status = "disabled";
    		port {
    			ov5640_ep: endpoint {
    				remote-endpoint = <&csi1_ep>;
    			};
    		};
    	};
    
  2. arch/arm/boot/dts/Makefile文件添加imx6ull-14x14-topeet-emmc.dtb,如下

    dtb-$(CONFIG_SOC_IMX6UL) += \
    	imx6ul-14x14-evk.dtb \
    	imx6ul-14x14-evk-csi.dtb \
    	imx6ul-14x14-evk-emmc.dtb \
    	imx6ul-14x14-evk-btwifi.dtb \
    	imx6ul-14x14-evk-btwifi-oob.dtb \
    	imx6ul-14x14-evk-ecspi-slave.dtb \
    	imx6ul-14x14-evk-ecspi.dtb \
    	imx6ul-14x14-evk-gpmi-weim.dtb \
    	imx6ul-9x9-evk.dtb \
    	imx6ul-9x9-evk-ldo.dtb \
    	imx6ul-9x9-evk-btwifi.dtb \
    	imx6ul-9x9-evk-btwifi-oob.dtb \
    	imx6ul-ccimx6ulsbcexpress.dtb \
    	imx6ul-ccimx6ulsbcpro.dtb \
    	imx6ul-geam.dtb \
    	imx6ul-isiot-emmc.dtb \
    	imx6ul-isiot-nand.dtb \
    	imx6ul-kontron-n6310-s.dtb \
    	imx6ul-kontron-n6310-s-43.dtb \
    	imx6ul-liteboard.dtb \
    	imx6ul-opos6uldev.dtb \
    	imx6ul-pico-hobbit.dtb \
    	imx6ul-pico-pi.dtb \
    	imx6ul-phytec-segin-ff-rdk-nand.dtb \
    	imx6ul-tx6ul-0010.dtb \
    	imx6ul-tx6ul-0011.dtb \
    	imx6ul-tx6ul-mainboard.dtb \
    	imx6ull-14x14-evk.dtb \
    	imx6ull-14x14-evk-emmc.dtb \
    	imx6ull-14x14-topeet-emmc.dtb \
    	imx6ull-14x14-evk-btwifi.dtb \
    	imx6ull-14x14-evk-btwifi-oob.dtb \
    	imx6ull-14x14-evk-gpmi-weim.dtb \
    	imx6ull-9x9-evk.dtb \
    	imx6ull-9x9-evk-ldo.dtb \
    	imx6ull-9x9-evk-btwifi.dtb \
    	imx6ull-9x9-evk-btwifi-oob.dtb \
    	imx6ull-colibri-eval-v3.dtb \
    	imx6ull-colibri-wifi-eval-v3.dtb \
    	imx6ull-phytec-segin-ff-rdk-nand.dtb \
    	imx6ull-phytec-segin-ff-rdk-emmc.dtb \
    	imx6ull-phytec-segin-lc-rdk-nand.dtb \
    	imx6ulz-14x14-evk.dtb \
    	imx6ulz-14x14-evk-btwifi.dtb \
    	imx6ulz-14x14-evk-gpmi-weim.dtb \
    	imx6ulz-14x14-evk-emmc.dtb
    

修改完成后执行./make.sh等待编译完成。编译完成后在arch/arm/boot/目录下生成内核镜像文件zImage,在目录arch/arm/boot/dts/下生成设备树二进制文件imx6ull-14x14-topeet-emmc.dtb

五、验证

5.1、SD卡方式

  1. 查看SD卡挂载在系统中的名称:cat /proc/partitions,我的是sdb,包含两个分区sdb1sdb2

    $ cat /proc/partitions
    major minor  #blocks  name
    
       7        0          4 loop0
       7        1     101828 loop1
       7        2     101824 loop2
       7        3      56772 loop3
       7        4      63252 loop4
       7        5      56768 loop5
       7        6      63316 loop6
       7        7     166776 loop7
      11        0    1048575 sr0
       8        0  104857600 sda
       8        1   83884032 sda1
       7        8     224248 loop8
       7        9     224256 loop9
       7       10     247156 loop10
       7       11       2544 loop11
       7       12     168712 loop12
       7       13        276 loop13
       7       14        548 loop14
       7       15       2540 loop15
       7       16     248160 loop16
       7       17        548 loop17
       7       18       2560 loop18
       7       19        704 loop19
       7       20      52180 loop20
       7       21      66776 loop21
       7       22       2288 loop22
       7       23      66660 loop23
       8       16   30578688 sdb
       8       17    1048576 sdb1
       8       18   29512704 sdb2
    
  2. 使用fdisk工具对SD卡进行格式化和分区:sudo fdisk /dev/sdx

    注意:在使用fdisk工具前先将设备卸载:sudo umount /dev/sdx

    $ sudo fdisk /dev/sdb
    
    欢迎使用 fdisk (util-linux 2.34)。
    更改将停留在内存中,直到您决定将更改写入磁盘。
    使用写入命令前请三思。
    
    
    命令(输入 m 获取帮助): m
    
    帮助:
    
      DOS (MBR)
       a   开关 可启动 标志
       b   编辑嵌套的 BSD 磁盘标签
       c   开关 dos 兼容性标志
    
      常规
       d   删除分区
       F   列出未分区的空闲区
       l   列出已知分区类型
       n   添加新分区
       p   打印分区表
       t   更改分区类型
       v   检查分区表
       i   打印某个分区的相关信息
    
      杂项
       m   打印此菜单
       u   更改 显示/记录 单位
       x   更多功能(仅限专业人员)
    
      脚本
       I   从 sfdisk 脚本文件加载磁盘布局
       O   将磁盘布局转储为 sfdisk 脚本文件
    
      保存并退出
       w   将分区表写入磁盘并退出
       q   退出而不保存更改
    
      新建空磁盘标签
       g   新建一份 GPT 分区表
       G   新建一份空 GPT (IRIX) 分区表
       o   新建一份的空 DOS 分区表
       s   新建一份空 Sun 分区表
    

    格式化SD卡:

    命令(输入 m 获取帮助): d
    分区号 (1,2, 默认  2): 1
    
    分区 1 已删除。
    
    命令(输入 m 获取帮助): d
    已选择分区 2
    分区 2 已删除。
    
    命令(输入 m 获取帮助): d
    还没有定义分区!
    
    命令(输入 m 获取帮助): 
    

    SD卡重新分区:

    分区如下:

    • 前面4M空间留给uboot
    • uboot空间之后建立分区1给内核和设备树
    • 分区一之后建立分区2给根文件系统
    命令(输入 m 获取帮助): n
    分区类型
       p   主分区 (0个主分区,0个扩展分区,4空闲)
       e   扩展分区 (逻辑分区容器)
    选择 (默认 p): 
    
    将使用默认回应 p。
    分区号 (1-4, 默认  1): 
    第一个扇区 (2048-61157375, 默认 2048): 8192
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (8192-61157375, 默认 61157375): 2105344
    
    创建了一个新分区 1,类型为“Linux”,大小为 1 GiB。
    
    命令(输入 m 获取帮助): n
    分区类型
       p   主分区 (1个主分区,0个扩展分区,3空闲)
       e   扩展分区 (逻辑分区容器)
    选择 (默认 p): 
    
    将使用默认回应 p。
    分区号 (2-4, 默认  2): 
    第一个扇区 (2048-61157375, 默认 2048): 2105345
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (2105345-61157375, 默认 61157375): 
    
    创建了一个新分区 2,类型为“Linux”,大小为 28.2 GiB。
    

    查看SD卡分区情况

    命令(输入 m 获取帮助): p
    Disk /dev/sdb:29.17 GiB,31312576512 字节,61157376 个扇区
    Disk model: Multi-Card      
    单元:扇区 / 1 * 512 = 512 字节
    扇区大小(逻辑/物理):512 字节 / 512 字节
    I/O 大小(最小/最佳):512 字节 / 512 字节
    磁盘标签类型:dos
    磁盘标识符:0x00000000
    
    设备       启动    起点     末尾     扇区  大小 Id 类型
    /dev/sdb1          8192  2105344  2097153    1G 83 Linux
    /dev/sdb2       2105345 61157375 59052031 28.2G 83 Linux
    

    保存分区

    命令(输入 m 获取帮助): w
    分区表已调整。
    正在同步磁盘。
    
  3. uboot写入SD卡

    $ sudo dd if=u-boot-dtb.imx of=/dev/sdb bs=1k seek=1 conv=fsync
    记录了519+0 的读入
    记录了519+0 的写出
    531456字节(531 kB,519 KiB)已复制,0.239474 s,2.2 MB/s
    
  4. 将内核镜像和设备树文件写入SD卡

    格式化分区1为VFAT格式:sudo mkfs.vfat /dev/sdx1

    $ sudo umount /dev/sdb1
    $ sudo mkfs.vfat /dev/sdb1
    

    挂载分区并将文件写入分区:

    $ mkdir mountpoint
    $ sudo mount /dev/sdb1 mountpoint
    $ sudo cp kernel/linux-imx_5.4.70_2.3.0/arch/arm/boot/zImage mountpoint/
    $ sudo cp kernel/linux-imx_5.4.70_2.3.0/arch/arm/boot/dts/imx6ull-14x14-topeet-emmc.dtb mountpoint/
    $ sudo umount mountpoint
    
  5. 从SD卡启动并进入uboot模式

    # uboot模式下执行如下命令设置启动命令,从SD卡加载内核镜像和设备树
    setenv bootcmd 'fatload mmc 0:1 80800000 zImage;fatload mmc 0:1 83000000 imx6ull-14x14-topeet-emmc.dtb;bootz 80800000 - 83000000'
    # 保存
    saveenv
    # 重新启动
    reset
    

重新启动然后在经过Uboot读秒之后可以看到Linux内核的启动信息Starting kernel ...

最后会报根文件系统无法挂载的错误信息,因为此时还没有可挂载根文件系统:

[    2.799286] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    2.807567] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

补充:Linux系统dd命令使用说明

$ dd --help
用法:dd [操作数] ...
 或:dd 选项
复制文件,依照指定操作数转换并格式化。

  bs=字节数      一次读写的比特数(默认:512);
                 会覆盖 ibs 和 obs 选项
  cbs=字节数     一次转换的字节数
  conv=CONVS     依照每个逗号分割的符号列表转换文件
  count=块数     只将复制指定数量的输入块
  ibs=字节数     一次读取的字节数(默认:512)
  if=文件         从指定文件而非标准输入来进行读取
  iflag=标志      按照以逗号分隔的符号列表指定的方式读取
  obs=字节数      一次写入指定字节数(默认:512)
  of=文件         写入到指定文件而非标准输出
  oflag=标志      按照以逗号分隔的符号列表指定的方式写入
  seek=块数       在输出开始处跳过指定的 obs 大小的块数
  skip=块数       在输入开始处跳过指定的 ibs 大小的块数
  status=等级     要输出到标准错误的信息等级;
                  'none' 将仅输出错误信息,
                  'noxfer' 将不输出最终传输统计信息,
                  'progress' 将显示周期性的传输统计信息

N and BYTES may be followed by the following multiplicative suffixes:
c =1, w =2, b =512, kB =1000, K =1024, MB =1000*1000, M =1024*1024, xM =M,
GB =1000*1000*1000, G =1024*1024*1024, and so on for T, P, E, Z, Y.

Each CONV symbol may be:

  ascii     from EBCDIC to ASCII
  ebcdic    from ASCII to EBCDIC
  ibm       from ASCII to alternate EBCDIC
  block     pad newline-terminated records with spaces to cbs-size
  unblock   replace trailing spaces in cbs-size records with newline
  lcase     change upper case to lower case
  ucase     change lower case to upper case
  sparse    try to seek rather than write the output for NUL input blocks
  swab      swap every pair of input bytes
  sync      pad every input block with NULs to ibs-size; when used
            with block or unblock, pad with spaces rather than NULs
  excl      如果输出文件已存在则认为操作失败
  nocreat   不要创建输出文件
  notrunc   不要截断输出文件
  noerror   读取数据发生错误后仍然继续
  fdatasync  结束前将输出文件数据物理上写入磁盘
  fsync     与上者类似,但也将元数据一同写入

FLAG 符号可以是:

  append	追加模式(仅对输出有意义;隐含了conv=notrunc)
  direct    使用直接I/O 存取模式
  directory  除非是目录,否则操作失败
  dsync     使用同步 I/O 存取模式
  sync      与上者类似,但同时也对元数据生效
  fullblock	为输入积累完整块(仅iflag)
  nonblock	使用无阻塞I/O 存取模式
  noatime   不更新访问时间
  nocache   请求不使用缓存。参见 oflag=sync
  noctty	不根据文件指派控制终端
  nofollow  不跟随链接文件
  count_bytes  把 'count=N' 看作字节计数(仅 iflag)
  skip_bytes  把 'skip=N' 看作字节计数(仅 iflag)
  seek_bytes  把 'seek=N' 看作字节计数(仅 oflag)

向正在运行的 'dd' 进程发送 USR1 信号可以令其向标准错误输出 I/O
统计数据并继续进行复制。

选项有:

      --help		显示此帮助信息并退出
      --version		显示版本信息并退出

GNU coreutils 在线帮助:<https://www.gnu.org/software/coreutils/>
请向 <http://translationproject.org/team/zh_CN.html> 报告 dd 的翻译错误
完整文档请见:<https://www.gnu.org/software/coreutils/dd>
或者在本地使用:info '(coreutils) dd invocation'

5.2、TFTP&NFS方式

见《开发板直连电脑搭建NFS&TFTP环境》



这篇关于IMX6ULL - 移植linux-imx_5.4.70_2.3.0的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程