mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
get rid of a directory which only contains a single file, and at the same time simplify the #includes and their hierarchies. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@313 f3766cd6-281f-0410-b1cd-43a5c92072e9
80 lines
1.6 KiB
C
80 lines
1.6 KiB
C
#include <console.h>
|
|
// #include <ip_checksum.h>
|
|
#include <elf.h>
|
|
#include <elf_boot.h>
|
|
#include <string.h>
|
|
|
|
|
|
#ifndef CMD_LINE
|
|
#define CMD_LINE ""
|
|
#endif
|
|
|
|
|
|
|
|
#define UPSZ(X) ((sizeof(X) + 3) &~3)
|
|
|
|
static struct {
|
|
Elf_Bhdr hdr;
|
|
Elf_Nhdr ft_hdr;
|
|
unsigned char ft_desc[UPSZ(FIRMWARE_TYPE)];
|
|
Elf_Nhdr bl_hdr;
|
|
unsigned char bl_desc[UPSZ(BOOTLOADER)];
|
|
Elf_Nhdr blv_hdr;
|
|
unsigned char blv_desc[UPSZ(BOOTLOADER_VERSION)];
|
|
Elf_Nhdr cmd_hdr;
|
|
unsigned char cmd_desc[UPSZ(CMD_LINE)];
|
|
} elf_boot_notes = {
|
|
.hdr = {
|
|
.b_signature = 0x0E1FB007,
|
|
.b_size = sizeof(elf_boot_notes),
|
|
.b_checksum = 0,
|
|
.b_records = 4,
|
|
},
|
|
.ft_hdr = {
|
|
.n_namesz = 0,
|
|
.n_descsz = sizeof(FIRMWARE_TYPE),
|
|
.n_type = EBN_FIRMWARE_TYPE,
|
|
},
|
|
.ft_desc = FIRMWARE_TYPE,
|
|
.bl_hdr = {
|
|
.n_namesz = 0,
|
|
.n_descsz = sizeof(BOOTLOADER),
|
|
.n_type = EBN_BOOTLOADER_NAME,
|
|
},
|
|
.bl_desc = BOOTLOADER,
|
|
.blv_hdr = {
|
|
.n_namesz = 0,
|
|
.n_descsz = sizeof(BOOTLOADER_VERSION),
|
|
.n_type = EBN_BOOTLOADER_VERSION,
|
|
},
|
|
.blv_desc = BOOTLOADER_VERSION,
|
|
.cmd_hdr = {
|
|
.n_namesz = 0,
|
|
.n_descsz = sizeof(CMD_LINE),
|
|
.n_type = EBN_COMMAND_LINE,
|
|
},
|
|
.cmd_desc = CMD_LINE,
|
|
};
|
|
|
|
|
|
int elf_check_arch(Elf_ehdr *ehdr)
|
|
{
|
|
return (
|
|
((ehdr->e_machine == EM_386) || (ehdr->e_machine == EM_486)) &&
|
|
(ehdr->e_ident[EI_CLASS] == ELFCLASS32) &&
|
|
(ehdr->e_ident[EI_DATA] == ELFDATA2LSB)
|
|
);
|
|
|
|
}
|
|
|
|
/* there used to be lots of complexity here to deal with the fact that this code ran in
|
|
* RAM. The code was awesome in its power, incomprehensible to most.
|
|
* But this code runs in ROM now, so the complexity went away
|
|
*/
|
|
void jmp_to_elf_entry(void *entry)
|
|
{
|
|
int (*v)(void) = entry;
|
|
v();
|
|
}
|
|
|
|
|