<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">22.1.2013 21:30, Stephen Turner
      kirjoitti:<br>
    </div>
    <blockquote
cite="mid:CAN_xxrXZWmhECAH1JfgvHk+U_wksdZ0ZyxpcaSea8KsEYy04mw@mail.gmail.com"
      type="cite">
      <div>Dont go out of your way to do this but if you do decide to
        play with it i would love to hear back about your experiences. 
        I suppose my concern now is more less that when the buildroot
        script makes a system such as the bzImage+cpio you expect it to
        boot and in that case it does. So why wouldn't the generated
        bzImage+squashfs boot?  my assumption was that i didn't have the
        correct grub4dos menu.lst entries to properly access it but
        scouring the Internet turned up next to nothing except for
        modifying your fstab to boot partially compressed systems.  As
        it turns out i was able to compress /usr and then cpio the
        remaining system. i now have a 5mb kernel 2mb cpio initrd and a
        41mb squashfs usr directory which im fairly certain can be
        smaller with the right commands. Im working on getting the
        system to mount the /usr squash system at boot which i have
        verified there is enough of the system available in the initrd
        to mount it manually so im sure it should be able to be done
        automatically. </div>
      <div> </div>
      <div>I do appreciate your help. If you have any pointers to the
        myserious buildroot output images not being bootable i would
        love to hear about it but in the mean time you helped me resolve
        the issue of shrinking my system!</div>
    </blockquote>
    <br>
    My pleasure. Glad that I could help. :-)<br>
    <br>
    Oh, and before I forgot: <br>
    <br>
    When generating that squashfs /usr be sure to use latest version of
    mksquashfs (4.2),<br>
    at least kernel version of 2.6.38 (that was the version when they
    added xz-compression support for squashfs) and give<br>
    -comp xz switch when compressing your usr.<br>
    <br>
    Something like this:<br>
    <br>
    mksquashfs usr/ usr.sqfs -comp xz<br>
    <br>
    Stefan<br>
    <br>
    <blockquote
cite="mid:CAN_xxrXZWmhECAH1JfgvHk+U_wksdZ0ZyxpcaSea8KsEYy04mw@mail.gmail.com"
      type="cite">
      <div> </div>
      <div>Thanks,</div>
      <div>Stephen<br>
        <br>
      </div>
      <div class="gmail_quote">On Tue, Jan 22, 2013 at 12:49 PM, Stefan
        Fröberg <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:stefan.froberg@petroprogram.com"
            target="_blank">stefan.froberg@petroprogram.com</a>></span>
        wrote:<br>
        <blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px
          0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
          <div bgcolor="#FFFFFF" text="#000000">
            <div>It's true that you can use squashfs to compress whole
              system but even in that case you have to<br>
              make your own init script that will take care of all the
              magic of mounting.<br>
              And because squashfs is read-only filesystem then it get's
              more trickier because you have to take care<br>
              of yourself of all those /tmp and /var/log etc..
              directories that need to store temporarily stuff.<br>
              <br>
              When you mount that squashfs-file with /dev/loop0 it does
              use very little ram.<br>
              Like I said only if some files are accessed from it then
              kernle might use little ram for caching it so that they
              are accessed<br>
              much faster next time.<br>
              <br>
              So there is no need to separately load it into ram. It's
              just is there, mounted throught /dev/loop0 <br>
              (which is always there, provided that you did not remove
              loopback device support from kernel conf)<br>
              <br>
              Actually this is quite interesting because I have newer
              tried to do that whole root squashfs myself before<br>
              (always just compressed part of the filesystem).<br>
              <br>
              I could try that and report later back if it's worth it.<br>
              <br>
              Stefan<br>
              <br>
              <br>
              22.1.2013 16:35, Stephen Turner kirjoitti:<br>
            </div>
            <div>
              <div class="h5">
                <blockquote type="cite">well actually, i just did a
                  standard buildroot with squashfs so everything except
                  the kernel bzImage is in the squashfs.  I suppose i
                  missunderstood how it worked as i thought having
                  support in the kernel allowed the reading of this file
                  and if thats so i didnt expect to need a initrd
                  especially since none was generated by the buildroot
                  scripts.  I was looking for a solution that worked
                  like that, where i could load it to ram or read it
                  from a disk saving ram but in essence compress
                  everything except perhaps the kernel. I dont suppose
                  there is an option like that is there?<br>
                  <br>
                  <div class="gmail_quote">On Tue, Jan 22, 2013 at 7:41
                    AM, Stefan Fröberg <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:stefan.froberg@petroprogram.com"
                        target="_blank">stefan.froberg@petroprogram.com</a>></span>
                    wrote:<br>
                    <blockquote style="BORDER-LEFT:#ccc 1px
                      solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex"
                      class="gmail_quote">
                      <div bgcolor="#FFFFFF" text="#000000">
                        <div>Hi Stephen<br>
                          22.1.2013 3:25, Stephen Turner kirjoitti:<br>
                        </div>
                        <div>
                          <div>
                            <blockquote type="cite">
                              <p>Sorry if my previous email went
                                through. Im having some difficulty
                                booting a squashfs with grub4dos on usb
                                and grub2 from hd. In short im using
                                bzImage for a kernel and trying to both
                                boot the squashfs in ram and imaged to a
                                usb drive. I havent found much info on
                                how to use the squashfs from busybox and
                                what i did find wasnt very helpful.
                                Could someone point me to a how to for
                                booting a busybox squash? Do i need to
                                make my own initrd Image or edit some
                                files such as fstab? <br>
                                I appreciate any and all input.</p>
                              <p>Thanks<br>
                                Stephen</p>
                              <br>
                            </blockquote>
                            <br>
                          </div>
                        </div>
                        What I usually have is squashfs (xz-compressed)
                        image of the whole /usr (because that's usually
                        the largest).<br>
                        <br>
                        And everything else is in xz-compressed
                        initramfs. Kernel extract and loads the
                        initramfs file(s) that you have <br>
                        specified in grub to  automatically to ram.
                        squashfs image does not need to loaded to ram
                        but mounted to<br>
                        loopback devise /dev/loop0. However, when files
                        are accessed in that image it's contents can be
                        also cached to ram.<br>
                        <br>
                        The basic idea is that everything that is
                        absolutely needed for booting and running, the
                        very minimal core of the<br>
                        system, is located in that initramfs.<br>
                        <br>
                        Now, in the /etc/inittab file there is usually a
                        line like <br>
                        null::sysinit:/bin/mount -a<br>
                        <br>
                        That will instruct that all stuff in /etc/fstab
                        should be mounted.<br>
                        <br>
                        My /etc/fstab look like this<br>
                        # /etc/fstab: static file system information.<br>
                        #<br>
                        # <file system>         <mount
                        pt>    <type>        <options>   
                            <dump>     <pass><br>
                        /modules.sqfs        /lib/modules    squashfs   
                        defaults,auto,loop,noatime    0    0<br>
                        /firmware.sqfs      /lib/firmware    squashfs   
                        defaults,auto,loop,noatime    0    0<br>
                        /dev/cdrom            /mnt/cdrom    iso9660   
                            defaults,noatime    0    0<br>
                        /mnt/cdrom/usr.sqfs        /mnt/ro       
                        squashfs    defaults,auto,loop,noatime    0    0<br>
                        proc                /proc               proc    
                            defaults          0    0<br>
                        devpts                /dev/pts          
                        devpts       defaults,gid=5,mode=620    0    0<br>
                        tmpfs                   /dev/shm          
                        tmpfs       mode=0777             0          0<br>
                        tmpfs                   /tmp              
                        tmpfs        defaults              0          0<br>
                        sysfs                /sys               sysfs   
                            defaults          0    0<br>
                        <br>
                        What that does, is:<br>
                        <br>
                        1 ) mount ./modules.sqfs (xz-compressed squashfs
                        containing kernel modules) to /lib/modules<br>
                        2 ) mount ./firmware.sqfs (xz-compressed
                        squashfs containing firmware stuff) to
                        /lib/firmware<br>
                        3 ) mount Live-CD (the system itself that is
                        running) to /mnt/cdrom. The reason for this is<br>
                        that storing usr.sqfs (xz-compressed squasfhs
                        containing /usr) to initramfs is waste of memory<br>
                        while it can be stored into the root (outside of
                        initramfs) of live-cd. Just like I have done
                        with kernel.<br>
                        4 ) Mount /mnt/cdrom/usr.sqfs to /mnt/ro. <br>
                        The reason for this is that later, in 
                        /etc/init.d/rcS<br>
                        im going to use unionfs to compine
                        read-writeable /mnt/rw (just empty directory
                        without nothing mounted in)<br>
                         and read-only /mnt/ro (the xz-compressed
                        squashfs image from Live-CD root that just got
                        mounted) to compined<br>
                        read-write directory in /usr<br>
                        <br>
                        It's all little compilacted but space and memory
                        saving and stuff can be written to /usr if need
                        to (for example Xorg<br>
                        needs at least one location inside/usr to be
                        writable for fonts if I remember correctly)<br>
                        <br>
                        If you don't need writable /usr then you can
                        just mount your usr-squashfs directly to /usr.<br>
                        If you don't need /usr at all but just want to
                        squashfs your /  then maybe it's doable but you
                        still have to mount<br>
                        few places as read-write for tmp files and other
                        stuff.<br>
                        <br>
                        Like:<br>
                        mount -t tmpfs tmpfs /tmp<br>
                        <br>
                        And maybe<br>
                        mount -t tmpfs tmpfs /var/log<br>
                        <br>
                        Ofcourse those can be also added to /etc/fstab<br>
                        <br>
                        What exatcly you have inside that squashfs ?
                        Just busybox and nothing else ?<br>
                        In that case it's really not worth all the
                        squashfs setup.<br>
                        <br>
                        Regards<br>
                        Stefan<br>
                        <br>
                        <br>
                        <br>
                        <br>
                        <blockquote type="cite">
                          <fieldset></fieldset>
                          <br>
                          <pre>_______________________________________________
buildroot mailing list
<a moz-do-not-send="true" href="mailto:buildroot@busybox.net" target="_blank">buildroot@busybox.net</a>
<a moz-do-not-send="true" href="http://lists.busybox.net/mailman/listinfo/buildroot" target="_blank">http://lists.busybox.net/mailman/listinfo/buildroot</a></pre>
                        </blockquote>
                        <br>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </blockquote>
                <br>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
    </blockquote>
    <br>
  </body>
</html>