I'm following up on my original question and cross-posting it to the Soekris list in case this is useful for anyone else. If there's an easier way to do this, I'd like to know!

Here's a bootloader script I wrote that works for me (FreeBSD 4.9_RELEASE).

================== kern_switch.4th =============================================
\
\ kern_switch.4th
\ -- MAC-based kernel switching for PXE clients
\
\ Allows PXE booting of different kernels for different MAC addresses
\ using a shared NFS root partition.
\ Will use the default kernel if not booting from PXE or no HW MAC
\ addresses are matched.
\
\ USAGE:
\ 1. Place this in /boot on the NFS server.
\ 2. Include this from /boot/loader.conf using the following line:
\ exec="include /boot/kern_switch.4th"
\ 3. Edit the MAC address and kernel definitions below.
\ 4. Make sure you have an alternate boot device handy when installing
\ so you can undo things if you make a mistake!
\
\ v 1.0; Mar_21_2004; Chris Roehrig <[EMAIL PROTECTED]>



: switch_kernel ( kern_addr kern_n -- ) 2dup ." kern_switch DBG: switching kernel to " type cr s" kernel" setenv ;

\ Check environment for loaddev...
s" loaddev" getenv  dup -1 = [if]
        drop            \ the -1 retval
        .( kern_switch: no loaddev present in environment!) cr
[else]
    2dup .( kern_switch: loaddev = ) type cr

    s" pxe0:" compare 0= [if]
        \ PXE Boot; get the hardware MAC address...
        s" boot.netif.hwaddr" getenv  dup -1 = [if]
            drop                \ the -1 retval
            .( kern_switch: no boot.netif.hwaddr present in environment!) cr
        [else]
            2dup .( kern_switch: boot.netif.hwaddr = ) type cr

            \ switch on HW address...
            \ ===================================================
            \ ENTER YOUR MAC ADDRESSES AND KERNEL NAMES HERE
            \   Pad all MAC bytes to 2-digit, lower-case.
            \   Be careful to preserve the space after s" !

            2dup s" 00:00:24:c1:2a:64" compare 0= [if]
                s" /kernel.NET4501"  switch_kernel [then]

            2dup s" 00:00:24:c1:35:50" compare 0= [if]
                s" /kernel.NET4801"  switch_kernel [then]
            \ ===================================================

2drop \ environment HW string

        [then]
    [then]
[then]



\ Display the kernel to be used...
s" kernel" getenv  dup -1 <> [if]
    .( kern_switch: using kernel = ) type cr
[else]
    drop
    .( kern_switch: no kernel present in environment!) cr
[then]

======================================================================== ====



On Mar 20, 2004, at 10:58, Chris Roehrig wrote:
I'm running FreeBSD 4.9_RELEASE and I'd like to share my server's root partition as the root partition for some diskless PXE clients, but I need different kernels for the server and clients. The /conf structure works great for providing different /etc environments for each machine, but I can't figure out how to boot a different kernel for my PXE clients.

_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to