├── .gitignore ├── LICENSE ├── README.md ├── build.sh ├── mkosi.conf └── mkosi.skeleton ├── boot └── efi │ └── EFI │ └── fedora │ └── grub.cfg ├── etc ├── default │ └── grub ├── dracut.conf.d │ └── initial-boot.conf ├── fstab ├── hostname ├── kernel │ └── install.conf ├── sysconfig │ └── kernel ├── vconsole.conf └── yum.repos.d │ ├── mkosi-group_asahi-fedora-remix-branding.repo │ ├── mkosi-group_asahi-fedora-remix-scripts.repo │ ├── mkosi-group_asahi-kernel.repo │ └── mkosi-group_asahi-u-boot.repo ├── image.creation ├── create.bls.entry └── info └── usr ├── lib └── dracut │ └── dracut.conf.d │ └── 10-asahi.conf └── local └── sbin ├── chroot.asahi └── umount.asahi /.gitignore: -------------------------------------------------------------------------------- 1 | mnt_usb 2 | mkosi.cache 3 | mkosi.output 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright The Asahi Linux Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Creates a Fedora usb drive that will boot on Apple M-series systems (that have Asahi Linux installed on the internal hard drive!!!) 2 | 3 | ## Fedora Package Install 4 | ```dnf install arch-install-scripts bubblewrap dosfstools e2fsprogs gdisk mkosi openssl pandoc rsync systemd-container``` 5 | 6 | #### Notes 7 | 8 | - The root password is **fedora** 9 | - The ```qemu-user-static``` package is needed if building the image on a ```non-aarch64``` system 10 | - This project will work with mkosi versions less then or equal to `mkosi v23` 11 | If needed, you can always install a specific version via pip 12 | `python3 -m pip install --user git+https://github.com/systemd/mkosi.git@v22` 13 | 14 | 15 | To build a minimal Fedora image and install it to a usb drive, simply run: 16 | ``` 17 | ./build.sh -d /dev/sda 18 | ``` 19 | 20 | **note:** substitute ```/dev/sda``` with the device id of your usb drive 21 | 22 | If you've previously installed this Fedora image to the usb drive, you can wipe the drive and install a new image without having to repartition/reformat the drive by providing the `-w` argument 23 | ``` 24 | ./build.sh -wd /dev/sda 25 | ``` 26 | 27 | Once the drive is created, you can locally mount, unmount, or chroot into the usb drive (which contains 3 partitions) to/from ```mnt_usb/``` with 28 | ``` 29 | ./build.sh mount 30 | ./build.sh umount 31 | ./build.sh chroot 32 | ``` 33 | **note:** mounting the usb drive is useful for inspecting the contents of the drive or making changes to it 34 | 35 | To boot the usb drive, type `bootmenu` at the `u-boot` prompt and select the usb drive ie `Usb 0` 36 | 37 | 38 | 39 | 40 | 41 | 42 | **Setting up WiFi** 43 | 44 | To connect to a wireless network, use the following sytanx: 45 | ```nmcli dev wifi connect network-ssid``` 46 | 47 | An actual example: 48 | ```nmcli dev wifi connect blacknet-ac password supersecretpassword``` 49 | 50 | **Rescuing a Fedora install** 51 | 52 | Two helper scripts have been added to this image 53 | Which are useful if you have Fedora installed on the internal drive: 54 | ``` 55 | /usr/local/sbin/chroot.asahi 56 | /usr/local/sbin/umount.asahi 57 | ``` 58 | 1. `chroot.asahi` will mount the (Fedora) internal drive under `/mnt` and will `arch-chroot` into it. 59 | To exit from the `chroot` environment, simply type `ctrl+d` or `exit` 60 | 61 | 2. `umount.asahi` will unmount the internal drive from `/mnt` 62 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | mkosi_output='mkosi.output' 6 | mkosi_rootfs="$mkosi_output/image" 7 | mkosi_cache='mkosi.cache' 8 | mnt_usb="$(pwd)/mnt_usb" 9 | mkosi_max_supported_version=23 10 | 11 | EFI_UUID='3051-D434' 12 | BOOT_UUID='a1492762-3fe2-4908-a8b9-118439becd26' 13 | ROOT_UUID='d747cb2a-aff1-4e47-8a33-c4d9b7475df9' 14 | 15 | if [ "$(whoami)" != 'root' ]; then 16 | echo "You must be root to run this script" 17 | echo "Try \`sudo su -\` before running this script" 18 | exit 19 | elif [[ -n $SUDO_USER ]] && [[ $SUDO_USER != 'root' ]]; then 20 | echo "You must run this script as root and not with sudo" 21 | echo "Try \`sudo su -\` before running this script" 22 | exit 23 | fi 24 | 25 | [ ! -d $mnt_usb ] && mkdir $mnt_usb 26 | [ ! -d $mkosi_output ] && mkdir $mkosi_output 27 | [ ! -d $mkosi_cache ] && mkdir $mkosi_cache 28 | 29 | # specify the usb device with the -d argument 30 | while getopts :d:w arg 31 | do 32 | case "${arg}" in 33 | d) usb_device=${OPTARG};; 34 | w) wipe=true;; 35 | esac 36 | done 37 | 38 | shift "$((OPTIND-1))" 39 | 40 | [[ -n $usb_device ]] && [[ ! -b $usb_device ]] && echo $usb_device is not a block device && exit 41 | 42 | check_mkosi() { 43 | mkosi_cmd=$(command -v mkosi || true) 44 | [[ -z $mkosi_cmd ]] && echo 'mkosi is not installed...exiting' && exit 45 | mkosi_version=$(mkosi --version | awk '{print $2}' | sed 's/\..*$//') 46 | 47 | if [[ $mkosi_version -gt $mkosi_max_supported_version ]]; then 48 | echo "mkosi path: $mkosi_cmd" 49 | echo "mkosi version: $mkosi_version" 50 | echo -e "\nOnly mkosi version $mkosi_max_supported_version and below are supported" 51 | echo "please install a compatible version to continue" 52 | exit 53 | fi 54 | } 55 | 56 | mount_usb() { 57 | # mounts an existing usb drive to mnt_usb/ so you can inspect the contents or chroot into it...etc 58 | systemctl daemon-reload 59 | sleep 1 60 | # first try to mount the usb partitions via their uuid 61 | if [ $(blkid | grep -Ei "$EFI_UUID|$BOOT_UUID|$ROOT_UUID" | wc -l) -eq 3 ]; then 62 | [[ -z "$(findmnt -n $mnt_usb)" ]] && mount -U $ROOT_UUID $mnt_usb 63 | [[ -z "$(findmnt -n $mnt_usb/boot)" ]] && mount -U $BOOT_UUID $mnt_usb/boot 64 | [[ -z "$(findmnt -n $mnt_usb/boot/efi)" ]] && mount -U $EFI_UUID $mnt_usb/boot/efi 65 | # we need this since we're using set -e 66 | return 0 67 | else 68 | # otherwise mount via the device id 69 | if [[ -z $usb_device ]]; then 70 | echo -e "\nthe usb device can't be mounted via the uuid values" 71 | echo -e "\ntherefore you must specify the usb device ie\n./build.sh -d /dev/sda mount\n" 72 | exit 73 | fi 74 | [[ -z "$(findmnt -n $mnt_usb)" ]] && mount "$usb_device"3 $mnt_usb 75 | [[ -z "$(findmnt -n $mnt_usb/boot)" ]] && mount "$usb_device"2 $mnt_usb/boot 76 | [[ -z "$(findmnt -n $mnt_usb/boot/efi)" ]] && mount "$usb_device"1 $mnt_usb/boot/efi 77 | fi 78 | } 79 | 80 | umount_usb() { 81 | # if $usb_device is specified then ensure all partitions from the drive are unmounted 82 | # this is needed for new usb devices and for systems that auto-mount usb devices 83 | if [[ -n $usb_device ]]; then 84 | for partition in ${usb_device}?*; do 85 | [[ -n "$(findmnt -n $partition)" ]] && umount $partition 86 | done 87 | return 0 88 | fi 89 | 90 | # umounts usb drive from mnt_usb/ 91 | echo '### Checking to see if usb drive is mounted to mnt_usb' 92 | if [ ! "$(findmnt -n $mnt_usb)" ]; then 93 | return 0 94 | fi 95 | 96 | echo '### Unmounting usb partitions' 97 | [[ "$(findmnt -n $mnt_usb/boot/efi)" ]] && umount $mnt_usb/boot/efi 98 | [[ "$(findmnt -n $mnt_usb/boot)" ]] && umount $mnt_usb/boot 99 | [[ "$(findmnt -n $mnt_usb)" ]] && umount $mnt_usb 100 | } 101 | 102 | wipe_usb() { 103 | # wipe the contents of the usb drive to avoid having to repartition it 104 | # first check if the partitions exist 105 | umount_usb 106 | 107 | if [ $(blkid | grep -Ei "$EFI_UUID|$BOOT_UUID|$ROOT_UUID" | wc -l) -eq 3 ]; then 108 | [[ -z "$(findmnt -n $mnt_usb)" ]] && mount -U $ROOT_UUID $mnt_usb 109 | if [ -e $mnt_usb/boot ]; then 110 | [[ -z "$(findmnt -n $mnt_usb/boot)" ]] && mount -U $BOOT_UUID $mnt_usb/boot 111 | fi 112 | if [ -e $mnt_usb/boot/efi ]; then 113 | [[ -z "$(findmnt -n $mnt_usb/boot/efi)" ]] && mount -U $EFI_UUID $mnt_usb/boot/efi 114 | fi 115 | fi 116 | 117 | if [ ! "$(findmnt -n $mnt_usb)" ]; then 118 | echo -e '### The usb drive did not mount\nparitioning disk\n' 119 | wipe=false 120 | return 121 | fi 122 | 123 | echo '### Wiping usb partitions' 124 | [[ "$(findmnt -n $mnt_usb/boot/efi)" ]] && rm -rf $mnt_usb/boot/efi/* && umount $mnt_usb/boot/efi 125 | [[ "$(findmnt -n $mnt_usb/boot)" ]] && rm -rf $mnt_usb/boot/* && umount $mnt_usb/boot 126 | [[ "$(findmnt -n $mnt_usb)" ]] && rm -rf $mnt_usb/* && umount $mnt_usb 127 | } 128 | 129 | # ./build.sh mount 130 | # ./build.sh umount 131 | # ./build chroot 132 | # to mount, unmount, or chroot into the usb drive (that was previously created by this script) to/from mnt_usb 133 | if [[ $1 == 'mount' ]]; then 134 | echo "### Mounting to $mnt_usb" 135 | mount_usb 136 | exit 137 | elif [[ $1 == 'umount' ]] || [[ $1 == 'unmount' ]]; then 138 | echo "### Umounting from $mnt_usb" 139 | umount_usb 140 | exit 141 | elif [[ $1 == 'chroot' ]]; then 142 | mount_usb 143 | echo "### Chrooting into $mnt_usb" 144 | arch-chroot $mnt_usb 145 | exit 146 | elif [[ -n $1 ]]; then 147 | echo "$1 isn't a recogized option" 148 | fi 149 | 150 | [[ -z $usb_device ]] && echo "usage ./build -d [usb_device] || ./build {mount,umount,chroot}" && exit 151 | [[ ! -e $usb_device ]] && echo -e "\n$usb_device doesn't exist\n" && exit 152 | 153 | 154 | prepare_usb_device() { 155 | umount_usb 156 | is_mounted=$(lsblk -no MOUNTPOINT $usb_device | sed '/^$/d') 157 | [[ -n "$is_mounted" ]] && echo -e "\n### The usb drive is currently mounted here\n\n$(lsblk $usb_device)\n\n### Please unmount the drive and then re-run the script\n" && exit 158 | echo '### Preparing USB device' 159 | # create 5GB root partition 160 | #echo -e 'o\ny\nn\n\n\n+600M\nef00\nn\n\n\n+1G\n8300\nn\n\n\n+5G\n8300\nw\ny\n' | gdisk "$usb_device" 161 | # root partition will take up all remaining space\ 162 | echo -e 'o\ny\nn\n\n\n+600M\nef00\nn\n\n\n+1G\n8300\nn\n\n\n\n8300\nw\ny\n' | gdisk $usb_device 163 | mkfs.vfat -F 32 -n 'EFI-USB-FED' -i $(echo $EFI_UUID | tr -d '-') "$usb_device"1 || mkfs.vfat -F 32 -n 'EFI-USB-FED' -i $(echo $EFI_UUID | tr -d '-') "$usb_device"p1 164 | mkfs.ext4 -U $BOOT_UUID -L 'fedora-usb-boot' -F "$usb_device"2 || mkfs.ext4 -U $BOOT_UUID -L 'fedora-usb-boot' -F "$usb_device"p2 165 | mkfs.ext4 -U $ROOT_UUID -L 'fedora-usb-root' -F "$usb_device"3 || mkfs.ext4 -U $ROOT_UUID -L 'fedora-usb-root' -F "$usb_device"p3 166 | # reserved for future use: kernel 6.7 167 | #mkfs.f2fs -U $ROOT_UUID -l 'fedora-usb-root' -f "$usb_device"3 || mkfs.f2fs -U $ROOT_UUID -l 'fedora-usb-root' -f "$usb_device"p3 168 | systemctl daemon-reload 169 | 170 | if [ $(blkid | grep -Ei "$EFI_UUID|$BOOT_UUID|$ROOT_UUID" | wc -l) -ne 3 ]; then 171 | echo -e "\nthe partitions and/or filesystem were not created correctly on $usb_device\nexiting\n" 172 | exit 173 | fi 174 | } 175 | 176 | mkosi_create_rootfs() { 177 | umount_usb 178 | mkosi clean 179 | mkosi 180 | } 181 | 182 | install_usb() { 183 | umount_usb 184 | echo '### Cleaning up' 185 | rm -fr $mkosi_rootfs/var/cache/dnf/* 186 | echo '### Mounting usb partitions and copying files' 187 | mount -U $ROOT_UUID $mnt_usb 188 | rsync -aHAX --exclude '/tmp/*' --exclude '/boot/*' --exclude '/efi' $mkosi_rootfs/ $mnt_usb 189 | mount -U $BOOT_UUID $mnt_usb/boot 190 | echo "rsync -aHAX --exclude '/efi/*' $mkosi_rootfs/boot/ $mnt_usb/boot" 191 | rsync -aHAX --exclude '/efi/*' $mkosi_rootfs/boot/ $mnt_usb/boot 192 | mount -U $EFI_UUID $mnt_usb/boot/efi 193 | echo "rsync -aH $mkosi_rootfs/boot/efi/ $mnt_usb/boot/efi" 194 | rsync -aH $mkosi_rootfs/boot/efi/ $mnt_usb/boot/efi 195 | 196 | echo '### Setting uuids for partitions in /etc/fstab' 197 | sed -i "s/EFI_UUID_PLACEHOLDER/$EFI_UUID/" $mnt_usb/etc/fstab 198 | sed -i "s/BOOT_UUID_PLACEHOLDER/$BOOT_UUID/" $mnt_usb/etc/fstab 199 | sed -i "s/ROOT_UUID_PLACEHOLDER/$ROOT_UUID/" $mnt_usb/etc/fstab 200 | sed -i "s/BOOT_UUID_PLACEHOLDER/$BOOT_UUID/" $mnt_usb/boot/efi/EFI/fedora/grub.cfg 201 | 202 | echo '### Running systemd-machine-id-setup' 203 | # generate a machine-id 204 | [[ -f $mnt_usb/etc/machine-id ]] && rm -f $mnt_usb/etc/machine-id 205 | chroot $mnt_usb systemd-machine-id-setup 206 | chroot $mnt_usb echo "KERNEL_INSTALL_MACHINE_ID=$(cat /etc/machine-id)" > /etc/machine-info 207 | 208 | echo "### Creating BLS (/boot/loader/entries/) entry" 209 | arch-chroot $mnt_usb grub2-editenv create 210 | rm -f $mnt_usb/etc/kernel/cmdline 211 | arch-chroot $mnt_usb /image.creation/create.bls.entry 212 | 213 | echo -e '\n### Generating GRUB config' 214 | # /etc/grub.d/30_uefi-firmware creates a uefi grub boot entry that doesn't work on this platform 215 | chroot $mnt_usb chmod -x /etc/grub.d/30_uefi-firmware 216 | arch-chroot $mnt_usb grub2-mkconfig -o /boot/grub2/grub.cfg 217 | 218 | echo "### Enabling system services" 219 | arch-chroot $mnt_usb systemctl enable NetworkManager sshd systemd-resolved 220 | 221 | echo "### Disabling systemd-firstboot" 222 | chroot $mnt_usb rm -f /usr/lib/systemd/system/sysinit.target.wants/systemd-firstboot.service 223 | 224 | echo "### SElinux labeling filesystem" 225 | policy=$(ls -tr $mnt_usb/etc/selinux/targeted/policy/ | tail -1) 226 | 227 | arch-chroot $mnt_usb setfiles -F -p -c /etc/selinux/targeted/policy/$policy -e /proc -e /sys -e /dev /etc/selinux/targeted/contexts/files/file_contexts / 228 | arch-chroot $mnt_usb setfiles -F -p -c /etc/selinux/targeted/policy/$policy -e /proc -e /sys -e /dev /etc/selinux/targeted/contexts/files/file_contexts /boot 229 | 230 | ###### post-install cleanup ###### 231 | echo -e '\n### Cleanup' 232 | rm -f $mnt_usb/etc/kernel/{entry-token,install.conf} 233 | rm -rf $mnt_usb/image.creation 234 | rm -f $mnt_usb/etc/dracut.conf.d/initial-boot.conf 235 | rm -f $mnt_usb/etc/yum.repos.d/mkosi*.repo 236 | # not sure how/why a $mnt_usb/root/asahi-fedora-usb directory is being created 237 | # remove it like this to account for it being named something different 238 | find $mnt_usb/root/ -maxdepth 1 -mindepth 1 -type d | grep -Ev '/\..*$' | xargs rm -rf 239 | 240 | echo '### Unmounting usb partitions' 241 | umount $mnt_usb/boot/efi 242 | umount $mnt_usb/boot 243 | umount $mnt_usb 244 | echo '### Done' 245 | } 246 | 247 | check_mkosi 248 | # if -w argument is specified 249 | # ie 250 | # ./build.sh -wd /dev/sda 251 | # and the disk partitions already exist (from a previous install) 252 | # then remove the files from disk vs repartitioning it 253 | [[ $wipe = true ]] && wipe_usb || prepare_usb_device 254 | 255 | if [[ $(command -v getenforce) ]] && [[ "$(getenforce)" = "Enforcing" ]]; then 256 | setenforce 0 257 | trap 'setenforce 1; exit;' EXIT SIGHUP SIGINT SIGTERM SIGQUIT SIGABRT 258 | fi 259 | 260 | mkosi_create_rootfs 261 | install_usb 262 | -------------------------------------------------------------------------------- /mkosi.conf: -------------------------------------------------------------------------------- 1 | [Distribution] 2 | Distribution=fedora 3 | Release=42 4 | Architecture=arm64 5 | 6 | [Output] 7 | Format=directory 8 | 9 | [Content] 10 | Bootable=no 11 | RootPassword=fedora 12 | WithDocs=True 13 | Environment= 14 | KERNEL_INSTALL_BYPASS=0 15 | Packages= 16 | NetworkManager 17 | NetworkManager-wifi 18 | acl 19 | alsa-ucm-asahi 20 | arch-install-scripts 21 | asahi-audio 22 | asahi-bless 23 | asahi-fwupdate 24 | asahi-nvram 25 | asahi-platform-metapackage 26 | asahi-repos 27 | asahi-scripts 28 | audit 29 | bash-completion 30 | binutils 31 | btrfs-progs 32 | cracklib 33 | cracklib-dicts 34 | cryptsetup 35 | dhcp-client 36 | diffutils 37 | dnf 38 | dnf-plugins-core 39 | dosfstools 40 | dracut-asahi 41 | e2fsprogs 42 | efivar 43 | findutils 44 | grub2-efi-aa64 45 | grub2-efi-aa64-modules 46 | grubby 47 | hostname 48 | iproute 49 | iputils 50 | kernel-16k 51 | kernel-16k-modules-extra 52 | kmod 53 | light 54 | linux-firmware 55 | man-db 56 | man-pages 57 | ncurses 58 | net-tools 59 | openssh-clients 60 | openssh-server 61 | passwd 62 | pciutils 63 | rootfiles 64 | rpm 65 | rsync 66 | selinux-policy 67 | shim-aa64 68 | speakersafetyd 69 | sudo 70 | systemd-resolved 71 | tar 72 | tiny-dfr 73 | usbutils 74 | vim-enhanced 75 | vim-minimal 76 | wget 77 | wpa_supplicant 78 | zram-generator 79 | zram-generator-defaults 80 | 81 | -------------------------------------------------------------------------------- /mkosi.skeleton/boot/efi/EFI/fedora/grub.cfg: -------------------------------------------------------------------------------- 1 | search --no-floppy --fs-uuid --set=dev BOOT_UUID_PLACEHOLDER 2 | set prefix=($dev)/grub2 3 | 4 | export $prefix 5 | configfile $prefix/grub.cfg 6 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/default/grub: -------------------------------------------------------------------------------- 1 | GRUB_TIMEOUT=5 2 | GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" 3 | GRUB_DEFAULT=saved 4 | GRUB_DISABLE_SUBMENU=true 5 | GRUB_TERMINAL_OUTPUT="console" 6 | GRUB_CMDLINE_LINUX="" 7 | GRUB_DISABLE_RECOVERY=true 8 | GRUB_ENABLE_BLSCFG=true 9 | GRUB_DISABLE_OS_PROBER=true 10 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/dracut.conf.d/initial-boot.conf: -------------------------------------------------------------------------------- 1 | add_drivers+='vfat loop uas usb-storage ' 2 | fscks+='/usr/sbin/fsck.ext4 /usr/sbin/fsck.vfat ' 3 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/fstab: -------------------------------------------------------------------------------- 1 | UUID=EFI_UUID_PLACEHOLDER /boot/efi vfat umask=0077,shortname=winnt 0 2 2 | UUID=BOOT_UUID_PLACEHOLDER /boot ext4 defaults 0 2 3 | UUID=ROOT_UUID_PLACEHOLDER / ext4 defaults 0 1 4 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/hostname: -------------------------------------------------------------------------------- 1 | fedora-usb 2 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/kernel/install.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leifliddy/asahi-fedora-usb/fd7bd8e679b0f975de58c10e0b93f785eca4044f/mkosi.skeleton/etc/kernel/install.conf -------------------------------------------------------------------------------- /mkosi.skeleton/etc/sysconfig/kernel: -------------------------------------------------------------------------------- 1 | # UPDATEDEFAULT specifies if kernel-install should make 2 | # new kernels the default 3 | UPDATEDEFAULT=yes 4 | 5 | # DEFAULTKERNEL specifies the default kernel package type 6 | DEFAULTKERNEL=kernel-16k-core 7 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/vconsole.conf: -------------------------------------------------------------------------------- 1 | FONT="latarcyrheb-sun32" 2 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/yum.repos.d/mkosi-group_asahi-fedora-remix-branding.repo: -------------------------------------------------------------------------------- 1 | [copr:copr.fedorainfracloud.org:group_asahi:fedora-remix-branding] 2 | name=Copr repo for fedora-remix-branding owned by @asahi 3 | baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/fedora-remix-branding/fedora-$releasever-$basearch/ 4 | type=rpm-md 5 | skip_if_unavailable=False 6 | gpgcheck=1 7 | gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/fedora-remix-branding/pubkey.gpg 8 | repo_gpgcheck=0 9 | enabled=1 10 | enabled_metadata=1 11 | priority=1 12 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/yum.repos.d/mkosi-group_asahi-fedora-remix-scripts.repo: -------------------------------------------------------------------------------- 1 | [copr:copr.fedorainfracloud.org:group_asahi:fedora-remix-scripts] 2 | name=Copr repo for fedora-remix-scripts owned by @asahi 3 | baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/fedora-remix-scripts/fedora-$releasever-$basearch/ 4 | type=rpm-md 5 | skip_if_unavailable=False 6 | gpgcheck=1 7 | gpgkey=https://download.copr.fedorainfracloud.org/results/%40asahi/fedora-remix-scripts/pubkey.gpg 8 | repo_gpgcheck=0 9 | enabled=1 10 | enabled_metadata=1 11 | priority=5 12 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/yum.repos.d/mkosi-group_asahi-kernel.repo: -------------------------------------------------------------------------------- 1 | [copr:copr.fedorainfracloud.org:group_asahi:kernel] 2 | name=Copr repo for kernel owned by @asahi 3 | baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/kernel/fedora-$releasever-$basearch/ 4 | type=rpm-md 5 | skip_if_unavailable=False 6 | gpgcheck=1 7 | gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/kernel/pubkey.gpg 8 | repo_gpgcheck=0 9 | enabled=1 10 | enabled_metadata=1 11 | priority=5 12 | -------------------------------------------------------------------------------- /mkosi.skeleton/etc/yum.repos.d/mkosi-group_asahi-u-boot.repo: -------------------------------------------------------------------------------- 1 | [copr:copr.fedorainfracloud.org:group_asahi:u-boot] 2 | name=Copr repo for u-boot owned by @asahi 3 | baseurl=https://download.copr.fedorainfracloud.org/results/@asahi/u-boot/fedora-$releasever-$basearch/ 4 | type=rpm-md 5 | skip_if_unavailable=False 6 | gpgcheck=1 7 | gpgkey=https://download.copr.fedorainfracloud.org/results/@asahi/u-boot/pubkey.gpg 8 | repo_gpgcheck=0 9 | enabled=1 10 | enabled_metadata=1 11 | priority=1 12 | -------------------------------------------------------------------------------- /mkosi.skeleton/image.creation/create.bls.entry: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # this script only needs to run during the image creation process 4 | 5 | export KERNEL_INSTALL_MACHINE_ID=$(cat /etc/machine-id) 6 | 7 | rm -f /boot/loader/entries/*.conf 8 | 9 | kernel_version=$(rpm -q kernel-16k | sed 's/kernel-16k-//' | sed 's/$/+16k/') 10 | 11 | /usr/lib/kernel/install.d/20-grub.install add $kernel_version xxx /lib/modules/$kernel_version/vmlinuz 12 | -------------------------------------------------------------------------------- /mkosi.skeleton/image.creation/info: -------------------------------------------------------------------------------- 1 | # contains scripts that are only needed during the image creation process 2 | # this directory will be removed from the final image 3 | -------------------------------------------------------------------------------- /mkosi.skeleton/usr/lib/dracut/dracut.conf.d/10-asahi.conf: -------------------------------------------------------------------------------- 1 | # Modules necessary for using Linux on Apple Silicon Macs 2 | 3 | # For NVMe & SMC 4 | add_drivers+=" apple-mailbox " 5 | 6 | # For NVMe 7 | add_drivers+=" nvme_apple " 8 | 9 | # For USB and HID 10 | add_drivers+=" pinctrl-apple-gpio " 11 | 12 | # SMC core 13 | add_drivers+=" macsmc macsmc-rtkit " 14 | 15 | # For USB 16 | add_drivers+=" i2c-apple tps6598x apple-dart dwc3 dwc3-of-simple xhci-pci pcie-apple gpio_macsmc " 17 | 18 | # For HID 19 | add_drivers+=" spi-apple spi-hid-apple spi-hid-apple-of " 20 | 21 | # For RTC 22 | add_drivers+=" rtc-macsmc simple-mfd-spmi spmi-apple-controller nvmem_spmi_mfd " 23 | 24 | # For MTP HID 25 | add_drivers+=" apple-dockchannel dockchannel-hid apple-rtkit-helper " 26 | 27 | # For Apple firmware 28 | add_dracutmodules+=" asahi-firmware " 29 | -------------------------------------------------------------------------------- /mkosi.skeleton/usr/local/sbin/chroot.asahi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | root_fs=$(blkid -s TYPE -o value /dev/nvme0n1p6) 4 | 5 | [[ $root_fs == "btrfs" ]] && options='-o subvol=root' 6 | [[ -z "$(findmnt -n /mnt)" ]] && mount /dev/nvme0n1p6 $options /mnt 7 | [[ -z "$(findmnt -n /mnt/boot)" ]] && mount /dev/nvme0n1p5 /mnt/boot 8 | [[ -z "$(findmnt -n /mnt/boot/efi)" ]] && mount /dev/nvme0n1p4 /mnt/boot/efi 9 | 10 | arch-chroot /mnt 11 | -------------------------------------------------------------------------------- /mkosi.skeleton/usr/local/sbin/umount.asahi: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | [[ "$(findmnt -n /mnt/boot/efi)" ]] && umount /mnt/boot/efi 4 | [[ "$(findmnt -n /mnt/boot)" ]] && umount /mnt/boot 5 | [[ "$(findmnt -n /mnt)" ]] && umount /mnt 6 | --------------------------------------------------------------------------------