Updates to produce a linuxBIOS table. Modeled on the earlier
uniform_boot work, but relocated. You need the new mkelfImage to use the elf boot format. Previous tables were updated so I could find both the start and the end of where they were written in memory. Minor p4dc6 updates, to disable some debugging code. The mkelfImage-1.9 is checked in as util/mkelfImage
This commit is contained in:
parent
d9db3cd6c4
commit
9cda94e6d2
32 changed files with 3383 additions and 117 deletions
|
|
@ -390,6 +390,11 @@ typedef Elf64_Phdr Elf_phdr;
|
|||
#endif
|
||||
|
||||
extern int elf_check_arch(Elf_ehdr *ehdr);
|
||||
extern void jmp_to_elf_entry(void *entry, void *ube);
|
||||
extern int elfboot(size_t totalram);
|
||||
extern void jmp_to_elf_entry(void *entry);
|
||||
extern int elfboot(void);
|
||||
|
||||
#define FIRMWARE_TYPE "LinuxBIOS"
|
||||
#define BOOTLOADER "elfboot"
|
||||
#define BOOTLOADER_VERSION "0.99999"
|
||||
|
||||
#endif /* elf.h */
|
||||
|
|
|
|||
89
src/include/boot/elf_boot.h
Normal file
89
src/include/boot/elf_boot.h
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#ifndef ELF_BOOT_H
|
||||
#define ELF_BOOT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* This defines the structure of a table of parameters useful for ELF
|
||||
* bootable images. These parameters are all passed and generated
|
||||
* by the bootloader to the booted image. For simplicity and
|
||||
* consistency the Elf Note format is reused.
|
||||
*
|
||||
* All of the information must be Position Independent Data.
|
||||
* That is it must be safe to relocate the whole ELF boot parameter
|
||||
* block without changing the meaning or correctnes of the data.
|
||||
* Additionally it must be safe to permute the order of the ELF notes
|
||||
* to any possible permutation without changing the meaning or correctness
|
||||
* of the data.
|
||||
*
|
||||
*/
|
||||
|
||||
#define ELF_HEAD_SIZE (8*1024)
|
||||
#define ELF_BOOT_MAGIC 0x0E1FB007
|
||||
|
||||
typedef uint16_t Elf_Half;
|
||||
typedef uint32_t Elf_Word;
|
||||
typedef uint64_t Elf_Xword;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf_Word b_signature; /* "0x0E1FB007" */
|
||||
Elf_Word b_size;
|
||||
Elf_Half b_checksum;
|
||||
Elf_Half b_records;
|
||||
} Elf_Bhdr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Elf_Word n_namesz; /* Length of the note's name. */
|
||||
Elf_Word n_descsz; /* Length of the note's descriptor. */
|
||||
Elf_Word n_type; /* Type of the note. */
|
||||
} Elf_Nhdr;
|
||||
|
||||
|
||||
/* For standard notes n_namesz must be zero */
|
||||
/* All of the following standard note types provide a single null
|
||||
* terminated string in the descriptor.
|
||||
*/
|
||||
#define EBN_FIRMWARE_TYPE 0x00000001
|
||||
/* On platforms that support multiple classes of firmware this field
|
||||
* specifies the class of firmware you are loaded under.
|
||||
*/
|
||||
#define EBN_BOOTLOADER_NAME 0x00000002
|
||||
/* This specifies just the name of the bootloader for easy comparison */
|
||||
#define EBN_BOOTLOADER_VERSION 0x00000003
|
||||
/* This specifies the version of the bootlader */
|
||||
#define EBN_COMMAND_LINE 0x00000004
|
||||
/* This specifies a command line that can be set by user interaction,
|
||||
* and is provided as a free form string to the loaded image.
|
||||
*/
|
||||
|
||||
|
||||
/* Standardized Elf image notes for booting... The name for all of these is ELFBoot */
|
||||
|
||||
#define ELF_NOTE_BOOT "ELFBoot"
|
||||
|
||||
#define EIN_PROGRAM_NAME 0x00000001
|
||||
/* The program in this ELF file */
|
||||
#define EIN_PROGRAM_VERSION 0x00000002
|
||||
/* The version of the program in this ELF file */
|
||||
#define EIN_PROGRAM_CHECKSUM 0x00000003
|
||||
/* ip style checksum of the memory image. */
|
||||
|
||||
|
||||
/* Linux image notes for booting... The name for all of these is Linux */
|
||||
|
||||
#define LINUX_NOTE_BOOT "Linux"
|
||||
|
||||
#define LIN_COMMAND_LINE 0x00000001
|
||||
/* The command line to pass to the loaded kernel. */
|
||||
#define LIN_ROOT_DEV 0x00000002
|
||||
/* The root dev to pass to the loaded kernel. */
|
||||
#define LIN_RAMDISK_FLAGS 0x00000003
|
||||
/* Various old ramdisk flags */
|
||||
#define LIN_INITRD_START 0x00000004
|
||||
/* Start of the ramdisk in bytes */
|
||||
#define LIN_INITRD_SIZE 0x00000005
|
||||
/* Size of the ramdisk in bytes */
|
||||
|
||||
|
||||
#endif /* ELF_BOOT_H */
|
||||
23
src/include/boot/linuxbios_table.h
Normal file
23
src/include/boot/linuxbios_table.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef LINUXBIOS_TABLE_H
|
||||
#define LINUXBIOS_TABLE_H
|
||||
|
||||
#include <boot/linuxbios_tables.h>
|
||||
|
||||
/* This file holds function prototypes for building the linuxbios table. */
|
||||
unsigned long write_linuxbios_table(
|
||||
unsigned long *processor_map,
|
||||
unsigned long totalram,
|
||||
unsigned long low_table_start, unsigned long low_table_end,
|
||||
unsigned long rom_table_start, unsigned long rom_table_end);
|
||||
|
||||
struct lb_header *lb_table_init(unsigned long addr);
|
||||
struct lb_record *lb_first_record(struct lb_header *header);
|
||||
struct lb_record *lb_last_record(struct lb_header *header);
|
||||
struct lb_record *lb_next_record(struct lb_record *rec);
|
||||
struct lb_record *lb_new_record(struct lb_header *header);
|
||||
struct lb_memory *lb_memory(struct lb_header *header);
|
||||
void lb_memory_range(struct lb_memory *mem,
|
||||
uint32_t type, unsigned long start, unsigned long size);
|
||||
unsigned long lb_table_fini(struct lb_header *header);
|
||||
|
||||
#endif /* LINUXBIOS_TABLE_H */
|
||||
83
src/include/boot/linuxbios_tables.h
Normal file
83
src/include/boot/linuxbios_tables.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
#ifndef LINUXBIOS_TABLES_H
|
||||
#define LINUXBIOS_TABLES_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* The linuxbios table information is for conveying information
|
||||
* from the firmware to the loaded OS image. Primarily this
|
||||
* is expected to be information that cannot be discovered by
|
||||
* other means, such as quering the hardware directly.
|
||||
*
|
||||
* All of the information should be Position Independent Data.
|
||||
* That is it should be safe to relocated any of the information
|
||||
* without it's meaning/correctnes changing. For table that
|
||||
* can reasonably be used on multiple architectures the data
|
||||
* size should be fixed. This should ease the transition between
|
||||
* 32 bit and 64 bit architectures etc.
|
||||
*
|
||||
* The completeness test for the information in this table is:
|
||||
* - Can all of the hardware be detected?
|
||||
* - Are the per motherboard constants available?
|
||||
* - Is there enough to allow a kernel to run that was written before
|
||||
* a particular motherboard is constructed? (Assuming the kernel
|
||||
* has drivers for all of the hardware but it does not have
|
||||
* assumptions on how the hardware is connected together).
|
||||
*
|
||||
* With this test it should be straight forward to determine if a
|
||||
* table entry is required or not. This should remove much of the
|
||||
* long term compatibility burden as table entries which are
|
||||
* irrelevant or have been replaced by better alternatives may be
|
||||
* dropped. Of course it is polite and expidite to include extra
|
||||
* table entries and be backwards compatible, but it is not required.
|
||||
*/
|
||||
|
||||
|
||||
struct lb_header
|
||||
{
|
||||
uint8_t signature[4]; /* LBIO */
|
||||
uint32_t header_bytes;
|
||||
uint32_t header_checksum;
|
||||
uint32_t table_bytes;
|
||||
uint32_t table_checksum;
|
||||
uint32_t table_entries;
|
||||
};
|
||||
|
||||
/* Every entry in the boot enviroment list will correspond to a boot
|
||||
* info record. Encoding both type and size. The type is obviously
|
||||
* so you can tell what it is. The size allows you to skip that
|
||||
* boot enviroment record if you don't know what it easy. This allows
|
||||
* forward compatibility with records not yet defined.
|
||||
*/
|
||||
struct lb_record {
|
||||
uint32_t tag; /* tag ID */
|
||||
uint32_t size; /* size of record (in bytes) */
|
||||
};
|
||||
|
||||
#define LB_TAG_UNUSED 0x0000
|
||||
|
||||
#define LB_TAG_MEMORY 0x0001
|
||||
|
||||
struct lb_memory_range {
|
||||
uint64_t start;
|
||||
uint64_t size;
|
||||
uint32_t type;
|
||||
#define LB_MEM_RAM 1
|
||||
#define LB_MEM_RESERVED 2
|
||||
|
||||
};
|
||||
|
||||
struct lb_memory {
|
||||
uint32_t tag;
|
||||
uint32_t size;
|
||||
struct lb_memory_range map[0];
|
||||
};
|
||||
|
||||
#define LB_TAG_HWRPB 0x0002
|
||||
struct lb_hwrpb {
|
||||
uint32_t tag;
|
||||
uint32_t size;
|
||||
uint64_t hwrpb;
|
||||
};
|
||||
|
||||
|
||||
#endif /* LINUXBIOS_TABLES_H */
|
||||
6
src/include/ip_checksum.h
Normal file
6
src/include/ip_checksum.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef IP_CHECKSUM_H
|
||||
#define IP_CHECKSUM_H
|
||||
|
||||
unsigned long compute_ip_checksum(void *addr, unsigned long length);
|
||||
|
||||
#endif /* IP_CHECKSUM_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue