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環境》


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM