From a011422675bb9fed2c8012933665147a95d928d5 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Wed, 27 May 2020 18:17:36 -0400 Subject: [PATCH 1/9] LTO WIP. Next step, making toolset dynamic instead of static Ref: https://github.com/richfelker/musl-cross-make/commit/d2f59c98d6e5d83243e581714094160f9657f3d5#commitcomment-39462493 --- .circleci/config.yml | 80 ----------- .gitlab-ci.yml | 30 ---- config/linux-x230.config | 135 +++++------------- modules/linux | 28 +++- modules/musl-cross | 1 + .../0000-efi_bds.patch | 54 +++++++ .../0001-fake-acpi.patch | 32 +++++ .../0002-nmi-squelch.patch | 20 +++ .../0003-fake-trampoline.patch | 28 ++++ .../0010-winterfell-ahci.patch | 18 +++ 10 files changed, 213 insertions(+), 213 deletions(-) create mode 100644 patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0000-efi_bds.patch create mode 100644 patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0001-fake-acpi.patch create mode 100644 patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0002-nmi-squelch.patch create mode 100644 patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0003-fake-trampoline.patch create mode 100644 patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0010-winterfell-ahci.patch diff --git a/.circleci/config.yml b/.circleci/config.yml index fba86d2b4..a408c7931 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,68 +19,6 @@ jobs: command: | git reset --hard "$CIRCLE_SHA1" \ -# linuxboot steps need something to pass in the kernel header path -# skipping for now -# - run: -# name: qemu-linuxboot-edk2 -# command: | -# ./build/make-4.2.1/make \ -# CROSS=/cross/bin/x86_64-linux-musl- \ -# BOARD=qemu-linuxboot \ -# `/bin/pwd`/build/linuxboot-git/build/qemu/.configured \ -# # Run first to avoid too many processes -# -# - run: -# name: qemu-linuxboot -# command: | -# ./build/make-4.2.1/make \ -# CROSS=/cross/bin/x86_64-linux-musl- \ -# --load 2 \ -# V=1 \ -# BOARD=qemu-linuxboot \ -# -# - store-artifacts: -# path: build/qemu-linuxboot/linuxboot.rom -# - store-artifacts: -# path: build/qemu-linuxboot/hashes.txt - - - - run: - name: qemu-coreboot - command: | - rm -rf build/make-4.2.1/ build/qemu-coreboot/* build/log/* && make --load 2 \ - V=1 \ - BOARD=qemu-coreboot \ - no_output_timeout: 3h - - run: - name: Output qemu-coreboot hashes - command: | - cat build/qemu-coreboot/hashes.txt \ - - run: - name: Archiving build logs for qemu-coreboot - command: | - tar zcvf build/qemu-coreboot/logs.tar.gz build/log/* - - store-artifacts: - path: build/qemu-coreboot - - - run: - name: x230-flash - command: | - rm -rf build/x230-flash/* build/log/* && make --load 2 \ - V=1 \ - BOARD=x230-flash \ - no_output_timeout: 3h - - run: - name: Ouput x230-flash hashes - command: | - cat build/x230-flash/hashes.txt \ - - run: - name: Archiving build logs for x230-flash - command: | - tar zcvf build/x230-flash/logs.tar.gz build/log/* - - store-artifacts: - path: build/x230-flash - - run: name: x230 command: | @@ -99,24 +37,6 @@ jobs: - store-artifacts: path: build/x230 - - run: - name: x230-hotp-verification - command: | - rm -rf build/x230-hotp-verification/* build/log/* && make --load 2 \ - V=1 \ - BOARD=x230-hotp-verification \ - no_output_timeout: 3h - - run: - name: Ouput x230-hotp-verification hashes - command: | - cat build/x230-hotp-verification/hashes.txt \ - - run: - name: Archiving build logs for x230-hotp-verification - command: | - tar zcvf build/x230-hotp-verification/logs.tar.gz build/log/* - - store-artifacts: - path: build/x230-hotp-verification - - save_cache: key: heads-{{ .Branch }}{{ .Environment.CACHE_VERSION }} paths: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ccaec9475..4116278cc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -19,33 +19,6 @@ build: - dnf install -y @development-tools gcc-c++ gcc-gnat zlib-devel perl-Digest-MD5 perl-Digest-SHA uuid-devel pcsc-tools ncurses-devel lbzip2 libuuid-devel lzma elfutils-libelf-devel bc bzip2 bison flex git gnupg iasl m4 nasm patch python wget libusb-devel cmake automake pv bsdiff autoconf libtool cpio texinfo - git fetch origin - git reset --hard origin/$CI_COMMIT_REF_NAME - - echo "Removing old qemu-coreboot artifacts..." - - rm -rf ./build/qemu-coreboot/* - - rm -rf ./build/log/* - - echo "Building BOARD=qemu-coreboot board..." - - make BOARD=qemu-coreboot || (find ./build/log/ -cmin 1|xargs tail; exit 1) - - echo "qemu-coreboot hashes:" - - cat ./build/qemu-coreboot/hashes.txt - - echo "Archiving qemu-coreboot logs..." - - tar zcvf ./build/qemu-coreboot/logs.tar.gz ./build/log/* - - echo "Removing old x230-flash artifacts..." - - rm -rf ./build/x230-flash/* - - rm -rf ./build/log/* - - echo "Building BOARD=x230-flash board..." - - make BOARD=x230-flash || (find ./build/log/ -cmin 1|xargs tail; exit 1) - - echo "x230-flash hashes:" - - cat ./build/x230-flash/hashes.txt - - echo "Archiving x230-flash logs..." - - tar zcvf ./build/x230-flash/logs.tar.gz ./build/log/* - - echo "Removing old x230-hotp-verification artifacts..." - - rm -rf ./build/x230-hotp-verification/* - - rm -rf ./build/log/* - - echo "Building BOARD=x230-hotp-verification board..." - - make BOARD=x230-hotp-verification || (find ./build/log/ -cmin 1|xargs tail; exit 1) - - echo "x230-hotp-verification hashes:" - - cat ./build/x230-hotp-verification/hashes.txt - - echo "Archiving x230-hotp-verification logs..." - - tar zcvf ./build/x230-hotp-verification/logs.tar.gz ./build/log/* - echo "Removing old x230 artifacts..." - rm -rf ./build/x230/* - rm -rf ./build/log/* @@ -57,7 +30,4 @@ build: - tar zcvf ./build/x230/logs.tar.gz ./build/log/* artifacts: paths: - - ./build/qemu-coreboot - - ./build/x230-flash - - ./build/x230-hotp-verification - ./build/x230 diff --git a/config/linux-x230.config b/config/linux-x230.config index dd5af0c15..ef5dc8bb4 100644 --- a/config/linux-x230.config +++ b/config/linux-x230.config @@ -3,8 +3,8 @@ CONFIG_LOCALVERSION="-heads" CONFIG_KERNEL_XZ=y # CONFIG_SWAP is not set # CONFIG_CROSS_MEMORY_ATTACH is not set -# CONFIG_FHANDLE is not set CONFIG_NO_HZ_IDLE=y +CONFIG_PREEMPT_VOLUNTARY=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_BLK_DEV_INITRD=y CONFIG_INITRAMFS_SOURCE="../../../blobs/dev.cpio" @@ -14,37 +14,27 @@ CONFIG_INITRAMFS_SOURCE="../../../blobs/dev.cpio" # CONFIG_RD_LZO is not set # CONFIG_RD_LZ4 is not set CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_LTO_MENU=y +# CONFIG_MULTIUSER is not set # CONFIG_SGETMASK_SYSCALL is not set # CONFIG_SYSFS_SYSCALL is not set +# CONFIG_FHANDLE is not set # CONFIG_BASE_FULL is not set # CONFIG_SIGNALFD is not set # CONFIG_TIMERFD is not set # CONFIG_EVENTFD is not set # CONFIG_AIO is not set # CONFIG_ADVISE_SYSCALLS is not set -# CONFIG_MEMBARRIER is not set CONFIG_EMBEDDED=y # CONFIG_VM_EVENT_COUNTERS is not set # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set -CONFIG_JUMP_LABEL=y -CONFIG_CC_STACKPROTECTOR_STRONG=y -CONFIG_MODULES=y -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set CONFIG_SMP=y # CONFIG_X86_EXTENDED_PLATFORM is not set CONFIG_PROCESSOR_SELECT=y # CONFIG_CPU_SUP_CENTAUR is not set -CONFIG_PREEMPT_VOLUNTARY=y CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y -# CONFIG_X86_MCE_AMD is not set -# CONFIG_PERF_EVENTS_INTEL_RAPL is not set # CONFIG_MICROCODE is not set -# CONFIG_SPARSEMEM_VMEMMAP is not set -# CONFIG_COMPACTION is not set -# CONFIG_BOUNCE is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=65536 CONFIG_X86_PMEM_LEGACY=y # CONFIG_MTRR is not set # CONFIG_X86_SMAP is not set @@ -56,35 +46,35 @@ CONFIG_KEXEC_FILE=y CONFIG_PHYSICAL_ALIGN=0x1000000 # CONFIG_MODIFY_LDT_SYSCALL is not set # CONFIG_SUSPEND is not set -CONFIG_ACPI_VIDEO=y -CONFIG_PCI_MSI=y -# CONFIG_HT_IRQ is not set -CONFIG_PCI_IOV=y -CONFIG_PCI_PRI=y +# CONFIG_FIRMWARE_MEMMAP is not set +# CONFIG_DMIID is not set +CONFIG_GOOGLE_FIRMWARE=y +CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY=y +# CONFIG_VIRTUALIZATION is not set +CONFIG_JUMP_LABEL=y +CONFIG_MODULES=y +CONFIG_TRIM_UNUSED_KSYMS=y # CONFIG_COREDUMP is not set +# CONFIG_SPARSEMEM_VMEMMAP is not set +# CONFIG_COMPACTION is not set +# CONFIG_BOUNCE is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=65536 CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_INET=y CONFIG_SYN_COOKIES=y -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_DIAG is not set # CONFIG_IPV6 is not set # CONFIG_WIRELESS is not set -# CONFIG_UEVENT_HELPER is not set CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y # CONFIG_STANDALONE is not set -# CONFIG_FIRMWARE_IN_KERNEL is not set # CONFIG_ALLOW_DEV_COREDUMP is not set CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_EEPROM_93CX6=m -CONFIG_INTEL_MEI_ME=m -CONFIG_INTEL_MEI_TXE=m # CONFIG_SCSI_PROC_FS is not set CONFIG_BLK_DEV_SD=y CONFIG_BLK_DEV_SR=y @@ -92,7 +82,6 @@ CONFIG_CHR_DEV_SG=y CONFIG_SCSI_SCAN_ASYNC=y CONFIG_ISCSI_TCP=y CONFIG_ATA=y -CONFIG_SATA_AHCI=y # CONFIG_ATA_SFF is not set CONFIG_MD=y CONFIG_BLK_DEV_DM=y @@ -100,56 +89,26 @@ CONFIG_DM_CRYPT=y CONFIG_DM_VERITY=y CONFIG_DM_VERITY_FEC=y CONFIG_NETDEVICES=y -# CONFIG_NET_VENDOR_3COM is not set -# CONFIG_NET_VENDOR_ADAPTEC is not set -# CONFIG_NET_VENDOR_AGERE is not set -# CONFIG_NET_VENDOR_ALTEON is not set # CONFIG_NET_VENDOR_AMAZON is not set -# CONFIG_NET_VENDOR_AMD is not set # CONFIG_NET_VENDOR_ARC is not set -# CONFIG_NET_VENDOR_ATHEROS is not set -# CONFIG_NET_CADENCE is not set # CONFIG_NET_VENDOR_BROADCOM is not set -# CONFIG_NET_VENDOR_BROCADE is not set # CONFIG_NET_VENDOR_CAVIUM is not set -# CONFIG_NET_VENDOR_CHELSIO is not set -# CONFIG_NET_VENDOR_CISCO is not set -# CONFIG_NET_VENDOR_DEC is not set -# CONFIG_NET_VENDOR_DLINK is not set -# CONFIG_NET_VENDOR_EMULEX is not set # CONFIG_NET_VENDOR_EZCHIP is not set -# CONFIG_NET_VENDOR_EXAR is not set -# CONFIG_NET_VENDOR_HP is not set -CONFIG_E1000=m -CONFIG_E1000E=m # CONFIG_NET_VENDOR_I825XX is not set # CONFIG_NET_VENDOR_MARVELL is not set # CONFIG_NET_VENDOR_MELLANOX is not set # CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MYRI is not set # CONFIG_NET_VENDOR_NATSEMI is not set # CONFIG_NET_VENDOR_NETRONOME is not set -# CONFIG_NET_VENDOR_NVIDIA is not set -# CONFIG_NET_VENDOR_OKI is not set -# CONFIG_NET_PACKET_ENGINE is not set -# CONFIG_NET_VENDOR_QLOGIC is not set # CONFIG_NET_VENDOR_QUALCOMM is not set -# CONFIG_NET_VENDOR_REALTEK is not set # CONFIG_NET_VENDOR_RENESAS is not set -# CONFIG_NET_VENDOR_RDC is not set # CONFIG_NET_VENDOR_ROCKER is not set # CONFIG_NET_VENDOR_SAMSUNG is not set # CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SILAN is not set -# CONFIG_NET_VENDOR_SIS is not set -# CONFIG_NET_VENDOR_SMSC is not set # CONFIG_NET_VENDOR_STMICRO is not set -# CONFIG_NET_VENDOR_SUN is not set -# CONFIG_NET_VENDOR_TEHUTI is not set -# CONFIG_NET_VENDOR_TI is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set # CONFIG_NET_VENDOR_VIA is not set # CONFIG_NET_VENDOR_WIZNET is not set -# CONFIG_NET_VENDOR_SYNOPSYS is not set # CONFIG_USB_NET_DRIVERS is not set # CONFIG_WLAN is not set # CONFIG_INPUT_MOUSE is not set @@ -159,16 +118,10 @@ CONFIG_E1000E=m CONFIG_SERIAL_8250=y # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set # CONFIG_SERIAL_8250_PNP is not set -# CONFIG_SERIAL_8250_PCI is not set -# CONFIG_SERIAL_8250_LPSS is not set -# CONFIG_SERIAL_8250_MID is not set CONFIG_TTY_PRINTK=y CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_TIMERIOMEM=m -CONFIG_HW_RANDOM_INTEL=m -CONFIG_HW_RANDOM_AMD=m CONFIG_HW_RANDOM_VIA=m -CONFIG_HW_RANDOM_TPM=m CONFIG_TCG_TPM=y CONFIG_TCG_TIS=y # CONFIG_I2C_COMPAT is not set @@ -182,12 +135,7 @@ CONFIG_PTP_1588_CLOCK=y # CONFIG_X86_PKG_TEMP_THERMAL is not set CONFIG_MFD_SYSCON=y CONFIG_DRM=y -CONFIG_DRM_I915=y CONFIG_FB_VESA=y -CONFIG_BACKLIGHT_LCD_SUPPORT=y -# CONFIG_LCD_CLASS_DEVICE is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -# CONFIG_BACKLIGHT_GENERIC is not set CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_USB=y CONFIG_USB_XHCI_HCD=m @@ -197,19 +145,11 @@ CONFIG_USB_EHCI_HCD_PLATFORM=m CONFIG_USB_STORAGE=m CONFIG_RTC_CLASS=y # CONFIG_X86_PLATFORM_DEVICES is not set -CONFIG_INTEL_IOMMU=y -CONFIG_INTEL_IOMMU_SVM=y CONFIG_GENERIC_PHY=y # CONFIG_BLK_DEV_PMEM is not set # CONFIG_ND_BLK is not set # CONFIG_BTT is not set -# CONFIG_FIRMWARE_MEMMAP is not set -# CONFIG_DMIID is not set -CONFIG_GOOGLE_FIRMWARE=y -CONFIG_GOOGLE_MEMCONSOLE_X86_LEGACY=y -# CONFIG_EXT2_FS is not set CONFIG_EXT4_FS=y -CONFIG_EXT4_USE_FOR_EXT2=y # CONFIG_DNOTIFY is not set # CONFIG_INOTIFY_USER is not set CONFIG_ISO9660_FS=y @@ -224,31 +164,9 @@ CONFIG_NLS_DEFAULT="utf8" CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_UTF8=y -CONFIG_PRINTK_TIME=y -CONFIG_BOOT_PRINTK_DELAY=y -# CONFIG_ENABLE_WARN_DEPRECATED is not set -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_FRAME_WARN=1024 -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_MAGIC_SYSRQ=y -CONFIG_HARDLOCKUP_DETECTOR=y -CONFIG_WQ_WATCHDOG=y -# CONFIG_SCHED_DEBUG is not set -CONFIG_STACKTRACE=y -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_RCU_TRACE is not set -# CONFIG_FTRACE is not set -# CONFIG_STRICT_DEVMEM is not set -# CONFIG_X86_VERBOSE_BOOTUP is not set -# CONFIG_DOUBLEFAULT is not set -CONFIG_IO_DELAY_0XED=y -CONFIG_OPTIMIZE_INLINING=y -# CONFIG_X86_DEBUG_FPU is not set CONFIG_HARDENED_USERCOPY=y CONFIG_CRYPTO_RSA=m CONFIG_CRYPTO_USER=y -CONFIG_CRYPTO_MCRYPTD=m -CONFIG_CRYPTO_AUTHENC=m CONFIG_CRYPTO_CCM=m CONFIG_CRYPTO_GCM=m CONFIG_CRYPTO_CHACHA20POLY1305=m @@ -310,7 +228,6 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=y CONFIG_CRYPTO_USER_API_RNG=y CONFIG_CRYPTO_USER_API_AEAD=y # CONFIG_CRYPTO_HW is not set -# CONFIG_VIRTUALIZATION is not set CONFIG_CRC_CCITT=m CONFIG_CRC_T10DIF=y CONFIG_CRC_ITU_T=m @@ -320,3 +237,21 @@ CONFIG_CRC8=m CONFIG_XZ_DEC_TEST=m CONFIG_CORDIC=m CONFIG_IRQ_POLL=y +CONFIG_PRINTK_TIME=y +CONFIG_BOOT_PRINTK_DELAY=y +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_FRAME_WARN=1024 +# CONFIG_UNUSED_SYMBOLS is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_HARDLOCKUP_DETECTOR=y +CONFIG_WQ_WATCHDOG=y +# CONFIG_SCHED_DEBUG is not set +CONFIG_STACKTRACE=y +# CONFIG_DEBUG_BUGVERBOSE is not set +# CONFIG_RCU_TRACE is not set +# CONFIG_FTRACE is not set +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +# CONFIG_DOUBLEFAULT is not set +CONFIG_IO_DELAY_0XED=y +# CONFIG_X86_DEBUG_FPU is not set diff --git a/modules/linux b/modules/linux index f8817935b..6cf5c9827 100644 --- a/modules/linux +++ b/modules/linux @@ -1,6 +1,8 @@ modules-y += linux -linux_version := 4.14.62 +#https://github.com/andikleen/linux-misc/tree/lto-420-1 +linux_version := b87b58e1b057a2706d422fbdc76aa34309c6c90b + linux_base_dir := linux-$(linux_version) # TODO: fixup the patch process @@ -13,11 +15,18 @@ linux_kconfig := $(or $(CONFIG_LINUX_CONFIG),config/linux.config) linux_dir := $(linux_base_dir)/$(notdir $(basename $(linux_kconfig))) linux_tar := linux-$(linux_version).tar.xz -linux_url := https://cdn.kernel.org/pub/linux/kernel/v4.x/$(linux_tar) +linux_url := https://github.com/andikleen/linux-misc/archive/$(linux_version).tar.xz +#linux_url := https://cdn.kernel.org/pub/linux/kernel/v4.x/$(linux_tar) +#linux_url := https://cdn.kernel.org/pub/linux/kernel/v5.x/$(linux_tar) linux-4.9.38_hash := 76d789d87dd51d2fd58c095727171984fa4a992f5e25b9e3eb1e5fd5cd129074 linux-4.9.80_hash := 9e2e83ccc0afc3f23340ed5e58a35d8c6300a7c58aa98ca913848de41226477b linux-4.14.62_hash := 51ca4d7e8ee156dc0f19bc7768915cfae41dbb0b4f251e4fa8b178c5674c22ab +linux-4.19.63_hash := 75988760b931864b46292dcfad1dd54b3f4da10168041f48ca6d7f6dd4e5d25d +linux-4.19.114_hash := 1e40a0dc6afc95a259f97b80d5f5ef8f89e2ee49e993ba6844e2bc55de361f0e +linux-5.4.30_hash := 11dd78f701bce619d90d3b2ee597601716c48087e159c890c1decd7b90349def + +linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b_hash := 30c7ed4d4240e1aa2ec124fbbcb8e30ec5dae1b7109e835f17f8b9d027225c88 linux_hash := $(linux-$(linux_version)_hash) @@ -95,7 +104,20 @@ linux_modules-$(CONFIG_LINUX_NVME) += drivers/nvme/host/nvme-core.ko linux_modules-$(CONFIG_LINUX_MEI) += drivers/misc/mei/mei.ko linux_modules-$(CONFIG_LINUX_MEI) += drivers/misc/mei/mei-me.ko -EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches +# MMC/sdard support through Secure Digital Host Controller Interface support +#Common +linux_modules-$(CONFIG_LINUX_MMC) += drivers/mmc/core/mmc_core.ko +linux_modules-$(CONFIG_LINUX_MMC) += drivers/mmc/core/mmc_block.ko +#Ricoh +linux_modules-$(CONFIG_LINUX_MMC) += drivers/mmc/host/sdhci.ko +linux_modules-$(CONFIG_LINUX_MMC) += drivers/mmc/host/cqhci.ko +linux_modules-$(CONFIG_LINUX_MMC) += drivers/mmc/host/sdhci-pci.ko +#Realtek +linux_modules-$(CONFIG_LINUX_MMC) += drivers/mfd/mfd-core.ko +linux_modules-$(CONFIG_LINUX_MMC) += drivers/misc/cardreader/rtsx_pci.ko +linux_modules-$(CONFIG_LINUX_MMC) += drivers/mmc/host/rtsx_pci_sdmmc.ko + +EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches -flto linux_target := \ O="$(build)/$(linux_dir)" \ diff --git a/modules/musl-cross b/modules/musl-cross index f9cf79db0..28a1335de 100644 --- a/modules/musl-cross +++ b/modules/musl-cross @@ -35,6 +35,7 @@ else # have to build both x86_64 and i386 versions for coreboot musl-cross_configure := \ + /bin/echo -e >> config.mak 'GCC_CONFIG += --enable-languages=c,c++,lto' ; \ /bin/echo -e >> Makefile 'both:' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=x86_64-linux-musl install' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=i386-linux-musl install' ; \ diff --git a/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0000-efi_bds.patch b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0000-efi_bds.patch new file mode 100644 index 000000000..0d2d76ea3 --- /dev/null +++ b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0000-efi_bds.patch @@ -0,0 +1,54 @@ +diff -u --recursive ../../clean/linux-4.14.62/arch/x86/boot/compressed/eboot.c linux-4.14.62/arch/x86/boot/compressed/eboot.c +--- ../../clean/linux-4.14.62/arch/x86/boot/compressed/eboot.c 2018-08-09 06:16:40.000000000 -0400 ++++ linux-4.14.62/arch/x86/boot/compressed/eboot.c 2018-08-09 10:13:11.801000000 -0400 +@@ -630,8 +630,8 @@ + u16 *s2; + u8 *s1; + int i; +- unsigned long ramdisk_addr; +- unsigned long ramdisk_size; ++ unsigned long ramdisk_addr = 0; ++ unsigned long ramdisk_size = 0; + + efi_early = c; + sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; +@@ -686,9 +686,6 @@ + /* Fill in upper bits of command line address, NOP on 32 bit */ + boot_params->ext_cmd_line_ptr = (u64)(unsigned long)cmdline_ptr >> 32; + +- hdr->ramdisk_image = 0; +- hdr->ramdisk_size = 0; +- + /* Clear APM BIOS info */ + memset(bi, 0, sizeof(*bi)); + +@@ -712,10 +709,16 @@ + + if (status != EFI_SUCCESS) + goto fail2; +- hdr->ramdisk_image = ramdisk_addr & 0xffffffff; +- hdr->ramdisk_size = ramdisk_size & 0xffffffff; +- boot_params->ext_ramdisk_image = (u64)ramdisk_addr >> 32; +- boot_params->ext_ramdisk_size = (u64)ramdisk_size >> 32; ++ ++ // don't overwrite the bzImage or loader provided ramdisk pointer ++ // unless the kernel command line specified a different one. ++ if (ramdisk_addr != 0) ++ { ++ hdr->ramdisk_image = ramdisk_addr & 0xffffffff; ++ hdr->ramdisk_size = ramdisk_size & 0xffffffff; ++ boot_params->ext_ramdisk_image = (u64)ramdisk_addr >> 32; ++ boot_params->ext_ramdisk_size = (u64)ramdisk_size >> 32; ++ } + + return boot_params; + fail2: +--- clean/linux-4.14.62/arch/x86/boot/compressed/early_serial_console.c 2018-08-09 12:16:40.000000000 +0200 ++++ linux-4.14.62/arch/x86/boot/compressed/early_serial_console.c 2018-09-28 11:59:36.824015244 +0200 +@@ -1,5 +1,5 @@ + #include "misc.h" + +-int early_serial_base; ++int early_serial_base = 0x3f8; + + #include "../early_serial_console.c" diff --git a/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0001-fake-acpi.patch b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0001-fake-acpi.patch new file mode 100644 index 000000000..0c8b3b546 --- /dev/null +++ b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0001-fake-acpi.patch @@ -0,0 +1,32 @@ +diff --recursive -u ./clean/linux-4.9.80/drivers/acpi/acpica/evxfevnt.c linux-4.9.80/drivers/acpi/acpica/evxfevnt.c +--- ./clean/linux-4.9.80/drivers/acpi/acpica/evxfevnt.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/drivers/acpi/acpica/evxfevnt.c 2018-02-07 15:51:28.786502597 -0500 +@@ -111,6 +111,8 @@ + } + + ACPI_ERROR((AE_INFO, "Hardware did not enter ACPI mode")); ++printk("%s:%d faking ACPI mode\n", __func__, __LINE__); ++ return_ACPI_STATUS(AE_OK); + return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); + } + +diff --recursive -u ./clean/linux-4.9.80/drivers/acpi/acpica/hwacpi.c linux-4.9.80/drivers/acpi/acpica/hwacpi.c +--- ./clean/linux-4.9.80/drivers/acpi/acpica/hwacpi.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/drivers/acpi/acpica/hwacpi.c 2018-02-07 15:51:35.126557868 -0500 +@@ -168,12 +168,16 @@ + + status = acpi_read_bit_register(ACPI_BITREG_SCI_ENABLE, &value); + if (ACPI_FAILURE(status)) { ++printk("%s:%d faking ACPI mode\n", __func__, __LINE__); ++ return_UINT32(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_LEGACY); + } + + if (value) { + return_UINT32(ACPI_SYS_MODE_ACPI); + } else { ++//printk("%s:%d faking ACPI mode\n", __func__, __LINE__); ++// return_UINT32(ACPI_SYS_MODE_ACPI); + return_UINT32(ACPI_SYS_MODE_LEGACY); + } + } diff --git a/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0002-nmi-squelch.patch b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0002-nmi-squelch.patch new file mode 100644 index 000000000..bce1cd2f0 --- /dev/null +++ b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0002-nmi-squelch.patch @@ -0,0 +1,20 @@ +diff --recursive -u ./clean/linux-4.9.80/arch/x86/kernel/nmi.c linux-4.9.80/arch/x86/kernel/nmi.c +--- ./clean/linux-4.9.80/arch/x86/kernel/nmi.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/arch/x86/kernel/nmi.c 2018-02-07 18:56:10.475613884 -0500 +@@ -303,6 +303,8 @@ + + __this_cpu_add(nmi_stats.unknown, 1); + ++#if 0 ++// qemu generates these for some reason + pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n", + reason, smp_processor_id()); + +@@ -311,6 +313,7 @@ + nmi_panic(regs, "NMI: Not continuing"); + + pr_emerg("Dazed and confused, but trying to continue\n"); ++#endif + } + NOKPROBE_SYMBOL(unknown_nmi_error); + diff --git a/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0003-fake-trampoline.patch b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0003-fake-trampoline.patch new file mode 100644 index 000000000..e6ec15c9b --- /dev/null +++ b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0003-fake-trampoline.patch @@ -0,0 +1,28 @@ +diff --recursive -u ./clean/linux-4.9.80/arch/x86/realmode/init.c linux-4.9.80/arch/x86/realmode/init.c +--- ./clean/linux-4.9.80/arch/x86/realmode/init.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/arch/x86/realmode/init.c 2018-02-07 15:51:28.538500435 -0500 +@@ -35,8 +35,8 @@ + /* Has to be under 1M so we can execute real-mode AP code. */ + mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE); + if (!mem) { +- pr_info("No sub-1M memory is available for the trampoline\n"); +- return; ++ mem = 0x4000; ++ pr_info("No sub-1M memory is available for the trampoline, guessing %p\n", mem); + } + + memblock_reserve(mem, size); +@@ -138,7 +138,12 @@ + static int __init init_real_mode(void) + { + if (!real_mode_header) +- panic("Real mode trampoline was not allocated"); ++ { ++ // ignore for now ++ //panic("Real mode trampoline was not allocated"); ++ pr_warn("Real mode trampoline was not allocated"); ++ return 0; ++ } + + setup_real_mode(); + set_real_mode_permissions(); diff --git a/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0010-winterfell-ahci.patch b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0010-winterfell-ahci.patch new file mode 100644 index 000000000..9c4df7e28 --- /dev/null +++ b/patches/linux-b87b58e1b057a2706d422fbdc76aa34309c6c90b/0010-winterfell-ahci.patch @@ -0,0 +1,18 @@ +diff --recursive -u ./clean/linux-4.9.80/drivers/ata/libahci.c linux-4.9.80/drivers/ata/libahci.c +--- ./clean/linux-4.9.80/drivers/ata/libahci.c 2018-02-03 11:05:43.000000000 -0500 ++++ linux-4.9.80/drivers/ata/libahci.c 2018-02-07 18:02:32.526535910 -0500 +@@ -537,8 +537,12 @@ + } + + /* fabricate port_map from cap.nr_ports for < AHCI 1.3 */ +- if (!port_map && vers < 0x10300) { +- port_map = (1 << ahci_nr_ports(cap)) - 1; ++ if (!port_map) { // && vers < 0x10300) { ++ printk("%s: saved_port=%02x\n", __func__, hpriv->saved_port_map); ++ writel(0x1, mmio + HOST_PORTS_IMPL); ++ port_map = readl(mmio + HOST_PORTS_IMPL); ++ ++ //port_map = (1 << ahci_nr_ports(cap)) - 1; + dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map); + + /* write the fixed up value to the PI register */ From ce98894d6b12438dfd2a4f0e14840305c32f33b0 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 11:20:08 -0400 Subject: [PATCH 2/9] musl-cross: add 'LDFLAGS=-fuse-linker-plugin"' to support lto ref:http://yuguangzhang.com/blog/enabling-gcc-graphite-and-lto-on-gentoo/ --- modules/musl-cross | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/musl-cross b/modules/musl-cross index 28a1335de..897338d36 100644 --- a/modules/musl-cross +++ b/modules/musl-cross @@ -36,6 +36,7 @@ else musl-cross_configure := \ /bin/echo -e >> config.mak 'GCC_CONFIG += --enable-languages=c,c++,lto' ; \ + /bin/echo -e >> config.mak 'COMMON_CONFIG += LDFLAGS="-fuse-linker-plugin"' ; \ /bin/echo -e >> Makefile 'both:' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=x86_64-linux-musl install' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=i386-linux-musl install' ; \ From 23f0585282cc005c33ae1f5a8c92ff86f3165087 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 12:07:22 -0400 Subject: [PATCH 3/9] linux-lto: fix github download url to be tar.gz, not tar.xz --- modules/linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/linux b/modules/linux index 6cf5c9827..c873597b9 100644 --- a/modules/linux +++ b/modules/linux @@ -15,7 +15,7 @@ linux_kconfig := $(or $(CONFIG_LINUX_CONFIG),config/linux.config) linux_dir := $(linux_base_dir)/$(notdir $(basename $(linux_kconfig))) linux_tar := linux-$(linux_version).tar.xz -linux_url := https://github.com/andikleen/linux-misc/archive/$(linux_version).tar.xz +linux_url := https://github.com/andikleen/linux-misc/archive/$(linux_version).tar.gz #linux_url := https://cdn.kernel.org/pub/linux/kernel/v4.x/$(linux_tar) #linux_url := https://cdn.kernel.org/pub/linux/kernel/v5.x/$(linux_tar) From b77b76718c8dd2980ada5acf8c7e4737b07b75e6 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 14:50:01 -0400 Subject: [PATCH 4/9] linux-x230: remove RETPOLINE --- config/linux-x230.config | 1 + 1 file changed, 1 insertion(+) diff --git a/config/linux-x230.config b/config/linux-x230.config index ef5dc8bb4..b41c3bbf6 100644 --- a/config/linux-x230.config +++ b/config/linux-x230.config @@ -30,6 +30,7 @@ CONFIG_EMBEDDED=y # CONFIG_SLUB_DEBUG is not set # CONFIG_COMPAT_BRK is not set CONFIG_SMP=y +# CONFIG_RETPOLINE is not set # CONFIG_X86_EXTENDED_PLATFORM is not set CONFIG_PROCESSOR_SELECT=y # CONFIG_CPU_SUP_CENTAUR is not set From e49d9b1f8c63ec4126e80d354a4fcc03bdec8533 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 14:52:21 -0400 Subject: [PATCH 5/9] linux module: add LDFLAGS to also pass -flto and -fuse-linker-plugin downstream --- modules/linux | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/linux b/modules/linux index c873597b9..a7e5cb49b 100644 --- a/modules/linux +++ b/modules/linux @@ -117,7 +117,7 @@ linux_modules-$(CONFIG_LINUX_MMC) += drivers/mfd/mfd-core.ko linux_modules-$(CONFIG_LINUX_MMC) += drivers/misc/cardreader/rtsx_pci.ko linux_modules-$(CONFIG_LINUX_MMC) += drivers/mmc/host/rtsx_pci_sdmmc.ko -EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches -flto +EXTRA_FLAGS := -fdebug-prefix-map=$(pwd)=heads -gno-record-gcc-switches -flto -fuse-linker-plugin linux_target := \ O="$(build)/$(linux_dir)" \ @@ -125,6 +125,7 @@ linux_target := \ AFLAGS_KERNEL="$(EXTRA_FLAGS)" \ CFLAGS_KERNEL="$(EXTRA_FLAGS)" \ CFLAGS_MODULE="$(EXTRA_FLAGS)" \ + LDFLAGS="$(EXTRA_FLAGS)" \ KBUILD_BUILD_USER=$(notdir $(linux_kconfig)) \ KBUILD_BUILD_HOST=linuxboot \ KBUILD_BUILD_TIMESTAMP="1970-00-00" \ From 996fa0f000ea5212d916e84cbdde29a46153a057 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 14:53:10 -0400 Subject: [PATCH 6/9] musl-cross module: add --enable-lto to BINUTILS_CONFIG --- modules/musl-cross | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/musl-cross b/modules/musl-cross index 897338d36..51fa878a1 100644 --- a/modules/musl-cross +++ b/modules/musl-cross @@ -37,6 +37,7 @@ else musl-cross_configure := \ /bin/echo -e >> config.mak 'GCC_CONFIG += --enable-languages=c,c++,lto' ; \ /bin/echo -e >> config.mak 'COMMON_CONFIG += LDFLAGS="-fuse-linker-plugin"' ; \ + /bin/echo -e >> config.mak 'BINUTILS_CONFIG += --enable-lto' ; \ /bin/echo -e >> Makefile 'both:' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=x86_64-linux-musl install' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=i386-linux-musl install' ; \ From 8b2ea033ee343b8a2550c81c57bd1e0101b476f1 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 15:03:09 -0400 Subject: [PATCH 7/9] musl-cross module: enable gold linker in configuration --- modules/musl-cross | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/musl-cross b/modules/musl-cross index 51fa878a1..bb0f2c724 100644 --- a/modules/musl-cross +++ b/modules/musl-cross @@ -37,7 +37,7 @@ else musl-cross_configure := \ /bin/echo -e >> config.mak 'GCC_CONFIG += --enable-languages=c,c++,lto' ; \ /bin/echo -e >> config.mak 'COMMON_CONFIG += LDFLAGS="-fuse-linker-plugin"' ; \ - /bin/echo -e >> config.mak 'BINUTILS_CONFIG += --enable-lto' ; \ + /bin/echo -e >> config.mak 'BINUTILS_CONFIG += --enable-gold --enable-lto' ; \ /bin/echo -e >> Makefile 'both:' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=x86_64-linux-musl install' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=i386-linux-musl install' ; \ From 83f8e0475c5b538363c846c397fe5e863361e5ea Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 16:01:49 -0400 Subject: [PATCH 8/9] musl-cross module: pass --enable-gold and --enable-lto as COMMON_CONFIG --- modules/musl-cross | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/musl-cross b/modules/musl-cross index bb0f2c724..6fc5623e7 100644 --- a/modules/musl-cross +++ b/modules/musl-cross @@ -37,7 +37,7 @@ else musl-cross_configure := \ /bin/echo -e >> config.mak 'GCC_CONFIG += --enable-languages=c,c++,lto' ; \ /bin/echo -e >> config.mak 'COMMON_CONFIG += LDFLAGS="-fuse-linker-plugin"' ; \ - /bin/echo -e >> config.mak 'BINUTILS_CONFIG += --enable-gold --enable-lto' ; \ + /bin/echo -e >> config.mak 'COMMON_CONFIG += --enable-gold --enable-lto' ; \ /bin/echo -e >> Makefile 'both:' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=x86_64-linux-musl install' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=i386-linux-musl install' ; \ From 6e99e89737988424c1cc3700b8bb5f5368d186d3 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Thu, 28 May 2020 16:32:25 -0400 Subject: [PATCH 9/9] musl-cross module: Remove LDCONFIG statement per advice:https://github.com/richfelker/musl-cross-make/commit/d2f59c98d6e5d83243e581714094160f9657f3d5#commitcomment-39512163 --- modules/musl-cross | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/musl-cross b/modules/musl-cross index 6fc5623e7..638076dcb 100644 --- a/modules/musl-cross +++ b/modules/musl-cross @@ -36,7 +36,6 @@ else musl-cross_configure := \ /bin/echo -e >> config.mak 'GCC_CONFIG += --enable-languages=c,c++,lto' ; \ - /bin/echo -e >> config.mak 'COMMON_CONFIG += LDFLAGS="-fuse-linker-plugin"' ; \ /bin/echo -e >> config.mak 'COMMON_CONFIG += --enable-gold --enable-lto' ; \ /bin/echo -e >> Makefile 'both:' ; \ /bin/echo -e >> Makefile '\t$$$$(MAKE) TARGET=x86_64-linux-musl install' ; \