# VT(vga): resolution 640x480 change at early boot stage possible?



## Manoli (Nov 21, 2019)

Have question for FreeBSD graphics geek. ;-)

I'd like to change default VT(vga): resolution 640x480 (to be able to utilize full screen for system console from the very beginning of the boot-up sequence, if it is possible???)

My laptop is an old Toshiba Satellite from 2007, but I know it' native display resolution is 1280x800 with corresponding stty size of 160x50.

This is actually what I get later when /etc/rc.conf is processed and i915kms.ko is loaded. Then VT replaces "vga" driver with "fb" and laptop now utilizes its full display size.

But the question is if it's possible to switch VT(vga) driver to full native screen resolution. (I mean really VT driver, I'm not interested in switching to an old "sc" mode.) Putting i915kms_load="YES" in /boot/loader.conf doesn't make any change. That might be needed, but I don't know how to make this module load at early stage of boot-up sequence.

My vga is Intel Mobile 945GM, it is running on Intel Core Duo 32-Bit and I have installed FreeBSD 12.1-RELEASE i386. Of course it's non-UEFI installation but on GPT formated disk.

Thank you guys very much for any advice or suggestion.


----------



## SirDice (Nov 21, 2019)

Manoli said:


> I'd like to change default VT(vga): resolution 640x480 (to be able to utilize full screen for system console from the very beginning of the boot-up sequence, if it is possible???)


Have a look in the man pages, it's explained there: vt(4).


----------



## Manoli (Nov 21, 2019)

SirDice said:


> Have a look in the man pages, it's explained there: vt(4).


Thanks for info, I have read that already, but seems like _kern.vt.fb.default___mode _requires KMS driver to be loaded. But I'm only able to load it from /etc/rc.conf

Loading i915kms at early stage from /boot/loader.conf doesn't work but have no idea why?


----------



## aragats (Nov 21, 2019)

I've seen that in my Thinkpad T430 as well (don't own it now, so cannot check).
Also, I reported a similar issue and a work-around here, so you may try this:
	
	



```
i915kms_load="YES"
i915kms_name="/boot/kernel/i915kms.ko"
```
I'm not sure what's causing that, but in my case the issue disappears when I remove nvidia* modules loading from /boot/loader.conf.


----------



## BostonBSD (Oct 29, 2020)

I have an intel video card.  This worked for me:


To change the text resolution in FreeBSD 12.1
From 640x480 to 1024x768:

Add this to /boot/loader.conf:


```
hw.vga.textmode=1
kern.vty=vt
kern.vt.fb.default_mode="1024x768"     #For all devices
#kern.vt.fb.modes.VGA-1="1024x768"     #For a specific device
i915kms_load="YES"                #Load the kms module
i915kms_name="/boot/kernel/i915kms.ko"     #Define the module name
```


*******************************************
[The X windows system did not render properly after the alteration, with the VESA driver, so I did this and it used a driver called "modesetting" which appears to work.]

Reconfigure xorg under the new module and modesetting


```
# Xorg -configure
```

Test the new configuration with a visual background


```
# Xorg -retro -config /root/xorg.conf.new
```

After the new configuration has been adjusted and tested,
it can be split into smaller files in the normal location

[the filenames do not appear to matter, it looks like xorg reads each file and searches for the appropriate section name]:


/usr/local/etc/X11/xorg.conf.d/


You could also place the conf file in the legacy folder as:


/etc/X11/xorg.conf


or


/usr/local/etc/X11/xorg.conf


====================

This is an xorg.conf.d file that shuts off X windows with [alt] [ctrl] [bksp].  I gave it an arbitrary name keyboard-shutoff.conf.


```
Section    "InputClass"
    Identifier    "KeyboardDefaults"
    MatchIsKeyboard    "on"
    Option        "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
```


----------



## SKull (Oct 29, 2020)

Manoli take snapshots before you do anything.
Because trying to up my console resolution once forced me to get comfortable with the boot loader console


----------



## SirDice (Oct 29, 2020)

SKull said:


> forced me to get comfortable with the boot loader console


It's a good idea to get comfortable with it in any case. You will inevitably need it, some day. Things can always break, for whatever reason, and it's good form to know in advance what to do. How to work with loader(8), how to fix things in single user mode, etc. All things you hope never to use but will have a need for at some point in time.


----------



## BostonBSD (Oct 29, 2020)

I found out that single user mode is read only w/o mounting the filesystem.
Knowing these commands would be extremely useful for writing in single user mode
[the OS should just tell the user this when they start single user mode]:

For ZFS:

```
mount -u /
zfs mount -a
```

For UFS:


```
mount -u /
mount -a -t ufs
```


----------



## Mjölnir (Oct 30, 2020)

Manoli said:


> Thanks for info, I have read that already, but seems like _kern.vt.fb.default___mode _requires KMS driver to be loaded. But I'm only able to load it from /etc/rc.conf.  Loading i915kms at early stage from /boot/loader.conf doesn't work but have no idea why?


i915kms is blacklisted from beeing loaded in loader.conf(5): `grep module_blacklist /boot/defaults/loader.conf
module_blacklist="drm drm2 radeonkms i915kms amdgpu"    # Loader module blacklist`
It is advised to load the GPU modules from ports (in /boot/modules), the GPU modules shipped with the kernel are deprecated: `pkg install drm-kmod` (on 12.2 build from ports). You can try to set _i915kms_name="/boot/modules/i915kms.ko"_ in loader.conf(5), but I did not try that.  For me `sysrc kld_list+=" /boot/modules/i915kms.ko"` works fine, because on a UEFI system I set the initial resolution via _efi_max_resolution="720p"_.
Tweaks for drm-kmod in /boot/loader.conf:

```
compat.linuxkpi.i915_fastboot="1" # SKIP UNNECESSARY MODE SETS AT BOOT TIME
compat.linuxkpi.enable_rc6="7"  # ENABLE POWER SAVING RENDER C-STATE 6
compat.linuxkpi.enable_dc="2" # ENABLE POWER SAVING DISPLAY C-STATES
compat.linuxkpi.enable_fbc="1" # ENABLE FRAME BUFFER COMPRESSION FOR POWER SAVINGS
compat.linuxkpi.semaphores="1" # USE SEMAPHORES FOR INTER RING SYNC
```
EDIT Clarification: I do not recommend, but you can - at your own risk - overwrite
`module_blacklist="radeonkms amdgpu"` in /boot/loader.conf.  Just don't touch any file in /*/defaults/.


----------



## BostonBSD (Oct 30, 2020)

I didn't know that the GPU modules shipped with the kernel were depreciated nor that they blacklisted GPU modules from being loaded in /boot/loader.conf.

So I installed the latest modules from ports and this is what I found out.


```
i915kms_name="/boot/kernel/i915kms.ko"
```

Does work in /boot/loader.conf although that module is depreciated.


```
i915kms_name="/boot/modules/i915kms.ko"
```

Does not work in /boot/loader.conf, that module is not depreciated however it is blacklisted from being loaded in loader.conf.


```
sysrc kld_list+=" /boot/modules/i915kms.ko"
```

adds /boot/modules/i915kms.ko to rc.conf's kld_list.

Upon a reboot following this newer method, everything works the same however i915kms.ko appears to be loaded in rc.conf rather than loader.conf [slightly later during the boot process].

I still have:


```
hw.vga.textmode=1
kern.vty=vt
kern.vt.fb.default_mode="1024x768"
kern.vt.fb.modes.VGA-1="1024x768"
i915kms_load="YES"
```

In loader.conf.

=========
As a side note; I think if the resolution were changed too early in the boot process it would mess up how the FreeBSD menu appears.

The FreeBSD menu, I think, was designed for 640x480 resolution.


----------



## SirDice (Nov 2, 2020)

BostonBSD said:


> I think if the resolution were changed too early in the boot process it would mess up how the FreeBSD menu appears.


loader(8) loads the kernel, so it's active before the kernel.


----------

