U-Boot mkimage工具使用介绍
发布时间:2021-11-25 20:00:12 所属栏目:教程 来源:互联网
导读:mkimage工具是u-boot用来制作镜像文件的工具,其源代码在u-boot源码的tools目录下:mkimage.c。我们使用bootm命令加载的内核和根文件系统,都要用这个工具加上个头。 我们首先看下这个头的结构(一共64B): typedef struct image_header { uint32_t ih_magic
mkimage工具是u-boot用来制作镜像文件的工具,其源代码在u-boot源码的tools目录下:mkimage.c。我们使用bootm命令加载的内核和根文件系统,都要用这个工具加上个头。 我们首先看下这个头的结构(一共64B): typedef struct image_header { uint32_t ih_magic; /* Image Header Magic Number */ uint32_t ih_hcrc; /* Image Header CRC Checksum */ uint32_t ih_time; /* Image Creation Timestamp */ uint32_t ih_size; /* Image Data Size */ uint32_t ih_load; /* Data Load Address */ uint32_t ih_ep; /* Entry Point Address */ uint32_t ih_dcrc; /* Image Data CRC Checksum */ uint8_t ih_os; /* Operating System */ uint8_t ih_arch; /* CPU architecture */ uint8_t ih_type; /* Image Type */ uint8_t ih_comp; /* Compression Type */ uint8_t ih_name[IH_NMLEN]; /* Image Name */ } image_header_t; 我们再看下上面哪些参数是需要我们传递给mkimage这个工具?下面是这个工具使用说明 [root@localhost linux]# mkimage Usage: mkimage -l image -l ==> list image header information mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image -A ==> set architecture to 'arch' -O ==> set operating system to 'os' -T ==> set image type to 'type' -C ==> set compression type 'comp' -a ==> set load address to 'addr' (hex) -e ==> set entry point to 'ep' (hex) -n ==> set image name to 'name' -d ==> use image data from 'datafile' -x ==> set XIP (execute in place) [root@localhost linux]# -A:CPU 架构,可选的值有: "alpha","arm","x86","ia64","m6k8","microblaze","mips","mips64","nios","nios2","ppc","s390","sh","sparc","sparc64", "blackfin","avr32"。 -O:操作系统。可选的值有: "4_4bsd","artos","esix","freebsd","irix","linux","lynxos","ncr","netbsd","openbsd","psos","qnx","rtems","sco","sloaris", "u-boot",vxworks" -T:镜像类型。可选的值有: "filesystem","firmware","firmware","kernel","multi","ramdisk","script","standalone","flat_dt" -C:镜像压缩类型。可选的值有: "none","bzip2","gzip" none为没有压缩。 -n: 镜像名称。最长32个字符。 -a:镜像加载地址(16进制) -e:镜像入口(16进制) -d:制定制作镜像的源文件。 -x是指就在此执行的意思,就是说 入口 = 加载地址+64。 (编辑:东莞站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |