SV: Network install to hard drive

"Eliassen Einar (ErgoGroup)" <[email protected]>
Newsgroups gmane.linux.pxes.devel
Message-ID <B719AAEE5D0F0E4EACC65EB115828147DCB3C7@SEBOX012>
Hello again list.

Sorry I didnt answer earlier...I spent the weekend offline....and the
mailinglist had some major problems yesterday.

And I messed up AGAIN...hehe...I changed my return address yesterday...so
when I sent this mail today I had to await moderators approval.
To get this mail in sooner I removed my old address from the list and
re-subscribed with the new address. Worst case scenario is there will be 2
copies of this mail on the list. :|

Here's the complete instructions on how I did it....any why.

Just a little update first.
I've made some modifications since last time. I no longer use network
booting as much. I've moved the installimage onto a CD and using ISOLINUX to
boot it. For old computers unable to boot from CD I use LOADLIN from a DOS
prompt. More on that later. Also, I am using a FAT16 filesystem on the
clients. This is because I also use HP t5300 clients who come with Windows
CE on a FAT16 partition. So to make it easier I don't need to re-partition
the HP clients...I just format them with mkdosfs. The filesystem doesn't
really matter anyways since Grub just reads the initrd and kernel and then
starts PXES...which in turn is totally run in RAM on its own filesystem :)

So here we go:
First, make a copy of the orginal stock directory...name it 'test' or
something. Strip it down for anything you dont use. Like drivers for
network,sound,graphics etc. Also remove big binary files you are not going
to use. Once I did this, I got the final image down to 3MB. (By running
pxesconfig and making a 'telnet' session) Then you need to copy SFDISK,GRUB,
and MKDOSFS. I think I also mentioned FDISK before, but I don't use that. My
bad. Also, the TFTP binary I used before is now obsolete. Remember that
these programs require some libraries too. I didn't write down these I'm
afraid, so you just have to add them as you go...or search them up on the
net and add them. I did it the hard way......checked the error
message...then added that file...and kept on going until all errors were
gone ;) Once that is done, you will be able to run any of the programs I've
mentioned without problems.

Then you need to edit /opt/pxes-0.8/stock/dist/bin/starttext

Look for: "case "$Session" in
			telnet)
			exec pmonitor $PMO /usr/bin/telnet.sh
			;;
Change this to:
		"case "$Session" in
			telnet)
		exec /bin/install
			;;

That install file is our installscript.
I have 2 kinds of installscripts. One is used for ISOLINUX booting (CD) and
the other for LOADLIN (booting from a DOS prompt). I have copied the
pre-made thin client image into the installimage itself along with the
kernel. This bumps up the size of the installimage, but it eliminates the
need for an TFTP server if you use ISOLINUX or LOADLIN. The method I'm using
right now is installation CDs and installation diskettes. When using
ISOLINUX: Copy the grub files stage1,stage2,fat_stage1_5 and the grub binary
itself to the /bin directory in PXES. Copy the kernel image and the pre-made
initrd image to /bin too. And here is a goodie for you all: I have attached
my installscript for you to use. File for ISOLINUX is 'install-iso.txt' Then
when you have put all this together in the stock directory you made, you run
PXESCONFIG and make the installimage. My file adds up to roughly 11MB. 3 MB
for the telnet image itself, and 7 MB for my initrd and about 700k for the
kernel.

Use ISOLINUX to make a bootable CD with this installimage. I will not cover
this here. It's easy and well documented on the SYSLINUX homepage. This will
give you a complete install CD. If you need to use several kinds of image
for different hardware, then just replace the initrd file and make another
installimage, add it to ISOLINUX and make a menu. My personal installation
CD has 2 entries in ISOLINUX which I choose from at boot. Installation is
pretty easy and fast from here on :)



And now for those OLD computers who can't boot from CD:
(Using LOADLIN:)
This is a funny hack I must admit. Mostly due to problems I had with LOADLIN
on my hardware. When I used my installimage (11MB) on LOADLIN it crashed and
rebooted the computer. With no obvious error indication. I guess the image
was too big. So.... I use the same procedure as I did in the ISOLINUX
method, except I DON'T add the kernel or initrd file into the installimage
itself. The installimage,initrd and kernel is added seperate on the CD. So
you have the installimage at 3MB, initrd at 7MB and the kernel 700k on the
CD. The other files are so small it doesn't matter. I kept all the grub
stuff in the installimage. I boot from a DOS diskette with LOADLIN and
CD-ROM drivers on it. DOS boots up, loads the cd-rom driver and runs LOADLIN
from the diskette, but LOADLIN loads the kernel and installimage from the
CD. Then when installimage is started, it runs a different installscript
than the one I made for ISOLINUX. This installscript does about the same
thing as the previous one, but it also mounts the CD and copies the files
onto the harddisk :) And yes...this script is attached as well... ;) Its
called 'install-loadlin.txt'

This way you only need a CD for computers able to boot from CD, and
CD+DISKETTE for the old computers. You can also use the network method, just
run the installimage you made for ISOLINUX over the network via PXE :) Here
the Etherboot floppy images come in handy if you have old network cards who
don't support PXE. The 'beta' version of Etherboot supports PXE :)

Notes:
I added the fat_stage1_5 file when I encountered problems with Grub and old
computers/bios. Got geometry errors...I think :) So I put fat_stage1_5 in
there and added the 'd' switch to the grub command. Not sure if that file
was needed, but it solved my problems and didnt take up any noticable space.
When making the installimage (telnet session), just type anything as IP
adress. Doesn't matter. I have also attached an example of my grub.conf
file. :)

This mail got kinda long...due to all my ramblings between all the
instructions... :p I hope this helps out anyone struggling with this, and if
someone still require assistance with something or if I am rambling too much
somewhere and don't explain good enough...just let me know :) Maybe someday
when I have time I will write up a more clean HOWTO on this subject. ;)

And.... Hello Diego! I'm loving PXES more and more each day. Sorry I
couldn't meet up with you at LinuxTag. :( Next time you're in my
'neighborhood' let me know :)


Regards,
Einar Eliassen




-_____________________________________________ 

The contents of this e-mail are confidential to the person(s) or
organisation(s) to whom it is addressed. No-one else may copy or forward all
or any of it in any form without the prior written consent of the
originator. If you have received this e-mail in error, please contact the
sender and delete the material from any computer.
grub.conf.txt (text/plain, 156 B)
default=0
timeout=1

title Trondheim
	root (hd0,0)
	kernel /boot/midgard root=/dev/ram ramdisk_size=32768 init=/linuxrc console=null
	initrd /boot/trondspq2
install-iso.txt (text/plain, 953 B)
#!/bin/sh

# Comment for PXES list: My kernel file is called midgard.
# My initrd file is called trondspq2.
# I also have several grub files which I used in different network installs
# Thats why I copy grub.trondheim5 to grub.conf.
# You could just name it grub.conf to begin with.


clear
echo "Installation started......."
modprobe ide-disk

sfdisk /dev/discs/disc0/disc << EOF
,50,4
;
EOF

mkdosfs /dev/discs/disc0/part1

mount /dev/discs/disc0/part1 /mnt/flash -t vfat
mkdir /mnt/flash/boot
mkdir /mnt/flash/boot/grub
cp /bin/stage1 /mnt/flash/boot/grub
cp /bin/stage2 /mnt/flash/boot/grub
cp /bin/fat_stage1_5 /mnt/flash/boot/grub
cp /bin/midgard /mnt/flash/boot
cp /bin/trondspq2 /mnt/flash/boot
cp /bin/grub.trondheim5 /mnt/flash/boot/grub/grub.conf

cd /
umount /mnt/flash
sync
sync
sync

#Install Grub
/sbin/grub --batch <<EOT 1>/dev/null 2>/dev/null
root (hd0,0)
setup (hd0)
install /boot/grub/stage1 d (hd0) /boot/grub/stage2
quit
EOT

#Done
install-loadlin.txt (text/plain, 1.1 KB)
#!/bin/sh
# Comment for PXES list: My kernel file is called midgard.
# My initrd file is called trondspq2.
# I also have several grub files which I used in different network installs
# Thats why I copy grub.trondheim5 to grub.conf.
# You could just name it grub.conf to begin with.


clear
echo "Installation started...."

modprobe ide-disk
modprobe ide-cd

sfdisk /dev/discs/disc0/disc << EOF
,50,4
;
EOF

mkdosfs /dev/discs/disc0/part1
mount /dev/discs/disc0/part1 /mnt/flash -t vfat
mkdir /mnt/flash/boot
mkdir /mnt/flash/boot/grub
cp /bin/stage1 /mnt/flash/boot/grub
cp /bin/stage2 /mnt/flash/boot/grub
cp /bin/fat_stage1_5 /mnt/flash/boot/grub

mount /dev/cdroms/cdrom0 /mnt/cdrom -t iso9660

cp /mnt/cdrom/midgard /mnt/flash/boot/midgard
cp /mnt/cdrom/trondspq2 /mnt/flash/boot/trondspq2
cp /bin/grub.trondheim5 /mnt/flash/boot/grub/grub.conf

cd /
umount /mnt/flash
sync
sync
sync
umount /mnt/cdrom

#Install GRUB
/sbin/grub --batch <<EOT 1>/dev/null 2>/dev/null
root (hd0,0)
setup (hd0)
install /boot/grub/stage1 d (hd0) /boot/grub/stage2
quit
EOT

clear
echo
echo
echo
echo "Installation finished!"
echo

#Done
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.