| ECS Home Automation and Security Archives |
| Subject: From: Date: | Re: [ecs] Bootable CDROM procedure (estimated :-)) Ingo Pakleppa 09 Oct 2003 00:56:30 -0700 |
On Wed, 2003-10-08 at 15:20, Mark Gilmore wrote:
> Any/all feedback/suggestions are most welcome:
>
> 1) Create CDROM "/" dir:
> mkdir cdrom
> mkdir cdrom/var
> mkdir cdrom/var/lib
> mkdir cdrom
> cd /cdrom
You can shorten the mkdirs to a single one:
mkdir -p /cdrom/var/lib
I would suggest you don't work off the root directory, though. Work
within your home directory:
mkdir -p ~/cdrom/var/lib
cd ~/cdrom
> 2) Init RPM database:
> rpm --initdb --dbpath /cdrom/var/lib/rpm --root /cdrom
Note that this would put the database into /cdrom/cdrom/var/lib/rpm.
Probably not what you meant to do. The dbpath is always off the root
specified with --root.
> 3) Install kernel RPMs (using ("-dbpath /cdrom --root /cdrom") from
> RH9 install CD 1 (D:\RedHat\RPMS).
> But which ones ?:
> kernel-2.4.20-6.athlon.rpm
> kernel-2.4.20-6.i586.rpm
> kernel-2.4.20-6.i686.rpm
> kernel-BOOT-2.4.20-6.i386.rpm
> kernel-bigmem-2.4.20-6.i686.rpm
> kernel-pcmcia-cs-3.1.31-13.i386.rpm
> kernel-smp-2.4.20-6.athlon.rpm
> kernel-smp-2.4.20-6.i686.rpm
Actually, you should probably download the latest kernel; there are
security patches. I think current is 2.4.20-20.9. If you want to stay
generic, I would go for the i586 one.
Here is what these kernels are:
kernel-2.4.20-6.athlon.rpm
For single Athlons. Will fail on other CPUs
> kernel-2.4.20-6.i586.rpm
For single processor Pentiums. Will work on all recent CPUs.
> kernel-2.4.20-6.i686.rpm
For single processor Pentium IIs. Will fail on older Pentiums.
> kernel-BOOT-2.4.20-6.i386.rpm
Presumably, small kernel for bootstrapping.
> kernel-bigmem-2.4.20-6.i686.rpm
This kernel supports 3 GB of RAM instead of the usual 2 GB.
> kernel-pcmcia-cs-3.1.31-13.i386.rpm
Presumably, a kernel that contains support for PCMCIA cards (really only
used for wireless cards, IMX). I'm not really sure what this one is for,
since AFAIK, pcmcia is built into the regular kernels, too.
> kernel-smp-2.4.20-6.athlon.rpm
> kernel-smp-2.4.20-6.i686.rpm
Multiprocessor kernels.
> 4) Install Mozilla (and any packages on which it depends).
Stay away from Mozilla. This would open a HUGE can of worms because you
first have to install X Windows. That's virtually guaranteed to not fit
onto a CD.
> 5) "Make sure that none of the files in/etc are written to."
> Not sure how I'm supposed to tell, other than to start/exit
> Mozilla and then see if any files in /etc have been updated.
It is indeed a bit tricky. The easiest way to tell is to burn the
software onto CD, and then see which programs fail.
I had to use links for the following files:
/etc/resolv.conf
/etc/hosts
/etc/sysconfig/network
Chances are that if you are using RH, you will have a number more.
> "If they are, move them to /var/etc and create a symbolic link".
> I assume that such a link will "redirect" /etc to /var/etc ?
Not quite. While such a link could represent a whole directory, in this
case you would want to redirect only individual files. For instance:
ln -s /var/etc/resolv.conf /etc/resolv.conf
> 6) "Create a startup script that mounts the CD as "/" and the hard disk as
> /var".
> I assume that this step should really come *before* #7.
Correct.
> But where do I place these commands ?
Your best bet is probably to start with the RedHat initscripts package.
Unfortunately, you are going to have to understand them, there is no way
around that. The initscripts are quite complex; they are designed for
easy administration and flexibility (and many linux applications expect
them to be organized more or less along the standard ways).
Most parts of the initscripts system are what you find in /etc/rc.d. The
entry point is /etc/rc.d/rc.
> And is it not critical to redirect /var to the hard disk
> *very* early in the boot process ?
Actually, not that early. But something else does need to happen very
early in the boot process: the CD itself needs to be mounted. The kernel
actually typically doesn't do that! You can tell the kernel to do so on
the kernel command line. Usually, though, you'll use an initrd.
An initrd is a compressed file that contains a file system (yes, you can
do that in Linux!) So the kernel would take this initrd, uncompress it,
mount *it*, and then turn over control to an executable stored in a
directory inside the initrd. This executable, in turn, would then launch
scripts using a shell (in initrd, one would typically use ash or
busybox, although RedHat uses their own nash). This script, in turn,
would then locate and mount the CD-ROM. Now the problem at this point is
that initrd at this point is mounted as /. So you can't just mount the
CD-ROM where you want it. Instead, you mount the CD somewhere else.
There is a special command, called pivot_root, that essentially swaps
the CD-ROM drive and the initrd drive. From that point on, the CD-ROM
suddenly is mounted as root. As the very last step, the script would
then turn over control to the startup scripts.
> Otherwise, attempted writes to boot.log will fail.
>
> 7) Create a bootable CD holding contents of /cdrom.