old-www/HOWTO/Network-boot-HOWTO/x359.html

924 lines
18 KiB
HTML
Raw Permalink Blame History

<HTML
><HEAD
><TITLE
>Several ways of obtaining the kernel</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="Network Boot and Exotic Root HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Clients setup, creation of the root filesystem"
HREF="x251.html"><LINK
REL="NEXT"
TITLE="How to create diskless MS-Windows stations?"
HREF="x537.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Network Boot and Exotic Root HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x251.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x537.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN359">6. Several ways of obtaining the kernel</H1
><P
>We have spoken so far about the client and server's configuration for operation after the BOOTP request has been issued by the client, but the first problem is that most computers are not able to behave as BOOTP clients by default. We will see in this section how to fix this.</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN362">6.1. BOOTP or DHCP capable NICs</H2
><P
>This is the most simple case: some network cards provide a supplement to the BIOS, containing a BOOTP or DHCP client, so just setup them for BOOTP or DHCP operation in the BIOS, and you're done.</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN365">6.2. Kernel on a local floppy or hard drive</H2
><P
>These cases are also quite simple: the kernel is loaded from a local drive, and all the kernel has to do is to obtain its network parameters from BOOTP, and mount its root filesystem over NFS; this should not cause any problem. By the way, a local hard drive is a good place to leave a <TT
CLASS="FILENAME"
>/var</TT
>, <TT
CLASS="FILENAME"
>/tmp</TT
>, and a <TT
CLASS="FILENAME"
>/dev</TT
>...</P
><P
>If you have a local hard drive, all you have to do is to use lilo or your favourite boot loader as usual. If you use a floppy, you can use a bootloader or simply write the kernel on the floppy: a kernel is directly bootable.This enables you to use a command like the following:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>dd if=zImage of=/dev/fd0 bs=8192
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
>However, Alan Cox told in a linux-kernel thread that this feature of the linux kernel will be removed sooner or later, you thus will have to use a bootloader even on floppies some day. I know this still works with 2.4.11 kernels, but support seems to have been removed in the 2.4.13 version. See the sixth chapter of the <A
HREF="http://www.tldp.org/HOWTO/Bootdisk-HOWTO/index.html"
TARGET="_top"
>boot-disk-HOWTO</A
> for this topic.
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN376">6.3. Bootloader without kernel on a local floppy or hard drive</H2
><P
>Certain bootloaders are network aware, you may thus use them to download the kernel image from the network. Some of them are listed below:</P
><P
></P
><UL
><LI
STYLE="list-style-type: opencircle"
><P
><A
HREF="http://netboot.sourceforge.net"
TARGET="_top"
>netboot</A
>, a bootloader dedicated to network boot.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
><A
HREF="http://www.gnu.org/software/grub/"
TARGET="_top"
>GRUB</A
>, the GNU project's GRand Unified Bootloader, which is a very general purpose bootloader.</P
></LI
></UL
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN386">6.4. Creating ROMs for the clients</H2
><P
>Many network cards include a slot in which one can insert an EPROM with additional BIOS code. This enables one to add, for instance, BOOTP capabilities to the BI0S. To do so, you will first have to find how to enable the EPROM socket. You may need a jumper or a special software to do so. Some cards like the 3Com 905B have slots for EEPROMs which enable one to change the software in the EEPROM in place. In appendix, you'll find the information about EPROM and various types of memory chips.</P
><P
>For a list of EPROM burner manufacturers visit the Yahoo site and go to <A
HREF="http://dir.yahoo.com/Business_and_Economy/Companies/Computers/Hardware/Peripherals/Device_Programmers/"
TARGET="_top"
>economy-&#62;company-&#62;Hardware-&#62;Peripherals-&#62;Device programmers</A
> or check out the old Diskless-HOWTO <EM
>List of EPROM burner manufacturers</EM
> section.</P
><P
>If you choose to create your own ROMS, you will have to load a BOOTP or DHCP capable software in the ROM, and then, you will be in the case of BOOTP or DHCP capable NICs described above.</P
><P
>You will also need to find the proper EPROM size and speed for your NIC. Some methods to do so are provided in appendix, because the NICs manufacturers often do not provide this information.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN394">6.4.1. LanWorks BootWare PROMs</H3
><P
>This information may save you time. In order to make LanWorks BootWare(tm) PROMs to correctly start up a linux kernel image, the "bootsector" part of the image must be modified so as to enable the boot prom to jump right into the image start address. The net-bootable image format created by netboot/etherboot's `mknbi-linux' tool differs and will not run if used with BootWare PROMs.</P
><P
>A modified bootsector together with a Makefile to create a BootWare-bootable image after kernel compilation can be found at:
<P
></P
><UL
><LI
STYLE="list-style-type: opencircle"
><P
>Bwimage package: <A
HREF="ftp://ftp.ipp.mpg.de/pub/ipp/wls/linux/bwimage-0.1.tgz"
TARGET="_top"
>ftp://ftp.ipp.mpg.de/pub/ipp/wls/linux/bwimage-0.1.tgz</A
></P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>See also <A
HREF="http://www.patoche.org/LTT/net/00000096.html"
TARGET="_top"
>http://www.patoche.org/LTT/net/00000096.html</A
></P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>LanWorks BootWare Boot ROMs: <A
HREF="http://www.3com.com/lanworks"
TARGET="_top"
>http://www.3com.com/lanworks</A
></P
></LI
></UL
>
</P
><P
>Refer to the README file for installation details. Currently, only "zImage"-type kernels are supported. Unfortunately, kernel parameters are ignored.</P
><P
>This section was initially written by Jochen Kmietsch for the Diskless-HOWTO, email to: <TT
CLASS="EMAIL"
>&#60;<A
HREF="mailto:jochen.kmietsch@tu-clausthal.de"
>jochen.kmietsch@tu-clausthal.de</A
>&#62;</TT
> for any questions.</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN411">6.5. Local CDROM</H2
><P
>This section was originally written by Hans de Goede <TT
CLASS="EMAIL"
>&#60;<A
HREF="mailto:j.w.r.degoede@et.tudelft.nl"
>j.w.r.degoede@et.tudelft.nl</A
>&#62;</TT
> for the Diskless-root-NFS-HOWTO. I modified it slightly in order to reflect some differences between this document and the Diskless-root-NFS-HOWTO.</P
><P
>Much of the above also goes for booting from cdrom. Why would one want to boot a machine from cdrom? Booting from cdrom is interesting everywhere one wants to run a very specific application, like a kiosk, a library database program or an internet cafe, and one doesn't have a network or a server to use a root over nfs setup.</P
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN416">6.5.1. Creating a test setup</H3
><P
>Now that we know what we want to do and how, it's time to create a test setup:
<P
></P
><UL
><LI
STYLE="list-style-type: opencircle"
><P
>For starters just take one of the machines which you want to use and put in a big disk and a cd burner.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Install your linux of choice on this machine, and leave a 650<35>MB partition free for the test setup. This install will be used to make the iso image and to burn the cd's from, so install the necessary tools. It will also be used to restore any booboo's which leave the test setup unbootable.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>On the 650 mb partition install your linux of choice with the setup you want to have on the cd, this will be the test setup.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Boot the test setup.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Compile a kernel with isofs and cdrom support compiled in.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Configure the test setup as described above with the root filesystem mounted read only.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Verify that the test setup automagically boots and everything works.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Boot the main install and mount the 650<35>MB partition on <TT
CLASS="FILENAME"
>/test</TT
> of the main install.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Put the following in a file called <TT
CLASS="FILENAME"
>/test/etc/rc.d/rc.iso</TT
>, this file will be sourced at the beginning of <TT
CLASS="FILENAME"
>rc.sysinit</TT
> to create <TT
CLASS="FILENAME"
>/var</TT
>:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> #/var
echo Creating /var ...
mke2fs -q -i 1024 /dev/ram1 16384
mount /dev/ram1 /var -o defaults,rw
cp -a /lib/var /
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Edit <TT
CLASS="FILENAME"
>/test/etc/rc.sysinit</TT
>, comment the lines where the root is remounted rw, and add the following 2 lines directly after setting the PATH:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> #to boot from cdrom
. /etc/rc.d/rc.iso
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Copy the following to a script and execute it to make a template for <TT
CLASS="FILENAME"
>/var</TT
> and create <TT
CLASS="FILENAME"
>/tmp</TT
> and <TT
CLASS="FILENAME"
>/etc/mtab</TT
> links.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>&#13; #!/bin/sh
echo tmp
rm -fR /test/tmp
ln -s var/tmp /test/tmp
###
echo mtab
touch /test/proc/mounts
rm /test/etc/mtab
ln -s /proc/mounts /test/etc/mtab
###
echo var
mv /test/var/lib /test/lib/var-lib
mv /test/var /test/lib
mkdir /test/var
ln -s /lib/var-lib /test/lib/var/lib
rm -fR /test/lib/var/catman
rm -fR /test/lib/var/log/httpd
rm -f /test/lib/var/log/samba/*
for i in `find /test/lib/var/log -type f`; do
cat /dev/null &#62; $i;
done
rm `find /test/lib/var/lock -type f`
rm `find /test/lib/var/run -type f`
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Remove the creation of <TT
CLASS="FILENAME"
>/etc/issue*</TT
> from <TT
CLASS="FILENAME"
>/test/etc/rc.local</TT
>: it will only fail.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Now boot the test partition again, it will be read only just like a cdrom. If something doesn't work reboot to the working partition fix it, try again etc. Or you could remount <TT
CLASS="FILENAME"
>/</TT
> rw, fix it, then reboot straight into to test partition again. To remount <TT
CLASS="FILENAME"
>/</TT
> rw type:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>mount -o remount,rw /
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
></UL
>
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN463">6.5.2. Creating the CD</H3
><P
>If you need more information than you can find below, please refer to the CD-Writing-HOWTO.</P
><DIV
CLASS="SECT4"
><H4
CLASS="SECT4"
><A
NAME="AEN466">6.5.2.1. Creating a boot image</H4
><P
>First of all, boot into the working partition. To create a bootable cd we'll need an image of a bootable floppy. Just dd-ing a zImage doesn't work since the loader at the beginning of the zimage doesn't seem to like the fake floppydrive a bootable cd creates. So we'll use syslinux instead.
<P
></P
><UL
><LI
STYLE="list-style-type: opencircle"
><P
>Get boot.img from a redhat cd.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Mount boot.img somewhere through loopback by typing:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>mount boot.img somewhere -o loop -t vfat
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Remove everything from boot.img except for ldlinux.sys and
syslinux.cfg.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Cp the kernel-image from the test partition to boot.img.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Edit <TT
CLASS="FILENAME"
>syslinux.cfg</TT
> so that it contains the following, of course replace <TT
CLASS="FILENAME"
>zImage</TT
> by the appropriate image name:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>&#13; default linux
label linux
kernel zImage
append root=/dev/&#60;insert your cdrom device here&#62;
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Umount boot.img:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>umount somewhere
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>If your <TT
CLASS="FILENAME"
>/etc/mtab</TT
> is a link to <TT
CLASS="FILENAME"
>/proc/mounts</TT
>, umount won't automagically free <TT
CLASS="FILENAME"
>/dev/loop0</TT
> so free it by typing:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>losetup -d /dev/loop0
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
></UL
>
</P
></DIV
><DIV
CLASS="SECT4"
><H4
CLASS="SECT4"
><A
NAME="AEN496">6.5.2.2. Creating the iso image</H4
><P
>Now that we have the boot image and an install that can boot from a readonly mount it's time to create an iso image of the cd:
<P
></P
><UL
><LI
STYLE="list-style-type: opencircle"
><P
>Copy boot.img to <TT
CLASS="FILENAME"
>/test</TT
></P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Cd to the directory where you want to store the image and make sure it's on a partition with enough free space.</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Now generate the image by typing:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>mkisofs -R -b boot.img -c boot.catalog -o boot.iso /test
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
></UL
>
</P
></DIV
><DIV
CLASS="SECT4"
><H4
CLASS="SECT4"
><A
NAME="AEN509">6.5.2.3. Verifying the iso image</H4
><P
> <P
></P
><UL
><LI
STYLE="list-style-type: opencircle"
><P
>Mounting the image through the loopbackdevice by typing:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>mount boot.iso somewhere -o loop -t iso9660
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>Umount boot.iso:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>umount somewhere
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
STYLE="list-style-type: opencircle"
><P
>If your <TT
CLASS="FILENAME"
>/etc/mtab</TT
> is a link to <TT
CLASS="FILENAME"
>/proc/mounts</TT
> umount won't automagically free <TT
CLASS="FILENAME"
>/dev/loop0</TT
> so free it by typing:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="90%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>losetup -d /dev/loop0
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
></UL
>
</P
></DIV
><DIV
CLASS="SECT4"
><H4
CLASS="SECT4"
><A
NAME="AEN528">6.5.2.4. Writing the actual CD</H4
><P
>Assuming that you've got <B
CLASS="COMMAND"
>cdrecord</B
> installed and configured for your cd-writer type:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
> <TT
CLASS="PROMPT"
># </TT
>cdrecord -v speed=&#60;desired writing speed&#62; dev=&#60;path to your writers generic scsi device&#62; boot.iso
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></DIV
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN534">6.5.3. Boot the cd and test it</H3
><P
>Well the title of this paragraph says it all;)</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x251.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x537.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Clients setup, creation of the root filesystem</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>How to create diskless MS-Windows stations?</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>