Re: Support for kernel parameter NIC= in LTSP5 on Ubuntu?

Veli-Matti Lintu <veli-matti.lintu-Wdv/[email protected]>
Newsgroups gmane.linux.terminal-server.devel
Organization Opinsys Oy
Message-ID <1235687816.9939.77.camel@localhost>
Thanks for the pointer. I made a new version that uses the IPAPPEND
parameter in pxelinux.cfg like this:

----------------------------------------------------------
DEFAULT vmlinuz ro initrd=initrd.img
IPAPPEND 2
----------------------------------------------------------

Then I added a script in initrd to write the BOOTIF parameter
to /etc/udev/rules.d/70-persistent-net.rules udev takes then care of
assigning the correct interface name using the mac address. The hook
script copies the udev scripts to assign names to the other devices udev
finds. I tried getting udev to ignore the other devices with
"ignore_device" option, but couldn't get it working for some reason. If
some udev option ignores all but the defined mac, this could be made
simpler.

I don't have any of the problem boxes here right now but with this I was
able to assign the interface name to eth1 or anything else I wanted.

All testing was done on Ubuntu Hardy.

--------> /usr/share/initramfs-tools/hooks/pxe <---------
#! /bin/sh -e

. /usr/share/initramfs-tools/hook-functions

mkdir -p ${DESTDIR}/lib/udev
mkdir -p ${DESTDIR}/etc/udev/rules.d

copy_exec /lib/udev/write_net_rules /lib/udev/
cp /lib/udev/rule_generator.functions ${DESTDIR}/lib/udev
cp /etc/udev/rules.d/75-persistent-net-generator.rules
${DESTDIR}/etc/udev/rules.d/

exit 0
--------> /usr/share/initramfs-tools/hooks/pxe <---------

--------> /usr/share/initramfs-tools/scripts/init-top/pxe <---------
#!/bin/sh

. /scripts/functions

for x in $(cat /proc/cmdline); do
        case $x in
        BOOTIF=*)
                BOOTIF=${x#BOOTIF=}
                ;;
        esac
done

if [ -n "${BOOTIF}" ]; then
        log_begin_msg "Setting MAC for eth0 (BOOTIF=${BOOTIF})..."

        MAC=`echo -n ${BOOTIF} | sed "s/\(..\)-\(.*\)/\2/" | sed
"s/-/:/g"`
        echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\",
ATTR{address}==\"${MAC}\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=
\"eth0\"" > /etc/udev/rules.d/70-persistent-net.rules

        log_end_msg
fi
--------> /usr/share/initramfs-tools/scripts/init-top/pxe <---------

Veli-Matti Lintu

to, 2009-02-26 kello 17:01 +0200, Άλκης Γεωργόπουλος kirjoitti:
> I think the place to start would be here:
> http://syslinux.zytor.com/wiki/index.php/SYSLINUX#IPAPPEND_flag_val_.5BPXELINUX_only.5D
> 
> By using IPAPPEND 2 in pxelinux.cfg/default, pxelinux passes the boot
> interface (= the one that requested a dhcp address) as a kernel
> parameter (BOOTIF).
> Then an init script can pick up the mac-address in BOOTIF, match it
> against the list of available interfaces and select the correct one to
> pass to ipconfig or whatever else is used.
> 
> I can't think of any reason why this shouldn't be default behavior (if
> BOOTIF is defined, that is). Yup, I know, initrds etc are distro
> specific... :(
> 
> Alkis Georgopoulos
> 
> --------Αρχικό Μήνυμα --------
> Από: Veli-Matti Lintu <[email protected]>
> 
> LTSP 4.2 used to support kernel parameter NIC= to load specified module
> for a nic as specified here:
> 
> http://wiki.ltsp.org/twiki/bin/view/Ltsp/KernelOptions
> 
> <snip>



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
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.