Freebsd Compile Kernel

Posted on by admin

FreeBSD DRM and Graphics Support

Contents

The default kernel installed with the system, also known as GENERIC, is generally a good choice for all-purpose use but sometimes you may want to tweak it a little. For example, if you have a motherboard with flaky ACPI support, you may need to change your kernel configurations to disable APIC so that you can still use the ACPI features.

  1. Developer info
  2. Hardware Support
  3. Reporting

Then you can compile the kernel the usual way, ie: cd /sys/arm/conf config IQ31244 cd./compile/IQ31244 && make depend all To boot the resulting kernel, I configured a BOOTP and a TFTP server, asked RedBoot to use BOOTP, and then use the following little script to automatically boot the kernel: load -b 0x00200000 kernel go. The FreeBSD operating system utilizes the GENERIC kernel by default. This is a default configuration used to support a large variety of hardware out of the box. This is a default configuration used to support a large variety of hardware out of the box. FreeBSD: Build and Install a Custom Kernel. FreeBSD is a very powerful OS and you can even achieve higher performance by modifying the Kernel and only using the modules that you need. Before playing with the kernel you need to have the full FreeBSD source tree installed.

  • Compile a FreeBSD kernel to include VIMAGE support; Install jib and jng; Create a zfs data set for basejail; Configuring the jail.conf on the host; Enable and start jail service; Let us see all steps in details to configure a FreeBSD Jail with vnet and ZFS. Configure/compile vnet kernel. You must compile FreeBSD kernel.
  • Normally, the generic kernel that comes with default FreeBSD installations are good enough for most installations. But some machines that I worked on are having more then 4gb of memory. But some machines that I worked on are having more then 4gb of memory.
  • A FreeBSD kernel module is written in C. This is going to be only a slightly harder than writing hello world in C. We are going to create a single text file with a.c extension and put some C code in it.
Freebsd

Overview

This page and all the linked articles presents the status and directions of all the low-level components making FreeBSD usable as a desktop.

This includes:

  • X.Org-related ports: xserver, libraries, tools
  • Future Wayland-related ports
  • Mesa ports: libGL, dri, libglesv2, libEGL, freeglut, libGLU, libGLw, mesa-demos, libosmesa
  • OpenCL low-level libraries
  • Userland drivers (ie. xf86-*)

  • Input devices detection and configuration
  • Kernel-side GPU drivers (i.e. drm-* kernel modules)

It does not include:

  • Gnome, KDE or any other integrated desktop environments

    /change-folder-background-windows-7.html. First, the program's window remains in the foreground like Task Manager does.

  • Image processing or drawing software applications

Developer info

Developer information, including tasks in progress and similar, is available in the developer section.

TODO

Tasks currently worked on by the Graphics Team

Task

Developer

Status

Comment

Update drm-stable to Linux 4.16 for FreeBSD 12.0

johalun

80%

Update drm-devel to Linux 4.20

johalun, mmacy

20%

Planned before end of 2018

Add support for POWER9

mmacy

50%

radeonkms working

Tasks available to contributers

Task

Developer

Status

Comment

Get Intel GPU Tools working

Initial port exists

Outdated initial port here

Add and improve EVDEV support in kernel drivers

Not started

Make Xorg work well with libinput

Patch available

Do we need libudev-devd?

Contact

  • Mailing List: freebsd-x11

  • IRC: #freebsd-xorg (EFnet)

  • Gitter: https://gitter.im/FreeBSDDesktop/Lobby

  • GitHub: Various Repos

We also have a blog, which contains posts about:

  • Upcoming changes
  • Technical background and questions
  • Report team changes and how we work
  • Report to the community following an event

Hardware Support

The tables below are not an exhaustive list of supported hardware. Hardware is only listed if and when it has been explicitly tested/confirmed by developers and/or users. Graphics hardware missing from these tables may or may not work. If you have tested hardware that is not on the list, please report the results.

About GPU codenames vs. marketing names

The entries below are misleading because they use the marketing names as the 'key'. This table needs to be rewritten using GPU codenames as the key.

If your GPU is not supported

If your GPU is not supported by FreeBSD, you can fallback to VESA (if your computer uses a BIOS) or SCFB (if your computer uses UEFI). For the latter case, you can find instructions to setup SCFB in a dedicated article.

Intel Integrated Graphics (aka HD Graphics)

Intel HD Graphics refers to the class of graphics chips that are integrated on the same die as an Intel CPU. This Wikipedia entry provides a good overview of the various variations and names used for generations of Intel HD Graphics. You will find Intel HD Graphics chips on many modern laptop and desktop systems that ship with an Intel processor. As far as FreeBSD goes, and starting with 12.0-RELEASE, there are two generations of support for this platform:

  • drm-kmod
  • drm-legacy-kmod

Both are supplied as ports, and provide a kernel module to enable the integrated graphics chip on Intel CPUs. Generally speaking if you have a system with one of these graphics adapters it is suggested to install the drm-kmod metaport, which should work well on systems starting with the 'Broadwell' generation. This code is under active development and allows us to track more closely the drivers present in the Linux kernel. For haswell based systems, if the drm-kmod port does not work, it is suggested to install the drm-legacy-kmod. This is based on our previous code that matched the Linux 3.8 kernel drivers.

This page contains a table should illustrate the state of various Intel chipsets.

Furthermore, if you notice high CPU usage or excessive tearing while viewing HD video it is reported that installing the libva-intel-driver is helpful, as it enables VAAPI support on these systems. This package should be installed in addition to the drm-kmod, mesa-libs and mesa-dri packages.

Example Configuration For Post Broadwell System

A common configuration is a user who has an Intel laptop with a Kabylake Intel i915 HD Graphics chip. To enable the chipset one would follow these instructions:

  • Install the drm-kmod package

    • $ sudo pkg install drm-kmod

  • Take note of the post-install package message as it contains important information - specifically add this to your /etc/rc.conf or /etc/rc.conf.d/intel file:
    • kld_list='/boot/modules/i915kms.ko'

  • Ensure your UID is a member of the 'video' group.
  • Restart your system; you should see the i915kms.ko get loaded and a flash on your console as we switch over to the new display driver.
  • Start Xorg via your usual method (i.e. startx, GDM, etc.)

Note: For systems that are able to take advantage of this updated DRM code you should not have to prepare an xorg.conf configuration file, nor should you install xf86-video-intel port. Our Xorg should autodetect the driver, and utilize the modesetting Xorg driver and glamor driver.

AMD Graphics

AMD based GPUs are also supported using the drm-kmod port or package. Unlike the i915 Intel graphics driver there are two separate modules available for AMD devices based on their generation. The modules are named:

  • amdgpu
  • radeonkms

To view the AMD graphics support matrix view this page. The Xorg project also has a great resource on decoding AMD marketing names to engineering friendly names here.

It is important to note that there is currently a conflict with both AMD drivers and the EFI frambuffer. The current workaround, when booting via UEFI on these systems, is to disable the framebuffer via /boot/loader.conf:

hw.syscons.disable=1

This will have the side effect of there being no console output until either the amdgpu or radeonkms kernel driver is loaded. Please see this Github issue for more context.

Freebsd Compile Kernel

One final note - there is a patch available here that will allow you to use Vulkan, OpenCL, Xwayland and OpenMW when using Wayland.

AMD GPU

AMD GPU is the kernel module that can be used to support post-HD7000 or Tahiti GPUs. To enable graphics on these systems you would do the following:

  • Install the drm-kmod package

    • $ sudo pkg install drm-kmod

  • Take note of the post-install package message as it contains important information - specifically add this to your /etc/rc.conf or /etc/rc.conf.d/amd file:
    • kld_list='/boot/modules/amdgpu.ko'

  • Ensure that your UID is a member of the 'video' group.
  • Restart your system; you should see the amdgpu.ko get loaded and a flash on your console as we switch over to the new display driver.
  • Start Xorg via your usual method (i.e. startx, GDM, etc.)

Radeon KMS

Radeon KMS is a distinct driver intended for older AMD based GPUs that are available in pre-HD7000 or Tahiti GPUs. To enable graphics on systems with these GPUs you would do the following:

  • Install the drm-kmod package

    • $ sudo pkg install drm-kmod

  • Take note of the post-install package message as it contains important information - specifically add this to your /etc/rc.conf or /etc/rc.conf.d/radeon file:
    • kld_list='/boot/modules/radeonkms.ko'

  • Ensure that your UID is a member of the 'video' group.
  • Restart your system; you should see the radeonkms.ko get loaded and a flash on your console as we switch over to the new display driver.
  • Start Xorg via your usual method (i.e. startx, GDM, etc.)

Virtual Machines

VMware

Freebsd 11 Compile Kernel

Experimental support for accelerated graphics in FreeBSD as guest OS in VMware was added to drm-devel-kmod.

Known bugs:

  • There is a known race condition where the machine can lock up when loading the graphics driver or starting X. So far this has only been observed when the guest is configured with more than 1 CPU.

VirtualBox

A DRM driver for VirtualBox is going to be added to the Linux source tree in the next coming minor versions. Once it's there, a FreeBSD port is planned. Stay tuned here or check out the blog for updates.

Reporting

Issues / Bugs

If encountering problems in either the kernel driver or the in-development ports, post the following information to the mailing list

  • dmesg command output

  • pciconf -lvbce command output

  • devinfo -vr command output

  • sysctl hw.model

  • pkg info command output

  • Contents of xorg.conf file (and included sub-files, if any)

  • Contents of Xorg.log (if the problem is at X.Org startup or during your X session)
  • Any ports build or installation errors (if relevant)
  • If a kernel panic: Contents of core.$n.txt (in /var/crash)

  • Any other details that may be relevant

Debugging Tips

  • It is useful to see what features the kernel reports as being available, especially in regards to driver features exposed via the linuxkpi. On FreeBSD these are mapped to sysctl compat.linuxkpi. The best way to see what's available for your driver is to execute sysctl compat.linuxkpi after you loaded the driver. For description of what these parameters do, call sysctl with the description flag.
    • % sysctl -d compat.linuxkpi.enable_fbc

      compat.linuxkpi.enable_fbc: Enable frame buffer compression for power savings (default: -1 (use per-chip default))

  • Periodically you will have a kernel panic but a core will not be recorded. You can test setting this sysctl knob which will prevent you from entering ddb on panic which has been found to unreliable in some circumstances:
    • debug.debugger_on_panic=0

  • Also, adding this to your /boot/loader.conf can help in these scenarios:
    • dev.drm.skip_ddb='1'

  • The following can be useful for providing context and can be set in /boot/loader.conf to ensure debug output remains enabled. The one problem with it is that debug output will slow things down enough to mask many problems.:
    • dev.drm.drm_debug_persist='1'

  • Want to enable all DRM related debug flags at runtime? There is a knob for that:
    • dev.drm.drm_debug=-1

  • kms drivers through linux-kpi report debugging information using debugfs. To mount it:
    • # mkdir /debug && mount -t debugfs none /debug

  • To test how hardware acceleration is working you may want to run glxgears, but by default it may force syncing with your display (60fps for example). To disable this you can invoke glxgears like so:

    • $ export vblank_mode=0 && glxgears

Freebsd Compile Kernel Java

Test Results

If everything works, let us know on the mailing list. Your information helps us confirm which hardware/software configurations work well.

Please include:

  • dmesg command output

  • pciconf -lvbce command output

  • pkg info command output

  • Contents of xorg.conf file (and included sub-files, if any)

  • Contents of Xorg.log
  • Any other details that may be relevant

Known Issues

  • Permission errors, or inability to start X when using the DRM kernel modules? Make sure your user is a member of the video group, otherwise you will not have access to /dev/drm/ devices.

  • Xorg -configure crashes with a 'Segmentation fault'; it is a known defect. Do not use Xorg -configure anymore: it is recommended to let Xorg auto-configure itself. If you need to override part of the configuration, create a config file under /usr/local/etc/X11/xorg.conf.d/ containing only the relevant section.

  • There are reports that users on i386 hardware have problems using the drm-kmod package. A workaround for this is to disable PAE via /boot/loader.conf: hw.above4g_allow=0

Wayland

Freebsd Compile Driver Into Kernel

Wayland has its own page.

OpenCL

OpenCL has its own page.

Legacy Documentation

There is a copy of the previous iteration of this page available here. Hopefully no critical information was left out during this migration, but please notify the team if anything was missed!

Freebsd Install Kernel Sources

CategoryProjectCategoryTeam