About do_basic_setup during network initialization in Linux kernel-general Linux technology-Linux programming and kernel information. During linux network initialization, The start_kernel () function in initmain. c calls kernel_thread to start the init process, which corresponds to the init function in initmain. c. The init function calls the do_basic_setup () function, which calls the sock_init () function in netsocket. c.
Do_basic_setup:
Initialize the bus (such as pci_init ())
Network initialization (initialize the network data structure, sock_init (); In 2.4.17, sock_init () only initializes the network data structure. The actual protocol initialization is to run do_initcils () automatically load each protocol module)
Create an event management Core Thread (start_context_thread ())
Load all modules (use do_initcballs () to start any function identified by _ initcall (to facilitate core developers to add startup functions ))
# Define module_init (x) _ initcall (x. h, so that the system initializes to call initmain. module x is automatically loaded when do_initcils in c (enters x initialization ). In af_inet.c, module_init (inet_init) exists, so it also includes initializing the inet module. Haha
It is easier to understand in 2.6.14.2. View
CODE: static void _ init do_basic_setup (void)
{
/* Drivers will send hotplug events */
Init_workqueues ();
Usermodehelper_init ();
Driver_init ();
# Ifdef CONFIG_SYSCTL
Sysctl_init ();
# Endif
/* Networking initialization needs a process context */
Sock_init ();
Do_initcils ();
} |