<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">Hello Stephen<br>
<br>
I made a quick conversion of my LiveCD initramfs stuff to squashfs
image file and then played little bit with it and kernel image<br>
with the help of qemu. (took less time than starting all
reconfiguring/combiling from buildroot)<br>
<br>
The good news is that yes, it should be doable to do boot directly
from squashfs root image.<br>
<br>
For example I did this to start it (ramdisk_size is in kilobytes):<br>
<br>
qemu-system-i386 -kernel bzImage -initrd rootfs.sqfs -append
"ramdisk_size=131072"<br>
<br>
It first tries to unpack rootfs as initramfs and then it notices
that it's not initramfs but traditional,<br>
older version of initrd file. (please see root.png).<br>
<br>
After that it should print RAMDISK: squashfs filesystem found and
start automatically loading it to ram.<br>
(please see root2.png)<br>
<br>
After that it continues normally and starts the normal init
process.<br>
<br>
And now the bad news:<br>
<br>
- Takes a lot of memory. This is old style initrd stuff (time when
2.4 kernel was still hot and new).<br>
- Squashfs is read-only so if you use mdev or udev then expect
little troubles (please see root3.png).<br>
<br>
However maybe buildroot init already takes care of those ????<br>
<br>
<br>
Now, you said you use grub to load ? Then either try givin that
rootfs.sqfs as in a separate line starting with "initrd
/path/to/your/rootfs.sqfs"<br>
in your grub menu.lst (or is it grub.conf now?) <br>
or if that does not work then giving kernel parameter in kernel
line like "initrd rootfs.sqfs" (or maybe "initrd=rootfs.sqfs")<br>
<br>
The other way of using squashfs root from image could be maybe
done with initramfs and that script that Arnout posted (without
unionfs stuff in your case).<br>
But maybe it needs some cleaning up first and pivot_root changed
to switch_root ???<br>
<br>
Adding maybe this line to init script inside your initramfs to
mount rootfs.sqfs to loopback device just before switching to
realroot:<br>
<br>
mount -o loop rootfs.sqfs /mnt/realroot<br>
switch_root /mnt/realroot<br>
<br>
.... init continues normally here in the real root (squashfs image
mounted to loopback device, usually /dev/loop0) ....<br>
<br>
<br>
Regards<br>
Stefan<br>
<br>
25.1.2013 1:47, Stephen Turner kirjoitti:<br>
</div>
<blockquote
cite="mid:CAN_xxrXsvvupyo61cqZhCR4JyLwtCsm1NRAh9JCy_uVHRqGO4A@mail.gmail.com"
type="cite">
<p>Im hoping to use the raspberry pi (may need the special
buildroot distro for that) but really were building this for soc
risc boards in general. I am trying to stay away from loading to
ram since its limited and we will be doing something like a
freebsd nanobsd setup where scripts update software to 2
partitions one backup other booting. That way they have a fall
back in the event a update goes south. It would be ideal to run
the systems from a file instead of dd a image to an area. If i
cant boot from the squash file then im thinking of just
squashing the usr and mounting it at boot like i have done now
as that leaves me with a 2 mb initrd + 40mb squash and 5 mb
kernel so far on a 586 for a pilot.</p>
<div class="gmail_quote">On Jan 24, 2013 5:40 PM, "Stefan Fröberg"
<<a moz-do-not-send="true"
href="mailto:stefan.froberg@petroprogram.com">stefan.froberg@petroprogram.com</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div>Thin client? Ah, now I beging to understand why you
needed to load that squashfs image into ram.<br>
<br>
So your thin client is totally diskless ? No hard drive at
all ? <br>
And you plan to load your squashfs image from server or
usb stick or from where ?<br>
<br>
Stefan<br>
<br>
<br>
24.1.2013 21:29, Stephen Turner kirjoitti:<br>
</div>
<blockquote type="cite">
<p>I shouldnt need unionfs as im just loading a basic
thinclient and having it in a ro image would be best to
prevent accidental or intentional tampering when a
simple reboot will fix. The rw items can use a temp
ramdisk. Only issue i was running into was figuring out
how to read a squashfs at boot with no initrd or
basically busybox squash output which is only bzImage
and rootfs.squashfs. i have managed to move usr to
squash and use the rest of the os as initrd but if thats
what needs to be done then shouldnt the busybox build
script handle that?</p>
<div class="gmail_quote">On Jan 24, 2013 1:50 PM, "Arnout
Vandecappelle" <<a moz-do-not-send="true"
href="mailto:arnout@mind.be" target="_blank">arnout@mind.be</a>>
wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"> On
01/22/13 13:41, Stefan Fröberg wrote:<br>
[snip]<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
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>
</blockquote>
<br>
Now this is a real use case for being able to split
the rootfs into several parts.<br>
<br>
However, as Thomas mentioned, it's simpler to just
use a complete squashfs rootfs and put the unionfs on
top of that. How? Somewhere early in your init.d you
put something like the following (a script I swiped
from the internet, don't remember where from; I
haven't actually tested it myself):<br>
<br>
#!/bin/sh<br>
<br>
CHROOT_PATH="/tmp/unionfs"<br>
UNION_OPT="-o
allow_other,use_ino,suid,dev,nonempty,chroot=$CHROOT_PATH,max_files=32768"<br>
<br>
#mount -t proc proc /proc<br>
#mount -t tmpfs tmpfs /tmp<br>
<br>
mkdir -p $CHROOT_PATH/root<br>
mkdir -p $CHROOT_PATH/rw<br>
mkdir -p /tmp/union<br>
<br>
# Mount the filesystems<br>
mount --bind / $CHROOT_PATH/root<br>
# $CHROOT_PATH/rw is already on a tmpfs so doesn't
need to be mounted<br>
<br>
modprobe fuse<br>
$CHROOT_PATH/root/usr/bin/unionfs $UNION_OPT
/rw=RW:/root=RO /tmp/union<br>
<br>
#mount -t proc proc /tmp/union/proc<br>
<br>
cd /tmp/union<br>
mkdir oldroot<br>
pivot_root . oldroot<br>
cd /<br>
<br>
# Move existing mounts, if any<br>
#umount /proc<br>
mount --move /oldroot/proc /proc<br>
mount --move /oldroot/dev /dev<br>
mount --move /oldroot/sys /sys<br>
mount --move /oldroot/tmp /tmp<br>
rmdir /tmp/union<br>
<br>
-- <br>
Arnout Vandecappelle arnout
at mind be<br>
Senior Embedded Software Architect <a
moz-do-not-send="true" href="tel:%2B32-16-286500"
value="+3216286500" target="_blank">+32-16-286500</a><br>
Essensium/Mind <a
moz-do-not-send="true" href="http://www.mind.be"
target="_blank">http://www.mind.be</a><br>
G.Geenslaan 9, 3001 Leuven, Belgium BE 872
984 063 RPR Leuven<br>
LinkedIn profile: <a moz-do-not-send="true"
href="http://www.linkedin.com/in/arnoutvandecappelle"
target="_blank">http://www.linkedin.com/in/arnoutvandecappelle</a><br>
GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963
ECAB 2450 2F1F<br>
</blockquote>
</div>
</blockquote>
<br>
</div>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>