# Lenovo T470 with i5-7300 and X at FreeBSD-13.1



## chrbr (Oct 18, 2022)

Dear community,
I own a T470 with the i5-7300 CPU. Everything works so far beside X which loads the VESA driver only. I have installed drm-kmod without success. There are lots of i915*.ko in /boot/modules. But I have no idea how to proceed. There are tutorials, but most are related to FreeBSD-12.*. Any advise is appreciated.
Thank you for your kind help in advance,
Christoph


----------



## Alain De Vos (Oct 18, 2022)

I did not found direct any good tutorials.
Normally you load the correct intel-GPU driver in /etc/rc.conf with
kld_list= "drm ..."
I found an old GPU-list,


			Graphics/Intel-GPU-Matrix - FreeBSD Wiki
		

I know there exist a vesa-driver, a framebuffer-driver(SCFB) & intel-driver.
Maybe:
kld_list="i915kms"


----------



## Erichans (Oct 18, 2022)

Perhaps try graphics/drm-510-kmod - drm-fbsd13-kmod is gone (in favor of drm-510-kmod)


----------



## algi (Oct 18, 2022)

I struggled with it as well and I had to create my own X.org config file, which loads intel driver. Then X will start.


----------



## Alain De Vos (Oct 18, 2022)

Can you share the contents of your xorg.conf file


----------



## chrbr (Oct 18, 2022)

Dear Alain De Vos,


Alain De Vos said:


> kld_list="i915kms"


That did not work. `dmesg` reports an error as below.

```
kldload: /boot/modules/i915_ehl_guc_33_0_4.bin.ko: file has no contents
```
May be I have to load a different file.

Dear Erichans,
I have graphics/drm-510-kmod installed already. May be it came with graphics/drm-kmod. It is quite confusing for me.

Kind regards,
Christoph


----------



## cmoerz (Oct 18, 2022)

For my x270, the following packages work without any xorg conf. I assume, this should work for your device as well, since you've got the same graphics chip.

```
drm-510-kmod-5.10.113_7        DRM drivers modules
drm-kmod-20220907_1            Metaport of DRM modules for the linuxkpi-based KMS components
gpu-firmware-kmod-20220511,1   Firmware modules for the drm-kmod drivers
xorg-server-21.1.4_1,1         X.Org X server and related programs
xorg-vfbserver-21.1.4_1,1      X.Org X server and related programs
```
/boot/loader.conf has

```
i915kms_load="YES"
```


----------



## chrbr (Oct 21, 2022)

Dear comunity,
please excuse the late reply. The T470 seems to be slightly different to the x270 model. I have tried all proposals without success. But generally the VESA driver should have been sufficient for my use case.

But as stated in the FreeBSD-Wiki has a more severe issue. It hangs from time to time. I have experienced that after leaving X. Also after a shutdown it can happen that the T470 hangs. That has already resulted in a corrupt file system which is not acceptable.

Finally I have installed Linux Debian/Bullseye which runs flawlessly. This is not a good news but better than messing with corrupted file systems. As a summary the T470 should be avoided. From the end user perspective a lot of tools from the BSD world are available as Debian packages. This makes the situation more comfortable.

Nevertheless thank you for your ideas,
Christoph


----------



## rsronin (Oct 21, 2022)

Did you check this?

Nevertheless, FreeBSD 13.1 is trucking from my HDD in a Thinkpad t430 and Debian Bullseye is on the mSATA SSD.


----------



## Erichans (Oct 21, 2022)

rsronin said:


> Did you check this?


Perhaps, more specifically, from there at the Graphics section:

```
# /usr/local/etc/X11/xorg.conf.d/driver-intel.conf
Section "Device"
    Identifier "Card0"
    Driver     "intel"
    Option     "DRI" "3"
EndSection
```
Also verify that there are no other files in /usr/local/etc/X11/xorg.conf.d/ ending in .conf
Try first commenting/leaving out the line with "Option"*. 

___
* From xorg.conf:

```
DEVICE SECTION
       The config file may have	multiple Device sections.  There  must	be  at
       least one, for the video card being used.

       Device sections have the	following format:

	   Section "Device"
	       Identifier "name"
	       Driver	  "driver"
	       entries
	       ...
	   EndSection

       The  Identifier and Driver entries are required in all Device sections.
       All other entries are optional.
*[...]*
       *Option "ModeDebug"* "boolean"
	      Enable  printing of additional debugging information about mode-
	      setting to the server log.

       *Option "PreferCloneMode"*	"boolean"
	      If enabled, bring	up monitors of a screen	in clone mode  instead
	      of  horizontal extended layout by	default. (Defaults to off; the
	      video driver can change the default value, but this  option  can
	      always override it)

       *Options*
	      Option flags may be specified in the Device sections.  These in-
	      clude driver-specific options  and  driver-independent  options.
	      The  former  are described in the	driver-specific	documentation.
	      Some of the latter are described below in	the section about  the
	      Screen section, and they may also	be included here.
```
From this I gather that in /usr/local/etc/X11/xorg.conf.d/driver-intel.conf that the given line with "Option" (i.e. singular) does not match the description from the man page.


----------



## chrbr (Oct 21, 2022)

rsronin said:


> Did you check this?


No, I have not found that page. May be the ACPI stuff is the key because there are a lot of error messages during the boot sequence. When I have some time I will replace the HDD with a spare one and try the instructions from the link.


----------



## Erichans (Oct 21, 2022)

Also: Thinkpad T470


----------



## chrbr (Oct 22, 2022)

There are also different CPU options. Mine has a i5-7300 instead of a i7-7500. I have no idea about the differences.


----------



## Erichans (Oct 22, 2022)

Yes, true. I think you likely have an i5-7300U; perhaps you could verify that sysutils/neofetch/ or any other (Linux) utility of your choice. Looking at Core i5-7300U and Core i7-7500U they have the same HD graphics 620 GPU with the same "Intel	Device ID	0x5916".

I don't have any personal experience with this CPU/GPU but, as it supports, by the various links given, the 620 GPU (also by a previous driver incarnation), one can have confidence that a FreeBSD graphics driver should be able to support it and make this work. I cannot imagine that only the difference in CPU core(s) affect the working of a graphics driver for its GPU; also the i5-7300U was introduced in early 2017, quite a long time ago. (As you already installed  "Linux Debian/Bullseye which runs flawlessly" one can safely exclude any hardware mailfunction.)

If you want to make it work for FreeBSD and want to dive into it a little more, combined with the support and reactions here, there should be more clarity; or you could ask in a relevant FreeBSD mailing list. 

I think this is more about the graphics/drm-kmod (meta port) and graphics/drm-510-kmod* and its setup. Therefore, perhaps a change in topic to something like 
"graphics/drm-kmod for Intel HD graphics 620 setup problem - Lenovo T470 with i5-7300 and X at FreeBSD-13.1" 
might attract some extra attention.

___
* as mentioned in drm-fbsd13-kmod is gone (in favor of drm-510-kmod)


----------



## Erichans (Oct 23, 2022)

I've looked at this further but I'm not running 13.1 and don't have a FreeBSD set up with an intel CPU/GPU for the i915kms driver. 

When you're at your T470 with FreeBSD again and want to continue to try to get the i915kms driver to work, it would be good to check a few things. As graphics/drm-kmod with its latest non-dev version of the i915 driver has been released after FreeBSD 13.1-RELEASE there might be more than one i915kms.ko* on your system.

I suggest you have your T470 set up to boot into a CLI without X starting and then, having in /etc/rc.conf (and not specified in /boot/loader.conf):

```
kld_list="i915kms"
```
boot your system and please show the output of:
`ls -l /boot/kernel/i915kms.ko /boot/modules/i915kms.ko`
`kldstat -vn i915kms.ko`
`kldconfig -r` **

If there's a /boot/modules/i915kms.ko then show the output of:
`pkg which /boot/modules/i915kms.ko`
That should verify that that i915kms.ko is from the intended graphics/drm-kmod (or graphics/drm-510-kmod)

When you have the correct /boot/modules/i915kms.ko from graphics/drm-kmod then change your i915kms entry in /etc/rc.conf to:

```
kld_list="/boot/modules/i915kms.ko"
```
(I'm pretty sure that `kld_list="/boot/modules/i915kms"` will also work but try the fully qualified one first.)

Now reboot and verify the correct loading with `kldstat -vn i915kms.ko`. Then verify that you have X setup correctly including the setup about /usr/local/etc/X11/xorg.conf.d/driver-intel.conf that I mentioned earlier. If there's a problem when starting X, please show the output of an appropriate log file such as /var/log/Xorg.0.log as mentioned in 5.9 Troubleshooting

___
* don't worry about the "lots of i915*.ko in /boot/modules"; they are probably (sub)modules pulled in when needed by a loading  i915kms.ko depending on the CPU architecture of the CPU that is actually in the system. For example i915_*kbl*_huc_ver_4_0_0_bin.ko and i915_*skl*_huc_ver_2_0_0_bin.ko are likely intended for CPUs with the Kaby Lake & Sky Lake micro-architectures respectively.
** `sysctl kern.module_path` will work as well


----------



## chrbr (Oct 23, 2022)

The thing is that there is no /boot/*/i915kms.ko. Currently I gave up. The T470 has no good access to the HDD. There are plastic snap in noses instead of screws. Therefore I do not like to change the hard disk. But I might try installing FreeBSD-13.1 on an USB hard disk. That would be of slow speed but would allow debugging.


----------



## Erichans (Oct 24, 2022)

Well, if there is no i915kms.ko in /boot/modules/ (or anywhere along `sysctl kern.module_path` for that matter) , I think there has gone something wrong with either `pkg install drm-kmod` or `pkg install drm-510-kmod`.

If reinstalling after `pkg delete <package> ; pkg autoremove` doesn't help and that is the case consistently, I'd ask the mailinglist or file a "PR" on https://github.com/freebsd/drm-kmod/issues


----------



## fbsd470 (Oct 31, 2022)

Hi,
I recently installed FreeBSD 13.1 on two T470 Thinkpads, a i5-7200U Kaby Lake on which i write theses lines, and a i5-6200U Skylake. Both are provided with Intel HD Graphics - they are *not *fitted with an additional NVIDIA GeForce Optimus chip!
Display resolution of both Thinkpads is Full-HD.

FreeBSD - in more detail Xorg and Xfce - work like a charm 

All i needed to do was:

```
# pkg install -y xorg
# shutdown -r now
# pkg install -y xfce
# shutdown -r now
# pkg install -y drm-kmod

optional, seems to be unnecessary with latest packages:
pkg install -y gpu-firmware-intel-kmod-kabylake-20220511

# sysrc kld_list+=i915kms
# sysrc kld_list+=acpi_video
# shutdown -r now

# startxfce4
```


No need for a user defined xorg.conf, Xorg just starts out of the box.
Hope this helps


----------



## fbsd470 (Nov 1, 2022)

Some additional information:

BIOS Version 1.70

Modified BIOS settings:

Security --> I/O Port Access: Wireless WAN, Memory Card Slot, Integrated Camera, Fingerprint Reader & WiGig disabled (I don't need these)
Startup --> UEFI/Legcy Boot: UEFI Only
Restart --> OS Optimized Defaults: disabled

and some offtopic stuff : to get my Logitech Bluetooth mouse working I had to install a firmware package:

```
# pkg install -y iwmbt-firmware

to enable bluetooth:
# sysrc hcsecd_enable="YES"
# sysrc bthidd_enable="YES"
# sysrc sdpd_enable="YES"
```

P.S.: Please ensure that all users requiring graphics are members of the "*video*" group.


----------

