Linux启动流程

Linux Bootup secquence

Kernel 入口点
连接脚本:arch/arm64/kernel/vmlinux.lds.S
入口 arch/arm64/kernel/entry.S

start_kernel

  • setup_arch
    • setup_processor
    • setup_machine_fdt
    • early_fixmap_init
    • early_ioremap_init
    • parse_early_param
    • local_async_enable
    • efi_init
    • arm64_memblock_init
    • smp_build_mpidr_hash
    • vfs_cache_init
  • rest_init
    • 初始化多线程环境
    • start kernel_init (先跑initcall, 然后init进程)
    • start kthreadd (启动内核线程)
    • waitfor kthreadd
    • 启动smp环境,进行cpu idle调度 (idle/ swapper)

kernel_init
- kernel_init_freeable
- wait for kthread_done
- do_pre_smp_initcalls();
- lockup_detector_init();
- smp_init();
- sched_init_smp();
- do_basic_setup();
- cpuset_init_smp();
- usermodehelper_init();
- shmem_init();
- driver_init();
- /* These are the core pieces /
- devtmpfs_init();
- devices_init();
- buses_init();
- classes_init();
- firmware_init();
- hypervisor_init();
- /
These are also core pieces, but must come after the
- * core core pieces.
- */
- platform_bus_init();
- cpu_dev_init();
- memory_dev_init();
- container_dev_init();
- init_irq_proc();
- do_ctors();
- usermodehelper_enable();
- do_initcalls();
- random_int_secret_init();
- Open the /dev/console on the rootfs
- exec init

kthreadd 管理内核线程,遍历链表调用create_kthread,

关于“Linux启动流程”我的1个想法

一位WordPress评论者进行回复 取消回复

电子邮件地址不会被公开。 必填项已用*标注