/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { init_workqueues(); cpuset_init_smp(); usermodehelper_init(); init_tmpfs(); driver_init(); init_irq_proc(); do_ctors(); do_initcalls(); }
static int __init init(void * unused) { lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ init_pid_ns.child_reaper = current; cad_pid = task_pid(current); smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); smp_init(); sched_init_smp(); cpuset_init_smp(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work * if defined CONFIG_RG_INITFS_RAMFS, we are sure there's a rootfs, no * need for prepare_namespace() */ #ifndef CONFIG_RG_INITFS_RAMFS if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } #endif /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); return 0; }
/* * Ok, the machine is now initialized. None of the devices * have been touched yet, but the CPU subsystem is up and * running, and memory and process management works. * * Now we can finally start doing some real work.. */ static void __init do_basic_setup(void) { rcu_init_sched(); /* needed by module_init stage. */ init_workqueues(); cpuset_init_smp(); usermodehelper_init(); driver_init(); init_irq_proc(); do_ctors(); do_initcalls(); }
static int __init kernel_init(void * unused) { /* * Wait until kthreadd is all set-up. */ wait_for_completion(&kthreadd_done); lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ init_pid_ns.child_reaper = current; __set_special_pids(1, 1); cad_pid = task_pid(current); smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); smp_init(); sched_init_smp(); cpuset_init_smp(); do_basic_setup(); /* Open the /dev/console on the rootfs, this should never fail */ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk(KERN_WARNING "Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ init_post(); return 0; }
static int init(void * unused) { int fdin, fdout, fderr; lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ child_reaper = current; /* Sets up cpus_possible() */ smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); fixup_cpu_present_map(); smp_init(); sched_init_smp(); cpuset_init_smp(); /* * Do this before initcalls, because some drivers want to access * firmware files. */ populate_rootfs(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (sys_access((const char __user *) "/init", 0) == 0) execute_command = "/init"; else prepare_namespace(); /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ free_initmem(); unlock_kernel(); system_state = SYSTEM_RUNNING; numa_default_policy(); fdin = sys_open((const char __user *) "/dev/console", O_RDWR, 0); if (fdin < 0) { printk(KERN_WARNING "Warning: unable to open /dev/console as initial console, res=%d.\n", fdin); fdin = sys_open((const char __user *) "/dev/null", O_RDWR, 0); if (fdin < 0) { panic("unable to open /dev/null as initial console, res=%d.\n", fdin); } } if (fdin != 0) { panic("initial console's stdin fd is not 0, but %d\n", fdin); } fdout = sys_dup(fdin); if (fdout < 0) { panic("can't dup initial console's stdout, res=%d\n", fdout); } else if (fdout != 1) { panic("initial console's stdout fd is not 1, but %d\n", fdout); } fderr = sys_dup(fdin); if (fderr < 0) { panic("can't dup initial console's stderr, res=%d\n", fderr); } else if (fderr != 2) { panic("initial console's stderr fd is not 2, but %d\n", fderr); } /* * We try each of these until one succeeds. * * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ 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."); }
static int init(void * unused) { lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ child_reaper = current; smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); smp_init(); sched_init_smp(); cpuset_init_smp(); /* * Do this before initcalls, because some drivers want to access * firmware files. */ populate_rootfs(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ free_initmem(); unlock_kernel(); mark_rodata_ro(); system_state = SYSTEM_RUNNING; numa_default_policy(); if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk(KERN_WARNING "Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); if (ramdisk_execute_command) { run_init_process(ramdisk_execute_command); printk(KERN_WARNING "Failed to execute %s\n", ramdisk_execute_command); } /* * We try each of these until one succeeds. * * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ if (execute_command) { run_init_process(execute_command); printk(KERN_WARNING "Failed to execute %s. Attempting " "defaults...\n", 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."); }
static int init(void * unused) { lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ child_reaper = current; smp_prepare_cpus(max_cpus); init_hardirqs(); do_pre_smp_initcalls(); smp_init(); sched_init_smp(); cpuset_init_smp(); /* * Do this before initcalls, because some drivers want to access * firmware files. */ populate_rootfs(); do_basic_setup(); /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } #ifdef CONFIG_PREEMPT_RT WARN_ON(irqs_disabled()); #endif #define DEBUG_COUNT (defined(CONFIG_DEBUG_RT_MUTEXES) + defined(CONFIG_DEBUG_PREEMPT) + defined(CONFIG_CRITICAL_PREEMPT_TIMING) + defined(CONFIG_CRITICAL_IRQSOFF_TIMING) + defined(CONFIG_LATENCY_TRACE) + defined(CONFIG_DEBUG_SLAB) + defined(CONFIG_DEBUG_PAGEALLOC) + defined(CONFIG_LOCKDEP)) #if DEBUG_COUNT > 0 printk(KERN_ERR "*****************************************************************************\n"); printk(KERN_ERR "* *\n"); #if DEBUG_COUNT == 1 printk(KERN_ERR "* REMINDER, the following debugging option is turned on in your .config: *\n"); #else printk(KERN_ERR "* REMINDER, the following debugging options are turned on in your .config: *\n"); #endif printk(KERN_ERR "* *\n"); #ifdef CONFIG_DEBUG_RT_MUTEXES printk(KERN_ERR "* CONFIG_DEBUG_RT_MUTEXES *\n"); #endif #ifdef CONFIG_DEBUG_PREEMPT printk(KERN_ERR "* CONFIG_DEBUG_PREEMPT *\n"); #endif #ifdef CONFIG_CRITICAL_PREEMPT_TIMING printk(KERN_ERR "* CONFIG_CRITICAL_PREEMPT_TIMING *\n"); #endif #ifdef CONFIG_CRITICAL_IRQSOFF_TIMING printk(KERN_ERR "* CONFIG_CRITICAL_IRQSOFF_TIMING *\n"); #endif #ifdef CONFIG_LATENCY_TRACE printk(KERN_ERR "* CONFIG_LATENCY_TRACE *\n"); #endif #ifdef CONFIG_DEBUG_SLAB printk(KERN_ERR "* CONFIG_DEBUG_SLAB *\n"); #endif #ifdef CONFIG_DEBUG_PAGEALLOC printk(KERN_ERR "* CONFIG_DEBUG_PAGEALLOC *\n"); #endif #ifdef CONFIG_LOCKDEP printk(KERN_ERR "* CONFIG_LOCKDEP *\n"); #endif printk(KERN_ERR "* *\n"); #if DEBUG_COUNT == 1 printk(KERN_ERR "* it may increase runtime overhead and latencies. *\n"); #else printk(KERN_ERR "* they may increase runtime overhead and latencies. *\n"); #endif printk(KERN_ERR "* *\n"); printk(KERN_ERR "*****************************************************************************\n"); #endif /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ free_initmem(); unlock_kernel(); mark_rodata_ro(); system_state = SYSTEM_RUNNING; numa_default_policy(); if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk(KERN_WARNING "Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); if (ramdisk_execute_command) { run_init_process(ramdisk_execute_command); printk(KERN_WARNING "Failed to execute %s\n", ramdisk_execute_command); } #ifdef CONFIG_PREEMPT_RT WARN_ON(irqs_disabled()); #endif /* * We try each of these until one succeeds. * * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ if (execute_command) { run_init_process(execute_command); printk(KERN_WARNING "Failed to execute %s. Attempting " "defaults...\n", 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."); }
static int init(void * unused) { #ifdef CONFIG_STR8100_GNSD630 __u32 data; /* * from original kernel image * TODO: figure out what the commented out lines do */ /* * mode for gpio pins: * 22 and 23: led mode * 24: stays gpio. changes disk mode */ MISC_GPIOA_PIN_ENABLE_REG = 0x0; MISC_GPIOA_PIN_ENABLE_REG |= (0x3 << 22); /* * set some pins to input mode * 13: device is connected to pc * 0: reset button */ GPIOA_DIRECTION_REG = 0xffffdff0; /* * disk to standalone mode */ GPIOA_DATA_OUTPUT_REG = 0x010fffff; udelay(10); /* GPIOA_DATA_OUTPUT_REG |= 0x20000; GPIOA_DATA_OUTPUT_REG |= 0x20000000; */ /* set disk to device mode if connected to pc */ HAL_GPIOA_READ_DATA_IN_STATUS(data); if (!(data & 0x00002000)) GPIOA_DATA_OUTPUT_REG = 0x000fdfff; /* GPIOA_DATA_OUTPUT_REG |= 0x10000; */ #endif lock_kernel(); /* * init can run on any cpu. */ set_cpus_allowed(current, CPU_MASK_ALL); /* * Tell the world that we're going to be the grim * reaper of innocent orphaned children. * * We don't want people to have to make incorrect * assumptions about where in the task array this * can be found. */ child_reaper = current; smp_prepare_cpus(max_cpus); do_pre_smp_initcalls(); fixup_cpu_present_map(); smp_init(); sched_init_smp(); cpuset_init_smp(); /* * Do this before initcalls, because some drivers want to access * firmware files. */ populate_rootfs(); do_basic_setup(); #ifdef CONFIG_STR8100_GNSD630 /* GPIOA_DATA_OUTPUT_REG |= 0x20000; GPIOA_DATA_OUTPUT_REG |= 0x20000000; */ /* * setup gpio pins again. seems redundant */ MISC_GPIOA_PIN_ENABLE_REG = 0x0; MISC_GPIOA_PIN_ENABLE_REG |= (0x3 << 22); #endif /* * check if there is an early userspace init. If yes, let it do all * the work */ if (!ramdisk_execute_command) ramdisk_execute_command = "/init"; if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) { ramdisk_execute_command = NULL; prepare_namespace(); } /* * Ok, we have completed the initial bootup, and * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ free_initmem(); unlock_kernel(); mark_rodata_ro(); system_state = SYSTEM_RUNNING; numa_default_policy(); if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk(KERN_WARNING "Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); if (ramdisk_execute_command) { run_init_process(ramdisk_execute_command); printk(KERN_WARNING "Failed to execute %s\n", ramdisk_execute_command); } /* * We try each of these until one succeeds. * * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ if (execute_command) { run_init_process(execute_command); printk(KERN_WARNING "Failed to execute %s. Attempting " "defaults...\n", 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."); }