diff --git a/drivers/serial.c b/drivers/serial.c index c8c5d43..4431912 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -33,8 +33,12 @@ struct serial_dev *serial_first_device() { return first_serial_dev; } +/* + * Initialize the serial sybsystem. + * Note: this is called directly from the kernel initialization as opposed to + * being an initcall because it has to be called before the serial drivers get + * initialized in earlyinitcalls. + */ void serial_init() { first_serial_dev = 0; } - -driversubsys_initcall(serial_init); diff --git a/kernel/start_kernel.c b/kernel/start_kernel.c index 2c34826..adb7c2d 100644 --- a/kernel/start_kernel.c +++ b/kernel/start_kernel.c @@ -64,8 +64,9 @@ void serial_console_init() { print_init(sdev->putc); } +void serial_init(); void kmalloc_init(); - + int main(void) { char *lower, *upper; struct atag *atags; @@ -73,8 +74,13 @@ int main(void) { //setup MMU mmu_reinit(); + /* Initialize the serial subsystem before + * init_earlyinitcalls(), because console drivers get + * initialized here so as to have an output console as + * early as possible, and we don't want those + * initializations to fail. */ + serial_init(); init_earlyinitcalls(); - serial_console_init(); //setup memory