(no commit message)
[ikiwiki.git] / docs / handbook / docs / handbook / docs / newhandbook / KabylakeNUC / index.mdwn
1 ## Kabylake NUC Config
2
3 DragonFly was recently worked up on the Kabylake NUC (the NUC715BNK) with very good results.  This NUC setup is with 16G of ram and a NVMe SSD installed (we don't recommend ever using Intel's Optane 'memory' junk).  In testing, this NUC has no problem booting from the ethernet via PXE, a USB stick, or its internal storage.
4
5 You can install DragonFly by booting via USB image and then installing to NVMe.  We recommend connecting up the ethernet for initial connectivity, but Wifi will work once it has been set up.  Once you've installed to NVMe try to reboot via NVMe and continue making adjustments as described below.
6
7 In "/boot/loader.conf" add:
8
9     sound_load="YES"
10     snd_hda_load="YES"
11     if_emx_load="YES"
12     if_iwm_load="YES"
13     iwm8265fw_load="YES"
14
15 In "/etc/rc.conf" if you are using your primary ethernet and not Wifi, this usually does the trick:
16
17     ifconfig_emx0="DHCP"
18
19 Note that the if_em driver is built-in and works if you don't load emx, but emx is a better driver.  To use if_em, just have an ifconfig_em0="DHCP" line in /etc/rc.conf.  In fact, you can put both lines in your rc.conf and it will use emx if emx is loaded, and em otherwise.
20
21 ### WIFI setup
22
23 If you have the NUC, for WIFI support you will want this in your "/etc/rc.conf".  Also note that DHCP will not play well running on both the ethernet interface and the wlan (at least if both are plugged in), so only specify the DHCP option for one of the two.  If the wifi is your primary connectivity, put the DHCP option there.
24
25     wlans_iwm0="wlan0"
26     ifconfig_wlan0="DHCP WPA"
27
28 And your "/etc/wpa_supplicant.conf" file should contain entries for all the wifi basestations you can connect to.  Most typically an entry looks like this:
29
30     network={
31         ssid="blahblah"
32         psk="passwordhere"
33     }
34
35 Its easiest to just reboot after setting up the files rather than trying to start wpa_supplicant manually.  You can have multiple network={} elements in the config file.  Reboot and make sure its working before you worry about the rest of the config.
36
37 ### Sound Setup
38
39 The sound and snd_hda drivers can be loaded from /boot/loader.conf, which we have already described above.  There are typically two channels.  Channel 0 is typically the stereo jack and Channel 1 is typically routed through the HDMI display connector.  You can set the hw.snd.default_unit sysctl to whichever you prefer.  If you have problems with hum on the stereo output, trying routing through the HDMI (and connecting your speakers to your monitor's stereo output instead of the computer's stereo output).
40
41 ### X11 Setup
42
43 DragonFly supports accelerated X on Haswell and later cpus via the "intel" driver.  You no longer have to recompile the X server.  We recommend the following package sets:
44
45     pkg install xorg-apps
46     pkg install xorg-docs
47     pkg install xorg-fonts
48     pkg install xorg-libraries
49     pkg install xorg-macros
50     pkg install xorg-drivers
51     pkg install xorg-server
52     pkg install xdm
53     pkg install dbus
54     pkg install xbindkeys
55     pkg install firefox         (for 'firefox')
56     pkg install chromium        (for 'chrome')
57     (also install your favorite apps, GUIs, window managers, whatever)
58
59 The X11 configuration should work without needing an xorg.conf file.  If you want to play with driver options you will need to set up a file.  Note that our Kabylake support does work pretty well with driver defaults, but may give you a blank screen if you try to change the Accel mode.
60
61 We suggest [starting X via xdm](http://www.dragonflybsd.org/docs/newhandbook/X/#index4h3) which needs a package in addition to xorg:
62
63     pkg install xdm
64
65 ### Further Mouse Setup
66
67 We recommend using moused and /dev/sysmouse to handle external USB mouse attachments.  By using moused, mice can be plugged and unplugged without imploding X11.  Try putting this in your /etc/rc.conf:
68
69     moused_enable="YES"
70
71 If that doesn't work then set moused_enable="NO" in /etc/rc.conf and start moused manually in /etc/rc.local:
72
73     moused -p /dev/ums0
74     moused -p /dev/ums1
75
76 ### Volume and backlight adjustment keys
77 In order to use these keys make two scripts:
78
79     #!/bin/csh
80     #
81     # mute script  "mute"
82     
83     set curvol = "`mixer -f /dev/mixer -s vol`"
84     
85     if ( -f ~/.savemute ) then
86             set lastvol = "`cat ~/.savemute`"
87     else
88             set lastvol = ""
89     endif
90     
91     if ( "$curvol" == "vol 0:0" ) then
92             if ( "$lastvol" != "" ) then
93                     eval mixer -f /dev/mixer $lastvol
94             endif
95     else
96             if ( "$lastvol" != "$curvol" ) then
97                     echo "$curvol" > ~/.savemute
98             endif
99             mixer -f /dev/mixer vol 0
100     endif
101
102     #!/bin/csh
103     #
104     # backlight script "backlight"
105     
106     set level = `sysctl -n hw.backlight_level`
107     @ level = $level + $argv
108     sysctl hw.backlight_level=${level}
109
110 add next lines to `~/.xbindkeysrc`:
111
112     # Volume
113     #
114     "/path/to/scripts/mute"
115       F8
116     
117     "mixer -f /dev/mixer vol -5 pcm -5"
118       F9
119     
120     "mixer -f /dev/mixer vol +5 pcm +5"
121       F10
122     
123     # Screen (if a laptop, this should work.  If not, probably won't)
124     #
125     "/path/to/scripts/backlight -20"
126       F6
127     
128     "/path/to/scripts/backlight 20"
129       F7
130
131 You must call xbindkeys somewhere in your `.xinitrc`.
132
133 *Hint:* You can set default blacklight level (on a laptop) by placing next line in `.xinitrc`:
134
135     sysctl hw.backlight_level=370
136
137 ### Dual Displays
138
139 When X comes up it may not auto-probe all of your connected displays or properly orient them relative to each other.  I find that the easiest solution is to make any required adjustments in your .xinitrc rather than trying to set them up in the /etc/X11/xorg.conf file.  For example, on my Kabylake NUC I use two 4K displays and add this to my .xinitrc:
140
141     xrandr --output DP2 --left-of DP1
142     xrandr --fbmm 622x342
143
144
145 ### Power savings
146
147 This sysctl setting tells the cpu to automatically go to the best power state it can:
148
149     sysctl machdep.mwait.CX.idle=AUTODEEP
150
151 WARNING!  If you get system lockups every once in a while, try commenting this out.  Sometimes AUTODEEP mode interferes with AHCI (disk driver) operation.