From: Olaf Hering Date: Sun, 7 Dec 2003 22:08:44 +0000 (+0000) Subject: +- update patches.suse/early_userspace-instead-of-linuxrc X-Git-Url: http://git.alex.org.uk +- update patches.suse/early_userspace-instead-of-linuxrc + simply changes suse-commit: 952f927b7f4897f21bf802be20e537876a504feb --- diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 1d414dd..2d2a739 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1449,8 +1449,9 @@ cleanup: #endif /* USE_ELF_CORE_DUMP */ -int init_elf_binfmt(void) +static int __init init_elf_binfmt(void) { + printk("%s\n",__FUNCTION__); return register_binfmt(&elf_format); } @@ -1460,6 +1461,6 @@ static void __exit exit_elf_binfmt(void) unregister_binfmt(&elf_format); } -EXPORT_SYMBOL(init_elf_binfmt); +core_initcall(init_elf_binfmt); module_exit(exit_elf_binfmt) MODULE_LICENSE("GPL"); diff --git a/init/do_mounts.c b/init/do_mounts.c index e2c915e..ad8c88a 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -370,46 +370,17 @@ void __init mount_root(void) mount_block_root("/dev/root", root_mountflags); } -extern int sysfs_mounted; -extern asmlinkage long sys_access(const char * filename, int mode); -extern asmlinkage long sys_umount(char __user * name, int flags); -static char *kinit_command = "/sbin/kinit"; - -static int __init kinit_setup(char *str) -{ - kinit_command = str; - return 1; -} - -__setup("kinit=", kinit_setup); - -static int __init kinit_exec(void * shell) -{ - static char *argv[] = { "kinit", NULL, }; - extern char * envp_init[]; - - close(0);close(1);close(2); - setsid(); - (void) open("/dev/console",O_RDWR,0); - (void) dup(0); - (void) dup(0); - return execve(shell, argv, envp_init); -} /* * Prepare the namespace - decide what/where to mount, load ramdisks, etc. */ void __init prepare_namespace(void) { int is_floppy; - int pid, i; mount_devfs(); md_run_setup(); - if (sysfs_mounted) - sys_umount("/sys",0); - if (saved_root_name[0]) { root_device_name = saved_root_name; ROOT_DEV = name_to_dev_t(root_device_name); @@ -422,20 +393,6 @@ void __init prepare_namespace(void) if (initrd_load()) goto out; - /* - * check if there is an early userspace init, if yes - * let it do all the work of mounting the root fs and return - */ - if (kinit_command && sys_access(kinit_command,0) == 0) { - pid = kernel_thread(kinit_exec, kinit_command, SIGCHLD); - if (pid > 0) { - while (pid != waitpid(-1, &i, 0)) - yield(); - } - sys_chdir("/root"); - goto out; - } - if (is_floppy && rd_doload && rd_load_disk(0)) ROOT_DEV = Root_RAM0; diff --git a/init/initramfs.c b/init/initramfs.c index b1d0af8..59fabf2 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -483,17 +483,12 @@ extern char __initramfs_start, __initramfs_end; #include #endif -extern int sysfs_mounted; - void __init populate_rootfs(void) { char *err = unpack_to_rootfs(&__initramfs_start, &__initramfs_end - &__initramfs_start, 0); if (err) panic(err); - sysfs_mounted = sys_mount("sys", "/sys","sysfs",NULL,NULL); - printk(" mount sysfs returned %ld\n", sysfs_mounted); - sysfs_mounted = !sysfs_mounted; #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { int fd; diff --git a/init/main.c b/init/main.c index 2495eba..4d7d70d 100644 --- a/init/main.c +++ b/init/main.c @@ -304,6 +304,15 @@ static int __init init_setup(char *str) } __setup("init=", init_setup); +static char *kinit_command; + +static int __init kinit_setup(char *str) +{ + kinit_command = str; + return 1; +} +__setup("kinit=", kinit_setup); + extern void setup_arch(char **); extern void cpu_idle(void); @@ -491,7 +500,6 @@ asmlinkage void __init start_kernel(void) } int __initdata initcall_debug; -int __initdata sysfs_mounted; static int __init initcall_debug_setup(char *str) { @@ -509,6 +517,7 @@ static void __init do_initcalls(void) initcall_t *call; int count = preempt_count(); + printk("%s\n",__FUNCTION__); for (call = &__initcall_start; call < &__initcall_end; call++) { char *msg; @@ -536,8 +545,9 @@ static void __init do_initcalls(void) flush_scheduled_work(); } -extern int init_elf_binfmt(void); -extern int init_elf32_binfmt(void); +asmlinkage long sys_access(const char __user * filename, int mode); +asmlinkage long sys_mount(char *dev_name, char *dir_name, char *type, + unsigned long flags, void *data); /* * Ok, the machine is now initialized. None of the devices @@ -548,6 +558,8 @@ extern int init_elf32_binfmt(void); */ static void __init do_basic_setup(void) { + extern char hotplug_path[]; + driver_init(); #ifdef CONFIG_SYSCTL @@ -558,14 +570,12 @@ static void __init do_basic_setup(void) sock_init(); init_workqueues(); - init_elf_binfmt(); -#if defined(__powerpc64__) || \ - defined(CONFIG_IA32_SUPPORT) || \ - defined(CONFIG_MIPS32) || \ - defined(CONFIG_PARISC64) || \ - defined(CONFIG_BINFMT_ELF32) - init_elf32_binfmt(); -#endif + + if (sys_access(hotplug_path, 0) == 0) { + printk(KERN_INFO "mounting sysfs on /sys"); + sys_mount("sys", "/sys","sysfs",0,NULL); + } + do_initcalls(); } @@ -610,6 +620,13 @@ static int init(void * unused) smp_init(); do_basic_setup(); + /* + * check if there is an early userspace init, if yes + * let it do all the work + */ + if (kinit_command || sys_access("/sbin/init", 0) == 0) + execute_command = kinit_command ? kinit_command : 0; + else prepare_namespace(); /* diff --git a/lib/kobject.c b/lib/kobject.c index ff65c0f..22bfc67 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -156,6 +156,9 @@ static void kset_hotplug(const char *action, struct kset *kset, envp [i++] = scratch; scratch += sprintf(scratch, "ACTION=%s", action) + 1; + if(!sequence_num) + printk(" ... the first call_usermodehelper: %s\n", name); + spin_lock(&sequence_lock); seq = sequence_num++; spin_unlock(&sequence_lock); diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c index fd89afd..e1ccfaa 100644 --- a/usr/gen_init_cpio.c +++ b/usr/gen_init_cpio.c @@ -215,10 +215,7 @@ int main (int argc, char *argv[]) { cpio_mkdir("/dev", 0755, 0, 0); cpio_mknod("/dev/console", 0600, 0, 0, 'c', 5, 1); - cpio_mknod("/dev/ram0", 0600, 0, 0, 'b', 5, 1); cpio_mkdir("/root", 0700, 0, 0); - cpio_mkdir("/sys", 0755, 0, 0); - cpio_mkdir("/events", 0755, 0, 0); cpio_trailer(); exit(0);