Home | History | Annotate | Line # | Download | only in mkubootimage
      1 /* $NetBSD: uboot.h,v 1.9 2024/05/21 03:54:31 gutteridge Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2010 Jared D. McNeill <jmcneill (at) invisible.ca>
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. The name of the author may not be used to endorse or promote products
     13  *    derived from this software without specific prior written permission.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     20  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     21  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     22  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     23  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25  * SUCH DAMAGE.
     26  */
     27 
     28 #ifndef _HAVE_UBOOT_H
     29 #define _HAVE_UBOOT_H
     30 
     31 enum uboot_image_os {
     32 	IH_OS_UNKNOWN = 0,
     33 	IH_OS_OPENBSD = 1,
     34 	IH_OS_NETBSD = 2,
     35 	IH_OS_FREEBSD = 3,
     36 	IH_OS_LINUX = 5
     37 };
     38 
     39 enum uboot_image_arch {
     40 	IH_ARCH_UNKNOWN = 0,
     41 	IH_ARCH_ARM = 2,
     42 	IH_ARCH_I386 = 3,
     43 	IH_ARCH_MIPS = 5,
     44 	IH_ARCH_MIPS64 = 6,
     45 	IH_ARCH_PPC = 7,
     46 	IH_ARCH_SH = 9,
     47 	IH_ARCH_OPENRISC = 21,
     48 	IH_ARCH_ARM64 = 22,
     49 	IH_ARCH_RISCV = 26
     50 };
     51 
     52 enum uboot_image_type {
     53 	IH_TYPE_UNKNOWN = 0,
     54 	IH_TYPE_STANDALONE = 1,
     55 	IH_TYPE_KERNEL = 2,
     56 	IH_TYPE_RAMDISK = 3,
     57 	IH_TYPE_SCRIPT = 6,
     58 	IH_TYPE_FILESYSTEM = 7,
     59 	IH_TYPE_KERNEL_NOLOAD = 14,
     60 };
     61 
     62 enum uboot_image_comp {
     63 	IH_COMP_NONE = 0,
     64 	IH_COMP_GZIP = 1,
     65 	IH_COMP_BZIP2 = 2,
     66 	IH_COMP_LZMA = 3,
     67 	IH_COMP_LZO = 4,
     68 };
     69 
     70 #define IH_MAGIC	0x27051956
     71 #define IH_NMLEN	32
     72 
     73 struct uboot_image_header {
     74 	uint32_t	ih_magic;
     75 	uint32_t	ih_hcrc;
     76 	uint32_t	ih_time;
     77 	uint32_t	ih_size;
     78 	uint32_t	ih_load;
     79 	uint32_t	ih_ep;
     80 	uint32_t	ih_dcrc;
     81 	uint8_t		ih_os;
     82 	uint8_t		ih_arch;
     83 	uint8_t		ih_type;
     84 	uint8_t		ih_comp;
     85 	uint8_t		ih_name[IH_NMLEN];
     86 };
     87 
     88 #endif /* !_HAVE_UBOOT_H */
     89