compressing nanoBSD image

Aleksandr Rybalko ray at freebsd.org
Sat Dec 8 23:19:55 UTC 2012


On Sat, 8 Dec 2012 06:09:49 -0800 (PST)
Jack Mc Lauren <jack.mclauren at yahoo.com> wrote:

> > Hi all
> 
> > 
> > Are there any ways to compress the nanoBSD image and decompress it
> > at boot time ?
> > 
> > Thank u all 
> 
> >>Hi!
> >>
> >>you can use mkuzip/mkulzma and geom_uncompress in kernel.
> >>But Read-only of course. 
> >>
> >>WBW
> >>-- 
> 
> Thank you so much.
> Can you help me with an example please ?
> 
> Thanks

Yeah, sure!

Assume you have rootfs dir, then
makefs -d 255 -t cd9660 -o "rockridge" rootfs.iso rootfs
mkulzma -v rootfs.iso.ulzma -s 131072 rootfs.iso

So now you have rootfs.iso.ulzma which is rootfs files in the ISO9660
filesystem packed into ulzma (each block compressed with LZMA)

so you have to have already loaded kernel with geom_uncompress inside
and that image at begin of any attached to system media, or on some
partition/slice of media.

For example, if you have only CF card to boot, you need way to load
kernel first. You can put kernel on separate partition (since ulzma
inaccessible yet, till kernel started), or depend on loader(BIOS)
ability it can be even some blocks of card w/o any FS. Then
when kernel done attaching media, GEOM inspect meta info on it, parse
partitions, find header of ulzma and attach it as
"something.uncompress".

If you put rootfs.iso.ulzma into /dev/da0s2, then it appear
as /dev/da0s2.uncompress, and you will able to mount it with
mount -t cd9660 /dev/da0s2.uncompress /dir.

etc.

WBW
-- 
Aleksandr Rybalko <ray at freebsd.org>


More information about the freebsd-embedded mailing list