Merge pull request #391 from Googulator/bare-metal-linux

Make the Linux kernel & Fiwix->Linux kexec more bare-metal-friendly
This commit is contained in:
fosslinux 2024-01-10 07:16:20 +00:00 committed by GitHub
commit f51fb080b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 582 additions and 338 deletions

View File

@ -70,7 +70,7 @@ b39826742e236890f3562cdf19492e7ef4224b271f3e75ddeab1f07982b03ebe libffi-3.3_0.t
daae709e98d2df2190d1d13b4e86f7f3fe90fa7a975282fe0bb03289b6539f29 libtool-2.2.4_0.tar.bz2
6cefa575362149620f8008a32c8af54f0198a18bc6ab910bd3cead196c1507d7 libtool-2.4.7_0.tar.bz2
503007bbcddcf4e49d26514c59b4c9501f8b42f0c994a59dfdc388b1ae6b7900 libunistring-0.9.10_0.tar.bz2
fd2264a08cbeeb28f3e2580cba174376a154c77b0ef6cbf67b55fd13c0987f52 linux-4.9.10_0.tar.bz2
576c04a4b2ccbfe6b48f5f16e8bd59469e359bdc77458ed82a4025da98ad6dcb linux-4.9.10_0.tar.bz2
d15c922973c15a8206e09020e8cfe6a78f7e93614de212f2b37ff80163799c6c linux-headers-4.9.10_0.tar.bz2
fdb3dce8af3eb6c0745f103989f1bae0bfe9156390215f97240a75ed77ae4acd m4-1.4.7_0.tar.bz2
e69554b0a77b419ddd5d0a0e418ba4005ecd0f6784c92a6928a0270bd929a098 make-3.82_0.tar.bz2

View File

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

View File

@ -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));

File diff suppressed because it is too large Load Diff

View File

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

View File

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