Statistics
| Branch: | Revision:

root / uboot_image.h @ 8c5e95d8

History | View | Annotate | Download (6 kB)

1 1c7b3754 pbrook
/*
2 1c7b3754 pbrook
 * (C) Copyright 2000-2005
3 1c7b3754 pbrook
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 1c7b3754 pbrook
 *
5 1c7b3754 pbrook
 * See file CREDITS for list of people who contributed to this
6 1c7b3754 pbrook
 * project.
7 1c7b3754 pbrook
 *
8 1c7b3754 pbrook
 * This program is free software; you can redistribute it and/or
9 1c7b3754 pbrook
 * modify it under the terms of the GNU General Public License as
10 1c7b3754 pbrook
 * published by the Free Software Foundation; either version 2 of
11 1c7b3754 pbrook
 * the License, or (at your option) any later version.
12 1c7b3754 pbrook
 *
13 1c7b3754 pbrook
 * This program is distributed in the hope that it will be useful,
14 1c7b3754 pbrook
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 1c7b3754 pbrook
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
16 1c7b3754 pbrook
 * GNU General Public License for more details.
17 1c7b3754 pbrook
 *
18 1c7b3754 pbrook
 * You should have received a copy of the GNU General Public License
19 1c7b3754 pbrook
 * along with this program; if not, write to the Free Software
20 1c7b3754 pbrook
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 1c7b3754 pbrook
 * MA 02111-1307 USA
22 1c7b3754 pbrook
 *
23 1c7b3754 pbrook
 ********************************************************************
24 1c7b3754 pbrook
 * NOTE: This header file defines an interface to U-Boot. Including
25 1c7b3754 pbrook
 * this (unmodified) header file in another file is considered normal
26 1c7b3754 pbrook
 * use of U-Boot, and does *not* fall under the heading of "derived
27 1c7b3754 pbrook
 * work".
28 1c7b3754 pbrook
 ********************************************************************
29 1c7b3754 pbrook
 */
30 1c7b3754 pbrook
31 1c7b3754 pbrook
#ifndef __UBOOT_IMAGE_H__
32 1c7b3754 pbrook
#define __UBOOT_IMAGE_H__
33 1c7b3754 pbrook
34 1c7b3754 pbrook
/*
35 1c7b3754 pbrook
 * Operating System Codes
36 1c7b3754 pbrook
 */
37 1c7b3754 pbrook
#define IH_OS_INVALID                0        /* Invalid OS        */
38 1c7b3754 pbrook
#define IH_OS_OPENBSD                1        /* OpenBSD        */
39 1c7b3754 pbrook
#define IH_OS_NETBSD                2        /* NetBSD        */
40 1c7b3754 pbrook
#define IH_OS_FREEBSD                3        /* FreeBSD        */
41 1c7b3754 pbrook
#define IH_OS_4_4BSD                4        /* 4.4BSD        */
42 1c7b3754 pbrook
#define IH_OS_LINUX                5        /* Linux        */
43 1c7b3754 pbrook
#define IH_OS_SVR4                6        /* SVR4                */
44 1c7b3754 pbrook
#define IH_OS_ESIX                7        /* Esix                */
45 1c7b3754 pbrook
#define IH_OS_SOLARIS                8        /* Solaris        */
46 1c7b3754 pbrook
#define IH_OS_IRIX                9        /* Irix                */
47 1c7b3754 pbrook
#define IH_OS_SCO                10        /* SCO                */
48 1c7b3754 pbrook
#define IH_OS_DELL                11        /* Dell                */
49 1c7b3754 pbrook
#define IH_OS_NCR                12        /* NCR                */
50 1c7b3754 pbrook
#define IH_OS_LYNXOS                13        /* LynxOS        */
51 1c7b3754 pbrook
#define IH_OS_VXWORKS                14        /* VxWorks        */
52 1c7b3754 pbrook
#define IH_OS_PSOS                15        /* pSOS                */
53 1c7b3754 pbrook
#define IH_OS_QNX                16        /* QNX                */
54 1c7b3754 pbrook
#define IH_OS_U_BOOT                17        /* Firmware        */
55 1c7b3754 pbrook
#define IH_OS_RTEMS                18        /* RTEMS        */
56 1c7b3754 pbrook
#define IH_OS_ARTOS                19        /* ARTOS        */
57 1c7b3754 pbrook
#define IH_OS_UNITY                20        /* Unity OS        */
58 1c7b3754 pbrook
59 1c7b3754 pbrook
/*
60 1c7b3754 pbrook
 * CPU Architecture Codes (supported by Linux)
61 1c7b3754 pbrook
 */
62 1c7b3754 pbrook
#define IH_CPU_INVALID                0        /* Invalid CPU        */
63 1c7b3754 pbrook
#define IH_CPU_ALPHA                1        /* Alpha        */
64 1c7b3754 pbrook
#define IH_CPU_ARM                2        /* ARM                */
65 1c7b3754 pbrook
#define IH_CPU_I386                3        /* Intel x86        */
66 1c7b3754 pbrook
#define IH_CPU_IA64                4        /* IA64                */
67 1c7b3754 pbrook
#define IH_CPU_MIPS                5        /* MIPS                */
68 1c7b3754 pbrook
#define IH_CPU_MIPS64                6        /* MIPS         64 Bit */
69 1c7b3754 pbrook
#define IH_CPU_PPC                7        /* PowerPC        */
70 1c7b3754 pbrook
#define IH_CPU_S390                8        /* IBM S390        */
71 1c7b3754 pbrook
#define IH_CPU_SH                9        /* SuperH        */
72 1c7b3754 pbrook
#define IH_CPU_SPARC                10        /* Sparc        */
73 1c7b3754 pbrook
#define IH_CPU_SPARC64                11        /* Sparc 64 Bit */
74 1c7b3754 pbrook
#define IH_CPU_M68K                12        /* M68K                */
75 1c7b3754 pbrook
#define IH_CPU_NIOS                13        /* Nios-32        */
76 1c7b3754 pbrook
#define IH_CPU_MICROBLAZE        14        /* MicroBlaze   */
77 1c7b3754 pbrook
#define IH_CPU_NIOS2                15        /* Nios-II        */
78 1c7b3754 pbrook
#define IH_CPU_BLACKFIN                16        /* Blackfin        */
79 1c7b3754 pbrook
#define IH_CPU_AVR32                17        /* AVR32        */
80 1c7b3754 pbrook
81 1c7b3754 pbrook
/*
82 1c7b3754 pbrook
 * Image Types
83 1c7b3754 pbrook
 *
84 1c7b3754 pbrook
 * "Standalone Programs" are directly runnable in the environment
85 1c7b3754 pbrook
 *        provided by U-Boot; it is expected that (if they behave
86 1c7b3754 pbrook
 *        well) you can continue to work in U-Boot after return from
87 1c7b3754 pbrook
 *        the Standalone Program.
88 1c7b3754 pbrook
 * "OS Kernel Images" are usually images of some Embedded OS which
89 1c7b3754 pbrook
 *        will take over control completely. Usually these programs
90 1c7b3754 pbrook
 *        will install their own set of exception handlers, device
91 1c7b3754 pbrook
 *        drivers, set up the MMU, etc. - this means, that you cannot
92 1c7b3754 pbrook
 *        expect to re-enter U-Boot except by resetting the CPU.
93 1c7b3754 pbrook
 * "RAMDisk Images" are more or less just data blocks, and their
94 1c7b3754 pbrook
 *        parameters (address, size) are passed to an OS kernel that is
95 1c7b3754 pbrook
 *        being started.
96 1c7b3754 pbrook
 * "Multi-File Images" contain several images, typically an OS
97 1c7b3754 pbrook
 *        (Linux) kernel image and one or more data images like
98 1c7b3754 pbrook
 *        RAMDisks. This construct is useful for instance when you want
99 1c7b3754 pbrook
 *        to boot over the network using BOOTP etc., where the boot
100 1c7b3754 pbrook
 *        server provides just a single image file, but you want to get
101 1c7b3754 pbrook
 *        for instance an OS kernel and a RAMDisk image.
102 1c7b3754 pbrook
 *
103 1c7b3754 pbrook
 *        "Multi-File Images" start with a list of image sizes, each
104 1c7b3754 pbrook
 *        image size (in bytes) specified by an "uint32_t" in network
105 1c7b3754 pbrook
 *        byte order. This list is terminated by an "(uint32_t)0".
106 1c7b3754 pbrook
 *        Immediately after the terminating 0 follow the images, one by
107 1c7b3754 pbrook
 *        one, all aligned on "uint32_t" boundaries (size rounded up to
108 1c7b3754 pbrook
 *        a multiple of 4 bytes - except for the last file).
109 1c7b3754 pbrook
 *
110 1c7b3754 pbrook
 * "Firmware Images" are binary images containing firmware (like
111 1c7b3754 pbrook
 *        U-Boot or FPGA images) which usually will be programmed to
112 1c7b3754 pbrook
 *        flash memory.
113 1c7b3754 pbrook
 *
114 1c7b3754 pbrook
 * "Script files" are command sequences that will be executed by
115 1c7b3754 pbrook
 *        U-Boot's command interpreter; this feature is especially
116 1c7b3754 pbrook
 *        useful when you configure U-Boot to use a real shell (hush)
117 1c7b3754 pbrook
 *        as command interpreter (=> Shell Scripts).
118 1c7b3754 pbrook
 */
119 1c7b3754 pbrook
120 1c7b3754 pbrook
#define IH_TYPE_INVALID                0        /* Invalid Image                */
121 1c7b3754 pbrook
#define IH_TYPE_STANDALONE        1        /* Standalone Program                */
122 1c7b3754 pbrook
#define IH_TYPE_KERNEL                2        /* OS Kernel Image                */
123 1c7b3754 pbrook
#define IH_TYPE_RAMDISK                3        /* RAMDisk Image                */
124 1c7b3754 pbrook
#define IH_TYPE_MULTI                4        /* Multi-File Image                */
125 1c7b3754 pbrook
#define IH_TYPE_FIRMWARE        5        /* Firmware Image                */
126 1c7b3754 pbrook
#define IH_TYPE_SCRIPT                6        /* Script file                        */
127 1c7b3754 pbrook
#define IH_TYPE_FILESYSTEM        7        /* Filesystem Image (any type)        */
128 1c7b3754 pbrook
#define IH_TYPE_FLATDT                8        /* Binary Flat Device Tree Blob        */
129 1c7b3754 pbrook
130 1c7b3754 pbrook
/*
131 1c7b3754 pbrook
 * Compression Types
132 1c7b3754 pbrook
 */
133 1c7b3754 pbrook
#define IH_COMP_NONE                0        /*  No         Compression Used        */
134 1c7b3754 pbrook
#define IH_COMP_GZIP                1        /* gzip         Compression Used        */
135 1c7b3754 pbrook
#define IH_COMP_BZIP2                2        /* bzip2 Compression Used        */
136 1c7b3754 pbrook
137 1c7b3754 pbrook
#define IH_MAGIC        0x27051956        /* Image Magic Number                */
138 1c7b3754 pbrook
#define IH_NMLEN                32        /* Image Name Length                */
139 1c7b3754 pbrook
140 1c7b3754 pbrook
/*
141 1c7b3754 pbrook
 * all data in network byte order (aka natural aka bigendian)
142 1c7b3754 pbrook
 */
143 1c7b3754 pbrook
144 1c7b3754 pbrook
typedef struct uboot_image_header {
145 1c7b3754 pbrook
        uint32_t        ih_magic;        /* Image Header Magic Number        */
146 1c7b3754 pbrook
        uint32_t        ih_hcrc;        /* Image Header CRC Checksum        */
147 1c7b3754 pbrook
        uint32_t        ih_time;        /* Image Creation Timestamp        */
148 1c7b3754 pbrook
        uint32_t        ih_size;        /* Image Data Size                */
149 1c7b3754 pbrook
        uint32_t        ih_load;        /* Data         Load  Address                */
150 1c7b3754 pbrook
        uint32_t        ih_ep;                /* Entry Point Address                */
151 1c7b3754 pbrook
        uint32_t        ih_dcrc;        /* Image Data CRC Checksum        */
152 1c7b3754 pbrook
        uint8_t                ih_os;                /* Operating System                */
153 1c7b3754 pbrook
        uint8_t                ih_arch;        /* CPU architecture                */
154 1c7b3754 pbrook
        uint8_t                ih_type;        /* Image Type                        */
155 1c7b3754 pbrook
        uint8_t                ih_comp;        /* Compression Type                */
156 1c7b3754 pbrook
        uint8_t                ih_name[IH_NMLEN];        /* Image Name                */
157 1c7b3754 pbrook
} uboot_image_header_t;
158 1c7b3754 pbrook
159 1c7b3754 pbrook
160 1c7b3754 pbrook
#endif        /* __IMAGE_H__ */