OS Hacking and more.


Altering a microroot image

In order to create a proxy /sbin/init in x86.microroot, we'll need to unpack the microroot image. x86.microroot happens to be a gzipped ufs disk image, so this process is pretty easy.
From Solaris:

$ gzip -dc x86.microroot > microroot.img
$ lofiadm -a /[Wherever the image is]/microroot.img
$ mount /dev/lofi/3 /mnt2

from Linux it's read-only and therefore more troublesome, so I'll neglect that for now.
We now have x86.microroot mounted at /mnt2, where we can edit it.

When we're done, all that needs to be done to repack it is:

$ umount /mnt2
$ lofiadm -d /[Path to microroot]/microroot.img
$ gzip -c1 microroot.img > x86.microroot

This is a good place to perform other space-saving alterations to x86.microroot...check out solaristhings.blogspot.com/ Make sure your microroot is still able to import zpools and mount zfs volumes after any and all alterations are made.

Previous Step
Next Step

1 comment:

joeykork said...

For linux, you can mount the microroot like so:

LOOP=$(losetup -f)
mkdir tmp
mkdir mnt

zcat x86.miniroot > tmp/x86.miniroot
losetup $LOOP tmp/x86.miniroot
mount -t ufs -o ro,ufstype=sunx86 $LOOP mnt
mount -o remount,rw mnt

"-o loop" will not work! You have to do it this way to get around the kernel complaining about the UFS being dirty (and refusing the +w bit)