Skip to content

Commit

Permalink
Fedora 38 (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeeq committed May 2, 2023
1 parent 418345f commit af89d45
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 68 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fedora:37
FROM fedora:38

RUN dnf upgrade -y \
&& dnf install -y \
Expand Down
43 changes: 23 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,23 @@ macOS Mojave: 10.14.6 (18G103)
- First of all I recommend to shrink (resize) macOS APFS partition and not removing macOS installation entirely from your MacBook, because it's the only way to keep your device up-to-date. macOS OS updates also contains security patches to EFI/Apple T2
- HowTo: <https://www.anyrecover.com/hard-drive-recovery-data/resize-partition-mac/> # Steps to Resize Mac Partition
- Boot Fedora Installer from USB drive directly from macOS boot manager. (You can boot into it by pressing and holding Option key (ALT key) after clicking the power-on button when your computer was turned off or on restart/reboot when Apple logo is shown on the screen).
- There will be two/three boot options available, usually the last one works for me. (There are multiple boot options, because there are three different partitions in the ISO to make the ISO bootable on different set of computers: 1) ISO9660: with installer data, 2) fat32, 3) hfs+)
- I recommend using standard partition layout during partitioning your Disk in Anaconda (Fedora Installer) as I haven't tested other scenarios yet. <https://github.com/mikeeq/mbp-fedora/issues/2

- please create a separate partition for Linux EFI (Linux HFS+ ESP) as Anaconda installer requires separate partition on Mac devices, and it'll be reformatted to EFI (FAT32) during post-install scripts Anaconda's step (at the end of installation process).
- Usually there will be two/three (can be one in newer versions of mbp-fedora) USB boot options available, usually the last one works for me. (There are multiple boot options, because there are three different partitions in the ISO to make the ISO bootable on different set of computers: 1) ISO9660: with installer data, 2) fat32, 3) hfs+)
- I recommend using standard partition layout during partitioning your Disk in Anaconda (Fedora Installer)

```bash
/boot/efi - 600MiB Linux HFS+ ESP
/boot/efi - 600MiB EFI FAT32
/boot - 2GiB EXT4
/ - xxxGiB EXT4
```

> You can leave the desired capacity value empty for the last partition, Anaconda will allocate all free disk space to that partition when defining it.
![anaconda partitioning](screenshots/anaconda-3.png)

> You can also encrypt your main partition using LUKS
![anaconda luks](screenshots/anaconda-luks.png)

- To install additional languages (only English is available out of the box), install appropriate langpack via dnf `dnf search langpacks`, i.e.: to install Polish language pack execute: `dnf install langpacks-pl`
- You can change mappings of ctrl, option keys (PC keyboard mappings) by creating `/etc/modprobe.d/hid_apple.conf` file and recreating grub config. All available modifications could be found here: <https://github.com/free5lot/hid-apple-patched>

Expand Down Expand Up @@ -106,7 +109,7 @@ reboot

# 2. Update mbp-fedora-kernel
## update_kernel_mbp has built-in selfupgrade function, so when it fails it's just due to script update - please rerun everything should be good on second run
KERNEL_VERSION="6.1.5-f37" UPDATE_SCRIPT_BRANCH="v6.1-f37" update_kernel_mbp
KERNEL_VERSION="6.2.13-f38" UPDATE_SCRIPT_BRANCH="v6.2-f38" update_kernel_mbp
reboot

# 3. Update your OS to include all changes made in mbp-fedora-t2-config RPM
Expand All @@ -117,9 +120,9 @@ reboot
dnf install -y dnf-plugin-system-upgrade

# 5. Upgrade to new OS version
## If you're trying to upgrade older version of mbp-fedora to latest version, please repeat a process by upgrading only to one major release of Fedora, i.e.: Fedora 33 -> 34, 34 -> 35, 35 -> 36, 36 -> 37, by changing the number in `--releasever` argument
## If you're trying to upgrade older version of mbp-fedora to latest version, please repeat a process by upgrading only to one major release of Fedora, i.e.: Fedora 33 -> 34, 34 -> 35, 35 -> 36, 36 -> 37 -> 38, by changing the number in `--releasever` argument

dnf system-upgrade download -y --releasever=37
dnf system-upgrade download -y --releasever=38

# 6. Reboot your Mac
dnf system-upgrade reboot
Expand All @@ -146,19 +149,10 @@ reboot
## Partially working

- Suspend - really unstable, I recommend disabling it. If you would stuck in sleep mode, try to keep pressing power off button for a while to force poweroff and then turn on the Macbook.
- Keyboard Backlight - it's working for older 15,x models, currently not working for 16,x - you can check Ubuntu build as it's working in it.
- Touch Bar, if you encounter any issues, I recommend reboot to MacOS/Windows to initialize TouchBar and then back to Linux - it should fix the problem.

## TODO

- disable iBridge network interface (awkward internal Ethernet device?)

```bash
echo "# Disable Unused Apple Ethernet
blacklist cdc_ncm
blacklist cdc_mbim" | sudo tee -a /etc/modprobe.d/blacklist.conf
```

- disable not working camera device
- there are two video devices (web cameras) initialized/discovered, don't know why yet

Expand All @@ -175,16 +169,25 @@ reboot
## Known issues

- Kernel/Mac related issues are mentioned in kernel repo
- Anaconda sometimes could not finish installation process and it's freezing on `Network Configuration` step, probably due to iBridge internal network interface
- internal iBridge network interface
- Anaconda sometimes could not finish installation process and it's freezing on `Network Configuration` step, probably due to iBridge internal network interface
- internal iBridge network interface is getting discovered and causing slow OS boot

> workaround - it's a final step of installation, just reboot your Mac (installation is completed)
> workaround - two kernel modules responsible for loading it are disabled by default in mbp-fedora
```bash
echo "# Disable Unused Apple Ethernet
blacklist cdc_ncm
blacklist cdc_mbim" | sudo tee -a /etc/modprobe.d/apple_internal_eth_blacklist.conf
```

- Macbooks with Apple T2 can't boot EFI binaries from HFS+ formatted ESP - only FAT32 (FAT32 have to be labelled as msftdata).

> workaround applied - HFS+ ESP is reformatted to FAT32 in post-scripts step and labelled as `msftdata`
> ~~workaround applied - HFS+ ESP is reformatted to FAT32 in post-scripts step and labelled as `msftdata`~~ fixed in upstream
- `ctrl+x` is not working in GRUB, so if you are trying to change kernel parameters - start your OS by clicking `ctrl+shift+f10` on external keyboard


## Docs

- Discord: <https://discord.gg/Uw56rqW>
Expand Down
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
set -eu -o pipefail

CURRENT_PWD=$(pwd)
FEDORA_VERSION=37
FEDORA_VERSION=38
FEDORA_KICKSTARTS_GIT_URL=https://pagure.io/fedora-kickstarts.git
FEDORA_KICKSTARTS_BRANCH_NAME=f37
FEDORA_KICKSTARTS_COMMIT_HASH=a000cf7510a9304aec2374112627c0a727389a12 # https://pagure.io/fedora-kickstarts/commits/f37
FEDORA_KICKSTARTS_BRANCH_NAME=f38
FEDORA_KICKSTARTS_COMMIT_HASH=69c726f7536cde6acf36697f7ba112ad3107e7ac # https://pagure.io/fedora-kickstarts/commits/f38
LIVECD_TOOLS_GIT_URL=https://github.com/livecd-tools/livecd-tools
LIVECD_TOOLS_GIT_BRANCH_NAME=main
LIVECD_TOOLS_GIT_COMMIT_HASH=3efb4e3626a7a74b4bf16fc3237ecfd7f7f0ce4a
LIVECD_TOOLS_GIT_COMMIT_HASH=4acb0c9515783446c3ad87bf29ec049ed835f788
LIVECD_CACHE_PATH=/var/cache/live

FEDORA_DESKTOP_ENV="${FEDORA_DESKTOP_ENV:-}"
Expand Down
2 changes: 1 addition & 1 deletion build_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eu -o pipefail

DOCKER_IMAGE=fedora:37
DOCKER_IMAGE=fedora:38

docker pull ${DOCKER_IMAGE}
docker run \
Expand Down
4 changes: 2 additions & 2 deletions build_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

set -eu -o pipefail

docker build -t fedora_iso:37 .
docker build -t fedora_iso:38 .

DOCKER_IMAGE=fedora_iso:37
DOCKER_IMAGE=fedora_iso:38
LIVECD_CACHE_PATH=/var/cache/live

docker run \
Expand Down
10 changes: 6 additions & 4 deletions fedora-mbp.ks
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ eula --agreed

## Install mbp-fedora-kernel, mbp-fedora-t2-config, mbp-fedora-t2-repo
curl
-kernel-6.*.fc37.x86_64
kernel-*.*[0-9].mbp.fc37.x86_64
-kernel-6.*.fc38.x86_64
kernel-*.*[0-9].mbp.fc38.x86_64
mbp-fedora-t2-config
mbp-fedora-t2-repo

%end

%post
UPDATE_SCRIPT_BRANCH=v6.2-f37
UPDATE_SCRIPT_BRANCH=v6.2-f38
### Add dns server configuration
echo "===]> Info: Printing PWD"
Expand Down Expand Up @@ -57,7 +57,9 @@ sed -i '/^type=rpm.*/a exclude=kernel,kernel-core,kernel-devel,kernel-devel-matc
cp -rfv /tmp/kickstart_files/grub/30_os-prober ${INSTALL_ROOT}/etc/grub.d/30_os-prober
chmod 755 ${INSTALL_ROOT}/etc/grub.d/30_os-prober
### Post install anaconda scripts - Reformatting HFS+ EFI partition to FAT32 and rebuilding grub config
### Post install anaconda scripts - Adding Fedora icon and label to Mac boot entry
mkdir -p ${INSTALL_ROOT}/usr/share/anaconda/mac_extras
cp -rfv /tmp/kickstart_files/usb/.* ${INSTALL_ROOT}/usr/share/anaconda/mac_extras/
cp -rfv /tmp/kickstart_files/post-install-kickstart/*.ks ${INSTALL_ROOT}/usr/share/anaconda/post-scripts/
%end
41 changes: 5 additions & 36 deletions files/post-install-kickstart/97-mbp-post-install.ks
Original file line number Diff line number Diff line change
@@ -1,41 +1,10 @@
%post --nochroot
EFI_DEV=$(df | grep '/boot/efi' | awk '{print $1}')
if [[ $EFI_DEV =~ "/dev/nvme" ]]; then
EFI_DISK=${EFI_DEV%??}
elif [[ $EFI_DEV =~ "/dev/sd" ]]; then
EFI_DISK=${EFI_DEV%?}
elif [[ $EFI_DEV =~ "/dev/vd" ]]; then
EFI_DISK=${EFI_DEV%?}
else
echo >&2 "Not supported disk, skipping reformatting..."; exit 0;
fi
EFI_PARTITION=${EFI_DEV: -1}
# Adding Fedora icon and label to Mac boot entry
mkdir -p ${ANA_INSTALL_PATH}/boot/efi/
mkdir -p ${ANA_INSTALL_PATH}/boot/efi/System/Library/CoreServices/
if cat ${ANA_INSTALL_PATH}/etc/fstab | grep hfsplus ; then
### HFS+ boot partition reformatting to FAT32
mkdir -p ${ANA_INSTALL_PATH}/opt/efi_backup
cp -rfv ${ANA_INSTALL_PATH}/boot/efi/* ${ANA_INSTALL_PATH}/opt/efi_backup/
cp -rfv ${ANA_INSTALL_PATH}/boot/efi/.VolumeIcon.icns ${ANA_INSTALL_PATH}/opt/efi_backup/.VolumeIcon.icns
umount $EFI_DEV
mkfs.vfat -F 32 $EFI_DEV
mount $EFI_DEV ${ANA_INSTALL_PATH}/boot/efi/
cp -rfv ${ANA_INSTALL_PATH}/opt/efi_backup/* ${ANA_INSTALL_PATH}/boot/efi/
cp -rfv ${ANA_INSTALL_PATH}/opt/efi_backup/.VolumeIcon.icns ${ANA_INSTALL_PATH}/boot/efi/
cp -rfv ${ANA_INSTALL_PATH}/boot/efi/EFI/fedora/.disk_label ${ANA_INSTALL_PATH}/boot/efi/System/Library/CoreServices/
parted ${EFI_DISK} set ${EFI_PARTITION} msftdata on
rm -rfv ${ANA_INSTALL_PATH}/opt/efi_backup
### Change fstab
sed -i '/hfsplus/d' ${ANA_INSTALL_PATH}/etc/fstab
EFI_FAT_UUID=$(blkid ${EFI_DEV} -o export | grep -e '^UUID')
echo "${EFI_FAT_UUID} /boot/efi vfat defaults 0 2" >> ${ANA_INSTALL_PATH}/etc/fstab
# touch ${ANA_INSTALL_PATH}/.autorelabel
# rm -rf /etc/grub.d/30_os-prober
# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
else
echo "OS installed on non-Apple device..."
fi
cp -rfv ${ANA_INSTALL_PATH}/usr/share/anaconda/mac_extras/.VolumeIcon.icns ${ANA_INSTALL_PATH}/boot/efi/
cp -rfv ${ANA_INSTALL_PATH}/usr/share/anaconda/mac_extras/.disk_label ${ANA_INSTALL_PATH}/boot/efi/System/Library/CoreServices/
%end
Binary file modified screenshots/anaconda-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/anaconda-luks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit af89d45

Please sign in to comment.