/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
* Copyright 2017-2018 NXP
*
* SPDX-License-Identifier: GPL-2.0+
* derived from u-boot's mkimage utility
*
*/
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <sys/stat.h>
#include <getopt.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <zlib.h>
#ifndef O_BINARY
#define O_BINARY 0
#endif
#undef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
typedef struct {
uint32_t addr;
uint32_t value;
} dcd_addr_data_t;
typedef struct {
uint8_t tag;
uint16_t length;
uint8_t version;
} __attribute__((packed)) ivt_header_t;
typedef struct {
uint8_t tag;
uint16_t length;
uint8_t param;
} __attribute__((packed)) write_dcd_command_t;
#define MAX_HW_CFG_SIZE_V2 1017
struct dcd_v2_cmd {
write_dcd_command_t write_dcd_command; /*4*/
dcd_addr_data_t addr_data[MAX_HW_CFG_SIZE_V2]; /*8136*/
} __attribute__((packed));
typedef struct {
ivt_header_t header;
struct dcd_v2_cmd dcd_cmd;
uint32_t padding[1]; /* end up on an 8-byte boundary */
} dcd_v2_t;
typedef struct {
uint32_t start;
uint32_t size;
uint32_t plugin;
uint32_t padding[1];
} boot_data_t;
typedef struct {
ivt_header_t header;
uint32_t entry;
uint32_t reserved1;
uint32_t dcd_ptr;
uint32_t boot_data_ptr;
uint32_t self;
uint32_t csf;
uint32_t reserved2;
} flash_header_v2_t;
typedef struct {
flash_header_v2_t fhdr;
boot_data_t boot_data;
uint32_t alignment[4];
} imx_header_v2_t;
#define IH_MAGIC 0x27051956 /* Image Magic Number */
#define IH_NMLEN 32 /* Image Name Length */
typedef struct uimage_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 */
} uimage_header_t;
struct fdt_header {
uint32_t magic; /* magic word FDT_MAGIC */
uint32_t totalsize; /* total size of DT block */
uint32_t off_dt_struct; /* offset to structure */
uint32_t off_dt_strings; /* offset to strings */
uint32_t off_mem_rsvmap; /* offset to memory reserve map */
uint32_t version; /* format version */
uint32_t last_comp_version; /* last compatible version */
/* version 2 fields below */
uint32_t boot_cpuid_phys; /* Which physical CPU id we're
booting on */
/* version 3 fields below */
uint32_t size_dt_strings; /* size of the strings block */
/* version 17 fields below */
uint32_t size_dt_struct; /* size of the structure block */
};
/* Command tags and parameters */
#define HAB_DATA_WIDTH_BYTE 1 /* 8-bit value */
#define HAB_DATA_WIDTH_HALF 2 /* 16-bit value */
#define HAB_DATA_WIDTH_WORD 4 /* 32-bit value */
#define HAB_CMD_WRT_DAT_MSK 1 /* mask/value flag */
#define HAB_CMD_WRT_DAT_SET 2 /* set/clear flag */
#define HAB_CMD_CHK_DAT_SET 2 /* set/clear flag */
#define HAB_CMD_CHK_DAT_ANY 4 /* any/all flag */
#define HAB_CMD_WRT_DAT_FLAGS_WIDTH 5 /* flags field width */
#define HAB_CMD_WRT_DAT_FLAGS_SHIFT 3 /* flags field offset */
#define HAB_CMD_WRT_DAT_BYTES_WIDTH 3 /* bytes field width */
#define HAB_CMD_WRT_DAT_BYTES_SHIFT 0 /* bytes field offset */
#define IVT_HEADER_TAG 0xD1
#define IVT_VERSION 0x41
#define DCD_HEADER_TAG 0xD2
#define DCD_VERSION 0x41
#define DCD_WRITE_DATA_COMMAND_TAG 0xCC
#define DCD_WRITE_DATA_PARAM (HAB_DATA_WIDTH_WORD << HAB_CMD_WRT_DAT_BYTES_SHIFT) /* 0x4 */
#define DCD_WRITE_CLR_BIT_PARAM ((HAB_CMD_WRT_DAT_MSK << HAB_CMD_WRT_DAT_FLAGS_SHIFT) | (HAB_DATA_WIDTH_WORD << HAB_CMD_WRT_DAT_BYTES_SHIFT)) /* 0xC */
#define DCD_WRITE_SET_BIT_PARAM ((HAB_CMD_WRT_DAT_MSK << HAB_CMD_WRT_DAT_FLAGS_SHIFT) | (HAB_CMD_WRT_DAT_SET << HAB_CMD_WRT_DAT_FLAGS_SHIFT) | (HAB_DATA_WIDTH_WORD << HAB_CMD_WRT_DAT_BYTES_SHIFT)) /* 0x1C */
#define DCD_CHECK_DATA_COMMAND_TAG 0xCF
#define DCD_CHECK_BITS_CLR_PARAM (HAB_DATA_WIDTH_WORD << HAB_CMD_WRT_DAT_BYTES_SHIFT) /* 0x04 */
#define DCD_CHECK_BITS_SET_PARAM ((HAB_CMD_CHK_DAT_SET << HAB_CMD_WRT_DAT_FLAGS_SHIFT) | (HAB_DATA_WIDTH_WORD << HAB_CMD_WRT_DAT_BYTES_SHIFT)) /* 0x14 */
#define DCD_CHECK_ANY_BIT_CLR_PARAM ((HAB_CMD_CHK_DAT_ANY << HAB_CMD_WRT_DAT_FLAGS_SHIFT) | (HAB_DATA_WIDTH_WORD << HAB_CMD_WRT_DAT_BYTES_SHIFT)) /* 0x24 */
#define DCD_CHECK_ANY_BIT_SET_PARAM ((HAB_CMD_CHK_DAT_ANY << HAB_CMD_WRT_DAT_FLAGS_SHIFT) | (HAB_CMD_CHK_DAT_SET << HAB_CMD_WRT_DAT_FLAGS_SHIFT) | (HAB_DATA_WIDTH_WORD << HAB_CMD_WRT_DAT_BYTES_SHIFT)) /* 0x34 */
#define IVT_OFFSET_NAND (0x400)
#define IVT_OFFSET_I2C (0x400)
#define IVT_OFFSET_FLEXSPI (0x1000)
#define IVT_OFFSET_SD (0x400)
#define IVT_OFFSET_SATA (0x400)
#define IMAGE_OFFSET_SD (0x8000)
#define ROM_INITIAL_LOAD_SIZE (0x2000)
#define CSF_DATA_SIZE (0x4000)
#define INITIAL_LOAD_ADDR_SCU_ROM 0x3100e000
#define INITIAL_LOAD_ADDR_AP_ROM 0x00110000
#define INITIAL_LOAD_ADDR_FLEXSPI 0x08000000
#define IMG_AUTO_ALIGN 0x10
#define PLUGIN_IMAGE_FLAG_MASK (0x0001) /* bit 0 is plugin image indicator */
#define HDMI_IMAGE_FLAG_MASK (0x0002) /* bit 1 is HDMI image indicator */
#define HDMI_IVT_ID 0
#define PLUGIN_IVT_ID 1
#define IMAGE_IVT_ID 2
#define HDMI_FW_SIZE 0x17000 /* Use Last 0x1000 for IVT and CSF */
#define HDMI_FW_ADDR 0x32c10000
#define IH_OS_U_BOOT 17
#define IH_ARCH_ARM 2
#define IH_TYPE_FIRMWARE 5
#define IH_COMP_NONE 0
#define FDT_MAGIC 0xd00dfeed
#define CSF_SIZE 0x2000
#define DEK_BLOB_MAX_SIZE 0x60
#define ROM_V1 1
#define ROM_V2 2 /* V2 ROM for iMX8MN */
#define ALIGN(x,a) __ALIGN_MASK((x),(__typeof__(x))(a)-1, a)
#define __ALIGN_MASK(x,mask,mask2) (((x)+(mask))/(mask2)*(mask2))
#define uswap_16(x) \
((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
#define uswap_32(x) \
((((x) & 0xff000000) >> 24) | \
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#define _uswap_64(x, sfx) \
((((x) & 0xff00000000000000##sfx) >> 56) | \
(((x) & 0x00ff000000000000##sfx) >> 40) | \
(((x) & 0x0000ff0000000000##sfx) >> 24) | \
(((x) & 0x000000ff00000000##sfx) >> 8) | \
(((x) & 0x00000000ff000000##sfx) << 8) | \
(((x) & 0x0000000000ff0000##sfx) << 24) | \
(((x) & 0x000000000000ff00##sfx) << 40) | \
(((x) & 0x00000000000000ff##sfx) << 56))
#if defined(__GNUC__)
# define uswap_64(x) _uswap_64(x, ull)
#else
#error
# define uswap_64(x) _uswap_64(x, )
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define cpu_to_le16(x) (x)
# define cpu_to_le32(x) (x)
# define cpu_to_le64(x) (x)
# define le16_to_cpu(x) (x)
# define le32_to_cpu(x) (x)
# define le64_to_cpu(x) (x)
# define cpu_to_be16(x) uswap_16(x)
# define cpu_to_be32(x) uswap_32(x)
# define cpu_to_be64(x) uswap_64(x)
# define be16_to_cpu(x) uswap_16(x)
# define be32_to_cpu(x) uswap_32(x)
# define be64_to_cpu(x) uswap_64(x)
#else
#error
# define cpu_to_le16(x) uswap_16(x)
# define cpu_to_le32(x) uswap_32(x)
# define cpu_to_le64(x) uswap_64(x)
# define le16_to_cpu(x) uswap_16(x)
# define le32_to_cpu(x) uswap_32(x)
# define le64_to_cpu(x) uswap_64(x)
# define cpu_to_be16(x) (x)
# define cpu_to_be32(x) (x)
# define cpu_to_be64(x) (x)
# define be16_to_cpu(x) (x)
# define be32_to_cpu(x) (x)
# define be64_to_cpu(x) (x)
#endif
#define fdt32_to_cpu(x) be32_to_cpu(x)
#define fdt_get_header(fdt, field) \
(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
#define fdt_totalsize(fdt) (fdt_get_header(fdt, totalsize))
#define fdt_off
没有合适的资源?快使用搜索试试~ 我知道了~
GXLife-Android--Double-imx-mkimage
需积分: 5 0 下载量 186 浏览量
2022-08-08
09:56:16
上传
评论
收藏 11.96MB GZ 举报
温馨提示
共99个文件
bin:27个
mak:22个
sample:11个
GXLife-Android--Double-imx-mkimage 打包工具怕找不到
资源详情
资源评论
资源推荐
收起资源包目录
git-double-imx-mkimage--GXLife-Android.tar.gz (99个子文件)
git-double-imx-mkimage-Android
iMX8M
soc.mak 14KB
print_fit_hab.sh 2KB
mkimage_imx8.c 50KB
README 1KB
mkimage_fit_atf.sh 3KB
lib
ddr_memory_map.h 161KB
iMX8QM
bl31.bin 40KB
u-boot-hash-a72.bin 831KB
scfw_tcm.bin 185KB
m4_image.bin 31KB
uboot-old-back--A53
u-boot.bin 750KB
u-boot-spl.bin 115KB
soc.mak 13KB
u-boot-atf.bin 878KB
m4_1_image.bin 40KB
u-boot-atf-a72.bin 959KB
expand_c_define.sh 3KB
bl31-optee-a53.bin 44KB
u-boot-hash.bin 750KB
tee.bin 1.65MB
u-boot-spl-a72.bin 105KB
bl31-a72.bin 40KB
u-boot-a72.bin 831KB
tee-a72.bin 1.66MB
u-boot-atf-container-a72.img 2.6MB
A72-linux-Uboot-NXP-BACK
u-boot-spl-a72.bin 105KB
u-boot-a72.bin 659KB
scfw_tcm.bin--NXP--old 177KB
head.hash 9B
mx8qmb0-ahab-container.img 73KB
Android-5.10-tee
tee-imx8qm.bin 1.65MB
tee.bin 1.65MB
tee-a72.bin 1.66MB
mkimage_fit_atf.sh 2KB
linux-tee-back
tee.bin 2.02MB
tee-a72.bin 2.02MB
flash.bin 5.47MB
boot-spl-container.img 477KB
scripts
m4.mak 2KB
test.mak 704B
misc.mak 2KB
autobuild.mak 5KB
alias.mak 378B
android.mak 3KB
u-boot.bin 750KB
bl31-optee-a72.bin 44KB
u-boot-spl.bin 115KB
iMX8QX
soc.mak 8KB
mkimage_fit_atf.sh 2KB
scripts
m4.mak 635B
test.mak 2KB
misc.mak 2KB
autobuild.mak 7KB
alias.mak 490B
android.mak 1KB
.git
index 4KB
hooks
fsmonitor-watchman.sample 3KB
pre-push.sample 1KB
prepare-commit-msg.sample 1KB
applypatch-msg.sample 478B
pre-commit.sample 2KB
pre-receive.sample 544B
pre-applypatch.sample 424B
commit-msg.sample 896B
pre-rebase.sample 5KB
update.sample 4KB
post-update.sample 189B
config 301B
description 73B
refs
tags
heads
lf-5.10.y_2.0.0 41B
branches
logs
refs
heads
lf-5.10.y_2.0.0 187B
HEAD 173B
packed-refs 11KB
objects
info
alternates 127B
pack
info
exclude 240B
HEAD 32B
iMX8DXL
soc.mak 9KB
scripts
m4.mak 718B
test.mak 2KB
misc.mak 2KB
autobuild.mak 2KB
android.mak 1KB
mkimage_imx8 1.05MB
src
imx8qxb0.c 36KB
build_info.h 35B
mkimage_imx8.c 26KB
mkimage_common.h 12KB
README 3KB
Makefile 2KB
iMX8ULP
soc.mak 5KB
scripts
split_spl.sh 681B
fspi_header 1KB
pad_image.sh 800B
fspi_packer.sh 609B
qspi_header 5KB
gen_sit.sh 321B
sit_template 334B
dtb_check.sh 595B
COPYING 18KB
共 99 条
- 1
gxl
- 粉丝: 11
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0