Merge branch 'bare-metal-linux' into bare-metal-essentials

This commit is contained in:
Gábor Stefanik 2024-01-02 01:03:20 +01:00
commit 8fb8808a6c
5 changed files with 581 additions and 337 deletions

View file

@ -1 +1 @@
7d98c6ce71a3b45d86453d50b2bc91e651b31aac9615705bb73d09580b220997 /usr/bin/kexec-fiwix f8c754de5bd9cf5a1b36dfea25e81f7b39c4e0145e10eebafccc8cdca5be91bd /usr/bin/kexec-fiwix

View file

@ -6,7 +6,8 @@
#include "multiboot1.h" #include "multiboot1.h"
#define MULTIBOOT_MAGIC 0x2BADB002 #define MULTIBOOT_MAGIC 0x2BADB002
#define INITRD_MB 1152 #define INITRD_MB 1280
#define KEXEC_MB 256
int main() { int main() {
/* Read the kernel */ /* Read the kernel */
@ -81,11 +82,11 @@ int main() {
char *bare_metal = getenv("BARE_METAL"); char *bare_metal = getenv("BARE_METAL");
if (bare_metal != NULL && strcmp(bare_metal, "True") == 0) if (bare_metal != NULL && strcmp(bare_metal, "True") == 0)
{ {
sprintf(cmdline, "fiwix root=/dev/ram0 ramdisksize=%d initrd=fiwix.ext2 kexec_proto=linux kexec_size=280000 kexec_cmdline=\"init=/init\"", INITRD_MB * 1024); sprintf(cmdline, "fiwix root=/dev/ram0 ramdisksize=%d initrd=fiwix.ext2 kexec_proto=linux kexec_size=%d kexec_cmdline=\"init=/init consoleblank=0\"", INITRD_MB * 1024, KEXEC_MB * 1024);
} }
else else
{ {
sprintf(cmdline, "fiwix console=/dev/ttyS0 root=/dev/ram0 ramdisksize=%d initrd=fiwix.ext2 kexec_proto=linux kexec_size=280000 kexec_cmdline=\"init=/init console=ttyS0\"", INITRD_MB * 1024); sprintf(cmdline, "fiwix console=/dev/ttyS0 root=/dev/ram0 ramdisksize=%d initrd=fiwix.ext2 kexec_proto=linux kexec_size=%d kexec_cmdline=\"init=/init console=ttyS0\"", INITRD_MB * 1024, KEXEC_MB * 1024);
} }
char * boot_loader_name = "kexec-fiwix"; char * boot_loader_name = "kexec-fiwix";
@ -127,13 +128,13 @@ int main() {
pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t); pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t);
pmultiboot_memory_map->addr = 0x00000000; pmultiboot_memory_map->addr = 0x00000000;
pmultiboot_memory_map->len = 0x0009FC00; pmultiboot_memory_map->len = 0x00080000;
pmultiboot_memory_map->type = MULTIBOOT_MEMORY_AVAILABLE; pmultiboot_memory_map->type = MULTIBOOT_MEMORY_AVAILABLE;
pmultiboot_memory_map++; pmultiboot_memory_map++;
pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t); pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t);
pmultiboot_memory_map->addr = 0x0009FC00; pmultiboot_memory_map->addr = 0x00080000;
pmultiboot_memory_map->len = 0x00000400; pmultiboot_memory_map->len = 0x00020000;
pmultiboot_memory_map->type = MULTIBOOT_MEMORY_RESERVED; pmultiboot_memory_map->type = MULTIBOOT_MEMORY_RESERVED;
pmultiboot_memory_map++; pmultiboot_memory_map++;
@ -145,13 +146,13 @@ int main() {
pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t); pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t);
pmultiboot_memory_map->addr = 0x00100000; pmultiboot_memory_map->addr = 0x00100000;
pmultiboot_memory_map->len = 0xBFEE0000; pmultiboot_memory_map->len = 0xBC000000;
pmultiboot_memory_map->type = MULTIBOOT_MEMORY_AVAILABLE; pmultiboot_memory_map->type = MULTIBOOT_MEMORY_AVAILABLE;
pmultiboot_memory_map++; pmultiboot_memory_map++;
pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t); pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t);
pmultiboot_memory_map->addr = 0XBFFE0000; pmultiboot_memory_map->addr = 0XBC000000;
pmultiboot_memory_map->len = 0x00020000; pmultiboot_memory_map->len = 0x04000000;
pmultiboot_memory_map->type = MULTIBOOT_MEMORY_RESERVED; pmultiboot_memory_map->type = MULTIBOOT_MEMORY_RESERVED;
pmultiboot_memory_map++; pmultiboot_memory_map++;
@ -208,6 +209,7 @@ int main() {
0xF3, 0xA4, /* rep movsb */ 0xF3, 0xA4, /* rep movsb */
0xB8, 0x00, 0x00, 0x00, 0x00, /* mov eax, 0x00000000 */ 0xB8, 0x00, 0x00, 0x00, 0x00, /* mov eax, 0x00000000 */
0xBB, 0x00, 0x00, 0x00, 0x00, /* mov ebx, 0x00000000 */ 0xBB, 0x00, 0x00, 0x00, 0x00, /* mov ebx, 0x00000000 */
0xFB, /* sti */
0xEA, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00 /* jmp far 0x0008:0x00000000 */ 0xEA, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00 /* jmp far 0x0008:0x00000000 */
}; };
@ -217,7 +219,7 @@ int main() {
*((unsigned int *) &trampoline[11]) = INITRD_MB * 1024 * 1024; *((unsigned int *) &trampoline[11]) = INITRD_MB * 1024 * 1024;
*((unsigned int *) &trampoline[19]) = magic; *((unsigned int *) &trampoline[19]) = magic;
*((unsigned int *) &trampoline[24]) = multiboot_info_num; *((unsigned int *) &trampoline[24]) = multiboot_info_num;
*((unsigned int *) &trampoline[29]) = e_entry; *((unsigned int *) &trampoline[30]) = e_entry;
memcpy((void *)0x4000, trampoline, sizeof(trampoline)); memcpy((void *)0x4000, trampoline, sizeof(trampoline));

File diff suppressed because it is too large Load diff

View file

@ -48,7 +48,7 @@
#define BLOCK_SIZE 1024 #define BLOCK_SIZE 1024
#define FILENAME_LENGTH 256 #define FILENAME_LENGTH 256
#define INITRD_MB 1152 #define INITRD_MB 1280
const char *input_name = NULL; const char *input_name = NULL;
/**@brief Block device handle.*/ /**@brief Block device handle.*/

View file

@ -1 +1 @@
a07ed611ce6a0547063be9d5f8ba0f7d14a2ea4e23fa6ff3cbcb09974ece9527 /usr/bin/make_fiwix_initrd 68e17d5d7d372101fb7d9857113b9d9b0d19610b19014a742d054d52998c782d /usr/bin/make_fiwix_initrd