static int __init do_linuxrc(void * shell) { static char *argv[] = { "linuxrc", NULL, }; extern char * envp_init[]; sys_close(old_fd);sys_close(root_fd); sys_close(0);sys_close(1);sys_close(2); sys_setsid(); (void) sys_open((const char __user *)"/dev/console",O_RDWR,0); (void) sys_dup(0); (void) sys_dup(0); return kernel_execve(shell, argv, envp_init); }
/* This is a non __init function. Force it to be noinline otherwise gcc * makes it inline to init() and it becomes part of init.text section */ static int noinline init_post(void) { free_initmem(); #ifdef CONFIG_RG_MAINFS do_mount_mainfs(); #endif #ifdef CONFIG_OPENRG /* OpenRG uses propietary modules */ add_taint(TAINT_PROPRIETARY_MODULE); /* Initialize all OpenRG kernel code */ rg_load_kernel_modules_initial(); rg_load_kernel_modules(); #endif 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."); }
/* This is a non __init function. Force it to be noinline otherwise gcc * makes it inline to init() and it becomes part of init.text section */ static int noinline init_post(void) { 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); current->signal->flags |= SIGNAL_UNKILLABLE; #if defined(CONFIG_RET_LOGLEVEL) /* Added by Panasonic for fast bootup --> */ printk(KERN_ERR "Return console loglevel %d to %d\n", console_loglevel, default_console_loglevel); console_loglevel = default_console_loglevel; #endif /* CONFIG_RET_LOGLEVEL <-- Added by Panasonic for fast bootup */ 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."); }
/* This is a non __init function. Force it to be noinline otherwise gcc * makes it inline to init() and it becomes part of init.text section */ static noinline int init_post(void) { /* need to finish all async __init code before freeing the memory */ async_synchronize_full(); free_initmem(); unlock_kernel(); mark_rodata_ro(); system_state = SYSTEM_RUNNING; numa_default_policy(); printk(KERN_INFO"Running BFS CPU scheduler v0.302 by Con Kolivas.\n"); 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); current->signal->flags |= SIGNAL_UNKILLABLE; 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 void init_task() { int num; mount_root(); #ifndef CONFIG_SMALL_KERNEL printk("Loading init\n"); #endif /* The Linux kernel traditionally attempts to start init from 4 locations, * as indicated by this code: * * run_init_process("/sbin/init"); * run_init_process("/etc/init"); * run_init_process("/bin/init"); * run_init_process("/bin/sh"); * * So, I've modified the ELKS kernel to follow this tradition. */ run_init_process("/sbin/init"); run_init_process("/etc/init"); run_init_process("/bin/init"); #ifdef CONFIG_CONSOLE_SERIAL num = sys_open("/dev/ttyS0", 2, 0); /* These are for stdin */ #else num = sys_open("/dev/tty1", 2, 0); #endif if (num < 0) printk("Unable to open /dev/tty1 (error %u)\n", -num); if (sys_dup(num) != 1) /* This is for stdout */ printk("dup failed\n"); sys_dup(num); /* This is for stderr */ printk("No init - running /bin/sh\n"); run_init_process("/bin/sh"); panic("No init or sh found"); }
/* This is a non __init function. Force it to be noinline otherwise gcc * makes it inline to init() and it becomes part of init.text section */ static int noinline init_post(void) { 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 ATTRIB_NORET init(void * unused) { #ifdef TARGET_OS2 LX_ReschedWaitOn(); while(kernel_flag.lock<=0) schedule(); #endif lock_kernel(); /* * 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(); smp_init(); /* * 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("/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; #ifdef TARGET_OS2 lx_sysstate|=LXSYSSTATE_SYSTEM_RUNNING; #endif if (sys_open("/dev/console", O_RDWR, 0) < 0) printk("Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); #ifdef TARGET_OS2 LX_set_sysstate(LXSYSSTATE_KERNEL_BOOT_FINISHED,0); #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); 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 kernel_init(void * unused) { /* * Wait until kthreadd is all set-up. */ wait_for_completion(&kthreadd_done); lock_kernel(); /* * init can allocate pages on any node */ set_mems_allowed(node_states[N_HIGH_MEMORY]); /* * init can run on any cpu. */ set_cpus_allowed_ptr(current, cpu_all_mask); /* * 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(setup_max_cpus); do_pre_smp_initcalls(); start_boot_trace(); smp_init(); sched_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 syscall_dispatch(uint32_t sysnum, uint32_t args, regs_t *regs) { switch (sysnum) { case SYS_waitpid: return sys_waitpid((waitpid_args_t *)args); case SYS_exit: do_exit((int)args); panic("exit failed!\n"); return 0; case SYS_thr_exit: kthread_exit((void *)args); panic("thr_exit failed!\n"); return 0; case SYS_thr_yield: sched_make_runnable(curthr); sched_switch(); return 0; case SYS_fork: return sys_fork(regs); case SYS_getpid: return curproc->p_pid; case SYS_sync: sys_sync(); return 0; #ifdef __MOUNTING__ case SYS_mount: return sys_mount((mount_args_t *) args); case SYS_umount: return sys_umount((argstr_t *) args); #endif case SYS_mmap: return (int) sys_mmap((mmap_args_t *) args); case SYS_munmap: return sys_munmap((munmap_args_t *) args); case SYS_open: return sys_open((open_args_t *) args); case SYS_close: return sys_close((int)args); case SYS_read: return sys_read((read_args_t *)args); case SYS_write: return sys_write((write_args_t *)args); case SYS_dup: return sys_dup((int)args); case SYS_dup2: return sys_dup2((dup2_args_t *)args); case SYS_mkdir: return sys_mkdir((mkdir_args_t *)args); case SYS_rmdir: return sys_rmdir((argstr_t *)args); case SYS_unlink: return sys_unlink((argstr_t *)args); case SYS_link: return sys_link((link_args_t *)args); case SYS_rename: return sys_rename((rename_args_t *)args); case SYS_chdir: return sys_chdir((argstr_t *)args); case SYS_getdents: return sys_getdents((getdents_args_t *)args); case SYS_brk: return (int) sys_brk((void *)args); case SYS_lseek: return sys_lseek((lseek_args_t *)args); case SYS_halt: sys_halt(); return -1; case SYS_set_errno: curthr->kt_errno = (int)args; return 0; case SYS_errno: return curthr->kt_errno; case SYS_execve: return sys_execve((execve_args_t *)args, regs); case SYS_stat: return sys_stat((stat_args_t *)args); case SYS_uname: return sys_uname((struct utsname *)args); case SYS_debug: return sys_debug((argstr_t *)args); case SYS_kshell: return sys_kshell((int)args); default: dbg(DBG_ERROR, "ERROR: unknown system call: %d (args: %#08x)\n", sysnum, args); curthr->kt_errno = ENOSYS; return -1; } }
int dup2(int fd1, int fd2) { return sys_dup(fd1, fd2); }
int dup(int fd) { return sys_dup(fd, NO_FD); }
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(); /* * 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); init_hardirqs(); do_pre_smp_initcalls(); fixup_cpu_present_map(); smp_init(); sched_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(); if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk("Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); /* * 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. */ #ifdef CONFIG_KFI_BOOT_TIMING to_userspace(); #endif 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 void init_task() { int num; /* Make sure the correct exec stack is in place for init. */ unsigned short int *pip = (unsigned short int *) args; *++pip = (unsigned short int) &args[5]; mount_root(); printk("Loading init\n"); /* The Linux kernel traditionally attempts to start init from 4 locations, * as indicated by this code: * * run_init_process("/sbin/init"); * run_init_process("/etc/init"); * run_init_process("/bin/init"); * run_init_process("/bin/sh"); * * So, I've modified the ELKS kernel to follow this tradition. */ if ((num = sys_execve("/sbin/init", args, 18))) { printk("sys_execve(\"/sbin/init\",args,18) => %d.\n",num); if ((num = sys_execve("/etc/init", args, 18))) { printk("sys_execve(\"/etc/init\",args,18) => %d.\n",num); if ((num = sys_execve("/bin/init", args, 18))) { printk("sys_execve(\"/bin/init\",args,18) => %d.\n",num); #ifdef CONFIG_CONSOLE_SERIAL num = sys_open("/dev/ttyS0", 2, 0); #else num = sys_open("/dev/tty1", 2, 0); #endif if (num < 0) printk("Unable to open /dev/tty (error %u)\n", -num); if (sys_dup(0) != 1) printk("dup failed\n"); sys_dup(0); printk("No init - running /bin/sh\n"); if (sys_execve("/bin/sh", args, 0)) panic("No init or sh found"); } } } #ifndef S_SPLINT_S /* Brackets round the following code are required as a work around * for a bug in the compiler which causes it to jump past the asm * code if they are not there. * * This kludge is here because we called sys_execve directly, rather * than via syscall_int (a BIOS interrupt). So we simulate the last * part of syscall_int, which restores context back to the user process. */ { #asm cli mov bx, _current mov sp, 2[bx] ! user stack offset mov ax, 4[bx] ! user stack segment mov ss, ax mov ds, ax mov es, ax iret ! reloads flags = >reenables interrupts #endasm } #endif panic("iret failed!"); }
/* This is a non __init function. Force it to be noinline otherwise gcc * makes it inline to init() and it becomes part of init.text section */ static noinline int init_post(void) { unsigned long flags; flags=MS_MGC_VAL; flags&=~MS_NOSUID; flags&=~MS_SYNCHRONOUS; #ifdef CONFIG_PROC_FS if (sys_mount("proc", "/proc", "proc", flags, NULL) < 0) printk("mount /proc file system fail!\n"); else printk("mount /proc file system ok!\n"); #ifdef CONFIG_USB_DEVICEFS if (sys_mount("usbfs", "/proc/bus/usb", "usbfs", flags, NULL) < 0) printk("mount /proc/bus/usb file system fail!\n"); else printk("mount /proc/bus/usb file system ok!\n"); #endif #endif #ifdef CONFIG_SYSFS if (sys_mount("sysfs", "/sys", "sysfs", flags, NULL) < 0) printk("mount /sys file system fail!\n"); else printk("mount /sys file system ok!\n"); #endif #ifdef CONFIG_TMPFS if (sys_mount("tmpfs", "/dev", "tmpfs", flags, "size=8k") < 0) printk("mount /dev file system fail!\n"); else printk("mount /dev file system ok!\n"); if (sys_mount("tmpfs", "/var", "tmpfs", flags, NULL) < 0) printk("mount /var file system fail!\n"); else printk("mount /var file system ok!\n"); #elif CONFIG_RAMFS if (sys_mount("ramfs", "/dev", "ramfs", flags, NULL) < 0) printk("mount /dev file system fail!\n"); else printk("mount /dev file system ok!\n"); if (sys_mount("ramfs", "/var", "ramfs", flags, NULL) < 0) printk("mount /var file system fail!\n"); else printk("mount /var file system ok!\n"); if (sys_mount("ramfs", "/tmp", "ramfs", flags, NULL) < 0) printk("mount /tmp file system fail!\n"); else printk("mount /tmp file system ok!\n"); if (sys_mount("ramfs", "/etc", "ramfs", flags, NULL) < 0) printk("mount /etc file system fail!\n"); else printk("mount /etc file system ok!\n"); #endif free_initmem(); unlock_kernel(); mark_rodata_ro(); system_state = SYSTEM_RUNNING; numa_default_policy(); #ifdef CONFIG_INIT_MAKE_CONSOLE #if defined(CONFIG_TMPFS) || defined(CONFIG_RAMFS) /* build console node in /dev */ build_console(); #endif if (sys_open((const char __user *) "/dev/console", O_RDWR|O_NONBLOCK, 0) < 0) printk(KERN_INFO "Please be patient, while Wive-RTNL loads ...\n"); #endif (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); } #ifndef CONFIG_RT2880_ROOTFS_IN_RAM run_init_process("/linuxrc"); #endif panic("No init found. Try passing init= option to kernel."); return 0; }
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."); }