diff --git a/config/coreboot-librem_13v2.config b/config/coreboot-librem_13v2.config index 53fd4686..512cd704 100644 --- a/config/coreboot-librem_13v2.config +++ b/config/coreboot-librem_13v2.config @@ -6,8 +6,9 @@ CONFIG_BOARD_PURISM_LIBREM13_V2=y CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS=y CONFIG_CPU_UCODE_BINARIES="3rdparty/purism-blobs/mainboard/purism/librem_skl/cpu_microcode_blob.bin" CONFIG_HAVE_ME_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_TPM_MEASURED_BOOT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" -CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2" +CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" diff --git a/config/coreboot-librem_13v4.config b/config/coreboot-librem_13v4.config index 4988622d..ef583ca9 100644 --- a/config/coreboot-librem_13v4.config +++ b/config/coreboot-librem_13v4.config @@ -6,8 +6,9 @@ CONFIG_BOARD_PURISM_LIBREM13_V4=y CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS=y CONFIG_CPU_UCODE_BINARIES="3rdparty/purism-blobs/mainboard/purism/librem_kbl/cpu_microcode_blob.bin" CONFIG_HAVE_ME_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_TPM_MEASURED_BOOT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" -CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2" +CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" diff --git a/config/coreboot-librem_14.config b/config/coreboot-librem_14.config index c98c0c31..871a9afd 100644 --- a/config/coreboot-librem_14.config +++ b/config/coreboot-librem_14.config @@ -6,8 +6,9 @@ CONFIG_BOARD_PURISM_LIBREM_14=y CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS=y CONFIG_CPU_UCODE_BINARIES="3rdparty/purism-blobs/mainboard/purism/librem_cnl/cpu_microcode_blob.bin" CONFIG_HAVE_ME_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_TPM_MEASURED_BOOT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" -CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet loglevel=2" +CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" diff --git a/config/coreboot-librem_15v3.config b/config/coreboot-librem_15v3.config index 2c6014cf..f9e088f6 100644 --- a/config/coreboot-librem_15v3.config +++ b/config/coreboot-librem_15v3.config @@ -6,8 +6,9 @@ CONFIG_BOARD_PURISM_LIBREM15_V3=y CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS=y CONFIG_CPU_UCODE_BINARIES="3rdparty/purism-blobs/mainboard/purism/librem_skl/cpu_microcode_blob.bin" CONFIG_HAVE_ME_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_TPM_MEASURED_BOOT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" -CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2" +CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" diff --git a/config/coreboot-librem_15v4.config b/config/coreboot-librem_15v4.config index f58758c2..26ab7cfd 100644 --- a/config/coreboot-librem_15v4.config +++ b/config/coreboot-librem_15v4.config @@ -6,8 +6,9 @@ CONFIG_BOARD_PURISM_LIBREM15_V4=y CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS=y CONFIG_CPU_UCODE_BINARIES="3rdparty/purism-blobs/mainboard/purism/librem_kbl/cpu_microcode_blob.bin" CONFIG_HAVE_ME_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_TPM_MEASURED_BOOT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" -CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 video=eDP-1:1920x1080" +CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 video=eDP-1:1920x1080 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" diff --git a/config/coreboot-librem_mini.config b/config/coreboot-librem_mini.config index 548d0852..71b2b7dc 100644 --- a/config/coreboot-librem_mini.config +++ b/config/coreboot-librem_mini.config @@ -8,7 +8,8 @@ CONFIG_BOARD_PURISM_LIBREM_MINI=y CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS=y CONFIG_CPU_UCODE_BINARIES="3rdparty/purism-blobs/mainboard/purism/librem_cnl/cpu_microcode_blob.bin" CONFIG_HAVE_ME_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" -CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet loglevel=2" +CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" diff --git a/config/coreboot-librem_mini_v2.config b/config/coreboot-librem_mini_v2.config index f48386f8..84985169 100644 --- a/config/coreboot-librem_mini_v2.config +++ b/config/coreboot-librem_mini_v2.config @@ -7,7 +7,8 @@ CONFIG_BOARD_PURISM_LIBREM_MINI_V2=y CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS=y CONFIG_CPU_UCODE_BINARIES="3rdparty/purism-blobs/mainboard/purism/librem_cnl/cpu_microcode_blob.bin" CONFIG_HAVE_ME_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" -CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet loglevel=2" +CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" diff --git a/config/coreboot-t440p.config b/config/coreboot-t440p.config index 128125a0..c70c0e6a 100644 --- a/config/coreboot-t440p.config +++ b/config/coreboot-t440p.config @@ -7,12 +7,13 @@ CONFIG_ME_BIN_PATH="@BLOB_DIR@/t440p/me.bin" CONFIG_GBE_BIN_PATH="@BLOB_DIR@/t440p/gbe.bin" CONFIG_HAVE_IFD_BIN=y CONFIG_BOARD_LENOVO_THINKPAD_T440P=y -CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off" +CONFIG_LINUX_COMMAND_LINE="intel_iommu=igfx_off drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0" CONFIG_TPM_MEASURED_BOOT=y CONFIG_HAVE_MRC=y CONFIG_MRC_FILE="@BLOB_DIR@/haswell/mrc.bin" CONFIG_HAVE_ME_BIN=y CONFIG_HAVE_GBE_BIN=y +CONFIG_NO_GFX_INIT=y CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" diff --git a/config/linux-librem_common.config b/config/linux-librem_common.config index 00814567..d0030062 100644 --- a/config/linux-librem_common.config +++ b/config/linux-librem_common.config @@ -200,6 +200,7 @@ CONFIG_I2C_SLAVE=y # CONFIG_X86_PKG_TEMP_THERMAL is not set CONFIG_MFD_SYSCON=y CONFIG_DRM=y +CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM=y CONFIG_DRM_I915=y CONFIG_DRM_AST=y CONFIG_FB_VESA=y diff --git a/config/linux-t440p.config b/config/linux-t440p.config index 3aa08a2c..deea2c75 100644 --- a/config/linux-t440p.config +++ b/config/linux-t440p.config @@ -199,6 +199,7 @@ CONFIG_I2C_SLAVE=y # CONFIG_X86_PKG_TEMP_THERMAL is not set CONFIG_MFD_SYSCON=y CONFIG_DRM=y +CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM=y CONFIG_DRM_I915=y CONFIG_DRM_AST=y CONFIG_FB_VESA=y diff --git a/modules/kexec b/modules/kexec index 52fa0d4a..51532562 100644 --- a/modules/kexec +++ b/modules/kexec @@ -1,10 +1,10 @@ modules-$(CONFIG_KEXEC) += kexec -kexec_version := 2.0.22 +kexec_version := 2.0.26 kexec_dir := kexec-tools-$(kexec_version) kexec_tar := kexec-tools-$(kexec_version).tar.gz kexec_url := https://kernel.org/pub/linux/utils/kernel/kexec/$(kexec_tar) -kexec_hash := 40623d4321be2865ef9ea2cd6ec998d31dcf93d0f74353cbd3aa06d8821e3e41 +kexec_hash := 89bdd941542c64fec16311858df304ed3a3908c1a60874d69df5d9bf1611e062 kexec_configure := \ CFLAGS="-g -Os -fno-strict-aliasing -Wall -Wstrict-prototypes" \ diff --git a/patches/kexec-2.0.22.patch b/patches/kexec-2.0.22.patch deleted file mode 100644 index c16cda1b..00000000 --- a/patches/kexec-2.0.22.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff --git a/Makefile.in b/Makefile.in -index fb01134..bf1973e 100644 ---- a/Makefile.in -+++ b/Makefile.in -@@ -157,12 +157,12 @@ include $(srcdir)/kexec/Makefile - - # vmcore-dmesg (read dmesg from a vmcore) - # --include $(srcdir)/vmcore-dmesg/Makefile -+#include $(srcdir)/vmcore-dmesg/Makefile - - # - # kexec_test (test program) - # --include $(srcdir)/kexec_test/Makefile -+#include $(srcdir)/kexec_test/Makefile - - SPEC=$(PACKAGE_NAME).spec - GENERATED_SRCS:= $(SPEC) -diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c -index 057ee14..43e017a 100644 ---- a/kexec/arch/i386/x86-linux-setup.c -+++ b/kexec/arch/i386/x86-linux-setup.c -@@ -137,7 +137,8 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) - goto out; - if (-1 == ioctl(fd, FBIOGET_VSCREENINFO, &var)) - goto out; -- if (0 == strcmp(fix.id, "VESA VGA")) { -+ if (0 == strcmp(fix.id, "VESA VGA") -+ || 0 == strcmp(fix.id, "inteldrmfb")) { - /* VIDEO_TYPE_VLFB */ - real_mode->orig_video_isVGA = 0x23; - } else if (0 == strcmp(fix.id, "EFI VGA")) { -diff --git a/kexec/kexec.c b/kexec/kexec.c -index bc6ab3d..b82725b 100644 ---- a/kexec/kexec.c -+++ b/kexec/kexec.c -@@ -805,6 +805,27 @@ static int my_load(const char *type, int fileind, int argc, char **argv, - if (sort_segments(&info) < 0) { - return -1; - } -+ -+#if 1 -+ // force segment 0 to have memsz == bufsz -+ // so that it won't overwrite EBDA -+ if (info.segment[0].mem == 0) -+ { -+ if (kexec_debug) -+ printf("hack ebda into segment 0!\n"); -+ -+ uint8_t * ebda = calloc(1, info.segment[0].memsz); -+ memcpy(ebda, info.segment[0].buf, info.segment[0].bufsz); -+ info.segment[0].bufsz = info.segment[0].memsz; -+ info.segment[0].buf = ebda; -+ -+ // install some default EBDA values that are off scale, -+ // which will force Xen to use the multiboot info -+ *(uint16_t*)(ebda + 0x40e) = 0xFFFF; // segment -+ *(uint16_t*)(ebda + 0x413) = 0xFFFF; // size -+ } -+#endif -+ - /* if purgatory is loaded update it */ - update_purgatory(&info); - if (entry) -diff --git a/purgatory/Makefile b/purgatory/Makefile -index 2dd6c47..2de8f07 100644 ---- a/purgatory/Makefile -+++ b/purgatory/Makefile -@@ -44,7 +44,6 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c - mkdir -p $(@D) - $(COMPILE.c) -o $@ $^ - --$(PURGATORY): CC=$(TARGET_CC) - $(PURGATORY): CFLAGS=$(PURGATORY_EXTRA_CFLAGS) \ - $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ - -Os -fno-builtin -ffreestanding \ -diff --git a/util/Makefile b/util/Makefile -index 948ee63..833a897 100644 ---- a/util/Makefile -+++ b/util/Makefile -@@ -2,7 +2,7 @@ BIN_TO_HEX:= bin/bin-to-hex - - $(BIN_TO_HEX): $(srcdir)/util/bin-to-hex.c - @$(MKDIR) -p $(@D) -- $(LINK.o) $(CFLAGS) -o $@ $^ -+ $(BUILD_CC) $(BUILD_CFLAGS) -o $@ $^ - - $(BIN_TO_HEX): CC=$(BUILD_CC) - $(BIN_TO_HEX): CFLAGS=$(BUILD_CFLAGS) diff --git a/patches/kexec-2.0.26.patch b/patches/kexec-2.0.26.patch new file mode 100644 index 00000000..71c84aba --- /dev/null +++ b/patches/kexec-2.0.26.patch @@ -0,0 +1,161 @@ +diff --git a/Makefile.in b/Makefile.in +index 09bbd5c..500ad35 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -167,12 +167,12 @@ include $(srcdir)/kexec/Makefile + + # vmcore-dmesg (read dmesg from a vmcore) + # +-include $(srcdir)/vmcore-dmesg/Makefile ++#include $(srcdir)/vmcore-dmesg/Makefile + + # + # kexec_test (test program) + # +-include $(srcdir)/kexec_test/Makefile ++#include $(srcdir)/kexec_test/Makefile + + SPEC=$(PACKAGE_NAME).spec + GENERATED_SRCS:= $(SPEC) +diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c +index 14263b0..55291d6 100644 +--- a/kexec/arch/i386/x86-linux-setup.c ++++ b/kexec/arch/i386/x86-linux-setup.c +@@ -138,31 +138,76 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode) + if (-1 == fd) + return -1; + +- if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, &fix)) ++ if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, &fix)) { ++ dbgprintf("%s: FBIOGET_FSCREENINFO failed, can't provide framebuffer\n", ++ __func__); + goto out; +- if (-1 == ioctl(fd, FBIOGET_VSCREENINFO, &var)) ++ } ++ if (-1 == ioctl(fd, FBIOGET_VSCREENINFO, &var)) { ++ dbgprintf("%s: FBIOGET_FSCREENINFO failed, can't provide framebuffer\n", ++ __func__); + goto out; +- if (0 == strcmp(fix.id, "VESA VGA")) { ++ } ++ /* ++ * If we can get a framebuffer from the host kernel, provide it to the ++ * target kernel. This does not work for all drivers - we have to be ++ * able to get the framebuffer address, and the framebuffer must be a ++ * plain flat framebuffer. This should work for VESA framebuffers ++ * since that is the only type of framebuffer it creates. ++ * ++ * Since Linux 4.20, getting the framebuffer address requires ++ * CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM and ++ * drm_kms_helper.drm_leak_fbdev_smem=1 on the command line. ++ * ++ * Since Linux 5.8, i915 often uses a compressed framebuffer, this must ++ * be disabled with i915.enable_fbc=0 on the kernel command line. ++ * ++ * This does not work with ast ("astdrmfb") currently as it uses a ++ * shadow buffer internally in the kernel, and there is no way to get ++ * the real framebuffer address. ++ */ ++ if (0 == strcmp(fix.id, "VESA VGA") ++ || 0 == strcmp(fix.id, "inteldrmfb") ++ || 0 == strcmp(fix.id, "i915drmfb")) { + /* VIDEO_TYPE_VLFB */ + real_mode->orig_video_isVGA = 0x23; ++ dbgprintf("%s: Found driver %s, providing VIDEO_TYPE_VLFB\n", ++ __func__, fix.id); + } else if (0 == strcmp(fix.id, "EFI VGA")) { + /* VIDEO_TYPE_EFI */ + real_mode->orig_video_isVGA = 0x70; ++ dbgprintf("%s: Found driver %s, providing VIDEO_TYPE_EFI\n", ++ __func__, fix.id); + } else if (arch_options.reuse_video_type) { + int err; + off_t offset = offsetof(typeof(*real_mode), orig_video_isVGA); + + /* blindly try old boot time video type */ + err = get_bootparam(&real_mode->orig_video_isVGA, offset, 1); +- if (err) ++ if (err) { ++ dbgprintf("%s: Can't get booted video type, can't provide framebuffer\n", ++ __func__); + goto out; ++ } ++ dbgprintf("%s: Reusing video type %d\n", ++ __func__, real_mode->orig_video_isVGA); + } else { ++ dbgprintf("%s: Unknown driver %s, can't provide framebuffer\n", ++ __func__, fix.id); + real_mode->orig_video_isVGA = 0; + close(fd); + return 0; + } + close(fd); + ++ if (!fix.smem_start) { ++ dbgprintf("%s: Kernel did not provide framebuffer address\n", ++ __func__); ++ dbgprintf("%s: Try enabling CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM and " ++ "drm_kms_helper.drm_leak_fbdev_smem\n", ++ __func__); ++ } ++ + real_mode->lfb_width = var.xres; + real_mode->lfb_height = var.yres; + real_mode->lfb_depth = var.bits_per_pixel; +diff --git a/kexec/kexec.c b/kexec/kexec.c +index 0e92d96..f7984a8 100644 +--- a/kexec/kexec.c ++++ b/kexec/kexec.c +@@ -807,6 +807,27 @@ static int my_load(const char *type, int fileind, int argc, char **argv, + if (sort_segments(&info) < 0) { + return -1; + } ++ ++#if 1 ++ // force segment 0 to have memsz == bufsz ++ // so that it won't overwrite EBDA ++ if (info.segment[0].mem == 0) ++ { ++ if (kexec_debug) ++ printf("hack ebda into segment 0!\n"); ++ ++ uint8_t * ebda = calloc(1, info.segment[0].memsz); ++ memcpy(ebda, info.segment[0].buf, info.segment[0].bufsz); ++ info.segment[0].bufsz = info.segment[0].memsz; ++ info.segment[0].buf = ebda; ++ ++ // install some default EBDA values that are off scale, ++ // which will force Xen to use the multiboot info ++ *(uint16_t*)(ebda + 0x40e) = 0xFFFF; // segment ++ *(uint16_t*)(ebda + 0x413) = 0xFFFF; // size ++ } ++#endif ++ + /* if purgatory is loaded update it */ + update_purgatory(&info); + if (entry) +diff --git a/purgatory/Makefile b/purgatory/Makefile +index 4d2d071..ee5c642 100644 +--- a/purgatory/Makefile ++++ b/purgatory/Makefile +@@ -45,7 +45,6 @@ purgatory/sha256.o: $(srcdir)/util_lib/sha256.c + mkdir -p $(@D) + $(COMPILE.c) -o $@ $^ + +-$(PURGATORY): CC=$(TARGET_CC) + $(PURGATORY): CFLAGS=$(PURGATORY_EXTRA_CFLAGS) \ + $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ + -Os -fno-builtin -ffreestanding \ +diff --git a/util/Makefile b/util/Makefile +index 948ee63..833a897 100644 +--- a/util/Makefile ++++ b/util/Makefile +@@ -2,7 +2,7 @@ BIN_TO_HEX:= bin/bin-to-hex + + $(BIN_TO_HEX): $(srcdir)/util/bin-to-hex.c + @$(MKDIR) -p $(@D) +- $(LINK.o) $(CFLAGS) -o $@ $^ ++ $(BUILD_CC) $(BUILD_CFLAGS) -o $@ $^ + + $(BIN_TO_HEX): CC=$(BUILD_CC) + $(BIN_TO_HEX): CFLAGS=$(BUILD_CFLAGS)