mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-23 03:26:31 +01:00
Make the Linux kernel & Fiwix->Linux kexec more bare-metal-friendly
* Enable additional hardware drivers in Linux for better bare metal display, network & input device compatibility * Disable ATA-over-Ethernet support, because it spams the network with unnecessary packets, is basically useless for bootstrapping, and may even be a security risk * Increase Fiwix initrd size to 1280MB to fit a larger Linux build * Make the Fiwix kexec size configurable the same way as initrd (and reduce from 280MB to 256MB which is sufficient in my testing) * Use a more conservative memory map for Fiwix & Linux * Boot Linux with consoleblank=0 on bare metal, so the build won't go blind after 5 minutes * Support kexec-fiwix with interrupts disabled (will be useful later when builder-hex0 is updated)
This commit is contained in:
parent
133c05426c
commit
82c570694a
6 changed files with 582 additions and 338 deletions
|
|
@ -6,7 +6,8 @@
|
|||
#include "multiboot1.h"
|
||||
|
||||
#define MULTIBOOT_MAGIC 0x2BADB002
|
||||
#define INITRD_MB 1152
|
||||
#define INITRD_MB 1280
|
||||
#define KEXEC_MB 256
|
||||
|
||||
int main() {
|
||||
/* Read the kernel */
|
||||
|
|
@ -81,11 +82,11 @@ int main() {
|
|||
char *bare_metal = getenv("BARE_METAL");
|
||||
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
|
||||
{
|
||||
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";
|
||||
|
||||
|
|
@ -127,13 +128,13 @@ int main() {
|
|||
|
||||
pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t);
|
||||
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++;
|
||||
|
||||
pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t);
|
||||
pmultiboot_memory_map->addr = 0x0009FC00;
|
||||
pmultiboot_memory_map->len = 0x00000400;
|
||||
pmultiboot_memory_map->addr = 0x00080000;
|
||||
pmultiboot_memory_map->len = 0x00020000;
|
||||
pmultiboot_memory_map->type = MULTIBOOT_MEMORY_RESERVED;
|
||||
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->addr = 0x00100000;
|
||||
pmultiboot_memory_map->len = 0xBFEE0000;
|
||||
pmultiboot_memory_map->len = 0xBC000000;
|
||||
pmultiboot_memory_map->type = MULTIBOOT_MEMORY_AVAILABLE;
|
||||
pmultiboot_memory_map++;
|
||||
|
||||
pmultiboot_memory_map->size = sizeof(multiboot_memory_map_t) - sizeof(multiboot_uint32_t);
|
||||
pmultiboot_memory_map->addr = 0XBFFE0000;
|
||||
pmultiboot_memory_map->len = 0x00020000;
|
||||
pmultiboot_memory_map->addr = 0XBC000000;
|
||||
pmultiboot_memory_map->len = 0x04000000;
|
||||
pmultiboot_memory_map->type = MULTIBOOT_MEMORY_RESERVED;
|
||||
pmultiboot_memory_map++;
|
||||
|
||||
|
|
@ -208,6 +209,7 @@ int main() {
|
|||
0xF3, 0xA4, /* rep movsb */
|
||||
0xB8, 0x00, 0x00, 0x00, 0x00, /* mov eax, 0x00000000 */
|
||||
0xBB, 0x00, 0x00, 0x00, 0x00, /* mov ebx, 0x00000000 */
|
||||
0xFB, /* sti */
|
||||
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[19]) = magic;
|
||||
*((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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue