Skip to content

macbookpro late 2013 Notes

ipatch edited this page May 7, 2018 · 34 revisions

Contents

My daily πŸš—er

the early 2013 MBPr model # is A1398 Ivy Bridge
the late 2013 MBPr model # is A1398 Haswell

Hardware

  • Network Adapter - Broadcom Corporation BCM4360 802.11ac Wireless Network Adapter
  • Native screen resolution - 2880 x 1800

macOS

To check and see if a MacBook supports an IR remove

  1. Select ο£Ώ > System Preferences...
  2. Choose Security & Privacy
  3. Click on Advanced...
  4. If the MacBook has support for an IR remote there should be a checkbox to toggle functionality.

For more info IR support see

To determine wether macOS is using the discrete GPU or the integrated GPU

Useful Links πŸ”— macOS

Linux

Great πŸ‘Œ explanation for contributing to the Linux kernel

To find the model # of MBPr in Linux

dmidecode -s system-product-name

Working with GRUB2

To install grub2 to a removable USB drive from a Live Linux USB

grub-install --target=x86_64-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --removable --modules=part_gpt --bootloader-id=grub

a configuration file grub.cfg will be needed in order to bootstrap an ISO

grub-mkconfig -o /boot/grub/grub.cfg

Useful Links for working with GRUB2

Working with storage

To see a partition layout of a disk

lsblk

To format a filesystem to a disk

mkfs.ext4 /dev/partition

To convert a .dmg to an .iso follow the below steps

Debian based distro

apt-get install dmg2img
dmg2img my-fancy-pants.dmg

After the process completes, rename my-fancy-pants.img to my-fancy-pants.iso

mv my-fancy-pants.img my-fancy-pants.iso

Useful Links πŸ”— Working with Storage

Working with the kernel

a kernel module can be inserted into a running kernel with insmod a kernel module can be removed from a running kernel with rmmod
a kernel module is code that is inserted into and unloaded out of the static kernel image at run time.

The three types of modules

  1. char module - is a device that can be accessed like a file, stream of bytes.
  2. block module - block drivers have a completely different interface than char drivers.
  3. network module

char module - synchronous
block device - asynchronous

/proc/iomem should show what area of memory a device is occupying

To list known modules loaded in a Linux kernel

lsmod

To list info about a specific kernel module

modinfo <moduleName>

To load the vfio kernel module

sudo modprobe vfio

Printing useful info about system hardware

To get megahertz of CPU

lscpu

To print a list of devices attached to the PCI bus

lspci -nn

Working with processes

In UNIX / Linux a process is created using fork() and is composed of

  • address space
  • one thread upon creation
  • a process contains one thread

user space programs talk to the kernel via system calls, and the kernel talks to the hardware via interrupts.

A simple Hello Kernel program

hello.c
#include 
#include 

static int hello_init(void){ printk(KERN_ALERT β€œTEST: Hello Kernel!\n”); return 0; }

static void hello_exit(void) { printk(KERN_ALERT β€œEXIT: Goodbye Kernel!\n”); }

module_init(hello_init); module_exit(hello_exit);

Troubleshooting Audio

ALSA replaced OSS as the audio engine in Linux

To get the current version of ASLA

cat /proc/asound/version

To print the installed sound devices / cards on the system

cat /proc/asound/cards

To reload pulseaudio / ALSA sound server

pulseaudio -k; alsa force-reload

sudo may be required for alsa force-reload

To reconfigure a PulseAudio sound server during runtime see πŸ™ˆ, pacmd

To show a list of available sound cards

aplay -l

ALSA - is kernel sound mixing
PulseAudio - is user level sound mixing

To print the state of the sound system

aplay -l

To print the state of the sound system

pactl list

How to fix the distorted audio / sound playback?

enable the following flag when launching qemu

--audio-drv-list=alsa

Useful Links Troubleshooting Audio

Working with QEMU and GDB

To start qemu with gdb

qemu [-s/-gdb]

Open GDB in a different $TERM / $SHELL and make sure the appropriate architecture is set see πŸ™ˆ for more info

To print the version of Python 🐍 that GDB using

python import sys;print sys.version

The above command must be run within the (gdb) prompt

Working with QEMU

To attach an iPhone / iPod within qemu

see πŸ™ˆ

To launch a Windows 7 VM via qemu

qemu-system-x86_64 -m 2048 -enable-kvm -vga qxl VM/windows7.img -usbdevice tablet -monitor stdio

To setup macOS within qemu

see πŸ™ˆ

To pass through USB device to qemu

(qemu) usb_add host:03eb:6124

You will need to find the appropriate Device ID for this work

Useful Links Working with QEMU

Arch Linux

To list network interfaces on a system

ip link

To find wireless interface name

iw dev

To remove a package and all it’s dependencies

pacman -Rs <packageName>

Useful Links πŸ”— Arch Linux

X11

Where is xorg.conf on an Arch Linux system?

/etc/X11/xorg.conf

Running macOS on KVM

Useful Links πŸ”— Running macOS on KVM

Useful Links πŸ”—

TODOs

  • check to see if the below statement is still valid.

note each user space process is still limited to a 3GB of memory

Clone this wiki locally