Lines 6-11
Link Here
|
6 |
#include <linux/delay.h> |
6 |
#include <linux/delay.h> |
7 |
#include <linux/string.h> |
7 |
#include <linux/string.h> |
8 |
#include <linux/syscalls.h> |
8 |
#include <linux/syscalls.h> |
|
|
9 |
#include <asm/uaccess.h> |
9 |
|
10 |
|
10 |
static __initdata char *message; |
11 |
static __initdata char *message; |
11 |
static void __init error(char *x) |
12 |
static void __init error(char *x) |
Lines 463-468
Link Here
|
463 |
return message; |
464 |
return message; |
464 |
} |
465 |
} |
465 |
|
466 |
|
|
|
467 |
/* If we want the rootfs on initramfs so we mount initramfs over the |
468 |
* rootfs before we unpack it. The little dance we do by creating a |
469 |
* pivot point and moving the root to that is in fact necessary |
470 |
* because lookups of "." don't resolve mountpoints. |
471 |
*/ |
472 |
static inline void __init overmount_rootfs(void) |
473 |
{ |
474 |
#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS |
475 |
int init_tmpfs(void); |
476 |
int (*initfunc)(void) = init_tmpfs; |
477 |
mm_segment_t oldfs; |
478 |
char pivot[] = "/pivot"; |
479 |
|
480 |
/* Explicitly go and init the overmount fs early (long-term |
481 |
* the need for this will probably go away. */ |
482 |
|
483 |
if (initfunc()) |
484 |
goto err; |
485 |
|
486 |
oldfs = get_fs(); |
487 |
set_fs(KERNEL_DS); |
488 |
|
489 |
if (sys_mkdir(pivot, 0700) < 0) |
490 |
goto err; |
491 |
if (sys_mount("tmpfs", pivot, "tmpfs", 0, "size=90%")) |
492 |
goto err; |
493 |
|
494 |
/* Below here errors are unlikely and icky to deal with. */ |
495 |
sys_chdir(pivot); |
496 |
sys_mount(".", "/", NULL, MS_MOVE, NULL); |
497 |
sys_chdir("."); |
498 |
sys_chroot("."); |
499 |
printk(KERN_INFO "Overmounted tmpfs\n"); |
500 |
goto out; |
501 |
|
502 |
err: |
503 |
printk(KERN_ERR "Overmount error\n"); |
504 |
|
505 |
out: |
506 |
set_fs(oldfs); |
507 |
#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */ |
508 |
} |
509 |
|
466 |
extern char __initramfs_start[], __initramfs_end[]; |
510 |
extern char __initramfs_start[], __initramfs_end[]; |
467 |
#ifdef CONFIG_BLK_DEV_INITRD |
511 |
#ifdef CONFIG_BLK_DEV_INITRD |
468 |
#include <linux/initrd.h> |
512 |
#include <linux/initrd.h> |
Lines 482-487
Link Here
|
482 |
initrd_end - initrd_start, 1); |
526 |
initrd_end - initrd_start, 1); |
483 |
if (!err) { |
527 |
if (!err) { |
484 |
printk(" it is\n"); |
528 |
printk(" it is\n"); |
|
|
529 |
#ifdef CONFIG_EARLYUSERSPACE_ON_TMPFS |
530 |
overmount_rootfs(); |
531 |
#endif /* CONFIG_EARLYUSERSPACE_ON_TMPFS */ |
485 |
unpack_to_rootfs((char *)initrd_start, |
532 |
unpack_to_rootfs((char *)initrd_start, |
486 |
initrd_end - initrd_start, 0); |
533 |
initrd_end - initrd_start, 0); |
487 |
free_initrd_mem(initrd_start, initrd_end); |
534 |
free_initrd_mem(initrd_start, initrd_end); |