Hi Ken,

In the LiveCD initrd I probe for modules needed to access CD/DVD ROMS
(IDE, SATA), USB disks/sticks and network cards (in case of a diskless
client).
https://svn.iac.ethz.ch/pub/livecd/trunk/linux-live.sl/initrd/linuxrc
https://svn.iac.ethz.ch/pub/livecd/trunk/linux-live.sl/initrd/liblinuxlive

The SATA part is very simple, I just load libata, ata_piix, ahci,
sata_nv, sata_svw, sg, ... This seems to be good enough for most DVD/CD
ROMS connected over SATA. Of course I would be interested in a more
"intelligent" way to load the sata modules.

Concerning the detection of the network card. I did it on older LiveCDs
with a statically compiled lspci (running under busybox) and some grep
commands looking in the file pcitable for the correct module. The static
lspci is still available in
https://svn.iac.ethz.ch/pub/livecd/trunk/linux-live.sl/initrd/static-binaries/

However, pcitable was always out of date and the modules could support
more cards than listed in pcitable. Therefore I decided to do it with
brute force. Now, I load a network module, check if I see an active
link. If not, I unload the module again and load the next network module
... and so on. This is fast and works nicely.


Cheers,

    Urs




Mark Stodola wrote:
> Ken,
>
> /proc/pci contains much of the info provided by lspci.  For an initrd
> script, you might want to consider looking at the linux-live scripts
> used to build many of the livecds you find online (include the SL
> flavor made by Urs).  I believe if you look at Urs's livecd-trunk, you
> will find linux-live.sl/initrd/liblinuxlive.  This file has procedures
> for probing all common modules for a certain type of support (e.g.
> modprobe_usb_sata_modules).  Brute force seems the standard way to
> go.  I've made livecds in several ways, and have not run into a
> situation where I had to manually identify and probe modules for a
> specific IDE or SATA controller.
>
> Are you doing something drastically different from the norm?
>
> Cheers,
> Mark
>
> Ken Teh wrote:
>> Hi Troy,
>>
>> I'm looking for something more basic.  I'm trying to craft an init
>> script for an initrd image to load appropriate drivers.  Nothing
>> fancy.  Just the basics.  Like what sort of hard drives are on the
>> system.  SATA or IDE?  The SATA issue confuses me since there is a
>> plethora of SATA drivers.  Does the init script have to try each one
>> to see if it finds a match or is there something in /proc or /sys
>> that provides some identification?
>>
>> The only tool I have in my initrd image is busybox and it doesnt have
>> an lspci equivalent.  The /proc system contains a subdirectory that
>> lists all devices on PCI but as bus.device files.  I tried cat'ing
>> the files but they are not ascii.  I'm guessing it's possible to walk
>> these files to extract the information I need.  I can dig deeper but
>> to save time, I'd ask if someone already knows the answer.
>>
>> Ken
>>
>>
>>
>>
>> Troy Dawson wrote:
>>> Mark Stodola wrote:
>>>> I believe most of anaconda's "magic" comes from probing the PCI and
>>>> USB bus for vendor and device IDs.  If you dig into a driver (for
>>>> example, e1000e), you will find a pcitable listing all of the IDs
>>>> the driver supports.  If you look in /lib/modules/<kernel>/ you
>>>> will find a modules.pcimap and modules.usbmap among other bus types.
>>>>
>>>> Hope that helps.
>>>>
>>>> Cheers,
>>>> Mark
>>>>
>>>> Ken Teh wrote:
>>>>> How does a system determine the appropriate sata driver? 
>>>>> Specifically, how does anaconda figure out to write
>>>>>
>>>>> alias scsi_hostadapter ata_piix
>>>>>
>>>>> in my modprobe.conf and to bind it into my initrd image?
>>>>>
>>>>> I took apart boot.iso but didnt find anything "readable" that
>>>>> indicated how this was determined.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Ken
>>>>>
>>>>
>>>>
>>>
>>> Hi Ken,
>>> On SL 5, alot of that data comes from hwdata, which is in the
>>> /usr/share/hwdata directory.
>>> The main ones people and programs look at is
>>> pci.ids and usb.ids
>>> But there are other files in there.
>>> Troy
>>
>
>

Reply via email to