3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
4 * Copyright (C) 2008 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
5 * Copyright (C) 2009 Tomas 'ZeXx86' Jedrzejek (zexx86@gmail.com)
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 #include <partition.h>
33 #include <net/socket.h>
34 #include <net/packet.h>
35 #include <sound/audio.h>
47 /* Command structure */
48 typedef unsigned int (init_handler_t
) ();
50 /* OS information stamp */
56 kprintf (" v" ZEXOS_MAJOR
"." ZEXOS_MINOR
"." ZEXOS_REVISION
" " ZEXOS_DATE
" " ZEXOS_ARCH
" " ZEXOS_COMPILER
"\n");
59 /* Bootloader command parse system */
60 void oscmd (char *cmdline
)
74 if (cmdline
[x
] == ' ') {
77 if (!cstrcmp ("nolive", cmdline
+x
)) /* Disable Live form of the OS */
78 kernel_attr
|= KERNEL_NOLIVE
;
79 if (!cstrcmp ("noata", cmdline
+x
)) /* Ignore ATA devices - cdrom, hdd */
80 kernel_attr
|= KERNEL_NOATA
;
81 if (!cstrcmp ("18hz", cmdline
+x
)) /* Ticks on 18hz only - IBM default tickrate */
82 kernel_attr
|= KERNEL_18HZ
;
83 if (!cstrcmp ("noeth", cmdline
+x
)) /* Ignore ethernet cards */
84 kernel_attr
|= KERNEL_NOETH
;
85 if (!cstrcmp ("novesa", cmdline
+x
)) /* Disable vesa support when its available */
86 kernel_attr
|= KERNEL_NOVESA
;
93 /* Eye-candy status */
94 unsigned int checkinfo (char *msg
, int ret
)
124 unsigned int _init (init_handler_t
*handler
, char *msg
)
126 return checkinfo (msg
, handler ());
129 extern void calc_freqency ();
130 extern task_t
*_curr_task
;
132 /* initialization of kernel */
133 int init (char *cmdline
)
138 _init (&init_arch
, NULL
); /* architecture dependent stuff */
140 oscmd (cmdline
); /* bootloader command parsing */
142 _init (&init_video
, NULL
); /* video initialization */
144 osinfo (); /* print OS information - kernel ver.; compiler; .. */
146 _init (&init_mm
, "Initialize mm"); /* Memory management */
147 _init (&init_smp
, "Initialize SMP"); /* Symmetric multiprocessing */
148 _init (&init_keyboard
, "Initialize keyboard"); /* Keyboard should be accessible from here */
150 _init (&init_paging
, "Initialize paging"); /* Page covering, etc */
152 _init (&init_errno
, "Initialize errno"); /* Errno global variable */
153 _init (&init_env
, "Initialize env vars"); /* Environment variables */
154 _init (&init_fd
, "Initialize file desc"); /* File descriptors - stdin, stdout, .. */
155 _init (&init_tasks
, "Initialize tasks"); /* Thread and scheduler stuff */
156 _init (&init_vfs
, "Initialize VFS"); /* Virtual filesystem */
157 _init (&init_fs
, "Initialize fs"); /* Device filesystem */
158 _init (&init_partition
, "Initialize parts"); /* Device partitions - hda0, hda1, .. */
159 _init (&init_its
, "Initialize ITS"); /* Interval Time Scheduler */
160 _init (&init_netif
, "Initialize net if"); /* Network interface */
161 _init (&init_dev
, "Initialize devices"); /* Devices (PCI, RS232, Ethernet, ..) */
162 _init (&init_socket
, "Initialize sockets"); /* Network socket API */
163 _init (&init_packet
, "Initialize netcore"); /* Network handler - traffic parser */
164 _init (&init_audio
, "Initialize audio"); /* Sound System */
165 _init (&init_proc
, "Initialize procs"); /* Program's (software) process */
166 _init (&init_module
, "Loading modules"); /* Kernel additional modules (device drivers) */
167 _init (&init_commands
, "Registering cmds"); /* Built-in shell command registration */
168 _init (&init_console
, "Initialize console"); /* Console (terminal) stuff */
170 calc_swtimer (); /* Calculate by software time unit */
171 calc_freqency (); /* Calculate CPU clock */
173 _init (&init_tty
, NULL
); /* Start TTY console */
174 _init (&init_user
, NULL
); /* Register default user accounts */