Skip to content

Commit

Permalink
Make kernel build more strict
Browse files Browse the repository at this point in the history
We use KCONFIG_ALLCONFIG=1 when we build linux, so we want to be sure
that all the options we set are actually in our final kernel build.
  • Loading branch information
jmbaur committed May 10, 2024
1 parent e7a56ca commit c09526c
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 49 deletions.
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- make recovery firmware allow booting non-signed kernels
- network booting
- use non-volatile storage for configuration of boot order, etc.
- use CONFIG_MFD_CROS_EC_DEV & CONFIG_CROS_EC_VBC in linux
4 changes: 0 additions & 4 deletions boards/qemu-x86_64/kernel.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
CONFIG_DRM=y
CONFIG_DRM_BOCHS=y
CONFIG_DRM_FBDEV_EMULATION=y
CONFIG_DRM_SIMPLEDRM=y
CONFIG_FB_VESA=y
CONFIG_FB_VGA16=y
CONFIG_VGA_ARB=y
29 changes: 6 additions & 23 deletions kernel-configs/aarch64
Original file line number Diff line number Diff line change
@@ -1,46 +1,31 @@
# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
# CONFIG_BACKLIGHT_PWM is not set
# CONFIG_IIO is not set
# CONFIG_MTD_CFI is not set
# CONFIG_NVMEM is not set
# CONFIG_PCI_ENDPOINT_CONFIGFS is not set
# CONFIG_SPMI is not set
# CONFIG_SRAM is not set
# CONFIG_SUSPEND is not set
# CONFIG_THERMAL is not set
CONFIG_ARM64_ERRATUM_1024718=y
CONFIG_ARM64_ERRATUM_1165522=y
CONFIG_ARM64_ERRATUM_1286807=y
CONFIG_ARM64_ERRATUM_1319367=y
CONFIG_ARM64_ERRATUM_1418040=y
CONFIG_ARM64_ERRATUM_1463225=y
CONFIG_ARM64_ERRATUM_1508412=y
CONFIG_ARM64_ERRATUM_1530923=y
CONFIG_ARM64_ERRATUM_1542419=y
CONFIG_ARM64_ERRATUM_1742098=y
CONFIG_ARM64_ERRATUM_1902691=y
CONFIG_ARM64_ERRATUM_2038923=y
CONFIG_ARM64_ERRATUM_2051678=y
CONFIG_ARM64_ERRATUM_2054223=y
CONFIG_ARM64_ERRATUM_2064142=y
CONFIG_ARM64_ERRATUM_2067961=y
CONFIG_ARM64_ERRATUM_2077057=y
CONFIG_ARM64_ERRATUM_2119858=y
CONFIG_ARM64_ERRATUM_2139208=y
CONFIG_ARM64_ERRATUM_2224489=y
CONFIG_ARM64_ERRATUM_2253138=y
CONFIG_ARM64_ERRATUM_2441007=y
CONFIG_ARM64_ERRATUM_2441009=y
CONFIG_ARM64_ERRATUM_2457168=y
CONFIG_ARM64_ERRATUM_2658417=y
CONFIG_ARM64_ERRATUM_819472=y
CONFIG_ARM64_ERRATUM_824069=y
CONFIG_ARM64_ERRATUM_826319=y
CONFIG_ARM64_ERRATUM_827319=y
CONFIG_ARM64_ERRATUM_832075=y
CONFIG_ARM64_ERRATUM_834220=y
CONFIG_ARM64_ERRATUM_843419=y
CONFIG_ARM64_ERRATUM_845719=y
CONFIG_ARM_ARCH_TIMER=y
CONFIG_ARM_PMU=y
CONFIG_ARM_PSCI_CPUIDLE=y
Expand All @@ -52,19 +37,14 @@ CONFIG_ARM_SMMU_V3=y
CONFIG_CMDLINE_FROM_BOOTLOADER=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_IDLE=y
CONFIG_CROS_EC_RPMSG=y
CONFIG_CRYPTO_SHA256_ARM64=y
CONFIG_CRYPTO_SHA512_ARM64=y
CONFIG_DTC=y
CONFIG_EXTCON_USBC_CROS_EC=y
CONFIG_EXTCON_USB_GPIO=y
CONFIG_HW_PERF_EVENTS=y
CONFIG_I2C=y
CONFIG_MAILBOX=y
CONFIG_MFD_SYSCON=y
CONFIG_MTD=y
CONFIG_MTD_BLOCK=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_OF=y
CONFIG_OF=y
CONFIG_OF_ADDRESS=y
CONFIG_OF_EARLY_FLATTREE=y
Expand All @@ -74,9 +54,12 @@ CONFIG_OF_KOBJ=y
CONFIG_OF_RESERVED_MEM=y
CONFIG_PCI_ENDPOINT=y
CONFIG_PERF_EVENTS=y
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REMOTEPROC=y
CONFIG_RESET_CONTROLLER=y
CONFIG_RPMSG=y
CONFIG_RTC_CLASS=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_SUSPEND=y
4 changes: 2 additions & 2 deletions kernel-configs/chromebook
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ CONFIG_CROS_EC_I2C=y
CONFIG_CROS_EC_LPC=y
CONFIG_CROS_EC_PROTO=y
CONFIG_CROS_EC_SPI=y
CONFIG_CROS_EC_VBC=y
CONFIG_HID_VIVALDI=y
CONFIG_I2C_CROS_EC_TUNNEL=y
CONFIG_INPUT_VIVALDIFMAP=y
CONFIG_KEYBOARD_CROS_EC=y
CONFIG_MFD_CROS_EC_DEV=y
CONFIG_MMC=y
CONFIG_MMC_BLOCK=y
CONFIG_SERIAL_8250=y
Expand All @@ -26,3 +24,5 @@ CONFIG_TCG_TIS_SPI=y
CONFIG_TCG_TIS_SPI_CR50=y
CONFIG_TYPEC=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_HAPS=y
CONFIG_USB_DWC3_PCI=y
1 change: 0 additions & 1 deletion kernel-configs/debug
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
CONFIG_BACKTRACE_VERBOSE=y
CONFIG_BUG=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_KERNEL=y
Expand Down
11 changes: 3 additions & 8 deletions kernel-configs/generic
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INTEGRITY_TRUSTED_KEYRING is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_RT_MUTEXES is not set
# CONFIG_WIRELESS is not set
CONFIG_64BIT=y
CONFIG_ASYMMETRIC_KEY_TYPE=y
Expand Down Expand Up @@ -42,6 +36,7 @@ CONFIG_GPIOLIB=y
CONFIG_HID=y
CONFIG_HID_GENERIC=y
CONFIG_HID_SUPPORT=y
CONFIG_I2C=y
CONFIG_I2C_HID=y
CONFIG_IMA=y
CONFIG_IMA_APPRAISE=y
Expand All @@ -57,8 +52,6 @@ CONFIG_INTEGRITY_ASYMMETRIC_KEYS=y
CONFIG_INTEGRITY_SIGNATURE=y
CONFIG_IOMMU_SUPPORT=y
CONFIG_IRQ_POLL=y
CONFIG_IRQ_REMAP=y
CONFIG_KERNEL_XZ=y
CONFIG_KEXEC=y
CONFIG_KEXEC_FILE=y
CONFIG_KEYBOARD_ATKBD=y
Expand All @@ -78,7 +71,9 @@ CONFIG_PINCTRL=y
CONFIG_PRINTK=y
CONFIG_PROC_FS=y
CONFIG_RD_XZ=y
CONFIG_RTC_CLASS=y
CONFIG_SCSI=y
CONFIG_SCSI_LOWLEVEL=y
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SHMEM=y
Expand Down
1 change: 0 additions & 1 deletion kernel-configs/mediatek
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ CONFIG_GENERIC_ADC_THERMAL=y
CONFIG_HID_GOOGLE_HAMMER=y
CONFIG_I2C_MT65XX=y
CONFIG_KEYBOARD_MT6779=y
CONFIG_MAILBOX=y
CONFIG_MEDIATEK_WATCHDOG=y
CONFIG_MFD_MT6397=y
CONFIG_MMC_MTK=y
Expand Down
1 change: 1 addition & 0 deletions kernel-configs/network
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ CONFIG_ETHERNET=y
CONFIG_INET=y
CONFIG_IPV6=y
CONFIG_NETDEVICES=y
CONFIG_NET_CORE=y
2 changes: 2 additions & 0 deletions kernel-configs/qemu
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ CONFIG_E1000=y
CONFIG_FW_CFG_SYSFS=y
CONFIG_I2C_VIRTIO=y
CONFIG_IKCONFIG=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_NET_VENDOR_INTEL=y
CONFIG_SCSI_VIRTIO=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_ANCHOR=y
Expand Down
4 changes: 2 additions & 2 deletions kernel-configs/video
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CONFIG_BACKLIGHT_CLASS_DEVICE=y
CONFIG_FB=y
CONFIG_FB_BACKLIGHT=y
CONFIG_FB_DEVICE=y
CONFIG_FB_SIMPLE=y
CONFIG_FONTS=y
CONFIG_FONT_SUPPORT=y
CONFIG_FONT_TER16x32=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
Expand Down
21 changes: 13 additions & 8 deletions kernel-configs/x86_64
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
# CONFIG_HIGHMEM4G is not set
# CONFIG_HIGHMEM64G is not set
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_GZIP is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_UNWINDER_FRAME_POINTER is not set
CONFIG_ACPI=y
CONFIG_ACPI_BUTTON=y
CONFIG_ACPI_PROCESSOR=y
CONFIG_ACPI_THERMAL=y
CONFIG_ACPI_VIDEO=y
CONFIG_ACPI_WMI=y
CONFIG_ATA_ACPI=y
CONFIG_CMDLINE_BOOL=y
CONFIG_CPU_MITIGATIONS=y
CONFIG_CRYPTO_SHA256_SSSE3=y
CONFIG_CRYPTO_SHA512_SSSE3=y
CONFIG_GPIO_ACPI=y
CONFIG_IRQ_REMAP=y
CONFIG_KERNEL_XZ=y
CONFIG_MFD_INTEL_LPSS_ACPI=y
CONFIG_MFD_INTEL_LPSS_PCI=y
CONFIG_MTRR=y
CONFIG_NOHIGHMEM=y
CONFIG_PCI_MSI=y
CONFIG_PINCTRL_INTEL=y
CONFIG_PNP=y
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_RETPOLINE=y
Expand All @@ -30,17 +35,17 @@ CONFIG_SERIAL_8250_MID=y
CONFIG_SERIAL_8250_PCI=y
CONFIG_SERIAL_8250_PCILIB=y
CONFIG_SERIAL_8250_PERICOM=y
CONFIG_SPECULATION_MITIGATIONS=y
CONFIG_SPI_DESIGNWARE=y
CONFIG_SPI_INTEL=y
CONFIG_SPI_INTEL_PCI=y
CONFIG_SPI_MEM=y
CONFIG_SPI_PXA2XX=y
CONFIG_SPI_PXA2XX_PCI=y
CONFIG_SYSFB_SIMPLEFB=y
CONFIG_UNWINDER_GUESS=y
CONFIG_USB_DWC3_HAPS=y
CONFIG_USB_DWC3_PCI=y
CONFIG_VGA_CONSOLE=y
CONFIG_WMI_BMOF=y
CONFIG_X86=y
CONFIG_X86_64=y
CONFIG_X86_IOPL_IOPERM=y
CONFIG_X86_PAT=y
CONFIG_X86_PLATFORM_DEVICES=y
Expand Down
24 changes: 24 additions & 0 deletions pkgs/linux/check_config.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# shellcheck shell=bash

set -o errexit
set -o nounset
set -o pipefail

start_config=$1
end_config=$2

missing=()
while read -r line; do
if ! grep --silent "$line" "$end_config"; then
missing+=("$line")
fi
done <"$start_config"

if [[ ${#missing[@]} -gt 0 ]]; then
echo
for line in "${missing[@]}"; do
echo "\"$line\" not found in final config!"
done
echo
exit 1
fi
1 change: 1 addition & 0 deletions pkgs/linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ stdenv.mkDerivation {
runHook preConfigure
cat ${configFile} $extraConfigPath > all.config
make ARCH=${stdenv.hostPlatform.linuxArch} KCONFIG_ALLCONFIG=1 allnoconfig
bash ${./check_config.bash} all.config .config
runHook postConfigure
'';
buildFlags = [
Expand Down

0 comments on commit c09526c

Please sign in to comment.