1/* 2 * Copyright (C) 2002 Eric Biederman 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; version 2 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA 16 * 17 */ 18 19#ifndef ELF_BOOT_H 20#define ELF_BOOT_H 21 22#include <types.h> 23 24/* This defines the structure of a table of parameters useful for ELF 25 * bootable images. These parameters are all passed and generated 26 * by the bootloader to the booted image. For simplicity and 27 * consistency the Elf Note format is reused. 28 * 29 * All of the information must be Position Independent Data. 30 * That is it must be safe to relocate the whole ELF boot parameter 31 * block without changing the meaning or correctnes of the data. 32 * Additionally it must be safe to permute the order of the ELF notes 33 * to any possible permutation without changing the meaning or correctness 34 * of the data. 35 * 36 */ 37 38#define ELF_HEAD_SIZE (8*1024) 39#define ELF_BOOT_MAGIC 0x0E1FB007 40 41typedef u16 Elf_Half; 42typedef u32 Elf_Word; 43typedef u64 Elf_Xword; 44 45typedef struct 46{ 47 Elf_Word b_signature; /* "0x0E1FB007" */ 48 Elf_Word b_size; 49 Elf_Half b_checksum; 50 Elf_Half b_records; 51} Elf_Bhdr; 52 53typedef struct 54{ 55 Elf_Word n_namesz; /* Length of the note's name. */ 56 Elf_Word n_descsz; /* Length of the note's descriptor. */ 57 Elf_Word n_type; /* Type of the note. */ 58} Elf_Nhdr; 59 60 61/* For standard notes n_namesz must be zero */ 62/* All of the following standard note types provide a single null 63 * terminated string in the descriptor. 64 */ 65#define EBN_FIRMWARE_TYPE 0x00000001 66/* On platforms that support multiple classes of firmware this field 67 * specifies the class of firmware you are loaded under. 68 */ 69#define EBN_BOOTLOADER_NAME 0x00000002 70/* This specifies just the name of the bootloader for easy comparison */ 71#define EBN_BOOTLOADER_VERSION 0x00000003 72/* This specifies the version of the bootlader */ 73#define EBN_COMMAND_LINE 0x00000004 74/* This specifies a command line that can be set by user interaction, 75 * and is provided as a free form string to the loaded image. 76 */ 77 78 79/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */ 80 81#define ELF_NOTE_BOOT "ELFBoot" 82 83#define EIN_PROGRAM_NAME 0x00000001 84/* The program in this ELF file */ 85#define EIN_PROGRAM_VERSION 0x00000002 86/* The version of the program in this ELF file */ 87#define EIN_PROGRAM_CHECKSUM 0x00000003 88/* ip style checksum of the memory image. */ 89 90 91/* Linux image notes for booting... The name for all of these is Linux */ 92 93#define LINUX_NOTE_BOOT "Linux" 94 95#define LIN_COMMAND_LINE 0x00000001 96/* The command line to pass to the loaded kernel. */ 97#define LIN_ROOT_DEV 0x00000002 98/* The root dev to pass to the loaded kernel. */ 99#define LIN_RAMDISK_FLAGS 0x00000003 100/* Various old ramdisk flags */ 101#define LIN_INITRD_START 0x00000004 102/* Start of the ramdisk in bytes */ 103#define LIN_INITRD_SIZE 0x00000005 104/* Size of the ramdisk in bytes */ 105 106#endif /* ELF_BOOT_H */ 107

