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