1/* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: GPL-2.0-only 5 */ 6 7/* Configuration for MultiBoot, see MultiBoot Specification: 8 www.gnu.org/software/grub/manual/multiboot 9 We use a flags field of 3, indicating that we want modules loaded on page 10 boundaries and access to the memory map information. We do not set bit 16, 11 indicating that the structure of the image should be taken from its ELF 12 headers. */ 13 14#include <config.h> 15#include <machine/assembler.h> 16 17#define MULTIBOOT_HEADER_MAGIC 0x1BADB002 18 19#ifdef CONFIG_MULTIBOOT_GRAPHICS_MODE_NONE 20 #define MULTIBOOT_HEADER_FLAGS 3 21 #define MULTIBOOT_GRAPHICS_TEXT 0 22#else /* CONFIG_MULTIBOOT_GRAPHICS_MODE_NONE */ 23 #define MULTIBOOT_HEADER_FLAGS 7 24 #ifdef CONFIG_MULTIBOOT_GRAPHICS_MODE_TEXT 25 #define MULTIBOOT_GRAPHICS_TEXT 1 26 #else /* CONFIG_MULTIBOOT_GRAPHICS_MODE_TEXT */ 27 #define MULTIBOOT_GRAPHICS_TEXT 0 28 #endif /* CONFIG_MULTIBOOT_GRAPHICS_MODE_TEXT */ 29#endif /* CONFIG_MULTIBOOT_GRAPHICS_MODE_NONE */ 30 31/* These configs will be set if a graphics mode is set. if they aren't 32 * then we can put whatever in the multiboot header and it will be ignored. 33 * This seems to be the easiest way to make things compile */ 34#ifndef CONFIG_MULTIBOOT_GRAPHICS_MODE_HEIGHT 35#define CONFIG_MULTIBOOT_GRAPHICS_MODE_HEIGHT 0 36#endif 37#ifndef CONFIG_MULTIBOOT_GRAPHICS_MODE_WIDTH 38#define CONFIG_MULTIBOOT_GRAPHICS_MODE_WIDTH 0 39#endif 40#ifndef CONFIG_MULTIBOOT_GRAPHICS_MODE_DEPTH 41#define CONFIG_MULTIBOOT_GRAPHICS_MODE_DEPTH 0 42#endif 43 44.section .mbh 45#ifdef CONFIG_MULTIBOOT1_HEADER 46 /* MultiBoot header */ 47 .align 4 48 .long MULTIBOOT_HEADER_MAGIC; /*magic*/ 49 .long MULTIBOOT_HEADER_FLAGS; /*flags*/ 50 .long - MULTIBOOT_HEADER_FLAGS - MULTIBOOT_HEADER_MAGIC; /*checksum*/ 51 .long 0 /*header_addr*/ 52 .long 0 /*load_addr*/ 53 .long 0 /*load_end_addr*/ 54 .long 0 /*bss_end_addr*/ 55 .long 0 /*entry_addr*/ 56 .long MULTIBOOT_GRAPHICS_TEXT /*mode_type*/ 57 .long CONFIG_MULTIBOOT_GRAPHICS_MODE_WIDTH /*width*/ 58 .long CONFIG_MULTIBOOT_GRAPHICS_MODE_HEIGHT /*height*/ 59 .long CONFIG_MULTIBOOT_GRAPHICS_MODE_DEPTH /*depth*/ 60#endif 61#ifdef CONFIG_MULTIBOOT2_HEADER 62 .align 8 63 __mbi2_start: 64 /* magic multi-boot 2 header */ 65 .long 0xe85250d6 66 .long 0x0 67 .long (__mbi2_end - __mbi2_start) 68 .long -(0xe85250d6 + (__mbi2_end - __mbi2_start)) 69 /* end tag - type, flags, size */ 70 .word 0x0 71 .word 0x0 72 .long 0x8 73 __mbi2_end: 74#endif 75