Monday, February 8, 2021

Slackware64-current In MacBook Pro

I am just another regular Slackware user, who likes tinkering around with machines and installing Slackware64-current on them to check on their performance and if Slackware64-current can work on them.

I received a MacBook Pro from one of my customers and wanted to see if I could install Slackware64-current natively on it, since it had an issue that would cost $300 to $500 to fix with the built-in or integrated (soldered to the motherboard) video card, which all laptops have anyway.  These are the steps I took and the URLs I gathered in this process.

Note:  Do this at your own risk.  I assume no responsibility if something goes wrong.  This procedure will format the whole drive and you will lose macOS on it.

01) Download Slackware64-current iso (https://slackware.nl/slackware/slackware64-current-iso/) and create a USB bootable stick with it

02) Hold "alt" or "option" before pressing the power button on the MacBook Pro.  Release it when you see "EFI Boot"

03) Double click on "EFI Boot" to start the Slackware64-current installation

04) Use cfdisk or cgdisk to create partitions.  The first partition should be a 100M EFI partition.  Other partitions can include a swap partition, a root ("/") partition and a home ("/home") partitions or any other partition that you need.  The EFI partition is required for this procedure to work

05) Run setup as with any other installation and follow the prompts.  After it finishes installing the system, it will encounter the EFI partition and ask you if you want to format it

06) Click on "install" on the "ELILO (EFI Linux Loader) installation" screen

Note:  The text mentions "Apple computers use a different type of EFI firmware and efibotmgr has been know to damage them.  On all other computers, it is recommended to add a boot menu entry." and give the options to "install" or "skip".  This is the step that creates the boot entry and makes the MacBook Pro recognize the partition and allow you to boot from the installation

07) Remove elilo and configure grub.  I could not get elilo to work once I updated the kernel, plus I "pimped" my Slackware64-current installation a bit, by creating a png file to display while grub loads with 5 a seconds countdown.  I also downloaded a font to use in this splash screen in grub.  You can still use "e" while grub is displayed on the screen to login into a different runlevel

Files:

# grub (place it in /etc/default/ or run the script)

# If you change this file, run grub-mkconfig -o /boot/grub/grub.cfg
# afterwards to update /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Slackware"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash vga=current"
GRUB_FONT="/boot/grub/fonts/unicode.pf2"
GRUB_DISABLE_OS_PROBER=true
GRUB_BACKGROUND="/boot/grub/SlackGrub.png"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=1280x1024

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

# Save this image as SlackGrub.png and place it in /boot/grub/


Script:

# I saved it as grubconf.sh and chmod +x for it to run

#!/bin/bash
echo "Removing elilo"
removepkg elilo
cd /boot/efi/EFI/Slackware
mv elilo.conf elilo.conf.orig
mv elilo.efi elilo.efi.orig

echo "Configuring grub"
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug
mkdir -p /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

echo "Copying grub files"
cp grub /etc/default/grub
cp SlackGrub.png /boot/grub/SlackGrub.png
mkdir /boot/grub/fonts
cp unicode.pf2 /boot/grub/fonts/unicode.pf2

echo "Reconfiguring grub"
grub-mkconfig -o /boot/grub/grub.cfg

URLs:

https://docs.slackware.com/howtos:slackware_admin:set_up_grub_as_boot_loader_on_uefi_based_hardware

https://github.com/anak10thn/ign-bootloader/blob/master/ign-grub2/config/boot/grub/ -- Download unicode.pf2 from it

Regards,

F. Bobbio C.