| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* |
| 3 | * *** IMPORTANT *** |
| 4 | * This file is not only included from C-code but also from devicetree source |
| 5 | * files. As such this file MUST only contain comments and defines. |
| 6 | * |
| 7 | * Based on image.h from U-Boot which is |
| 8 | * (C) Copyright 2008 Semihalf |
| 9 | * (C) Copyright 2000-2005 Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 10 | */ |
| 11 | |
| 12 | #ifndef __UIMAGE_H__ |
| 13 | #define __UIMAGE_H__ |
| 14 | |
| 15 | /* |
| 16 | * Operating System Codes |
| 17 | * |
| 18 | * The following are exposed to uImage header. |
| 19 | * New IDs *MUST* be appended at the end of the list and *NEVER* |
| 20 | * inserted for backward compatibility. |
| 21 | */ |
| 22 | #define IH_OS_INVALID 0 /* Invalid OS */ |
| 23 | #define IH_OS_OPENBSD 1 /* OpenBSD */ |
| 24 | #define IH_OS_NETBSD 2 /* NetBSD */ |
| 25 | #define IH_OS_FREEBSD 3 /* FreeBSD */ |
| 26 | #define IH_OS_4_4BSD 4 /* 4.4BSD */ |
| 27 | #define IH_OS_LINUX 5 /* Linux */ |
| 28 | #define IH_OS_SVR4 6 /* SVR4 */ |
| 29 | #define IH_OS_ESIX 7 /* Esix */ |
| 30 | #define IH_OS_SOLARIS 8 /* Solaris */ |
| 31 | #define IH_OS_IRIX 9 /* Irix */ |
| 32 | #define IH_OS_SCO 10 /* SCO */ |
| 33 | #define IH_OS_DELL 11 /* Dell */ |
| 34 | #define IH_OS_NCR 12 /* NCR */ |
| 35 | #define IH_OS_LYNXOS 13 /* LynxOS */ |
| 36 | #define IH_OS_VXWORKS 14 /* VxWorks */ |
| 37 | #define IH_OS_PSOS 15 /* pSOS */ |
| 38 | #define IH_OS_QNX 16 /* QNX */ |
| 39 | #define IH_OS_U_BOOT 17 /* Firmware */ |
| 40 | #define IH_OS_RTEMS 18 /* RTEMS */ |
| 41 | #define IH_OS_ARTOS 19 /* ARTOS */ |
| 42 | #define IH_OS_UNITY 20 /* Unity OS */ |
| 43 | #define IH_OS_INTEGRITY 21 /* INTEGRITY */ |
| 44 | #define IH_OS_OSE 22 /* OSE */ |
| 45 | #define IH_OS_PLAN9 23 /* Plan 9 */ |
| 46 | #define IH_OS_OPENRTOS 24 /* OpenRTOS */ |
| 47 | #define IH_OS_ARM_TRUSTED_FIRMWARE 25 /* ARM Trusted Firmware */ |
| 48 | #define IH_OS_TEE 26 /* Trusted Execution Environment */ |
| 49 | #define IH_OS_OPENSBI 27 /* RISC-V OpenSBI */ |
| 50 | #define IH_OS_EFI 28 /* EFI Firmware (e.g. GRUB2) */ |
| 51 | |
| 52 | /* |
| 53 | * CPU Architecture Codes (supported by Linux) |
| 54 | * |
| 55 | * The following are exposed to uImage header. |
| 56 | * New IDs *MUST* be appended at the end of the list and *NEVER* |
| 57 | * inserted for backward compatibility. |
| 58 | */ |
| 59 | #define IH_ARCH_INVALID 0 /* Invalid CPU */ |
| 60 | #define IH_ARCH_ALPHA 1 /* Alpha */ |
| 61 | #define IH_ARCH_ARM 2 /* ARM */ |
| 62 | #define IH_ARCH_I386 3 /* Intel x86 */ |
| 63 | #define IH_ARCH_IA64 4 /* IA64 */ |
| 64 | #define IH_ARCH_MIPS 5 /* MIPS */ |
| 65 | #define IH_ARCH_MIPS64 6 /* MIPS 64 Bit */ |
| 66 | #define IH_ARCH_PPC 7 /* PowerPC */ |
| 67 | #define IH_ARCH_S390 8 /* IBM S390 */ |
| 68 | #define IH_ARCH_SH 9 /* SuperH */ |
| 69 | #define IH_ARCH_SPARC 10 /* Sparc */ |
| 70 | #define IH_ARCH_SPARC64 11 /* Sparc 64 Bit */ |
| 71 | #define IH_ARCH_M68K 12 /* M68K */ |
| 72 | #define IH_ARCH_NIOS 13 /* Nios-32 */ |
| 73 | #define IH_ARCH_MICROBLAZE 14 /* MicroBlaze */ |
| 74 | #define IH_ARCH_NIOS2 15 /* Nios-II */ |
| 75 | #define IH_ARCH_BLACKFIN 16 /* Blackfin */ |
| 76 | #define IH_ARCH_AVR32 17 /* AVR32 */ |
| 77 | #define IH_ARCH_ST200 18 /* STMicroelectronics ST200 */ |
| 78 | #define IH_ARCH_SANDBOX 19 /* Sandbox architecture (test only) */ |
| 79 | #define IH_ARCH_NDS32 20 /* ANDES Technology - NDS32 */ |
| 80 | #define IH_ARCH_OPENRISC 21 /* OpenRISC 1000 */ |
| 81 | #define IH_ARCH_ARM64 22 /* ARM64 */ |
| 82 | #define IH_ARCH_ARC 23 /* Synopsys DesignWare ARC */ |
| 83 | #define IH_ARCH_X86_64 24 /* AMD x86_64, Intel and Via */ |
| 84 | #define IH_ARCH_XTENSA 25 /* Xtensa */ |
| 85 | #define IH_ARCH_RISCV 26 /* RISC-V */ |
| 86 | |
| 87 | /* |
| 88 | * Image Types |
| 89 | * |
| 90 | * "Standalone Programs" are directly runnable in the environment |
| 91 | * provided by U-Boot; it is expected that (if they behave |
| 92 | * well) you can continue to work in U-Boot after return from |
| 93 | * the Standalone Program. |
| 94 | * "OS Kernel Images" are usually images of some Embedded OS which |
| 95 | * will take over control completely. Usually these programs |
| 96 | * will install their own set of exception handlers, device |
| 97 | * drivers, set up the MMU, etc. - this means, that you cannot |
| 98 | * expect to re-enter U-Boot except by resetting the CPU. |
| 99 | * "RAMDisk Images" are more or less just data blocks, and their |
| 100 | * parameters (address, size) are passed to an OS kernel that is |
| 101 | * being started. |
| 102 | * "Multi-File Images" contain several images, typically an OS |
| 103 | * (Linux) kernel image and one or more data images like |
| 104 | * RAMDisks. This construct is useful for instance when you want |
| 105 | * to boot over the network using BOOTP etc., where the boot |
| 106 | * server provides just a single image file, but you want to get |
| 107 | * for instance an OS kernel and a RAMDisk image. |
| 108 | * |
| 109 | * "Multi-File Images" start with a list of image sizes, each |
| 110 | * image size (in bytes) specified by an "uint32_t" in network |
| 111 | * byte order. This list is terminated by an "(uint32_t)0". |
| 112 | * Immediately after the terminating 0 follow the images, one by |
| 113 | * one, all aligned on "uint32_t" boundaries (size rounded up to |
| 114 | * a multiple of 4 bytes - except for the last file). |
| 115 | * |
| 116 | * "Firmware Images" are binary images containing firmware (like |
| 117 | * U-Boot or FPGA images) which usually will be programmed to |
| 118 | * flash memory. |
| 119 | * |
| 120 | * "Script files" are command sequences that will be executed by |
| 121 | * U-Boot's command interpreter; this feature is especially |
| 122 | * useful when you configure U-Boot to use a real shell (hush) |
| 123 | * as command interpreter (=> Shell Scripts). |
| 124 | * |
| 125 | * The following are exposed to uImage header. |
| 126 | * New IDs *MUST* be appended at the end of the list and *NEVER* |
| 127 | * inserted for backward compatibility. |
| 128 | */ |
| 129 | #define IH_TYPE_INVALID 0 /* Invalid Image */ |
| 130 | #define IH_TYPE_STANDALONE 1 /* Standalone Program */ |
| 131 | #define IH_TYPE_KERNEL 2 /* OS Kernel Image */ |
| 132 | #define IH_TYPE_RAMDISK 3 /* RAMDisk Image */ |
| 133 | #define IH_TYPE_MULTI 4 /* Multi-File Image */ |
| 134 | #define IH_TYPE_FIRMWARE 5 /* Firmware Image */ |
| 135 | #define IH_TYPE_SCRIPT 6 /* Script file */ |
| 136 | #define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ |
| 137 | #define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */ |
| 138 | #define IH_TYPE_KWBIMAGE 9 /* Kirkwood Boot Image */ |
| 139 | #define IH_TYPE_IMXIMAGE 10 /* Freescale IMXBoot Image */ |
| 140 | #define IH_TYPE_UBLIMAGE 11 /* Davinci UBL Image */ |
| 141 | #define IH_TYPE_OMAPIMAGE 12 /* TI OMAP Config Header Image */ |
| 142 | #define IH_TYPE_AISIMAGE 13 /* TI Davinci AIS Image */ |
| 143 | /* OS Kernel Image, can run from any load address */ |
| 144 | #define IH_TYPE_KERNEL_NOLOAD 14 |
| 145 | #define IH_TYPE_PBLIMAGE 15 /* Freescale PBL Boot Image */ |
| 146 | #define IH_TYPE_MXSIMAGE 16 /* Freescale MXSBoot Image */ |
| 147 | #define IH_TYPE_GPIMAGE 17 /* TI Keystone GPHeader Image */ |
| 148 | #define IH_TYPE_ATMELIMAGE 18 /* ATMEL ROM bootable Image */ |
| 149 | #define IH_TYPE_SOCFPGAIMAGE 19 /* Altera SOCFPGA CV/AV Preloader */ |
| 150 | #define IH_TYPE_X86_SETUP 20 /* x86 setup.bin Image */ |
| 151 | #define IH_TYPE_LPC32XXIMAGE 21 /* x86 setup.bin Image */ |
| 152 | #define IH_TYPE_LOADABLE 22 /* A list of typeless images */ |
| 153 | #define IH_TYPE_RKIMAGE 23 /* Rockchip Boot Image */ |
| 154 | #define IH_TYPE_RKSD 24 /* Rockchip SD card */ |
| 155 | #define IH_TYPE_RKSPI 25 /* Rockchip SPI image */ |
| 156 | #define IH_TYPE_ZYNQIMAGE 26 /* Xilinx Zynq Boot Image */ |
| 157 | #define IH_TYPE_ZYNQMPIMAGE 27 /* Xilinx ZynqMP Boot Image */ |
| 158 | #define IH_TYPE_ZYNQMPBIF 28 /* Xilinx ZynqMP Boot Image (bif) */ |
| 159 | #define IH_TYPE_FPGA 29 /* FPGA Image */ |
| 160 | #define IH_TYPE_VYBRIDIMAGE 30 /* VYBRID .vyb Image */ |
| 161 | #define IH_TYPE_TEE 31 /* Trusted Execution Environment OS Image */ |
| 162 | #define IH_TYPE_FIRMWARE_IVT 32 /* Firmware Image with HABv4 IVT */ |
| 163 | #define IH_TYPE_PMMC 33 /* TI Power Management Micro-Controller Firmware */ |
| 164 | #define IH_TYPE_STM32IMAGE 34 /* STMicroelectronics STM32 Image */ |
| 165 | #define IH_TYPE_SOCFPGAIMAGE_V1 35 /* Altera SOCFPGA A10 Preloader */ |
| 166 | #define IH_TYPE_MTKIMAGE 36 /* MediaTek BootROM loadable Image */ |
| 167 | #define IH_TYPE_IMX8MIMAGE 37 /* Freescale IMX8MBoot Image */ |
| 168 | #define IH_TYPE_IMX8IMAGE 38 /* Freescale IMX8Boot Image */ |
| 169 | #define IH_TYPE_COPRO 39 /* Coprocessor Image for remoteproc*/ |
| 170 | |
| 171 | |
| 172 | /* |
| 173 | * Compression Types |
| 174 | * |
| 175 | * The following are exposed to uImage header. |
| 176 | * New IDs *MUST* be appended at the end of the list and *NEVER* |
| 177 | * inserted for backward compatibility. |
| 178 | */ |
| 179 | #define IH_COMP_NONE 0 /* No Compression Used */ |
| 180 | #define IH_COMP_GZIP 1 /* gzip Compression Used */ |
| 181 | #define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ |
| 182 | #define IH_COMP_LZMA 3 /* lzma Compression Used */ |
| 183 | #define IH_COMP_LZO 4 /* lzo Compression Used */ |
| 184 | #define IH_COMP_LZ4 5 /* lz4 Compression Used */ |
| 185 | |
| 186 | |
| 187 | #define LZ4F_MAGIC 0x184D2204 /* LZ4 Magic Number */ |
| 188 | #define IH_MAGIC 0x27051956 /* Image Magic Number */ |
| 189 | #define IH_NMLEN 32 /* Image Name Length */ |
| 190 | |
| 191 | /* |
| 192 | * Magic values specific to "openwrt,uimage" partitions |
| 193 | */ |
| 194 | #define IH_MAGIC_OKLI 0x4f4b4c49 /* 'OKLI' */ |
| 195 | #define FW_EDIMAX_OFFSET 20 /* Edimax Firmware Offset */ |
| 196 | #define FW_MAGIC_EDIMAX 0x43535953 /* Edimax Firmware Magic Number */ |
| 197 | |
| 198 | #endif /* __UIMAGE_H__ */ |