Linux using built in drivers

What is the Linux built-in driver load order?

How can we customize the built-in driver load order (to make some built-in driver module load first, and the dependent module load later)?

4 Answers 4

Built-in drivers wont be loaded, hence built-in. Their initialization functions are called and the drivers are activated when kernel sets up itself. These init functions are called in init/main.c::do_initcalls() . All init calls are classified in levels, which are defined in initcall_levels and include/linux/init.h

These levels are actuall symbols defined in linker script ( arch/*/kernel/vmlinux.lds.* ). At kernel compile time, the linker collects all function marked module_init() or other *_initcall() , classify in levels, put all functions in the same level together in the same place, and create like an array of function pointers.

What do_initcall_level() does in the run-time is to call each function pointed by the pointers in the array. There is no calling policy, except levels, in do_initcall_level, but the order in the array is decided in the link time.

So, now you can see that the driver’s initiation order is fixed at the link time, but what can you do?

  1. put your init function in the higher level, or
  2. put your device driver at the higher position in Makefile

The first one is clear if you’ve read the above. ie) use early_initcall() instead if it is appropriate.

The second one needs a bit more explanation. The reason why the order in a Makefile matter is how the current kernel build system works and how the linkers works. To make a long story short, the build system takes all object files in obj-y and link them together. It is highly environment dependent but there is high probability that the linker place first object file in the obj-y in lower address, thus, called earlier.

If you just want your driver to be called earlier than other drivers in the same directory, this is simplest way to do it.

Источник

VideoDriverHowto

IconsPage/info.png

IconsPage/tip.png

To determine your video card make and model, run this command from terminal:

More detailed information can be found by running

Basic Installation Instructions

The easiest way to install binary drivers is to use the built in Hardware Drivers manager in Ubuntu.

In Ubuntu 10.04 and 9:10 this is found under System->Administration->Hardware Drivers.

Note:In Ubuntu 10:10 Hardware Drivers is now named Additional Drivers

More Detailed Installation Instructions

IconsPage/resources.png

Here are some useful links and related pages.

  • Drivers
    • BinaryDriverHowto/ATI
    • BinaryDriverHowto/Nvidia
    • BinaryDriverHowto/MatroxParhelia
    • BinaryDriverHowto/EiconDiva
    • Ubuntu ATI Open Source Driver Howto
    • OpenChrome
    • BinaryDriverHowto/VIA
    • BinaryDriverHowto/Sis

Help!

  • Ubuntu Forums — Ask your questions here.
  • BinaryDriverHowto/DynamicMultiMonitor — How to dynamically set multiple monitor resolution.
  • If you have a Matrox based video card, you can also try the pages at the Unofficial Matrox Technical Support Forum
  • NvidiaManual — How to manually install the NVIDIA restricted drivers
  • Radeon_9200/9250_(RV280)_and_DVI — How to get DVI output working with ATI RV280 series video cards
  • Nvidia — How to install both the latest driver and the one in the repositories (also includes a detailed Problems Section)
  • Nvidia Troubleshooting — How to solve OpenGL Problems with NVIDIA Drivers
  • Nvidia TV Out — View X simultaneously on your monitor and TV
  • Nvidia manual drivers installation — How to install the Nvidia accelerated drivers without apt
  • Multiple monitors with NVIDIA — how to enable dual screens with the NVIDIA driver
Читайте также:  Все дистрибутивы linux 2022

For additional troubleshooting resources, please also see the Ubuntu X Team wiki

Xorg.conf.d

The xorg.conf.d directory (or xorg.conf file for older versions of Ubuntu) is the place that stores the configuration information for your input devices and output devices, such as video cards and monitors, as well as mice, keyboards, and tablets. This section focuses on the video card and monitor set-up.

In Ubuntu, the X configuration directory can be found at /usr/lib/X11/xorg.conf.d. Many of the configurations settings in use aren’t explicitly set by the files in this directory, but are rather hard-coded into the system. If you want to generate an old-style xorg.conf, you can boot into recovery mode, select root shell, and do:

X -configure cp /root/xorg.conf.new /etc/X11/xorg.conf

In older versions of Ubuntu (through 9.10), the xorg.conf configuration file can be found in the /etc/X11 directory.

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.old

To revert to the backup you simply reverse the order like this;

sudo cp /etc/X11/xorg.conf.old /etc/X11/xorg.conf

Before you start modifying your xorg.conf.d directory or xorg.conf file, it is strongly suggested you print out this page. While care is taken by your fellow user to ensure that everything will work, it is more often than not likely the case. Things do go wrong as you try to optimize your graphics driver and monitors.

Also it helps if you become familiar with ++F1 and similar key combinations. In older versions of Ubuntu, F1 to F6 were full screen terminals like the old terminals. F7 was the first x-window, F8 the second, F9 the third, etc. If you pressed ++F1 to F6 you would go into a terminal screen and then if you were to press ++F7 you would return to your graphical user interface. In newer versions of Ubuntu, +=F3 now takes you back to your graphical user interface.

The information below was written about pre-9.10 versions of Ubuntu, but can be analogous information for newer versions still applies:

When you restart your machine you should be able to recover quickly by simply restoring your xorg.conf file. Another good idea is to perform the two above copy command before you modify xorg.conf. That way the commands will be in your terminal history. You can then simply press up arrow on your keyboard to recover the key combinations.

Читайте также:  Команды linux определение системы

If you have changed your xorg.conf file before having backed up and are experience problems, you can copy the /etc/X11/xorg.conf from the Ubuntu LiveCD to your hard disk /etc/X11/xorg.conf file (before this, backup the file as described before).

If reverting back to the original xorg.conf file does not work for whatever reason and you are stuck in the terminal, you can execute the following command:

sudo dpkg-reconfigure -phigh xserver-xorg

This will reconfigure your X server. Note: This will overwrite your current xorg.conf file. This command will not function in Ubuntu 9.10 (Karmic Koala) due to bug #474455.

Before you start modifying xorg.conf

It is important to know what the capabilities of your hardware is before you start. It is a good idea to find out maximum resolution, vertical and horizontal sync ranges and have them close at hand for both the monitor and video card. Without that information it will be difficult to configure your hardware correctly.

Monitors running at low resolution

Often if your running CRT monitors you find that the video card only seems to have options to display in low resolution mode. The trick to this is being able to edit the xorg.conf file in low resolution mode. There are two ways this can be done. Either in one of the terminal text editors or in the GUI (graphical user interface). You can use programs like vi, pico, with a command line like for terminal;

If you not familiar with vi or pico the you could use a GUI like this;

gksu gedit /etc/X11/xorg.conf

Remember if the editor window is too large in the GUI you can hold down the +Button1 (left button) on your mouse to move the window about.

The method shown here is not foolproof. Configuring xorg.conf can be very tricky. But starting with the simplest method is sometimes the best. The first approach is to look for and modify a line that looks like one of these

Option "metamodes" "CRT-0: nvidia-auto-select
Option "metamodes" "CRT-0: 800x600

and change it to something that looks like this;

Option "metamodes" "CRT-0: 1600x1200

You should aim to only go up one resolution step at a time and be prepared to use the ++F1 key combination. It is not a good idea to drive a monitor out of range for too long, it may cause permanent damage.

There are other approaches to that require substantial editing and understanding of xorg.conf files formats. A search of the Ubuntu forums first for similar examples and then the linux forums may yield results.

Twin View or Dual Head displays

Try using the GUI found in System->Preferences->Monitors, or for NVIDIA users check the solutions found in NvidiaMultiMonitors before you use the following approach. Most users will not need to edit xorg.conf in order to use multiple monitors.

The approach to getting Twin View or two monitors working in Ubuntu is much the same as getting a low resolution monitor working as described above.

Читайте также:  Невозможно сохранить файл linux

The first step is to enable the proprietary drivers and getting them to work. Once you have the driver working you need to try and enable the second monitor. So long as you can enable the second monitor you have an easier chance of getting the second monitor working. (Note: Different video manufactures have different ways of enabling the second monitors and detailed information will be presented for each proprietary driver at some later date here.)

Like in the single monitor you are looking for a line in the xorg.conf file that looks something like this;

Option "metamodes" "CRT-0: nvidia-auto-select +1280+0, CRT-1: 1280x1024 +0+0"

which could be changed to this;

Option "metamodes" "CRT-0: nvidia-auto-select +1600+0, CRT-1: 1600x1200 +0+0"

What is interesting about this approach is that it seems to activate all the other resolutions as well.

You may also need to add other sections to your xorg.conf file such as this example;

Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "STAC Electronics Sampo Tech.KM-800U" HorizSync 30.0 - 95.0 VertRefresh 50.0 - 160.0 EndSection Section "Monitor" Identifier "Monitor1" VendorName "Sony" ModelName "MultscanG400" HorizSync 30.0 - 107.0 VertRefresh 48.0 - 120.0 EndSection

It can be frustrating to configure xorg.conf because there is little information and each linux distro video card manufacture handles xorg.conf files sightly differently.

How to recover a non-booting system due to driver malfunction

If your computer does not boot when you have upgraded drivers, press escape at the GRUB bootloader, then choose «recovery mode» for your latest kernel. Drop down to «root shell» and then run the ATI uninstaller:

NOTE: Please, please, please be careful with the «rm -rf» command — if you get this wrong, it could break your system!! Proceed with caution.

cd /usr/share/ati/ sh ./fglrx-uninstall.sh cd ~ rm -rf /etc/ati/ apt-get remove -purge xorg-driver-fglrx fglrx-amdcccle

Then run this to restore your xorg.conf file to default:

dpkg-reconfigure -phigh xserver-xorg

The computer should boot now using the open source «radeon» drivers, (it is important to keep these installed for a backup for this exact reason). If it doesn’t boot with the radeon drivers automatically, go:

Where it says «Device» you want to type «radeon» or «ati» in the «Driver» field, so it looks like this:

Section "Device" Driver "radeon" EndSection

Once you have booted back into Ubuntu, revert to an older version of the fglrx drivers, or continue to use the open source drivers if you like.

Troubleshooting

  • Graphics card not working correctly? Please follow the procedure in GraphicsTroubleshootingProcedure in order to get help from the Ubuntu community.

VideoDriverHowto (последним исправлял пользователь 56 2016-07-23 16:22:09)

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

Оцените статью
Adblock
detector