×ðÁú¿­Ê±

ÆÊÎöLinuxÄÚºËÖ÷º¯ÊýÔÚϵͳÆô¶¯ÖеĽÇÉ«

ÎÊÌ⣺LinuxÄÚºËÖ÷º¯ÊýÔÚϵͳÆô¶¯ÖеĽÇÉ«ÆÊÎö

ÔÚLinux²Ù×÷ϵͳÖÐ £¬ÄÚºËÖ÷º¯ÊýÊÇÕû¸öϵͳÆô¶¯Àú³ÌÖеĽ¹µã²¿·Ö £¬ËüÈÏÕæ³õʼ»¯ÏµÍ³µÄ¸÷ÏЧ £¬¼ÓÔØÐëÒªµÄÄ  £¿éºÍÇý¶¯³ÌÐò £¬×îÖÕ½«ÏµÍ³Ö¸µ¼µ½Óû§Ì¬¡£±¾ÎĽ«ÏêϸÆÊÎöLinuxÄÚºËÖ÷º¯ÊýÔÚϵͳÆô¶¯Àú³ÌÖеÄÏêϸ½ÇÉ« £¬²¢¸ø³öһЩ´úÂëʾÀýÀ´ËµÃ÷Æ书Ч¡£

1. ÄÚºËÖ÷º¯ÊýµÄ×÷ÓÃ

ÄÚºËÖ÷º¯Êý £¬Ò»Ñùƽ³£Î»ÓÚÎļþ init/main.c ÖÐµÄ start_kernel() º¯Êý £¬ÊÇÕû¸öÄÚºËÆô¶¯µÄÈë¿Úµã¡£ÔÚϵͳÆô¶¯Ê± £¬ÄÚºËÖ÷º¯ÊýµÄÖ÷Òª×÷ÓðüÀ¨£º

³õʼ»¯ÄÚºËÊý¾Ý½á¹¹ºÍϵͳ±äÁ¿

ÉèÖô¦Öóͷ£Æ÷ÇéÐÎ

³õʼ»¯ÄÚºË×Óϵͳ

×°ÔØÐëÒªµÄÄ  £¿éºÍÇý¶¯³ÌÐò

Æô¶¯ÏµÍ³µ÷ÀíÆ÷

ÔØÈëÓû§Ì¬³ÌÐò

ͨ¹ýÕâЩ°ì·¨ £¬ÄÚºËÖ÷º¯Êý½«ÏµÍ³´ÓÓ²¼þÖ¸µ¼µ½Èí¼þ £¬×îÖÕÈÃÓû§Äܹ»ÔÚϵͳÖÐÔËÐÐÖÖÖÖÓ¦ÓóÌÐò¡£

2. ÄÚºËÖ÷º¯ÊýµÄÏêϸ´úÂëʾÀý

ÏÂÃæ¸ø³öһЩ¼òÆӵĴúÂëʾÀý £¬Õ¹Ê¾ÄÚºËÖ÷º¯ÊýÔÚϵͳÆô¶¯Àú³ÌÖеÄһЩҪº¦²Ù×÷£º

£¨1£©³õʼ»¯ÄÚºËÊý¾Ý½á¹¹ºÍϵͳ±äÁ¿

void start_kernel(void)
{
    setup_arch();
    setup_log();
    MMU_init();
    init_IRQ();
    init_timers();
    calibrate_delay();
    setup_timer();
    init_task();
    cpus_timer_all();
    smp_prepare_cpus();
    boot_cpu_init();
    time_init();
    softirq_init();
    build_all_zonelists();
    page_alloc_init();
    enable_sysrq();
    migrate_init();
    printk("Linux version %s
", UTS_RELEASE);
    printk("System is %s on %s
", system_name, machine_name);
    printk("CPU revision is %d
", cpu_data.revision);
    printk("machine is %s
", machine_id);
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏ´úÂëʾÀýչʾÁËÄÚºËÖ÷º¯ÊýÖжÔÄÚºËÊý¾Ý½á¹¹ºÍϵͳ±äÁ¿¾ÙÐгõʼ»¯µÄÀú³Ì¡£

£¨2£©ÉèÖô¦Öóͷ£Æ÷ÇéÐÎ

void setup_arch(void)
{
    switch (system_type)
    {
        case SYSTEM_32BIT:
            setup_32bit();
            break;
        case SYSTEM_64BIT:
            setup_64bit();
            break;
        default:
            panic("Unsupported system type");
    }
}

µÇ¼ºó¸´ÖÆ

ÔÚÉèÖô¦Öóͷ£Æ÷ÇéÐÎʱ £¬Æ¾Ö¤ÏµÍ³Î»ÊýŲÓöÔÓ¦µÄ³õʼ»¯º¯Êý¾ÙÐд¦Öóͷ£Æ÷µÄÉèÖá£

£¨3£©³õʼ»¯ÄÚºË×Óϵͳ

void init_task(void)
{
    struct task_struct *p;
    p = (struct task_struct *) kmalloc(sizeof(struct task_struct));
    if (!p)
        panic("Cannot allocate memory for init task");
    memset(p, 0, sizeof(struct task_struct));
    p->pid = 1;
    p->state = TASK_RUNNING;
    p->mm = &init_mm;
    current = p;

    sprintf(p->comm, "%s", "init");
}

µÇ¼ºó¸´ÖÆ

³õʼ»¯ÄÚºË×Óϵͳʱ £¬½¨Éè init Àú³Ì×÷ΪϵͳµÄµÚÒ»¸öÀú³Ì¡£

£¨4£©Æô¶¯ÏµÍ³µ÷ÀíÆ÷

void cpu_idle(void)
{
    while (1)
    {
        schedule();
        sti();
    }
}

µÇ¼ºó¸´ÖÆ

ϵͳµ÷ÀíÆ÷ÈÏÕæÀú³Ì¼äµÄÇл»ºÍ×ÊÔ´µÄ·ÖÅÉ £¬cpu_idle º¯ÊýÊÇϵͳ¿ÕÏÐʱµÄ´¦Öóͷ£º¯Êý¡£

3. ×ܽá

ÔÚLinux²Ù×÷ϵͳÖÐ £¬ÄÚºËÖ÷º¯ÊýÔÚϵͳÆô¶¯Àú³ÌÖÐÊÎÑÝןÜÊÇÖ÷ÒªµÄ½ÇÉ« £¬ËüÈÏÕæÕû¸öϵͳµÄ³õʼ»¯ºÍÉèÖÃÊÂÇé £¬ÎªÓû§Ì¬³ÌÐòµÄÔËÐÐÌṩÁË»ù´¡¡£Í¨¹ýÖð²½ÆÊÎöÄÚºËÖ÷º¯ÊýµÄ¸÷¸ö¹¦Ð§ºÍ´úÂëʾÀý £¬ÎÒÃÇ¿ÉÒÔ¸üºÃµØÃ÷È·ÄÚºËÆô¶¯µÄÕû¸öÀú³Ì £¬²¢ÉîÈëÑо¿LinuxÄں˵ÄÊÂÇéÔ­Àí¡£

ÒÔÉϾÍÊÇÆÊÎöLinuxÄÚºËÖ÷º¯ÊýÔÚϵͳÆô¶¯ÖеĽÇÉ«µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿