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

Re: Creating an initrd - micro-howto

hi ya will

there is no initrd howto that i could find...

those docs i did find in google searches were out of date....
and incomplete in terms of getting a flash disk that you can boot
into  /dev/ram0

-- lets assume that tomsrtbt is too small on the 1.77Mb floppy
   and cdrom is too much hassle to make to boot into /dev/ram ???

we can take it offline to get you a working initrd
( am assumign you have another pc that we can debug it on

c ya

more expanded micro-initrd Flash howto ( from vague recollection of memory)
	am assuming you wanna boot from floppy or better if
	booting from 4Mb flash to be on /dev/hda on the target

A1.  Get a spare PC...
A2.  boot it normally...
A3.  install the kernel you wanna be using and compile it
     and boot until you got the bootable kernel 
A4.  make a boot floppy
A5.  boot the floppy.... if it works...good...now we can start

B0.  Move things around so that you are using ONLY /dev/hdb for
     your own development system
	- use /dev/hda as your flash device on your cev box
	and/or it will be the only disk on your target firewall

B1.  change/update your kernel to support initrd
	- turn on mimixfs
	- turn on /dev/ram
	- turn on /dev/loop  ( better than /dev/ram ?? )
	- you will be tweeking /dev/ram to support 8MB or 16Mb
	  since /lib/libc-2.* is how big ???
	- /lib /boot /root /bin /sbin /etc must all fit in /dev/ram0
	- keep playing with your kernel till you can 

B2.  make ANOTHER boot floppy....
	- something you can play with

B3.  make some ram devices

	dd if=/dev/zero of=/dev/ram0 bs=1k count=8192
	dd if=/dev/zero of=/dev/ram1 bs=1k count=8192
	# you're gonna be tweek -i to cram more bytes into the ram device
	mke2fs -m 0 -i 2000 /dev/ram0
	mke2fs -m 0 -i 2000 /dev/ram1
        mount /dev/ram0 /mnt/ram0
        mount /dev/ram1 /mnt/ram1

B4.  Start putting what is "required" to boot your server
     into the initrd file
	# make a script that does this
	# ============================
	# i forgot where mkinitrd puts its stuff
	#	- check your fs -- makes it easy
	#	- using mkinitrd helps solve some directory
	#	and copy problem but i forgot where it put stuff
	# mkinitrd

	-- lets do things the had way

	# the boot FLOPPY  that DOES work...
	mount /dev/fd0 /mnt/floppy
		= you should be able to see the guts of your boot floppy

	# make some directories for /var/log /tmp 
	mkdir /mnt/ram0/tmp /mnt/ram0/usr/tmp
	chmod 1777 /mnt/ram0/tmp /mnt/ram0/usr/tmp
	mkdir /var/log
	mkdir /var/run
	mkdir /var/spool
	# Copy the contents from the working bootable floppy
	# to your new boot media that we gonna create
	# remember the boot floppy assume /dev/hda1 or /dev/sda1
	# for root... we are gonna use /dev/ram0
	cp -par /mnt/floppy/bin /mnt/ram0/bin
	cp -par /mnt/floppy/etc /mnt/ram0/etc
	cp -par /mnt/floppy/dev /mnt/ram0/dev
	cp -par /mnt/floppy/lib /mnt/ram0/lib
	cp -par /mnt/floppy/boot /mnt/ram0/boot
	cp -par /mnt/floppy/sbin /mnt/ram0/sbin
		- fix /mnt/ram0/etc/fstab to point to /dev/hdaxx

	be sure to add/copy your basic/favorite commands into /mnt/ram0:
		bash, ls, ping, route, ifconfig, ps, top, dd,
		mount, cp, mv, etc..etc..
	# copy other non-critical, would be nice ot have commands
	# into/mnt/ram1

	# now lets create your initrd file
	dd if=/dev/ram0 of=/tmp/initrd.test bs=1k
	gzip /tmp/initrd.test.gz
        dd if=/dev/ram1 of=/tmp/initrd.extra bs=1k
        gzip /tmp/initrd.extra.gz
	cp -p /tmp/initrd.test.gz /boot
	cp -p /tmp/initrd.extra.gz /boot
	# the kernel you want should already be in /boot

B5.  Create a temporary lilo.Test.conf file
	# Create a boot media that boots into /dev/ram0
	# on the development machine, the flash is /dev/hda
	# Create a bootable flash disk
	# the flash disk will be hda on the target firewall
	# end of file

	# Run lilo.conf
	lilo -C /etc/lilo.Test.conf

	== the target flash disk should only need /boot/...stuff...

	== take the flash to virgin PC... and boot it there

	-- boot the flash ( on hda )  ... if it worked...
	you'd have /dev/ram0 as your root partition

	-- if it didnt boot....you're missing some required binaries

		- go back to the development box and see whats missing
		and add the missing binaries/libraries

have fun

On Tue, 8 May 2001, will trillich wrote:

> On Tue, May 08, 2001 at 08:32:01PM -0700, Alvin Oga wrote:
> > mkinitrd  ...
> > 
> > or take an existing initrd.gz file...decompress it
> > into /dev/ram  or /dev/loop
> > 	
> > than change the kernel to your version, add your libs/commands
> > and other stuff you want in the initrd to make your system
> > bootable
> > 
> > and compress that /dev/loop image into  your_initrd.gz   and add that
> > as your initrd image in lilo
> > 
> > or so goes the simplified 3-line howto...
> um, point the way or name the doc, if you would.
> > either way...you need to make sure you have minixfs and /dev/ram enabled
> > in your kernel to be able to create initrd files
> eh?
> > i created a full system in about 2.5Mb that expands into 8-16Mb of 
> > linux hierachy that runs in memory ( /dev/ramxx )
> > 	( put that on a 4Mb flash and you've got a nice firewall ?? )
> ding ding ding! you've got my attention... that's almost
> precisely what i'd like to accomplish. can you do that with
> debian?
> > you can try tomsrtbt too but, its bash is too small as is its libraries
> do you have a more fleshed-out documentation trail of making a
> uncompress-onto-ramdisk-during-boot system?
> -- 
> DEBIAN NEWBIE TIP #3 from Will Trillich <will@serensoft.com> 
> :
> Wondering how to find WHICH PACKAGE CONTAINS x-y-or-z? Just enter
> "dpkg -S part/of/path" and you'll get a list of all packages that
> affect paths like that. For an example, try "dpkg -S http".
> Also see http://newbieDoc.sourceForge.net/ ...
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: