Re: getting linux to mount a FAT16 part at boot time so I can giveit an initrd path?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Another question:  do I need to unmount /devfs and /proc before I do
the pivot_root()?

Me> int
Me> main (int argc, char *const argv[])
Me> {
Me>   struct loop_info loopinfo;
Me>   int fd, ffd;
Me> 
Me>   ffd = open ("/initrd.bin", O_RDWR);
Me>   fd = open ("/dev/loop/0", O_RDWR);
Me> 
Me>   memset (&loopinfo, 0, sizeof(loopinfo));
Me>   strncpy (loopinfo.lo_name, "/initrd.bin", LO_NAME_SIZE);
Me>   loopinfo.lo_offset = 0;
Me>   loopinfo.lo_encrypt_key_size = 0;
Me>   ioctl (fd, LOOP_SET_FD, ffd);
Me>   ioctl (fd, LOOP_SET_STATUS, &loopinfo);
Me>   close (fd);
Me>   close (ffd);
Me> 
Me>   mount ("/dev/loop/0", "/mnt", "ext2", 0, NULL);
Me>   chdir ("/mnt");
Me>   pivot_root ("/mnt", "/mnt/tmproot");
Me> 
Me>   fprintf (stderr, "GOT HERE\n");
Me> 
Me>   execv ("/sbin/init", argv);
Me>   return 0;
Me> }

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux