[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Grub2 PXE Boot UEFI MAC address based configuration
From: |
Engelmann Florian |
Subject: |
Re: Grub2 PXE Boot UEFI MAC address based configuration |
Date: |
Fri, 28 Oct 2016 07:18:00 +0000 |
Dear Andrei,
thank you for your feedback. My grub.cfg currently looks like this:
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set gfxpayload=keep
insmod all_video
#if $grub_platform = efi ; then
# eval "set net_pxe_mac=\$net_${efi_boot_interface}_mac"
#fi
set net_pxe_mac=$net_default_mac
regexp --set=1:m1 --set=2:m2 --set=3:m3 --set=4:m4 --set=5:m5 --set=6:m6
'^([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})'
"$net_default_mac"
mac=${m1}-${m2}-${m3}-${m4}-${m5}-${m6}
configfile=/cfg/mac/$net_pxe_mac
source "$configfile"
configfile=$prefix/grub.cfg-$mac
source "$configfile"
ip=$net_default_ip
for c in 1 2 3 4; do
configfile=$prefix/grub.cfg-$ip
source "$configfile"
regexp --set=ip '^(.*)\..+$' "$ip"
done
is there any way to nicen up that regexp command?
All the best,
Flo
________________________________________
From: Andrei Borzenkov <address@hidden>
Sent: Thursday, October 27, 2016 7:11 PM
To: Engelmann Florian; address@hidden
Subject: Re: Grub2 PXE Boot UEFI MAC address based configuration
27.10.2016 14:25, Engelmann Florian пишет:
> Dear list,
>
> I am at the same path Andy was:
>
> https://lists.gnu.org/archive/html/help-grub/2013-06/msg00019.html
>
> But I found lots of tutorials describing grub2 using a configuration scheme
> like grub.cfg-01-<MAC>:
>
> https://docs.oracle.com/cd/E52668_01/E54695/html/ol7-install-pxe-boot-uefi.html
>
> http://projects.theforeman.org/projects/foreman/wiki/PXE_Booting_UEFI/8
>
> https://beaveryoga.wordpress.com/2013/08/20/grub2-uefi-pxe-cobbler-ready/
>
> I was not able to make it work. I did:
>
> grub-mknetdir --net-directory=/srv/tftpboot
>
> and my dnsmasq configuration looks like:
>
> interface=eth1
> enable-tftp
> tftp-root=/srv/tftpboot
> dhcp-boot=bios/pxelinux.0
> dhcp-match=set:efi-x86_64,option:client-arch,9
> dhcp-boot=tag:efi-x86_64,boot/grub/x86_64-efi/core.efi
> dhcp-match=set:efi-x86_64,option:client-arch,7
> dhcp-boot=tag:efi-x86_64,boot/grub/x86_64-efi/core.efi
> #dhcp-boot=tag:efi-x86_64,efi64/syslinux.efi
> #dhcp-match=set:efi-x86_64,option:client-arch,7
> #dhcp-boot=tag:efi-x86_64,efi64/syslinux.efi
> #dhcp-match=set:efi-x86_32,option:client-arch,6
> #dhcp-boot=tag:efi-x86_32,efi32/syslinux.efi
> dhcp-option=42,10.38.111.15 # Timeserver
> domain-needed
> bogus-priv
> #listen-address=10.38.111.15
> expand-hosts
> dhcp-range=10.38.111.101,10.38.111.199,12h
> local=/xxxxxxxxxxxxxx/
>
> Using /srv/tftpboot/boot/grub/grub.cfg works fine but any file like
> /srv/tftpboot/boot/grub/grub.cfg-01-<client MAC address> is ignored.
>
> Is there any documentation to get the job done?
>
grub itself reads single file, which is grub.cfg. This file can be
script that attempts to load other files. You can access MAC address of
interface over which grub was netbooted using $net_default_mac variable
and derive file names from it.