On Thu, 2009-05-21 at 12:25 +1000, Jake Anderson wrote:
> I can see how it can be done, but I don't imagine I'm the first person 
> to want to do something like this and I was wondering if anybody had 
> some experience with a similar solution?

It can easily be done with a specially crafted initramfs and a partition
to hold an image on. It's the fastest solution from a reimaging
perspective, but actually building the system may take some time.

Basically build a statically-compiled dd, statically-compile a simple
little C program (as /init) to exec the dd, and have a minimal udev
system (don't know if there's anything simpler).

Basically, you use cpio to archive those couple of files and tell grub
to boot the initramfs with an existing kernel. The tiny /init will exec
dd with the appropriate parameters (e.g. dd if=/dev/sda3 of=/dev/sda2).

Easiest way to play around with that stuff is with QEMU. QEMU can boot a
kernel and initrd without even needing to set up a virtual disk with
bootloaders and stuff: qemu -kernel /boot/vmlinuz -initrd=/your/initrd

I've got some scripts and makefiles around for doing this exact stuff.
Most important thing is to statically compile stuff. Tracking down
shared libraries is a pain, even with the use of ldd. With only two or
three executables, your initrd will not even grow beyond a megabyte or
two.

The system hinges on GRUB working, and having the kernel and initrd not
die. For best results, keep them in /boot and on a separate partition,
preferably sda1 (or mmcblk0p1 if it's embedded).

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to