boot ze site

Ladislav Kostal ladislav.kostal at fem.uniag.sk
Sun Mar 17 08:58:03 CET 2002


> > Ahoj, muzete mi prosim poslat nejaky link ktery dobre popisuje boot
> ze
> > site. + pripadnou konfuguraci pod fbsd..
>
> Pokud mate PXE bootrom tak se podivejte na:
> http://www.freebsd.org/doc/en_US.ISO8859-1/articles/pxe/index.html


Toto je navod pre PXE, ako to fungovalo mne (v sucasnosti 3com 3C905C a
nejaka Intel karta).

1. /usr/ports/net/isc-dhcp3

dhcpd.conf:

allow booting;
allow bootp;
ddns-update-style none;
authoritative;
option domain-name "your-domain.org";
option routers 192.168.1.2;
option broadcast-address 192.168.1.255;
option domain-name-servers 192.168.1.3;
server-name "myserver";
server-identifier 192.168.1.1;

default-lease-time 7200;
max-lease-time 7200;

subnet 192.168.1.0 netmask 255.255.255.0 {
        filename "pxeboot";
        use-host-decl-names on;

        host tc1 {
                hardware ethernet 00:50:da:e0:bd:4f;
                fixed-address 192.168.1.10;
        }
}

2. tftp server

tftp    dgram   udp     wait    nobody  /usr/libexec/tftpd tftpd /tftp

3. place /boot/pxeroot to /tftp

4. /etc/exports

/pxeroot -maproot=0 192.168.1.10
/usr -ro 192.168.1.10

5. enable nfs server in /etc/rc.conf

nfs_reserved_port_only="YES"
nfs_server_enable="YES"
portmap_enable="YES"

6. compile DISKLESS kernel and put it to /pxeroot
(can gzip -9 for faster loading from server)

machine         i386
cpu             I686_CPU
ident           DISKLESS
maxusers        0

options         INET
options         FFS
options         SOFTUPDATES
options         UFS_DIRHASH
options         MFS
options         NFS
options         NFS_ROOT
options         NO_SWAPPING
options         NULLFS
options         MSDOSFS
options         CD9660
options         PROCFS
options         COMPAT_43
options         UCONSOLE
options         USERCONFIG
options         VISUAL_USERCONFIG
options         KTRACE
options         SYSVSHM
options         SYSVMSG
options         SYSVSEM
options         P1003_1B
options         _KPOSIX_PRIORITY_SCHEDULING
options         ICMP_BANDLIM
options         KBD_INSTALL_CDEV
options         CPU_ENABLE_SSE
options         VESA
options         USER_LDT

device          isa
device          pci

device          atkbdc0 at isa? port IO_KBD
device          atkbd0  at atkbdc? irq 1 flags 0x1
device          psm0    at atkbdc? irq 12
device          vga0    at isa?
pseudo-device   splash
device          sc0     at isa? flags 0x100
device          npx0    at nexus? port IO_NPX irq 13

device          miibus
device          xl # place your card's driver here

device          pcm

pseudo-device   loop
pseudo-device   ether
pseudo-device   tun
pseudo-device   pty
pseudo-device   md
pseudo-device   bpf

7. populate /pxeroot tree using script in
/usr/share/examples/diskless/clone_root
(change DEST to /pxeroot)

8. edit /pxeroot/etc/rc appropriatelly if necessary.
I make one file from rc.diskless1 and 2 (this is just ugly hack, but
working properly:):

chkerr() {
        case $1 in
        0)
                ;;
        *)
                echo "$2 failed: dropping into /bin/sh"
                /bin/sh
                # RESUME
                ;;
        esac
}

# Figure out our interface and IP.

bootp_ifc=""
bootp_ipa=""
bootp_ipbca=""
iflist=`ifconfig -l`
for i in ${iflist} ; do
    set `ifconfig ${i}`
    while [ $# -ge 1 ] ; do
        if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
            bootp_ifc=${i} ; bootp_ipa=${2} ; shift
        fi
        if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
            bootp_ipbca=$2; shift
        fi
        shift
    done
    if [ "${bootp_ifc}" != "" ] ; then
        break
    fi
done

mount_md() {
        if [ -n "$4" ]; then
                bpi="-i $4"
        fi
        /sbin/mount_mfs -c 104 -s $1 -T qp120at $bpi dummy $2
}

# If there is a global system configuration file, suck it in.

if [ -r /etc/defaults/rc.conf ]; then
        . /etc/defaults/rc.conf
        source_rc_confs
elif [ -r /etc/rc.conf ]; then
        . /etc/rc.conf
fi

mount_md 4096 /var 1

/bin/mkdir /var/db
/bin/mkdir /var/spool
/bin/mkdir /var/spool/output
/bin/mkdir /var/spool/lock
/bin/mkdir /var/log
/bin/mkdir /var/at
/bin/mkdir /var/at/jobs
/bin/mkdir /var/run
/bin/mkdir /var/cron
/bin/mkdir /var/cron/tabs
/bin/chmod 0700 /var/cron/tabs

mount /usr

set `/usr/bin/grep ${bootp_ipa} /etc/hosts`
hostname $2

LOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } '
/etc/newsyslog.conf`
if [ -n "$LOGFILES" ]; then
        /usr/bin/touch $LOGFILES
fi

/usr/bin/touch /var/log/lastlog

mount -a       # chown and chgrp are in /usr

/bin/mkdir /tmp/vi.recover
/bin/chmod 1777 /tmp/vi.recover
/bin/ln -s /tmp /var/tmp

# extract a list of device entries, then copy them to a writable fs
(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
mount_md 4096 /dev 3 512
(cd /; cpio -i -H newc -d < /tmp/dev.tmp)

9. edit /pxeroot/boot/loader.rc:

echo Loading kernel...
load /kernel
echo Booting...
set vfs.root.mountfrom="nfs:"
boot

10. Enable PXE on your card and boot.

11. I had some problem with out NBASE switch, which doesn't like DHCP or
so. Switching connection to Baystack enabled booting... I don't know why.

Maybe I forgot some step, so I you will have some problems, write me.

Ladislav Kostal





More information about the Users-l mailing list