Linux Bootup

From LinuxMIPS
Jump to: navigation, search

Linux startup sequence in 2.4.x

This page illustrates the Linux bootup in 2.4 kernels. Depending of the exact version there may be some slight differences. Linux 2.6 differs quite a bit.

   kernel_entry() - arch/mips/kernel/head.S
      set stack;
      prepare argc/argp/envp;
      jal init_arch - arch/mips/kernel/setup.c
           cpu_probe() -
           prom_init(...) - arch/mips/ddb5074/prom.c
           loadmmu()
           start_kernel()  - init/main.c
                   setup_arch(&commaind_line); - arch/mips/kernel/setup.c
                           ddb_setup()         - arch/mips/ddb5074/setup.c
                   parse_options(command_line);
                   trap_init();
                   init_IRQ();                 - arch/mips/kernel/irq.c
                   sched_init();
                   softirq_init();
                   time_init();
                           if (board_time_init) board_time_init();
                           set xtime by calling rtc_get_time();
                           pick appropriate do_gettimeoffset()
                           board_timer_setup(&timer_irqaction);
                   console_init();
                   init_modules();
                   kmem_cache_init();
                   sti();                  /* interrupt first open */
                   calibrate_delay();
                   mem_init();
                   kmem_cache_sizes_init();
                   pgtable_cache_init();
                   fork_init();
                   proc_caches_init();
                   vfs_caches_init();
                   buffer_init();
                   page_cache_init();
                   signals_init();
                   smp_init();
                   kernel_thread(init, ...)
                   cpu_idle();

   init() - init/main.c
     - lock_kernel();
       do_basic_setup();
         - [MTRR] mtrr_init();
           [SYSCTL] sysctl_init();
           [S390] s390_init_machine_check();
           [ACPI] acpi_init();
           [PCI] pci_init();
           [SBUS] sbus_init();
           [PPC] ppc_init();
           [MCA] mca_init();
           [ARCH_ACORN] ecard_init();
           [ZORRO] zorro_init();
           [DIO] dio_init();
           [MAC] nubus_init();
           [ISAPNP] isapnp_init();
           [TC] tc_init();
           sock_init();
           start_context_thread();
           do_initcalls();
           [IRDA] irda_proto_init();
           [IRDA] irda_device_init();
           [PCMCIA] init_pcmcia_ds();

       prepare_namespace();
       free_initmem();
       unlock_kernel();

       files = current->files;
       if(unshare_files())
               panic("unshare");
       put_files_struct(files);

       if (open("/dev/console", O_RDWR, 0) < 0)
                   printk("Warning: unable to open an initial console.\n");
       (void) dup(0);
       (void) dup(0);

       if (execute_command)
                   run_init_process(execute_command);
       run_init_process("/sbin/init");
       run_init_process("/etc/init");
       run_init_process("/bin/init");
       run_init_process("/bin/sh");

       panic("No init found.  Try passing init= option to kernel.");