help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Identifying diskless computers


From: Andrei Borzenkov
Subject: Re: Identifying diskless computers
Date: Fri, 24 Jun 2016 06:32:07 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

24.06.2016 00:16, address@hidden пишет:
> I am using a USB drive with grub to boot up a few diskless computers. Is
> there a way for grub to know which of the computers it is running on? To
> be able to automatically pick the right kernel & initrd on the USB key.
> 
> Ethernet controllers happen to have different vendor:device in lspci
> outputs. Is it possible to test the match in a grub script?
> 

TBH, it is easier to simply include all needed ethernet drivers in
kernel initrd and let it to automatically select the right one.

Otherwise you can do something like

set vendor=
setpci -v vendor -d <VENDOR>:<DEVICE> VENDOR_ID
if [ "x$vendor" = x<VENDOR> ] ; then
  echo found device
fi

where VENDOR_ID is literal name for PCI register. setpci will search
through all PCI devices, take the first one matching "-d" argument and
assign value of selected register to variable (specified by "-v"
argument). Value is represented as hexadecimal integer without leading
zeros (if you omit "-v" it should just print them).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]