Complete the kernel bootstrap by adding kexec of Linux from Fiwix.

A tiny bootloader bootstrap has been added to compile the builder-hex0 kernel from hex0 source.
The boot compiler is builder-hex0-x86-stage1.hex0 and builder-hex0-x86-stage1.bin.
The builder-hex0 kernel is now named builder-hex0-x86-stage2.hex0.
The inclusion of a binary seed resolves the problem with the previous strategy which used an
architecture-specific hex0 compiler.

If sysb detects a full disk (i.e. DISK=sda) it now partitions the disk unconditionally because
previously fdisk was reporting existing but empty partitions which resulted in no
parititions being created.

e2fsprogs is now built with --disable-tls because musl was built on Fiwix without full threading
support and mkfs.ext4 was crashing without disabling thread local storage.

kexec-linux writes the linux kernel and initramfs to a RAM drive on Fiwix which ensure
a pre-allocated contiguous memory block. The following is written to the ram drive:
a 32-bit number which is the size of the kernel in bytes, a 32-bit number which is the size
of the initramfs in bytes, followed by the Linux kernel image, followed by the initramfs.

kexec-fiwix invokes a sync syscall to ensure all writes are flushed to
the ram drive and then initiates the kexec by shutting down Fiwix with a reboot syscall.
Fiwix knows whether and how to perform the kexec based on kernel parameters passed to it.
This commit is contained in:
rick-masters 2023-05-10 14:33:42 +00:00
parent e86db47b6e
commit a2fcf1ced9
23 changed files with 633 additions and 277 deletions

View file

@ -21,6 +21,7 @@
/usr/bin/checksum-transcriber
/usr/bin/tcc
/usr/bin/tcc-0.9.26
/usr/bin/kexec-linux
/usr/lib/mes/libc.a
/usr/lib/mes/libgetopt.a
/usr/lib/mes/crt1.o

View file

@ -267,6 +267,18 @@ int main(int argc, char **argv)
printf("ext4_mknod error: %d \n", err);
return EXIT_FAILURE;
}
printf("ext4_mknod /mp/dev/ram0\n");
err = ext4_mknod("/mp/dev/ram0", EXT4_DE_BLKDEV, MKDEV(1, 0));
if (err != EOK) {
printf("ext4_mknod error: %d \n", err);
return EXIT_FAILURE;
}
printf("ext4_mknod /mp/dev/ram1\n");
err = ext4_mknod("/mp/dev/ram1", EXT4_DE_BLKDEV, MKDEV(1, 1));
if (err != EOK) {
printf("ext4_mknod error: %d \n", err);
return EXIT_FAILURE;
}
copy_file("/usr/bin/kaem", "/mp/init");
copy_file("/sysa/after2.kaem", "/mp/kaem.run");

View file

@ -1 +1 @@
0a3f0012c01cb5aee0643f1674f265e68b5eeadb37596bcc4fe60aad55c9d3d7 /usr/bin/make_fiwix_initrd
4135d55c65ba001b98804425de67907ba92d281a0582dfd8861d728d19da9e7d /usr/bin/make_fiwix_initrd