diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f6ea77d --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,11 @@ +--- +github: ['marcosfad'] +patreon: +open_collective: +ko_fi: +tidelift: +community_bridge: +liberapay: +issuehunt: +otechie: +custom: ['https://www.paypal.com/paypalme/marcosfad'] diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4ba07fc..a9aa7c3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,23 +10,22 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Configure variables + id: variables + run: | + BUILD=$(date '+%Y%m%d%H%M%S') + echo "::set-output name=build::${BUILD}" + - name: Build run: sudo ./build.sh - name: print sha256sum run: cat output/sha256 - - name: Generate Tag - id: tag - run: | - VER=$(egrep ^KERNEL_VERSION build.sh|cut -d= -f2) - echo Version is $VER - echo "::set-output name=tag::${VER}" - - name: Upload iso artifact uses: actions/upload-artifact@v2 with: - name: mbp-ubuntu-${{ steps.tag.outputs.tag }}.z01 + name: mbp-ubuntu-${{ steps.variables.outputs.build }} path: ${{ github.workspace }}/output/* - name: Instructions for putting it back together @@ -35,15 +34,16 @@ jobs: Download all the artifacts, and put them in a folder without other files. Then run:" unzip "*.z??.zip" - cat livecd-${{ steps.tag.outputs.tag }}-mbp.z?? > cd.zip + cat livecd-${{ steps.variables.outputs.build }}-mbp.z?? > cd.zip echo unzip cd.zip EOF + - name: Release if: github.ref == 'refs/heads/master' uses: softprops/action-gh-release@v1 with: - data: ${{ github.workspace }}/output/* - tag_name: v20.04-${{ steps.tag.outputs.tag }} + files: ${{ github.workspace }}/output/* + tag_name: v20.04-${{ steps.variables.outputs.build }} draft: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index b0e16d3..59b82e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ output /.idea +/files/kernels diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 80f4515..0000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -language: bash - -os: - - linux - -services: - - docker - -# branches: -# only: -# - master - -stages: - - test - - build_deploy - -jobs: - include: - - stage: test - name: "YamlLint" - script: | - docker run --rm -v $(pwd):/repo -it alpine:latest /bin/sh -c ' - cd /repo - apk add --no-cache python3 py-pip - pip install yamllint - yamllint . - ' - - stage: test - name: "ShellCheck" - script: | - docker run --rm -v $(pwd):/repo -it alpine:latest /bin/sh -c ' - cd /repo - apk add --no-cache shellcheck bash - shellcheck ./*.sh - shellcheck ./files/*.sh - ' - - stage: build_deploy - name: "Build Ubuntu and Deploy to GitHub Releases" - script: ./build_in_docker.sh - deploy: - provider: releases - api_key: "$GITHUB_TOKEN" - file_glob: true - file: "output/*" - skip_cleanup: true - # yamllint disable-line rule:truthy - on: - tags: true diff --git a/01_build_file_system.sh b/01_build_file_system.sh index e812ad2..335a4a2 100755 --- a/01_build_file_system.sh +++ b/01_build_file_system.sh @@ -14,7 +14,7 @@ mount --bind /dev "${CHROOT_PATH}/dev" mount --bind /run "${CHROOT_PATH}/run" cp -r "${ROOT_PATH}/files" "${CHROOT_PATH}/tmp/setup_files" -chroot "${CHROOT_PATH}" /bin/bash -c "KERNEL_VERSION=${KERNEL_VERSION} /tmp/setup_files/chroot_build.sh" +chroot "${CHROOT_PATH}" /bin/bash -c "/tmp/setup_files/chroot_build.sh" echo >&2 "===]> Info: Cleanup the chroot environment... " # In docker there is no run? diff --git a/02_build_image.sh b/02_build_image.sh index b843809..a37ff41 100755 --- a/02_build_image.sh +++ b/02_build_image.sh @@ -9,15 +9,54 @@ if [ -d "${IMAGE_PATH}" ]; then fi mkdir -p "${IMAGE_PATH}"/{casper,install,isolinux} -cp "${CHROOT_PATH}"/boot/vmlinuz-"${KERNEL_VERSION}" "${IMAGE_PATH}"/casper/vmlinuz -cp "${CHROOT_PATH}"/boot/initrd.img-"${KERNEL_VERSION}" "${IMAGE_PATH}"/casper/initrd echo >&2 "===]> Info: Grub configuration... " # we add an empty file to use it with the search command in grub later on. touch "${IMAGE_PATH}"/ubuntu cp -r "${ROOT_PATH}"/files/preseed "${IMAGE_PATH}"/preseed -cp "${ROOT_PATH}/files/grub/grub.cfg" "${IMAGE_PATH}"/isolinux/grub.cfg +cat < "${IMAGE_PATH}"/isolinux/grub.cfg +search --set=root --file /ubuntu +insmod all_video +EOF + +find "${CHROOT_PATH}"/boot -maxdepth 1 -type f -name 'vmlinuz-*' +find "${CHROOT_PATH}"/boot -maxdepth 1 -type f -name 'initrd*' + +for file in $(find "${CHROOT_PATH}"/boot -maxdepth 1 -type f -name 'vmlinuz-*' | grep t2 | cut -d'/' -f 6 | cut -d'-' -f2-10 | sort); do + echo "==> Adding $file" + cp "${CHROOT_PATH}/boot/vmlinuz-${file}" "${IMAGE_PATH}/casper/vmlinuz-${file}" + cp "${CHROOT_PATH}/boot/initrd.img-${file}" "${IMAGE_PATH}/casper/initrd-${file}" + cat <> "${IMAGE_PATH}"/isolinux/grub.cfg +submenu "Ubuntu, with Linux $file" { + + menuentry "Try Ubuntu FS without installing" { + linux /casper/vmlinuz-$file file=/cdrom/preseed/mbp.seed boot=casper ro efi=noruntime pcie_ports=compat --- + initrd /casper/initrd-$file + } + menuentry "Try Ubuntu FS without installing (blacklist=thunderbolt)" { + linux /casper/vmlinuz-$file file=/cdrom/preseed/mbp.seed boot=casper ro efi=noruntime pcie_ports=compat --- modprobe.blacklist=thunderbolt + initrd /casper/initrd-$file + } + menuentry "Install Ubuntu FS" { + linux /casper/vmlinuz-$file preseed/file=/cdrom/preseed/mbp.seed boot=casper only-ubiquity efi=noruntime pcie_ports=compat --- + initrd /casper/initrd-$file + } + menuentry "Install Ubuntu FS (blacklist=thunderbolt)" { + linux /casper/vmlinuz-$file preseed/file=/cdrom/preseed/mbp.seed boot=casper only-ubiquity efi=noruntime pcie_ports=compat --- modprobe.blacklist=thunderbolt + initrd /casper/initrd-$file + } + menuentry "Check disc for defects" { + linux /casper/vmlinuz-$file boot=casper integrity-check efi=noruntime enforcing=0 efi=noruntime pcie_ports=compat --- + initrd /casper/initrd-$file + } + menuentry "Check disc for defects (blacklist=thunderbolt)" { + linux /casper/vmlinuz-$file boot=casper integrity-check efi=noruntime enforcing=0 efi=noruntime pcie_ports=compat --- modprobe.blacklist=thunderbolt + initrd /casper/initrd-$file + } +} +EOF +done echo >&2 "===]> Info: Compress the chroot... " cd "${WORKING_PATH}" diff --git a/04_create_iso.sh b/04_create_iso.sh index e039b74..231ad75 100755 --- a/04_create_iso.sh +++ b/04_create_iso.sh @@ -23,7 +23,7 @@ xorriso -as mkisofs \ -no-emul-boot \ -isohybrid-mbr "${ROOT_PATH}/files/isohdpfx.bin" \ -isohybrid-gpt-basdat -isohybrid-apm-hfsplus \ - -output "${ROOT_PATH}/ubuntu-20.04-${KERNEL_VERSION}.iso" \ + -output "${ROOT_PATH}/ubuntu-20.04.iso" \ -graft-points \ "." \ /boot/grub/bios.img=isolinux/bios.img \ diff --git a/README.md b/README.md index 04f1b8b..ea7c9cd 100644 --- a/README.md +++ b/README.md @@ -17,14 +17,21 @@ I'm using the Kernel from - Using additional drivers: - [Apple T2 (apple-bce) (audio, keyboard, touchpad)](https://github.com/t2linux/apple-bce-drv) - [Touchbar (apple-ibridge, apple-ib-tb, apple-ib-als)](https://github.com/t2linux/apple-ib-drv) +- [mbpfan](https://github.com/networkException/mbpfan) Bootloader is configure correctly out of the box. No workaround needed. -## Before I begin, what version should I use? "mbp" or "mbp-16x-wifi"? +## Which kernel to choose -The difference between the two is that the mbp-16x-wifi version includes a different version of the brcmfmac wifi driver, made by corellium for M1 macs. This version of the wifi driver works on some models that the brcmfmac driver included with the mbp version doesn't support. Refer to the table on [this page](https://wiki.t2linux.org/guides/wifi/) to figure out which versions will work (Look at the "Firmware Options" column, Mojave means you can use the "mbp" version, and Big Sur means you can use the "mbp-16x-wifi" version). +I've pre installed several different kernel, to allow better support to different hardware. -**!! Please note that as of the v20.04-5.10.52 release, the mbp-16x-wifi iso does not support wifi on models with the BCM4377 chipset. For now, you can install a kernel from [here](https://github.com/AdityaGarg8/mbp-16.x-ubuntu-kernel/releases/tag/v5.13.12-1) after installing ubuntu if you have the BCM4377 chipset.** +If your macbook came with Big Sur preinstalled, you should use a bigsur version of kernel. + +If your macbook came with mojave, you should use a mojave version of the kernel. + +This will allow you to activate wifi in your macbook. See [this page for more information about wifi drivers](https://wiki.t2linux.org/guides/wifi/) + +I've recommend starting with the HWE Kernel. That one comes from Ubuntu own repository and I have had great performance with it. ## Installation @@ -51,6 +58,8 @@ sudo dd bs=4096 if=ubuntu-20.04-5.6.10-mbp.iso of=/dev/diskX 12. Start again using the option key. Select the new efi boot. 13. Enjoy. +See for more details. + ## Configuration - See diff --git a/build.sh b/build.sh index b4e04e7..08188ac 100755 --- a/build.sh +++ b/build.sh @@ -5,7 +5,6 @@ ROOT_PATH=$(pwd) WORKING_PATH=/root/work CHROOT_PATH="${WORKING_PATH}/chroot" IMAGE_PATH="${WORKING_PATH}/image" -KERNEL_VERSION=5.10.52 if [ -d "$WORKING_PATH" ]; then rm -rf "$WORKING_PATH" @@ -32,55 +31,49 @@ apt-get install -y -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::=" isolinux \ syslinux -echo >&2 "===]> Info: Start loop... " -for ALTERNATIVE in mbp mbp-16x-wifi -do - echo >&2 "===]> Info: Start building ${ALTERNATIVE}... " +echo >&2 "===]> Info: Start building... " - echo >&2 "===]> Info: Build Ubuntu FS... " - /bin/bash -c " - ROOT_PATH=${ROOT_PATH} \\ - WORKING_PATH=${WORKING_PATH} \\ - CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\ - IMAGE_PATH=${IMAGE_PATH} \\ - KERNEL_VERSION=${KERNEL_VERSION}-${ALTERNATIVE} \\ - ${ROOT_PATH}/01_build_file_system.sh - " +echo >&2 "===]> Info: Build Ubuntu FS... " +/bin/bash -c " + ROOT_PATH=${ROOT_PATH} \\ + WORKING_PATH=${WORKING_PATH} \\ + CHROOT_PATH=${CHROOT_PATH} \\ + IMAGE_PATH=${IMAGE_PATH} \\ + ${ROOT_PATH}/01_build_file_system.sh +" - echo >&2 "===]> Info: Build Image FS... " - /bin/bash -c " - ROOT_PATH=${ROOT_PATH} \\ - WORKING_PATH=${WORKING_PATH} \\ - CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\ - IMAGE_PATH=${IMAGE_PATH} \\ - KERNEL_VERSION=${KERNEL_VERSION}-${ALTERNATIVE} \\ - ${ROOT_PATH}/02_build_image.sh - " +echo >&2 "===]> Info: Build Image FS... " +/bin/bash -c " + ROOT_PATH=${ROOT_PATH} \\ + WORKING_PATH=${WORKING_PATH} \\ + CHROOT_PATH=${CHROOT_PATH} \\ + IMAGE_PATH=${IMAGE_PATH} \\ + ${ROOT_PATH}/02_build_image.sh +" - echo >&2 "===]> Info: Prepare Boot for ISO... " - /bin/bash -c " - IMAGE_PATH=${IMAGE_PATH} \\ - CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\ - ${ROOT_PATH}/03_prepare_iso.sh - " +echo >&2 "===]> Info: Prepare Boot for ISO... " +/bin/bash -c " + IMAGE_PATH=${IMAGE_PATH} \\ + CHROOT_PATH=${CHROOT_PATH} \\ + ${ROOT_PATH}/03_prepare_iso.sh +" + +echo >&2 "===]> Info: Create ISO... " +/bin/bash -c " + ROOT_PATH=${ROOT_PATH} \\ + IMAGE_PATH=${IMAGE_PATH} \\ + CHROOT_PATH=${CHROOT_PATH} \\ + ${ROOT_PATH}/04_create_iso.sh +" +livecd_exitcode=$? +if [ "${livecd_exitcode}" -ne 0 ]; then + echo "Error building" + exit "${livecd_exitcode}" +fi +### Zip iso and split it into multiple parts - github max size of release attachment is 2GB, where ISO is sometimes bigger than that +cd "${ROOT_PATH}" +zip -s 1500m "${ROOT_PATH}/output/livecd.zip" "${ROOT_PATH}/ubuntu-20.04.iso" - echo >&2 "===]> Info: Create ISO... " - /bin/bash -c " - ROOT_PATH=${ROOT_PATH} \\ - IMAGE_PATH=${IMAGE_PATH} \\ - CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\ - KERNEL_VERSION=${KERNEL_VERSION}-${ALTERNATIVE} \\ - ${ROOT_PATH}/04_create_iso.sh - " - livecd_exitcode=$? - if [ "${livecd_exitcode}" -ne 0 ]; then - echo "Error building ${KERNEL_VERSION}-${ALTERNATIVE}" - exit "${livecd_exitcode}" - fi - ### Zip iso and split it into multiple parts - github max size of release attachment is 2GB, where ISO is sometimes bigger than that - cd "${ROOT_PATH}" - zip -s 1500m "${ROOT_PATH}/output/livecd-${KERNEL_VERSION}-${ALTERNATIVE}.zip" "${ROOT_PATH}/ubuntu-20.04-${KERNEL_VERSION}-${ALTERNATIVE}.iso" -done ### Calculate sha256 sums of built ISO sha256sum "${ROOT_PATH}"/*.iso >"${ROOT_PATH}/output/sha256" diff --git a/build_in_docker.sh b/build_in_docker.sh index b603421..acf1856 100755 --- a/build_in_docker.sh +++ b/build_in_docker.sh @@ -5,10 +5,11 @@ set -eu -o pipefail DOCKER_IMAGE=ubuntu:20.04 docker pull ${DOCKER_IMAGE} + docker run \ --privileged \ --rm \ -t \ -v "$(pwd)":/repo \ ${DOCKER_IMAGE} \ - /bin/bash -c 'cd /repo && ./build.sh' + /bin/bash -c "cd /repo && ./build.sh" diff --git a/files/chroot_build.sh b/files/chroot_build.sh index 59c272c..51d875a 100755 --- a/files/chroot_build.sh +++ b/files/chroot_build.sh @@ -43,6 +43,7 @@ ln -s /bin/true /sbin/initctl echo >&2 "===]> Info: Install packages needed for Live System... " +# todo: Install the latest kernel automatically export DEBIAN_FRONTEND=noninteractive apt-get install -y -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \ ubuntu-standard \ @@ -60,20 +61,43 @@ apt-get install -y -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::=" locales \ initramfs-tools \ binutils \ - linux-generic \ - linux-headers-generic \ + linux-firmware \ grub-efi-amd64-signed \ - "linux-image-${KERNEL_VERSION}" \ - "linux-headers-${KERNEL_VERSION}" \ intel-microcode \ + linux-headers-azure \ + linux-headers-5.11.22-t2-hwe-bigsur \ + linux-headers-5.11.22-t2-hwe-mojave \ + linux-headers-5.12.19-t2-a-bigsur \ + linux-headers-5.12.19-t2-a-mojave \ + linux-headers-5.13.15-t2-j-bigsur \ + linux-headers-5.13.15-t2-j-mojave \ + linux-image-5.11.22-t2-hwe-bigsur \ + linux-image-5.11.22-t2-hwe-mojave \ + linux-image-5.12.19-t2-a-bigsur \ + linux-image-5.12.19-t2-a-mojave \ + linux-image-5.13.15-t2-j-bigsur \ + linux-image-5.13.15-t2-j-mojave \ thermald +echo >&2 "===]> Info: Add firmwares" +for file in skl_guc_49.0.1.bin bxt_guc_49.0.1.bin kbl_guc_49.0.1.bin glk_guc_49.0.1.bin kbl_guc_49.0.1.bin kbl_guc_49.0.1.bin cml_guc_49.0.1.bin icl_guc_49.0.1.bin ehl_guc_49.0.1.bin ehl_guc_49.0.1.bin tgl_huc_7.5.0.bin tgl_guc_49.0.1.bin tgl_huc_7.5.0.bin tgl_guc_49.0.1.bin tgl_huc_7.5.0.bin tgl_guc_49.0.1.bin dg1_dmc_ver2_02.bin +do +curl -L https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/i915/$file \ + --output /lib/firmware/i915/$file +done + +if [ -d /tmp/setup_files/kernels ]; then + echo >&2 "===]> Info: Install patched kernels... " + dpkg -i /tmp/setup_files/kernels/*.deb +fi + echo >&2 "===]> Info: Install window manager... " apt-get install -y -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \ plymouth-theme-ubuntu-logo \ ubuntu-desktop-minimal \ ubuntu-gnome-wallpapers \ + netplan.io \ snapd echo >&2 "===]> Info: Install Graphical installer... " @@ -107,51 +131,105 @@ APPLE_BCE_DRIVER_COMMIT_HASH=f93c6566f98b3c95677de8010f7445fa19f75091 APPLE_BCE_DRIVER_MODULE_NAME=apple-bce APPLE_BCE_DRIVER_MODULE_VERSION=0.2 -APPLE_IB_DRIVER_GIT_URL=https://github.com/t2linux/apple-ib-drv -APPLE_IB_DRIVER_BRANCH_NAME=mbp15 -APPLE_IB_DRIVER_COMMIT_HASH=fc9aefa5a564e6f2f2bb0326bffb0cef0446dc05 -APPLE_IB_DRIVER_MODULE_NAME=apple-ibridge -APPLE_IB_DRIVER_MODULE_VERSION=0.2 - -# thunderbolt is working for me. -#printf '\nblacklist thunderbolt' >>/etc/modprobe.d/blacklist.conf - git clone --single-branch --branch ${APPLE_BCE_DRIVER_BRANCH_NAME} ${APPLE_BCE_DRIVER_GIT_URL} \ /usr/src/"${APPLE_BCE_DRIVER_MODULE_NAME}-${APPLE_BCE_DRIVER_MODULE_VERSION}" git -C /usr/src/"${APPLE_BCE_DRIVER_MODULE_NAME}-${APPLE_BCE_DRIVER_MODULE_VERSION}" checkout "${APPLE_BCE_DRIVER_COMMIT_HASH}" cat << EOF > /usr/src/${APPLE_BCE_DRIVER_MODULE_NAME}-${APPLE_BCE_DRIVER_MODULE_VERSION}/dkms.conf -PACKAGE_NAME=apple-bce -PACKAGE_VERSION=0.1 +PACKAGE_NAME="${APPLE_BCE_DRIVER_MODULE_NAME}" +PACKAGE_VERSION="${APPLE_BCE_DRIVER_MODULE_VERSION}" +MAKE[0]="make KVERSION=\$kernelver" CLEAN="make clean" -MAKE="make" -BUILT_MODULE_NAME[0]="apple-bce" -DEST_MODULE_LOCATION[0]="/updates" +BUILT_MODULE_NAME[0]="${APPLE_BCE_DRIVER_MODULE_NAME}" +DEST_MODULE_LOCATION[0]="/kernel/drivers/misc" AUTOINSTALL="yes" -REMAKE_INITRD="yes" EOF -dkms install -m "${APPLE_BCE_DRIVER_MODULE_NAME}" -v "${APPLE_BCE_DRIVER_MODULE_VERSION}" -k "${KERNEL_VERSION}" -printf '\n### apple-bce start ###\nhid-apple\nbcm5974\nsnd-seq\napple-bce\n### apple-bce end ###' >>/etc/modules-load.d/apple-bce.conf -printf '\n### apple-bce start ###\nhid-apple\nsnd-seq\napple-bce\n### apple-bce end ###' >>/etc/initramfs-tools/modules +while IFS= read -r kernel; do + echo "==> Debug: Adding $kernel" + rm -rf "/lib/modules/$kernel/build" + ln -sf "/usr/src/linux-headers-$kernel" "/lib/modules/$kernel/build" + dkms --verbose install -m "${APPLE_BCE_DRIVER_MODULE_NAME}" -v "${APPLE_BCE_DRIVER_MODULE_VERSION}" -k "$kernel" + if [ -f "/var/lib/dkms/${APPLE_BCE_DRIVER_MODULE_NAME}/${APPLE_BCE_DRIVER_MODULE_VERSION}/build/make.log" ]; then + cat "/var/lib/dkms/${APPLE_BCE_DRIVER_MODULE_NAME}/${APPLE_BCE_DRIVER_MODULE_VERSION}/build/make.log" + fi +done < <(dpkg -l | grep linux-image | grep t2 | grep ii | grep t2 | cut -d' ' -f3|cut -d'-' -f3-10) + +printf '\n### apple-bce start ###\napple-bce\n### apple-bce end ###' >>/etc/modules-load.d/apple-bce.conf +printf '\n### apple-bce start ###\nhapple-bce\n### apple-bce end ###' >>/etc/initramfs-tools/modules + +APPLE_IB_DRIVER_GIT_URL=https://github.com/t2linux/apple-ib-drv +APPLE_IB_DRIVER_BRANCH_NAME=mbp15 +APPLE_IB_DRIVER_COMMIT_HASH=fc9aefa5a564e6f2f2bb0326bffb0cef0446dc05 +APPLE_IB_DRIVER_MODULE_NAME=apple-ibridge +APPLE_IB_DRIVER_MODULE_VERSION=0.1 git clone --single-branch --branch ${APPLE_IB_DRIVER_BRANCH_NAME} ${APPLE_IB_DRIVER_GIT_URL} \ /usr/src/"${APPLE_IB_DRIVER_MODULE_NAME}-${APPLE_IB_DRIVER_MODULE_VERSION}" git -C /usr/src/"${APPLE_IB_DRIVER_MODULE_NAME}-${APPLE_IB_DRIVER_MODULE_VERSION}" checkout "${APPLE_IB_DRIVER_COMMIT_HASH}" -dkms install -m "${APPLE_IB_DRIVER_MODULE_NAME}" -v "${APPLE_IB_DRIVER_MODULE_VERSION}" -k "${KERNEL_VERSION}" -printf '\n### applespi start ###\napple_ibridge\napple_ib_tb\napple_ib_als\n### applespi end ###' >>/etc/modules-load.d/applespi.conf + +echo >&2 "===]> Debug: Add apple-ib-drv ... " +cat /usr/src/"${APPLE_IB_DRIVER_MODULE_NAME}-${APPLE_IB_DRIVER_MODULE_VERSION}"/dkms.conf +while IFS= read -r kernel; do + echo "==> Debug: Adding $kernel" + rm -rf "/lib/modules/$kernel/build" + ln -sf "/usr/src/linux-headers-$kernel" "/lib/modules/$kernel/build" + dkms --verbose install -m "${APPLE_IB_DRIVER_MODULE_NAME}" -v "${APPLE_IB_DRIVER_MODULE_VERSION}" -k "$kernel" + if [ -f "/var/lib/dkms/${APPLE_IB_DRIVER_MODULE_NAME}/${APPLE_IB_DRIVER_MODULE_VERSION}/build/make.log" ]; then + cat "/var/lib/dkms/${APPLE_IB_DRIVER_MODULE_NAME}/${APPLE_IB_DRIVER_MODULE_VERSION}/build/make.log" + fi +done < <(dpkg -l | grep linux-image | grep t2 | grep ii | grep t2 | cut -d' ' -f3|cut -d'-' -f3-10) + + +printf '\n### applespi start ###\napple_ib_tb\napple_ib_als\n### applespi end ###' >> /etc/modules-load.d/applespi.conf printf '\n# display f* key in touchbar\noptions apple-ib-tb fnmode=2\n' >> /etc/modprobe.d/apple-touchbar.conf +## Add optional dkms for brcm80211-mbp16x +#cd /tmp +#wget https://gist.github.com/hexchain/22932a13a892e240d71cb98fad62a6a0/archive/50ce4513d2865b1081a972bc09e8da639f94a755.zip +#unzip *55.zip +#cd 22* +#cp -r /usr/src/linux-headers-*-generic/drivers/net/wireless/broadcom/brcm80211 . +#cd brcm80211 +#patch -Np6 -i "../8001-corellium-wifi-bigsur.patch" +#patch -Np6 -i "../8002-brcmfmac-4377-mod.patch" +#patch -Np6 -i "../8003-brcmfmac-4377-64bit-regs.patch" +#patch -Np6 -i "../8004-brcmfmac-4377-chip-ids.patch" +#patch -Np1 -i "../out-of-tree.patch" +#mv Makefile Kbuild +#cp ../Makefile . +#sed -e "s,@PACKAGE_NAME@,brcm80211-mbp16x," -e "s,@PACKAGE_VERSION@,2.0," ../dkms.conf.in > dkms.conf +#cp ./brcm80211 /usr/src/brcm80211-mbp16x-2.0 +#cd /tmp +#rm -rf *55.zip 22* + +echo >&2 "===]> Debug dkms status" +dkms status + +echo >&2 "===]> Configure amdgpu" +cat << EOF > /etc/udev/rules.d/30-amdgpu-pm.rules +KERNEL=="card0", SUBSYSTEM=="drm", DRIVERS=="amdgpu", ATTR{device/power_dpm_force_performance_level}="high" +EOF echo >&2 "===]> Info: Update initramfs... " ## Add custom drivers to be loaded at boot -/usr/sbin/depmod -a "${KERNEL_VERSION}" -update-initramfs -u -v -k "${KERNEL_VERSION}" +for kernel in $(dpkg -l | grep linux-image | grep ii | grep t2 | cut -d' ' -f3|cut -d'-' -f3-10); do + echo "==> Adding $kernel" + /usr/sbin/depmod -a "$kernel" + update-initramfs -u -v -k "$kernel" +done + +#echo >&2 "===]> Info: install mpbfan ... " +#git clone https://github.com/networkException/mbpfan /tmp/mbpfan +#cd /tmp/mbpfan +#make install +#cp mbpfan.service /etc/systemd/system/ +#systemctl enable mbpfan.service echo >&2 "===]> Info: Remove unused applications ... " -apt-get purge -y -qq \ +apt-get purge -y \ transmission-gtk \ transmission-common \ gnome-mahjongg \ @@ -160,18 +238,15 @@ apt-get purge -y -qq \ aisleriot \ hitori \ xiterm+thai \ - make \ - gcc \ vim \ - binutils \ linux-generic \ - linux-headers-5.4.0-28 \ - linux-headers-5.4.0-28-generic \ + linux-headers-azure \ + '^linux-headers-5\.4\..*' \ linux-headers-generic \ - linux-image-5.4.0-28-generic \ + '^linux-image-5\.4\..*' \ linux-image-generic \ - linux-modules-5.4.0-28-generic \ - linux-modules-extra-5.4.0-28-generic + '^linux-modules-5\.4\..*' \ + '^linux-modules-extra-5\.4\..*' apt-get autoremove -y diff --git a/files/grub/grub.cfg b/files/grub/grub.cfg deleted file mode 100644 index d36ad48..0000000 --- a/files/grub/grub.cfg +++ /dev/null @@ -1,32 +0,0 @@ - -search --set=root --file /ubuntu - -insmod all_video - -set default="0" -set timeout=30 - -menuentry "Try Ubuntu FS without installing" { - linux /casper/vmlinuz file=/cdrom/preseed/mbp.seed boot=casper ro efi=noruntime pcie_ports=compat acpi=force --- - initrd /casper/initrd -} -menuentry "Try Ubuntu FS without installing (blacklist=thunderbolt)" { - linux /casper/vmlinuz file=/cdrom/preseed/mbp.seed boot=casper ro efi=noruntime pcie_ports=compat acpi=force --- modprobe.blacklist=thunderbolt - initrd /casper/initrd -} -menuentry "Install Ubuntu FS" { - linux /casper/vmlinuz preseed/file=/cdrom/preseed/mbp.seed boot=casper only-ubiquity efi=noruntime pcie_ports=compat acpi=force --- - initrd /casper/initrd -} -menuentry "Install Ubuntu FS (blacklist=thunderbolt)" { - linux /casper/vmlinuz preseed/file=/cdrom/preseed/mbp.seed boot=casper only-ubiquity efi=noruntime pcie_ports=compat acpi=force --- modprobe.blacklist=thunderbolt - initrd /casper/initrd -} -menuentry "Check disc for defects" { - linux /casper/vmlinuz boot=casper integrity-check efi=noruntime enforcing=0 efi=noruntime pcie_ports=compat acpi=force --- - initrd /casper/initrd -} -menuentry "Check disc for defects (blacklist=thunderbolt)" { - linux /casper/vmlinuz boot=casper integrity-check efi=noruntime enforcing=0 efi=noruntime pcie_ports=compat --- modprobe.blacklist=thunderbolt - initrd /casper/initrd -} diff --git a/files/preseed/mbp.seed b/files/preseed/mbp.seed index 4c56c7b..46c2ca0 100644 --- a/files/preseed/mbp.seed +++ b/files/preseed/mbp.seed @@ -8,4 +8,4 @@ # well keep them installed. #ubiquity ubiquity/keep-installed string icedtea6-plugin openoffice.org -d-i debian-installer/add-kernel-opts string efi=noruntime pcie_ports=compat acpi=force +d-i debian-installer/add-kernel-opts string efi=noruntime pcie_ports=compat