4 Replace the current root with a new one
11 #include <sys/mount.h>
14 fprintf(stderr
, "Usage: newroot [-i] <block-special>\n");
15 fprintf(stderr
, "-i: copy mfs binary from boot image to memory\n");
19 int main(int argc
, char *argv
[])
26 mountflags
= 0; /* !read-only */
28 if (argc
!= 2 && argc
!= 3) usage();
31 } else if(argc
== 3) {
32 /* -i flag was supposedly entered. Verify.*/
33 if(strcmp(argv
[1], "-i") != 0) usage();
34 mountflags
|= MS_REUSE
;
38 r
= mount(dev
, "/", mountflags
, NULL
, NULL
);
40 fprintf(stderr
, "newroot: mount failed: %s\n",strerror(errno
));