Josef,

Thanks.  I've upgraded from 1.0.4 to 1.0.14 and have compiled with
NDEBUG.  My module is at 72k and my device at bootup is at 14m of memory
used for the whole system.  Its looking good.

What I'm trying to do now is see if it is possible to umount /initrd
when I finally get the system booted.  What I'm getting is "Resouce
Busy" error message.  Below is the part of my linuxrc in initrd that is
responsible for merging a cramfs ram disk and a tempfs ram disk into a
unionfs on /

---------------------------------------------------------------------- 

static void
do_unionfs(void) {
  pid_t p;

  mkdir("/sysroot", 0600);
  mkdir("/sysroot/union", 0600);
  mkdir("/sysroot/cramfs", 0600);
  mkdir("/sysroot/tmpfs", 0600);

  if (mount("/dev/root", "/sysroot/cramfs", "cramfs", MS_RDONLY, NULL))
{
    die("mount cramfs: %s\n", strerror(errno));
  }

  if(mount("none", "/sysroot/tmpfs", "tmpfs",  0xc0ed0000 , "size=1m")
== -1) {
    die("mount tmpfs: %s\n", strerror(errno));
  }

  switch(p = fork()) {
    case 0:
      execl("/bin/mount",
        "/bin/mount",
        "-t",
        "unionfs",
        "-o",
        "dirs=/sysroot/tmpfs=rw:/sysroot/cramfs=ro",
        "none",
        "/sysroot/union",
        0);
      warn("exec: %s\n", strerror(errno));
      exit(0);
    default:
      waitpid(p, NULL, 0);
      break;
  }

  return;

}

static void
do_pivot_root(const char *new_root, const char *put_old) {
  int fd;

  mount_proc(1);

  if((fd = open("/proc/sys/kernel/real-root-dev", O_WRONLY)) == -1) {
    die("set root dev: %s\n", strerror(errno));
  }

  write(fd, "0x100", 5);
  close(fd);

  mount_proc(0);

  pivot_root(new_root, put_old);
  return;
}

int main{int argc, char **argv) {
  // do a bunch of stuff
  do_unionfs();
  do_pivot_root("/sysroot/union", "/sysroot/union/initrd");

    /*
  close(0);
  close(1);
  close(2);

  STDIN = open("/dev/console", O_RDONLY);
  STDOUT = open("/dev/console", O_WRONLY);
  STDERR = open("/dev/console", O_WRONLY);
  chdir("/sysroot/union");
  chroot(".");
  execl("/sbin/init",  0);
  */

}
---------------------------------------------------------------------- 

Before I used the unionfs I was doing the chroot that is commented out
above.  Maybe I should keep it?

Here are my mounts after boot:
rootfs on / type rootfs (rw)
/dev/root.old on /initrd type ext2 (rw)
/dev/root on /initrd/sysroot/cramfs type cramfs (ro)
none on /initrd/sysroot/tmpfs type tmpfs (rw)
none on / type unionfs
(rw,dirs=/initrd/sysroot/tmpfs=rw:/initrd/sysroot/cramfs=ro,debug=0,delete=all,copyup=preserve)
none on /proc type proc (rw)

Thanks,
Chris

On Sat, 2006-02-18 at 22:13 -0500, Josef Sipek wrote: 
> On Fri, Feb 17, 2006 at 10:26:31PM -0500, Christopher Fowler wrote:
> > I only have 2 problems.
> > 
> > 1.  When I compile the 1.0.4 unionfs module the result is a 3M file :(
> > 2.  After I do all this my memory usage is around 24m.  Without doing
> >     this it is only 5m.
> 
> You want to put this in your fistdev,mk
> 
> EXTRACFLAGS=-DUNIONFS_NDEBUG
> 
> This will make all the debugging code disappear (as described in the
> INSTALL file.)
> 
> Jeff.

_______________________________________________
unionfs mailing list
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs

Reply via email to