void __init setup_arch(char **cmdline_p) { #ifdef CONFIG_64BIT extern int parisc_narrow_firmware; #endif unwind_init(); init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */ #ifdef CONFIG_64BIT printk(KERN_INFO "The 64-bit Kernel has started...\n"); #else printk(KERN_INFO "The 32-bit Kernel has started...\n"); #endif printk(KERN_INFO "Default page size is %dKB.\n", (int)(PAGE_SIZE / 1024)); pdc_console_init(); #ifdef CONFIG_64BIT if(parisc_narrow_firmware) { printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n"); } #endif setup_pdc(); setup_cmdline(cmdline_p); collect_boot_cpu_data(); do_memory_inventory(); /* probe for physical memory */ parisc_cache_init(); paging_init(); #ifdef CONFIG_CHASSIS_LCD_LED /* initialize the LCD/LED after boot_cpu_data is available ! */ led_init(); /* LCD/LED initialization */ #endif #ifdef CONFIG_PA11 dma_ops_init(); #endif #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) conswitchp = &dummy_con; /* we use take_over_console() later ! */ #endif }
int main(void) { #ifdef CONFIG_INITCALL int ret; initcall_t *initcall; for (initcall = __rnk_initcalls_start; initcall < __rnk_initcalls_end; initcall++) { debug_printk("initcall-> %pS\n", *initcall); ret = (*initcall)(); if (ret < 0) error_printk("initcall %pS failed: %d\n", *initcall, ret); } #endif /* CONFIG_INITCALL */ printk("Welcome to rnk\r\n"); printk("- Initialise scheduler...\r\n"); #ifndef CONFIG_INITCALL schedule_init(); time_init(); #endif /* CONFIG_INITCALL */ #ifdef CONFIG_UNWIND unwind_init(); #endif /* CONFIG_UNWIND */ printk("- Add thread to scheduler\r\n"); add_thread(&loading_thread, 1); printk("- Start scheduling...\r\n"); start_schedule(); while(1) ; return 0; //Never reach }
void __init setup_arch(char **cmdline_p) { #ifdef CONFIG_64BIT extern int parisc_narrow_firmware; #endif unwind_init(); init_per_cpu(smp_processor_id()); /* Set Modes & Enable FP */ #ifdef CONFIG_64BIT printk(KERN_INFO "The 64-bit Kernel has started...\n"); #else printk(KERN_INFO "The 32-bit Kernel has started...\n"); #endif printk(KERN_INFO "Kernel default page size is %d KB. Huge pages ", (int)(PAGE_SIZE / 1024)); #ifdef CONFIG_HUGETLB_PAGE printk(KERN_CONT "enabled with %d MB physical and %d MB virtual size", 1 << (REAL_HPAGE_SHIFT - 20), 1 << (HPAGE_SHIFT - 20)); #else printk(KERN_CONT "disabled"); #endif printk(KERN_CONT ".\n"); /* * Check if initial kernel page mappings are sufficient. * panic early if not, else we may access kernel functions * and variables which can't be reached. */ if (__pa((unsigned long) &_end) >= KERNEL_INITIAL_SIZE) panic("KERNEL_INITIAL_ORDER too small!"); pdc_console_init(); #ifdef CONFIG_64BIT if(parisc_narrow_firmware) { printk(KERN_INFO "Kernel is using PDC in 32-bit mode.\n"); } #endif setup_pdc(); setup_cmdline(cmdline_p); collect_boot_cpu_data(); do_memory_inventory(); /* probe for physical memory */ parisc_cache_init(); paging_init(); #ifdef CONFIG_CHASSIS_LCD_LED /* initialize the LCD/LED after boot_cpu_data is available ! */ led_init(); /* LCD/LED initialization */ #endif #ifdef CONFIG_PA11 dma_ops_init(); #endif #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) conswitchp = &dummy_con; /* we use do_take_over_console() later ! */ #endif clear_sched_clock_stable(); }
asmlinkage void __init start_kernel(void) { char * command_line; extern struct kernel_param __start___param[], __stop___param[]; smp_setup_processor_id(); /* * Need to run as early as possible, to initialize the * lockdep hash: */ unwind_init(); lockdep_init(); debug_objects_early_init(); cgroup_init_early(); local_irq_disable(); early_boot_irqs_off(); early_init_irq_lock_class(); /* * Interrupts are still disabled. Do necessary setups, then * enable them */ lock_kernel(); tick_init(); boot_cpu_init(); page_address_init(); #ifndef CONFIG_MIPS_BRCM printk(KERN_NOTICE); printk(linux_banner); #endif setup_arch(&command_line); mm_init_owner(&init_mm, &init_task); setup_command_line(command_line); unwind_setup(); setup_per_cpu_areas(); setup_nr_cpu_ids(); smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ #ifdef CONFIG_MIPS_BRCM printk(KERN_NOTICE); printk(linux_banner); #endif /* * Set up the scheduler prior starting any interrupts (such as the * timer interrupt). Full topology setup happens at smp_init() * time - but meanwhile we still have a functioning scheduler. */ sched_init(); /* * Disable preemption - early bootup scheduling is extremely * fragile until we cpu_idle() for the first time. */ preempt_disable(); build_all_zonelists(); page_alloc_init(); printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line); parse_early_param(); parse_args("Booting kernel", static_command_line, __start___param, __stop___param - __start___param, &unknown_bootoption); if (!irqs_disabled()) { printk(KERN_WARNING "start_kernel(): bug: interrupts were " "enabled *very* early, fixing it\n"); local_irq_disable(); } sort_main_extable(); trap_init(); rcu_init(); init_IRQ(); pidhash_init(); init_timers(); hrtimers_init(); softirq_init(); timekeeping_init(); time_init(); sched_clock_init(); profile_init(); if (!irqs_disabled()) printk("start_kernel(): bug: interrupts were enabled early\n"); early_boot_irqs_on(); local_irq_enable(); /* * HACK ALERT! This is early. We're enabling the console before * we've done PCI setups etc, and console_init() must be aware of * this. But we do want output early, in case something goes wrong. */ console_init(); if (panic_later) panic(panic_later, panic_param); lockdep_info(); /* * Need to run this when irqs are enabled, because it wants * to self-test [hard/soft]-irqs on/off lock inversion bugs * too: */ locking_selftest(); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " "disabling it.\n", page_to_pfn(virt_to_page((void *)initrd_start)), min_low_pfn); initrd_start = 0; } #endif vmalloc_init(); vfs_caches_init_early(); cpuset_init_early(); page_cgroup_init(); mem_init(); enable_debug_pagealloc(); cpu_hotplug_init(); kmem_cache_init(); debug_objects_mem_init(); idr_init_cache(); setup_per_cpu_pageset(); numa_policy_init(); if (late_time_init) late_time_init(); calibrate_delay(); pidmap_init(); pgtable_cache_init(); prio_tree_init(); anon_vma_init(); #ifdef CONFIG_X86 if (efi_enabled) efi_enter_virtual_mode(); #endif thread_info_cache_init(); fork_init(num_physpages); proc_caches_init(); buffer_init(); key_init(); security_init(); vfs_caches_init(num_physpages); radix_tree_init(); signals_init(); /* rootfs populating might need page-writeback */ page_writeback_init(); #ifdef CONFIG_PROC_FS proc_root_init(); #endif cgroup_init(); cpuset_init(); taskstats_init_early(); delayacct_init(); check_bugs(); acpi_early_init(); /* before LAPIC and SMP init */ ftrace_init(); /* Do the rest non-__init'ed, we're now alive */ rest_init(); }