On Apr 28, 2017 2:32 PM, "Andrei Borzenkov" <[email protected]> wrote:
28.04.2017 21:13, Carl Karsten пишет: > On Fri, Apr 28, 2017 at 11:28 AM, Andrei Borzenkov <[email protected]> > wrote: > >> 28.04.2017 08:57, Carl Karsten пишет: >>> I am using dnsmasq, but I can bring up isc dhcp too. I need help with >> both >>> sides, but on the grub list I won't be too picky about what dhcp server >> is >>> used. >>> >>> I am looking for the syntax of dhcp vendor options, and then how to >> access >>> them in grub-net. I think. maybe there is a better way. >>> >>> I pxe boot grub, which boots di (Debian Installer) and pass a preseed >> file. >>> >>> I am trying to work out a nice way to pass host specific info to di >>> example, most use: >>> partman-auto/disk="/dev/sda" >>> but one machine has an onboard ssd nvme which needs /dev/nvme0n1 >>> >>> di will read values appended to the kernel boot line, so I can hard code >> it >>> like this: >>> >>> menuentry "Install Ubuntu preseed" { >>> set gfxpayload=keep >>> linux /ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600 --- >>> auto=true url=dc10b hostname= partman-auto/disk="/dev/nvme0n1" >>> interface=${net_default_mac} >>> initrd /ubuntu-installer/amd64/initrd.gz >>> } >>> >>> interface=${net_default_mac} - use the nic that pxe booted. >>> >>> Now I get lost in conf options and syntax. forgive me for making stuff >> up >>> here, if it worked I wouldn't be asking for help. >>> >>> I am hoping for something like >>> partman-auto/disk=$(net_pxe_extensionspath/disk} >>> >>> in dnsmasq conf: >>> dhcp-host=40:8d:5c:7f:bb:90,,gator >>> >>> dhcp-option-force=host:gator,209,"disk=/dev/nvme0n1" >>> >>> So yeah, how do I send random strings based on mac/hostname >>> and how do I read what was sent in grub? >>> >> >> You can use net_get_dhcp_option to extract from DHCP ACK packet. In this >> case it would be something like >> >> net_get_dhcp_option disk ${net_default_interface} 209 string >> >> Unless you intend to set multiple values in single option, setting its >> value to just "/dev/nvme0n1" simplifies further parsing. >> > > This looks like the answer I am looking for. Now to digest it. This is on > the edge of what I am familiar with, so allow me to confirm things. > > 209 is how I reference the value I set? > Kinda like server sets key #209 = abc, > client says var = get key #209 > Yes. This is option number. > > Multiple values is something I should probably accommodate. > > I am thinking > > menuentry "Install Ubuntu preseed" { > set gfxpayload=keep > linux /ubuntu-installer/amd64/linux gfxpayload=800x600x16,800x600 --- > auto=true url=dc10b hostname= interface=${net_default_mac} ${more_appends} > initrd /ubuntu-installer/amd64/initrd.gz > } > > dhcp can supply > partman-auto/disk="/dev/nvme0n1" user=foo pw_hash=abc > tasks="ubuntu-desktop" > > either as one big value or a bunch of separate ones that get assembled. > Well, you will then probably need regex command to extract individual values. Allocating DHCP option number for each individual value certainly makes it easier. For now I am happy with one big string in and one big string out. The kernel or installer will parse it. But of I do need to send individual values, what option numbers are available? _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
