aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/fs/install.c
diff options
context:
space:
mode:
authorMarvin Borner2020-04-15 00:33:39 +0200
committerMarvin Borner2020-04-15 00:33:39 +0200
commit10cd931d75a02942c5ad254cef2e56b515122fa3 (patch)
treebe8c4476f43f686fa669bcd2506e418385843d53 /src/kernel/fs/install.c
parentb11a2a876e7bd14078d26e12eab62db997a4dc76 (diff)
Removed filesystem
SOON: Correct ext2 attempt
Diffstat (limited to 'src/kernel/fs/install.c')
-rw-r--r--src/kernel/fs/install.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/kernel/fs/install.c b/src/kernel/fs/install.c
deleted file mode 100644
index d8ac121..0000000
--- a/src/kernel/fs/install.c
+++ /dev/null
@@ -1,94 +0,0 @@
-#include <kernel/graphics/vesa.h>
-#include <kernel/fs/ata_pio.h>
-#include <kernel/io/io.h>
-#include <kernel/fs/marfs/marfs.h>
-#include <kernel/fs/iso9660/iso9660.h>
-#include <kernel/fs/atapi_pio.h>
-#include <kernel/acpi/acpi.h>
-#include <kernel/lib/stdio.h>
-#include <kernel/timer/timer.h>
-#include <kernel/memory/alloc.h>
-#include <kernel/fs/load.h>
-
-void install_melvix()
-{
- info("You're booting from a CD, Melvix will only run after an installation");
- cli();
- struct ata_interface *primary_master = new_ata(1, 0x1F0);
- if (marfs_init(primary_master) != 0) {
- panic("No HDD found!");
- }
-
- struct marfs_superblock *currentSB = marfs_read_superblock();
- if (currentSB->signature == 0x1083B99F34B59645) { // WEEEOOOWEEEOOO
- panic("Melvix seems to be already installed!");
- }
- kfree(currentSB);
-
- info("Installing...\n");
-
- // Copy MBR
- info("Copying MBR... ");
- serial_printf("Copying MBR... ");
- char *stage1_p[] = { "BOOT", "HDD1.BIN" };
- struct iso9660_entity *stage1_e = ISO9660_get(stage1_p, 2);
- if (!stage1_e)
- panic("Couldn't find the first HDD bootloader!");
- uint8_t *stage1 = ISO9660_read(stage1_e);
- kfree(stage1_e);
- marfs_write_mbr(stage1);
-
- // Format disk
- info("Formatting disk...");
- serial_printf("Formatting disk...");
- marfs_format();
-
- // Copy second stage
- info("Copying second stage...");
- serial_printf("Copying second stage...");
- char *stage2_p[] = { "BOOT", "HDD2.BIN" };
- struct iso9660_entity *stage2_e = ISO9660_get(stage2_p, 2);
- if (!stage2_e)
- panic("Couldn't find the second HDD bootloader!");
- uint8_t *stage2 = ISO9660_read(stage2_e);
- marfs_new_file(stage2_e->length, stage2, 0, 0, 0);
- kfree(stage2_e);
-
- // Copy the kernel
- info("Copying the kernel...");
- serial_printf("Copying the kernel...");
- char *kernel_p[] = { "BOOT", "KERNEL.BIN" };
- struct iso9660_entity *kernel_e = ISO9660_get(kernel_p, 2);
- if (!kernel_e)
- panic("WTH Kernel not found!?");
- uint8_t *kernel = (uint8_t *)kmalloc(kernel_e->length + 2048);
- ATAPI_granular_read(1 + (kernel_e->length / 2048), kernel_e->lba, kernel);
- marfs_new_file(kernel_e->length, kernel, 0, 0, 0);
- kfree(kernel);
- kfree(kernel_e);
-
- // Copy the userspace binary
- info("Copying userspace... ");
- serial_printf("Copying userspace... ");
- char *userspace_p[] = { "USER.BIN" };
- struct iso9660_entity *userspace_e = ISO9660_get(userspace_p, 1);
- if (!userspace_e)
- panic("Userspace not found!");
- uint8_t *userspace = ISO9660_read(userspace_e);
- marfs_new_file(userspace_e->length, userspace, 0, 0, 0);
- kfree(userspace_e);
-
- // Copy the global font binary
- info("Copying font... ");
- serial_printf("Copying font... ");
- char *font_p[] = { "FONT.BIN" };
- struct iso9660_entity *font_e = ISO9660_get(font_p, 1);
- marfs_new_file(font_e->length, (uint8_t *)font, 0, 0, 0);
- kfree(font_e);
-
- info("Installation successful!");
- serial_printf("Installation successful! (in %d ticks)", get_time());
- // timer_wait(200);
- acpi_poweroff();
- halt_loop();
-} \ No newline at end of file