ardix/kernel/main.c

67 lines
1.5 KiB
C
Raw Normal View History

/* See the end of this file for copyright, license, and warranty information. */
2020-06-07 16:49:03 +02:00
#include <ardix/io.h>
#include <ardix/kent.h>
2021-08-04 03:31:21 +02:00
#include <ardix/kevent.h>
2020-06-17 20:40:22 +02:00
#include <ardix/sched.h>
#include <config.h>
#include <stdbool.h>
2020-06-12 00:03:16 +02:00
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
2020-06-12 00:03:16 +02:00
extern int init_main(void); /* init/main.c */
2020-06-07 16:49:03 +02:00
/**
* Core init routine.
2020-06-12 00:03:16 +02:00
*
* This is invoked from the startup code (usually) located in
* arch/<architecture>/startup.c.
2020-06-07 16:49:03 +02:00
*/
int main(void)
2020-06-07 16:49:03 +02:00
{
int err = kent_root_init();
if (err != 0)
return err;
2021-08-04 03:31:21 +02:00
kevents_init();
err = sched_init();
if (err != 0)
return err;
err = devices_init();
if (err != 0)
return err;
err = io_init();
if (err != 0)
return err;
2020-06-17 20:40:22 +02:00
2021-08-04 03:31:21 +02:00
/* we should have a serial console now */
printf("Ardix version " ARDIX_VERSION_STR "\n");
printf("This is non-violent software, and there is NO WARRANTY.\n");
printf("See <https://git.fef.moe/fef/ardix> for details.\n\n");
pid_t pid = exec(init_main);
waitpid(pid, &err, 0);
printf("initd exited with status %d, system halted\n", err);
while (1);
2020-06-07 16:49:03 +02:00
}
2020-10-11 19:35:30 +02:00
/*
* This file is part of Ardix.
* Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
2020-10-11 19:35:30 +02:00
*
* Ardix is non-violent software: you may only use, redistribute,
* and/or modify it under the terms of the CNPLv6+ as found in
* the LICENSE file in the source code root directory or at
* <https://git.pixie.town/thufie/CNPL>.
2020-10-11 19:35:30 +02:00
*
* Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
* permitted by applicable law. See the CNPLv6+ for details.
2020-10-11 19:35:30 +02:00
*/