From 1a69f04e6edfe41d97a1d40f62721a015e119f78 Mon Sep 17 00:00:00 2001 From: Adel Kara Slimane Date: Tue, 5 Sep 2023 01:33:52 +0200 Subject: [PATCH] Add _kernel_on_diet customization option (#805) * prepare: remove prompt for modprobed.db it's an advanced feature, we don't want to prompt it just like with TCP congestion algos * add "_kernel_on_diet" customization option A little less sugar intake is always welcome this option hopefully helps with building kernels in github ci * prepare: fix typo in var name $_where the underscore was forgotten all this time... * ci: enable _kernel_on_diet * ci: move away from deprecated feature the new approach is better actually too https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- .../workflows/build-current-kernel-arch.yml | 13 +- customization.cfg | 6 + linux-tkg-config/6.5/minimal-modprobed.db | 654 ++++++++++++++++++ linux-tkg-config/prepare | 27 +- 4 files changed, 684 insertions(+), 16 deletions(-) create mode 100644 linux-tkg-config/6.5/minimal-modprobed.db diff --git a/.github/workflows/build-current-kernel-arch.yml b/.github/workflows/build-current-kernel-arch.yml index b49d9b9..37149d2 100644 --- a/.github/workflows/build-current-kernel-arch.yml +++ b/.github/workflows/build-current-kernel-arch.yml @@ -12,6 +12,7 @@ env: _debugdisable: "true" _noccache: "true" _STRIP: "false" + _kernel_on_diet: "true" #_kernel_work_folder: "/tmp" #_kernel_source_folder: "/tmp" # _modprobeddb: "true" @@ -48,18 +49,18 @@ jobs: run: | ./.github/get_latest_kver.sh latest_kernel="$(cat .github/latest-kernel)" - echo "::set-output name=latest_kernel::$latest_kernel" + echo "latest_kernel=$latest_kernel" >> $GITHUB_OUTPUT new_kernel=0 [[ "$latest_kernel" != "$latest_release" ]] || new_kernel=$? - echo "::set-output name=new_kernel::$new_kernel" + echo "new_kernel=$new_kernel" >> $GITHUB_OUTPUT env: latest_release: ${{ steps.latest_release.outputs.release }} cleanup-ubuntu: - + runs-on: ubuntu-latest needs: [check-for-newer-kernel] - + steps: - name: Free Disk Space (Ubuntu) uses: hirnidrin/free-disk-space@main @@ -67,7 +68,7 @@ jobs: # this might remove tools that are actually needed, # if set to "true" but frees about 6 GB tool-cache: false - + # all of these default to true, but feel free to set to # "false" if necessary for your workflow android: true @@ -141,6 +142,6 @@ jobs: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: ${{ needs.check-for-newer-kernel.outputs.latest_kernel }} prerelease: false - title: "${{ needs.check-for-newer-kernel.outputs.latest_kernel }}" + title: "[experimental] ${{ needs.check-for-newer-kernel.outputs.latest_kernel }}" files: | ${{ env.PKGDEST }}/kernel-packages-*/* diff --git a/customization.cfg b/customization.cfg index 663f44e..ee1d1c7 100644 --- a/customization.cfg +++ b/customization.cfg @@ -51,6 +51,12 @@ _force_all_threads="true" # Set to true to prevent ccache from being used and set CONFIG_GCC_PLUGINS=y (which needs to be disabled for ccache to work properly) _noccache="false" +# [Experimental] Build only a subset of the default kernel modules list to speedup compile time and lower needed space to build kernel +# Notes: +# - If the kernel fails to boot with this option active, disable it and rebuild +# - This option cannot be used with _modprobeddb="true" +_kernel_on_diet="false" + # Set to true to use modprobed db to clean config from unneeded modules. Speeds up compilation considerably. Requires root - https://wiki.archlinux.org/index.php/Modprobed-db # Using this option can trigger user prompts if the config doesn't go smoothly. # !!!! Make sure to have a well populated db !!!! - Leave empty to be asked about it at build time diff --git a/linux-tkg-config/6.5/minimal-modprobed.db b/linux-tkg-config/6.5/minimal-modprobed.db new file mode 100644 index 0000000..1ab29cb --- /dev/null +++ b/linux-tkg-config/6.5/minimal-modprobed.db @@ -0,0 +1,654 @@ +8021q +8250_dw +842 +842_compress +842_decompress +9p +9pnet +9pnet_virtio +ac97_bus +acer_wireless +acer_wmi +acpi_cpufreq +acpi_mdio +acpi_pad +acpi_tad +acpi_thermal_rel +aesni_intel +af_alg +af_key +af_packet +agpgart +ahci +algif_aead +algif_hash +algif_skcipher +alx +amd64_edac +amdgpu +amd_pmc +amd_pstate +amdxcp +apple_mfi_fastcharge +appletalk +asn1_encoder +asus_atk0110 +asus_nb_wmi +asus_wmi +ata_generic +ata_piix +ath +ath9k_common +ath9k_htc +ath9k_hw +atkbd +atl1c +auth_rpcgss +autofs4 +battery +bch +binder +binfmt_misc +blake2b_generic +bluetooth +bnep +bpf +bpf_preload +bridge +br_netfilter +btbcm +btcoexist +btintel +btmtk +btrfs +btrtl +btusb +button +cbc +ccm +ccp +cdc_acm +cdc_ether +cdc_mbim +cdc_ncm +cdc_wdm +cdrom +cec +cfbcopyarea +cfbfillrect +cfbimgblt +cfg80211 +cgroup +ch341 +chacha_x86_64 +chipreg +cifs +cifs_arc4 +cifs_md4 +cls_cgroup +cmac +cmdlinepart +coretemp +cpufreq_ondemand +crc16 +crc32c_generic +crc32c_intel +crc32_generic +crc32_pclmul +crc64 +crc64_rocksoft +crc64_rocksoft_generic +crc_itu_t +crct10dif_pclmul +cryptd +crypto_null +crypto_simd +crypto_user +curve25519_x86_64 +cuse +dca +des_generic +dm_crypt +dmi_sysfs +dm_log +dm_mirror +dm_mod +dm_multipath +dm_region_hash +dm_round_robin +dns_resolver +drm +drm_buddy +drm_display_helper +drm_kms_helper +drm_panel_orientation_quirks +drm_suballoc_helper +drm_ttm_helper +dvb_core +ebtable_filter +ebtables +ecb +ecc +ecdh_generic +ec_sys +edac_mce_amd +ee1004 +eeepc_wmi +eeprom +efi_pstore +efivarfs +ehci_hcd +ehci_pci +enclosure +encrypted_keys +evdev +exfat +ext2 +ext4 +f2fs +fan +fat +fb_sys_fops +ff_memless +fixed_phy +fjes +fscache +ftdi_sio +fuse +fwnode_mdio +garp +gcm +gf128mul +ghash_clmulni_intel +ghash_generic +gigabyte_wmi +gpio_amdpt +gpio_generic +gpu_sched +grace +hfs +hfsplus +hid +hid_apple +hid_asus +hid_generic +hid_hyperv +hid_logitech_dj +hid_logitech_hidpp +hid_microsoft +hid_multitouch +hid_nintendo +hidp +hid_playstation +hid_roccat +hid_roccat_common +hid_roccat_koneplus +hid_roccat_ryos +hid_sony +hid_steam +hid_wiimote +hv_balloon +hv_netvsc +hv_storvsc +hv_utils +hv_vmbus +hwmon_vid +hyperv_drm +hyperv_keyboard +i2c_algo_bit +i2c_core +i2c_dev +i2c_hid +i2c_hid_acpi +i2c_i801 +i2c_mux +i2c_nvidia_gpu +i2c_piix4 +i2c_smbus +i8042 +i915 +ib_cm +ib_core +idma64 +igb +igc +inet_diag +input_leds +int3400_thermal +int340x_thermal_zone +intel_agp +intel_cstate +intel_gtt +intel_lpss +intel_lpss_pci +intel_pch_thermal +intel_pmc_bxt +intel_powerclamp +intel_rapl_common +intel_rapl_msr +intel_soc_dts_iosf +intel_uncore +intel_vsec +intel_wmi_thunderbolt +iommufd +iommu_v2 +ip6table_filter +ip6table_mangle +ip6table_nat +ip6table_raw +ip6_tables +ip6table_security +ip6t_REJECT +ip6t_rt +ip6_udp_tunnel +ipmi_devintf +ipmi_msghandler +ip_set +iptable_filter +iptable_mangle +iptable_nat +iptable_raw +ip_tables +iptable_security +ipt_REJECT +ipv6 +ir_kbd_i2c +irqbypass +isofs +it87 +iTCO_vendor_support +iTCO_wdt +iw_cm +iwlmei +iwlmvm +iwlwifi +jbd2 +jc42 +jfs +joydev +k10temp +ksmbd +kvm +kvm_amd +kvm_intel +led_class_multicolor +ledtrig_audio +ledtrig_timer +libahci +libarc4 +libata +libchacha +libchacha20poly1305 +libcrc32c +libcurve25519_generic +libdes +libphy +libps2 +llc +lm75 +lm83 +lockd +loop +lpc_ich +lz4 +lz4_compress +lz4hc_compress +lzo +lzo_rle +mac80211 +mac_hid +mbcache +mc +mc44s803 +md4 +mdio +mdio_devres +md_mod +mei +mei_hdcp +mei_me +mei_pxp +mii +minix +mousedev +mptcp_diag +mrp +msdos +msr +mt20xx +mt76 +mt76_connac_lib +mt76_usb +mt76x02_lib +mt76x02_usb +mt76x2_common +mt76x2u +mt7921_common +mt7921e +mtd +mxm_wmi +nandcore +nbd +nct6683 +nct6775 +nct6775_core +netfs +nf_conntrack +nf_conntrack_broadcast +nf_conntrack_ftp +nf_conntrack_h323 +nf_conntrack_irc +nf_conntrack_netbios_ns +nf_conntrack_netlink +nf_conntrack_pptp +nf_conntrack_sip +nf_conntrack_tftp +nf_defrag_ipv4 +nf_defrag_ipv6 +nf_nat +nf_nat_ftp +nf_nat_h323 +nf_nat_irc +nf_nat_pptp +nf_nat_sip +nf_nat_tftp +nfnetlink +nfnetlink_log +nfnetlink_queue +nf_reject_ipv4 +nf_reject_ipv6 +nfs +nfsv4 +nf_tables +nft_chain_nat +nft_compat +nft_ct +nft_fib +nft_fib_inet +nft_fib_ipv4 +nft_fib_ipv6 +nft_masq +nft_nat +nft_reject +nft_reject_inet +nft_reject_ipv4 +nft_reject_ipv6 +nft_xfrm +nilfs2 +nlmon +nls_ascii +nls_cp437 +nls_iso8859_1 +nls_utf8 +nouveau +ntfs +ntfs3 +nvme +nvme_common +nvme_core +nvmem_rave_sp_eeprom +nvram +overlay +p8022 +parport +parport_pc +pata_acpi +pcc_cpufreq +pcspkr +pinctrl_alderlake +pinctrl_amd +pkcs8_key_parser +pktcdvd +platform_profile +pmt_class +pmt_telemetry +poly1305_x86_64 +polyval_clmulni +polyval_generic +ppdev +processor_thermal_device +processor_thermal_device_pci_legacy +processor_thermal_mbox +processor_thermal_rapl +processor_thermal_rfim +psmouse +psnap +qcserial +qrtr +r8152 +r8153_ecm +r8169 +radeon +raid1 +raid6_pq +rapl +rave_sp +raw_diag +rc_core +realtek +rfcomm +rfkill +rndis_host +rndis_wlan +rng_core +roles +rpcsec_gss_krb5 +rt2800lib +rt2800usb +rt2x00lib +rt2x00usb +rtl8192ee +rtl8723ae +rtl8723be +rtl8723_common +rtl8821ae +rtl_pci +rtlwifi +sch_cake +sch_fq_codel +sch_ingress +scsi_common +scsi_mod +scsi_transport_fc +scsi_transport_sas +sd_mod +selftests +serial_multi_instantiate +serio +serio_raw +ses +sg +sha512_ssse3 +snd +snd_acp6x_pdm_dma +snd_acp_config +snd_aloop +snd_compress +snd_ctl_led +snd_hda_codec +snd_hda_codec_generic +snd_hda_codec_hdmi +snd_hda_codec_realtek +snd_hda_core +snd_hda_ext_core +snd_hda_intel +snd_hrtimer +snd_hwdep +snd_intel_dspcfg +snd_intel_sdw_acpi +snd_pci_acp3x +snd_pci_acp5x +snd_pci_acp6x +snd_pcm +snd_pcm_dmaengine +snd_rawmidi +snd_rn_pci_acp3x +snd_seq +snd_seq_device +snd_seq_dummy +snd_seq_midi +snd_seq_midi_event +snd_seq_oss +snd_seq_virmidi +snd_soc_acp6x_mach +snd_soc_acpi +snd_soc_acpi_intel_match +snd_soc_core +snd_soc_dmic +snd_soc_hdac_hda +snd_soc_skl +snd_soc_sst_dsp +snd_soc_sst_ipc +snd_sof +snd_sof_amd_acp +snd_sof_amd_renoir +snd_sof_intel_hda +snd_sof_intel_hda_common +snd_sof_intel_hda_mlink +snd_sof_pci +snd_sof_pci_intel_cnl +snd_sof_probes +snd_sof_utils +snd_sof_xtensa_dsp +snd_timer +snd_ua101 +snd_ump +snd_usb_audio +snd_usbmidi_lib +snd_usb_us122l +snd_usb_usx2y +snd_virmidi +soundcore +soundwire_bus +soundwire_cadence +soundwire_generic_allocation +soundwire_intel +sp5100_tco +sparse_keymap +spi_intel +spi_intel_pci +spi_nor +squashfs +sr_mod +st +stp +sunrpc +syscopyarea +sysfillrect +sysimgblt +t10_pi +tap +tcp_bbr +tcp_diag +tda18271 +tda827x +tda8290 +tda9887 +tea5761 +tea5767 +tee +tg3 +thermal +tiny_power_button +tls +tpm +tpm_crb +tpm_tis +tpm_tis_core +trusted +ttm +tun +tuner_simple +tuner_types +tunnel4 +tunnel6 +typec +typec_ucsi +uas +ucsi_acpi +ucsi_ccg +udf +udp_diag +udp_tunnel +ufs +uhci_hcd +uhid +uinput +uio +uio_pdrv_genirq +unix_diag +usb_common +usbcore +usbhid +usbip_core +usbip_host +usbmon +usbnet +usb_storage +usb_wwan +uvc +uvcvideo +uvesafb +v4l2_dv_timings +veth +vfat +vfio +vfio_iommu_type1 +vfio_pci +vfio_pci_core +vhost +vhost_iotlb +vhost_net +video +videobuf2_common +videobuf2_memops +videobuf2_v4l2 +videobuf2_vmalloc +videodev +virtio_pci +virtio_pci_legacy_dev +virtio_pci_modern_dev +virtio_scsi +vivaldi_fmap +vmw_vmci +vmw_vsock_virtio_transport_common +vmw_vsock_vmci_transport +vsock +vsock_loopback +wacom +watchdog +wireguard +wmi +wmi_bmof +x86_pkg_temp_thermal +xc2028 +xc4000 +xc5000 +xfrm6_tunnel +xfrm_interface +xfs +xhci_hcd +xhci_pci +xhci_pci_renesas +xor +xpad +x_tables +xt_addrtype +xt_cgroup +xt_CHECKSUM +xt_comment +xt_conntrack +xt_hl +xt_limit +xt_LOG +xt_mark +xt_MASQUERADE +xt_nat +xt_NFQUEUE +xt_recent +xt_REDIRECT +xt_state +xt_tcpudp +xxhash_generic +zlib_deflate +zram diff --git a/linux-tkg-config/prepare b/linux-tkg-config/prepare index 23f9023..893c37a 100644 --- a/linux-tkg-config/prepare +++ b/linux-tkg-config/prepare @@ -1670,17 +1670,23 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\r fi # modprobed-db - if [ -z "$_modprobeddb" ]; then - plain "" - plain "Use modprobed db to clean config from unneeded modules?" - plain "Speeds up compilation considerably. Requires root." - plain "https://wiki.archlinux.org/index.php/Modprobed-db" - plain "!!!! Make sure to have a well populated db !!!!" - read -rp "`echo $' > N/y : '`" CONDITIONMPDB; + + if [[ "$_modprobeddb" = "true" && "$_kernel_on_diet" == "true" ]]; then + msg2 "_modprobeddb and _kernel_on_diet cannot be used together: it doesn't make sense, _kernel_on_diet uses our own modprobed list ;)" + exit 1 fi - if [[ "$CONDITIONMPDB" =~ [yY] ]] || [ "$_modprobeddb" = "true" ]; then - if [ -f "$where"/"$_modprobeddb_db_path" ];then - _modprobeddb_db_path="$where"/"$_modprobeddb_db_path" + + if [[ "$_kernel_on_diet" == "true" && "$_kver" -lt 605 ]]; then + msg2 "_kernel_on_diet not implemented for kernels older than 6.5" + exit 1 + fi + + if [[ "$_modprobeddb" = "true" || "$_kernel_on_diet" == "true" ]]; then + if [ -f "$_where"/"$_modprobeddb_db_path" ]; then + _modprobeddb_db_path="$_where"/"$_modprobeddb_db_path" + fi + if [ "$_kernel_on_diet" == "true" ]; then + _modprobeddb_db_path="$_where/minimal-modprobed.db" fi if [ ! -f $_modprobeddb_db_path ]; then msg2 "modprobed-db database not found" @@ -1688,6 +1694,7 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\r fi # Workaround for: https://github.com/Tk-Glitch/PKGBUILDS/issues/404. # Long live #404! + # The page doesn't exist any longer haha _disable "GPIO_BT8XX" "SND_SE6X" "SENSORS_ADM1021" "SENSORS_MAX6642" "SENSORS_ASUS_WMI_EC" make LSMOD=$_modprobeddb_db_path localmodconfig ${llvm_opt}