[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: is it possible to install a custom initramfs USB bootable system?



Miernik wrote:

> Hello,
> 
> I have a computer with 10 GB of RAM, but no hard disks. I want to
> install Debian to make it work this way:
> 
>  1. Debian is installed in RAM (maybe from PXE netboot)
> 
>  2. with some command a compressed squashfs image is created of the
>     current system, and saved on an USB flash stick
> 
>  3. the next time the system needs to be booted, it is booted from this
>     USB flash stick, fetched and uncompressed totally into RAM, and then
>     this flash stick is removed (it should not be needed for this stick
>     to stay inserted while the system works, only for boot)
> 
>  4. when (after) the system is upgraded (in live initramfs), a command
>     (from point 2.) is run again to update the compressed squashfs image
>     on the USB stick
> 
> Something similar to
>
http://www.gentoo-wiki.info/HOWTO_VERY_small_Portage_Tree_with_SquashFS_and_UnionFS
> for Gentoo portage tree (but for the whole system).
> 
> How can I achieve this setup?
> 
> I've seen http://wiki.debian.org/DebianLive/Howto/USB
>
http://lists.alioth.debian.org/pipermail/debian-live-devel/2007-September/002133.html
> 
> Is RAMboot something I need to use?
> 
> I would also like all programs to be executed in place (with XiP) and
> not copied into another portion of RAM for execution (which would be a
> waste of memory and time).
> 
> Pointers for the most efficient way to go apprecieated.

Hello,
it seems that you are trying to do something I partially accomplished in two
different projects - vreate a live cd and create a minimal usb bootable
stick.
In the first project I used sqashfs in the second I didn't, but I could if I
would have needed it. IT's just that the system I need this for has a USB
and CFlash and I used them to boot. IT has only 128MB ram, so I prefer not
to load that much into ram.

The way I remaster the initram is pretty simple (I actually have a kind a
config to do so) and this is the frame

shell# cd /tmp
shell# mkdir testird
shell# cd testird
shell# UNcompress the initrd 
shell# zcat /mnt/target/boot/<YOUR_INITRD> | cpio -i

<do what ever you want to do with it>

shell# find . ! -name "*~" | cpio -H newc --create | gzip -9
> ../test-initrd.gz

<think twice>

shell# mv ../test-initrd.gz /mnt/target/boot/<YOUR_INITRD>

if you want to use sqashfs on ram you should add lines in your initrd to
uncompress the fs and mount it in ram ... but actually it is done if you
don't have any phisical disk or the disk you have is not writable

Using a usb stick or CFcard makes it eassier, so I don't really think you
would need the ram thing in your project

REMARKS:
1) I found out that if I create my own initrd I save time on bootup compared
to the mkinit* scripts
2) I don't think nfsboot and nfsroot are good for firewalls or a like
systems - there are rather good for diskless clients in protected networks
AFAIK

regards



Reply to: