how do you deal with PCI-VENDOR-DEVICE text in your kernel?
how do you deal with PCI-VENDOR-DEVICE text in your kernel?
during the system initialization, we usually need to scan the pci bus and print all devices to screen with format like:
Realtek 8139d Ethernet adapter
Thus, we need a pci_vendor_device text table to record informations of all PCI device all over the world. I download such a C header file from internet:
http://pcidatabase.com/reports.php?type=csv
It's more than 9000 lines, and will increase the size of my kernel image by at least 128K. I feel a little uncomfortable that my little kernel(no more than 64K) will have to adopt such a large size text information .
How do you handle it in your kernel? seperate it into a disk file and read it during initialization? I considered that, but that means i have to produce ways of accessing filesystem in a very early phase of initialization. So i give up it.
But should we seperate it from the kernel image? What is a kernel image in your eyes? only consisting of the core code rather than such messy text information?
Now, i still encode it into my kernel image, because i have got used to encod everything into it. I know it's where i am uncomfortable, then i feel better ^.^ )
Realtek 8139d Ethernet adapter
Thus, we need a pci_vendor_device text table to record informations of all PCI device all over the world. I download such a C header file from internet:
http://pcidatabase.com/reports.php?type=csv
It's more than 9000 lines, and will increase the size of my kernel image by at least 128K. I feel a little uncomfortable that my little kernel(no more than 64K) will have to adopt such a large size text information .
How do you handle it in your kernel? seperate it into a disk file and read it during initialization? I considered that, but that means i have to produce ways of accessing filesystem in a very early phase of initialization. So i give up it.
But should we seperate it from the kernel image? What is a kernel image in your eyes? only consisting of the core code rather than such messy text information?
Now, i still encode it into my kernel image, because i have got used to encod everything into it. I know it's where i am uncomfortable, then i feel better ^.^ )
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
Does your kernel have drivers for all those devices? What is the reason for actually printing those text descriptions?
I mean, is there any use in printing text details of devices that you don't support? Would the id numbers not be enough, which the user could look up if necessary?
I mean, is there any use in printing text details of devices that you don't support? Would the id numbers not be enough, which the user could look up if necessary?
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
Thanks for your reply.iansjack wrote:Does your kernel have drivers for all those devices? What is the reason for actually printing those text descriptions?
I mean, is there any use in printing text details of devices that you don't support? Would the id numbers not be enough, which the user could look up if necessary?
Of cource i don't implement all those drivers.
I just think printing it out is perfect. It seems that linux or windows can specify all popular devices(i.e. know their vendor-device name). I want do like that. I don't know how linux or windows achieved that.
Anyway, this is a good suggestion. i can encode only popular devices' vendor text information into my kernel, and just print vendor_id : device_id if unknown. Thus, my kernel can be thinner.
- max
- Member
- Posts: 616
- Joined: Mon Mar 05, 2012 11:23 am
- Libera.chat IRC: maxdev
- Location: Germany
- Contact:
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
Load it from your ramdisk, or compile it into the kernel. Doesn't really make a difference though - if you want the feature, you need the information for it.
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
You could get clever, and load the list from the internet at run-time. You could also cache them locally, if you need updated information during boot up, before the network is ready.
So the first time you boot up, you would just have a bunch of unknown devices. But after that, you'd always have an up-to-date list stored locally.
Think of it like a poor man's Windows Update.
So the first time you boot up, you would just have a bunch of unknown devices. But after that, you'd always have an up-to-date list stored locally.
Think of it like a poor man's Windows Update.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
As said as above : are you sure you need this ?
Do you really need to put that in your kernel ?
Maybe what you want is something in user land . In your boot chain, or in your package system
EDIT: after seeing the CSV I'm pretty sure you can do a huge optimisation of it since some strings appears more than once.
Create a zero-separated string table like the .strtab section, and tell us how does this weighs.
Do you really need to put that in your kernel ?
Maybe what you want is something in user land . In your boot chain, or in your package system
EDIT: after seeing the CSV I'm pretty sure you can do a huge optimisation of it since some strings appears more than once.
Create a zero-separated string table like the .strtab section, and tell us how does this weighs.
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
I show the class names of the detected devices. When I have a driver for that specific device, it will show the full name.
This way I can also easily see if a certain device has no driver yet.
This way I can also easily see if a certain device has no driver yet.
My blog: http://www.rivencove.com/
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
I'd probably just include the pciids.gz and unpack it whenever I would want the real names. For now I just keep a listing of device nodes with their hardware IDs (ven/dev and class) and the chosen driver, then look up the IDs into devices offline if I need to.
The reason I won't do that anytime soon is that the compressed 250k of that index file is not worth the space on my floppies.
The reason I won't do that anytime soon is that the compressed 250k of that index file is not worth the space on my floppies.
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
We really need to modify that text file manually in some places because it's auto created by HTML and has some little faults.Boris wrote: ... you can do a huge optimisation of it since some strings appears more than once.
Create a zero-separated string table like the .strtab section, and tell us how does this weighs.
But i don't think there is much room for optimizing it.
Excuse me, do you mean that "create a zero-separated string table " is solution for "some string appears more than once" ?
It seems that gcc alwanys avoid generating a second copy of a string when compiling. I hope i remember correctly.
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
There are a number of techniques for compressing large text blocks, especially ones like this that will contain a lot of repeated words. I'd be surprised if you couldn't compress the information to at least one-third (probably much more) of its current size using simple techniques. (But I still think it is wasted effort.)miaowei wrote:But i don't think there is much room for optimizing it.
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
Hi,
Note that I'd also question the value of spewing hundreds of lines of techno-babble at the average user during boot. What the average user wants is an OS that reassures them that everything is fine (e.g. maybe something like a picture of a kitten with a progress bar near the bottom of the screen). They don't want an OS that presents a bunch of worthless information that the user should have no reason to care about, because this information does nothing more than make them feel inadequate (because they don't understand any of it, because they're not an OS developer or IT guru, because they're an accountant or secretary or teenager trying to do homework).
Cheers,
Brendan
No, we don't. Even for a monolithic kernel this sort of thing should be delegated to a user-space utility (e.g. "lspci"). The kernel only needs to care about using the device's classID, deviceID and vendorID to find a suitable driver; and providing an interface/API that user-space utilities can use to obtain hardware info.miaowei wrote:during the system initialization, we usually need to scan the pci bus and print all devices to screen with format like:
Realtek 8139d Ethernet adapter
Note that I'd also question the value of spewing hundreds of lines of techno-babble at the average user during boot. What the average user wants is an OS that reassures them that everything is fine (e.g. maybe something like a picture of a kitten with a progress bar near the bottom of the screen). They don't want an OS that presents a bunch of worthless information that the user should have no reason to care about, because this information does nothing more than make them feel inadequate (because they don't understand any of it, because they're not an OS developer or IT guru, because they're an accountant or secretary or teenager trying to do homework).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
How about a picture of a kitten that morphs into a grown cat as the boot progresses? That would be fun.Brendan wrote:maybe something like a picture of a kitten with a progress bar near the bottom of the screen
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
Excuse me, i did see many hardware vendor information at the net-bar ( i don't have a windows PC at home) . i am not sure this lines are generated by boot loader or windows kernel itself.Brendan wrote: No, we don't. Even for a monolithic kernel this sort of thing should be delegated to a user-space utility (e.g. "lspci").
I really like hear such kind of view, and it's where i care about.Brendan wrote: Note that I'd also question the value of spewing hundreds of lines of techno-babble at the average user during boot. What the average user wants is an OS that reassures them that everything is fine
-
- Member
- Posts: 501
- Joined: Wed Jun 17, 2015 9:40 am
- Libera.chat IRC: glauxosdever
- Location: Athens, Greece
Re: how do you deal with PCI-VENDOR-DEVICE text in your kern
Hi,
I don't think it's much value in printing vendor and device strings in depth because:
Regards,
glauxosdever
Indeed.iansjack wrote:How about a picture of a kitten that morphs into a grown cat as the boot progresses? That would be fun.Brendan wrote:maybe something like a picture of a kitten with a progress bar near the bottom of the screen
I don't think it's much value in printing vendor and device strings in depth because:
- It doesn't help the users at all (but instead irritates them or makes them even think something is wrong)
- The list can waste memory and time (when not really needed)
- If the list doesn't fit in one screen, then it will be scrolled (the start of the list will be lost, essentially making it more useless than it is already)
- Additional code to handle this can introduce security vulnerabilities (more code == more bugs, no code == no bugs)
- Some devices are not even connected through PCI
Regards,
glauxosdever