Debian on mackbook pro 8.2

From campisano.org
Jump to navigation Jump to search

About efi install

  • NOTE: the actual efi installation results in a not working discrete (AMD) graphic card. However there is something new there for direct boot using efistub and get AMD work:

- https://help.ubuntu.com/community/MacBookPro8-2/Raring

- https://wiki.debian.org/MacBook#Double_boot_-_Mac_OS_X_.26_Debian

- https://wiki.debian.org/EFIStub

(The used references are at the end of the article)

Stretch-stable

  • The follow partition scheme was prepared using the Disk Utility of OSX:
+-------------+-------+-----+
|name         |type   |size |
+-------------+-------+-----+
|CROSSMOUNT   |vfat   |25GB |
|ROOT         |xfs    |25GB |
|SRV          |xfs    |25GB |
|SWAP         |swap   |4GB  |
|HOME         |xfs    |219GB|
+-------------+-------+-----+

Install

  • At installer boot, no changes to grub menu are needed, but is convenient to choice the non graphical install mode
  • WARNING: in my tests, Grub efi boot loader will be installed without asking, overriding the default OSX boot loader (but that is what I want to do)
  • NOTE: Grub menu will appears freaky

WARNING: problems with AMD discrete card

Please note: if you have any (future) problems with AMD discrete card, you can disable it for macOS from linux command line:

trick from 1, 2 3

  • 1, from linux, set to disable the card before boot
# do the follow (USING LINUX) ONLY if you have problems booting MACOS with discrete card
printf "\x07\x00\x00\x00\x01\x00\x00\x00" > /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9
chattr +i "/sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9"
  • 2, from mac (starting in single mode), disable amd extensions
# do the follow (USING MACOS in single mode) ONLY if you have problems booting MACOS with discrete card
mount -uw /  (to be able to move System files)
mkdir /System/Library/DisabledExtensions/
mv /System/Library/Extensions/ATI* /System/Library/DisabledExtensions/

First boot

  • At first system boot, edit the Linux item of the Grub prompt disable 'modeset' features and switch off discrete graphic cards, adding:
- Follow lines just before the "Loading Linux" line:
        outb 0x728 1
        outb 0x710 2
        outb 0x740 2
        outb 0x750 0
- Follow parameters just before "ro quiet" ones (usually I remove the "quiet one too")
i915.modeset=1 i915.lvds_channel_mode=2 i915.lvds_use_ssc=0
- In my case, the result was like the follow:
[...]
        outb 0x728 1
        outb 0x710 2
        outb 0x740 2
        outb 0x750 0
        echo    'Loading Linux 4.9.0-3-amd64 ...
        linux   /boot/vmlinuz-4.9.0-3-amd64 root=UUID=a300f00d-de7e-42cd-ae2e-6fbb40bf2096 ro i915.modeset=1 i915.lvds_channel_mode=2 i915.lvds_use_ssc=0
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-4.9.0-3-amd64

Config

Etckeeper [optional]

  • OPTIONAL install etckeeper to keep tracks /etc config changes
- It is not in the install DVD, and it needs git package, so you will need to download etckeeper package and use the install DVD to install its dependencies)
- Configure it like Git server config backup

Grub

  • Persist Grub config to boot Debian with discrete card disabled
  • edit /etc/default/grup GRUB_CMDLINE_LINUX_DEFAULT varible and add the previous linux boot arguments, it should became like the follow:
GRUB_CMDLINE_LINUX_DEFAULT="radeon.modeset=0 i915.modeset=1 i915.lvds_channel_mode=2 i915.lvds_use_ssc=0"

Note from https://wwwtech.de/articles/2012/jun/gentoo-linux-on-the-macbook-pro-82-late-2011

the lvds_channel_mode=2 tells the i915 driver that there are two LVDS channels and the lvds_use_ssc=0 disables Spread-Spectrum Clocking, which is buggy with some i5/i7 chipsets.
  • add a new config file to disable discrete graphic
cat > /etc/grub.d/01_disable_discrete_graphic_card << EOF2
cat << EOF
outb 0x728 1 # Switch select
outb 0x710 2 # Switch display
outb 0x740 2 # Switch DDC
outb 0x750 0 # Power down discrete graphics
EOF
EOF2
chmod 755 /etc/grub.d/01_disable_discrete_graphic_card
  • finally, update grub configuration and reboot
update-grub

Wireless

  • NOTE: until 2018/03/07 I'm using b43 wireless module, experiencing some problem with the wireless device working intermittently as related here and here, so I'm testing a new kind of installation that is currently working:
- NEW firmware installation step-to-step (broadcom-sta-dkms), from here:
apt-get update
apt-get install linux-image-$(uname -r|sed 's,[^-]*-[^-]*-,,') linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms
modprobe -r b44 b43 b43legacy ssb brcmsmac bcma # unload conflicting modules, they was blacklisted from the previous apt command
modprobe wl # load the wl module, however in my case I need to restart!
echo NOTE, the wireless device name can change, in my case from 'wlp3s0b1' to 'wlp3s0'
echo PLEASE RESTART IF HAVE ANY PROBLEM!
- OLD firmware install step-to-step (b43), from here:
apt-get install firmware-b43-installer
rmmod b43
modprobe b43
  • Now, you can test the wireless using 'nm-applet' tray icon program in a X session to configure a wireless connection

Remote APT repository

Install others non-free firmware drivers

apt-get install firmware-linux-nonfree

Xorg

  • To have the touchpad configured, you may just install the synaptics X module with this command
apt-get install xserver-xorg-input-synaptics

and set your configuration in .xsession config file using the follow command

synclient VertTwoFingerScroll=1 HorizTwoFingerScroll=1 TapButton1=1 TapButton2=3 TapButton3=2
  • To have the proper keymap configured under X, you can use the command 'setxkbmap' in the ~/.xsession file like follows:
setxkbmap en, it, br

Keyboard

  • To have control of backlight, volume and keyboard light, use pommed
apt-get install pommed

Note, backlight control is very slow, you can edit the /etc/pommed.conf to speed up the backlight changes, editing the respective section as follows

lcd_sysfs {
        # The sysfs backlight control is a generic interface provided
        # by the Linux kernel for backlight control on most graphic cards.
        # The brightness range can differ depending on the hardware.

        # initial backlight level [12] (0 - 15, -1 to disable)
        init = -1
        # step value (1 - 2)
        step = 2500
        # backlight level when on battery [6] (1 - 15, 0 to disable)
        on_batt = 2500
}

Jessie-stable

Install

Installed from Debian 8 dvd using efi dvd boot:

  • MacbookPro EFI partition must be mounted
  • no need of rEFIt
  • Grub EFI installed
  • At first boot, edit Grub boot option and add the boot parameters 'nomodeset', or a video problem will halt the system
  • Install etckeeper, to keep track config changes
  • Reconfigure grub with 'nomodeset' option in /etc/default/grub, run update-grub to fix the changes
  • Install firmware-linux-nonfree xserver-xorg-video-ati for video and b43-fwcutter firmware-b43-installer for wireless
  • WARNING: suspend cause blank monitor on wake up!

Wheezy-stable tested

Install

install rEFIt
use dvd to install debian
install until boot loader installation
boot loader installation
 go back
 continue without
 stop! go to ctrl+alt+F2
 chroot /target
 grub-install /dev/sdX --force
 update-grub
 exit

continue until reboot
on rEFIt prompt, start Partitioning Tool
say yes to update MBR and hit enter
shutdown your mac
restart
boot your debian

First boot

Xorg

Modules

add this rows:


Section "Module"

    # This loads the 3d extrnsion drivers
    Load    "glx"        # OpenGL rendering;
    Load    "dri"        # direct rendering (NOT nvidia)
    Load    "vbe"        # BIOS VESA extensions (get info from board)
    Load    "ddc"        # Data Display Chanel (get info from board)
    Load    "int10"        # real-mode x86 emulator useful for "vbr"
    Load    "dbe"        # Double buffer extension

    #    Load    "GLcore"    # OpenGL support
    # OBS: Per quelli che intendono usare aiglx, e' necessario (tra le altre cose)
    # disabilitare proprio l' estensione GLX dalla configurazone di Xorg.

    Load    "v4l"        # Video4Linux

    # This loads the extension drivers
    Load    "extmod"    # Misc. extensions

    # This loads the font modules
    Load    "freetype"
    Load    "bitmap"

EndSection



Section "Extensions"
    Option    "Composite"    "Enable"
EndSection



Section "DRI"
    Mode    0666
EndSection

ATI proprietary driver

from http://wiki.debian.org/ATIProprietary

apt-get install  fglrx-control fglrx-driver


add this basic xorg.conf rows


Section "Device"
    Identifier  "ATI"
    Driver      "fglrx"
EndSection



Section "Screen"
    Identifier "Default Screen"
    DefaultDepth     24
    SubSection "Display"
        Viewport  0 0
        Virtual   3360 1980
        Depth     24
    EndSubSection
EndSection


test with

xrandr --auto --output LVDS --primary --mode 1440x900 --output DFP1 --mode 1920x1080 --right-of LVDS

Touchpad

/etc/X11/xorg.conf

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "synaptics"
    Option         "SendCoreEvents"        "true"
    Option         "Device"                "/dev/input/mice"
    Option         "Protocol"              "auto"

    # use two finger scrolling 
    Option         "VertTwoFingerScroll"   "1" 
    Option         "HorizTwoFingerScroll"  "1" # set to 0 if you don't want horizontal scrolling

    # minimum pressure motion factor 
    #Option         "PressureMotionMinZ"    "10"

    # touch and untouch thresholds, higher numbers if you like to push hard 
    Option         "FingerHigh"            "60" # change to 30 or 40 if you like
    Option         "FingerLow"             "20" 

    # FingerPress (Integer) : Above which counts as press 
    #Option         "FingerPress"           "130"

    # borders based on output from synclient 
    Option         "LeftEdge"              "100" 
    Option         "RightEdge"             "1100" 
    Option         "TopEdge"               "50" 
    Option         "BottomEdge"            "700"

    # speeds, smaller number for a slower mouse 
    Option         "MinSpeed"              "0.94" # 0.5 is very slow, 1.5 is very fast 
    Option         "MaxSpeed"              "1.0" # up to 1.5 works ok 
    Option         "New AccelFactor"       "0.03"
    Option         "AccelFactor"           "0.0015"

    # tap times, change to suit your tapping habits 
    Option         "FastTaps"              "0" 
    Option         "MaxTapMove"            "100" 
    Option         "MaxTapTime"            "180" 
    Option         "MaxDoubleTapTime"      "200"


    # don't change these or two finger tap stops working 
    Option         "TapButton1"            "0"
    Option         "TapButton2"            "3" 
    Option         "TapButton3"            "2"

    Option         "VertEdgeScroll"        "0"
    Option         "HorizEdgeScroll"       "0"

    # scroll speed, lower is faster 
    Option         "VertScrollDelta"       "20"
    Option         "HorizScrollDelta"      "20" 

    # Right Bottom Corner Button as right click 
    Option         "RTCornerButton"        "0" 
    Option         "RBCornerButton"        "2"

    # Left Bottom Corner Button as middle click 
    Option         "LTCornerButton"        "0" 
    Option         "LBCornerButton"        "3"

    # Palm Detection: Useful while typing 
    Option         "PalmDetect"            "on" 
    Option         "PalmMinWidth"          "10" 
    Option         "PalmMinZ"              "200"

    # needed for disabled while typing fix 
    Option         "SHMConfig"             "on"
EndSection

Wireless

Manual firmware install

apt-get install b43-fwcutter firmware-b43-installer
modprobe -r b43
export FIRMWARE_INSTALL_DIR="/lib/firmware"
wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
tar -xjf broadcom-wl-5.100.138.tar.bz2
b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" broadcom-wl-5.100.138/linux/wl_apsta.o
rm -rf broadcom-wl-5.100.138 broadcom-wl-5.100.138.tar.bz2
modprobe b43

Suspend with wireless working after resume [needed in Squeeze, maybe in wheezy too]

from Linux support for Broadcom 4331 wireless chip (Macbook Pro 8,1) | Raimar Sandner and Fix Suspend on Macbook Pro 8,1 and 8,2 « BITONIC BLOG

echo SUSPEND_MODULES=\"b43\" >> /etc/pm/config.d/default

References

Apple sad stories