From 913771f92481d08af76ae1bc3c3613d39456b253 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Tue, 26 Nov 2024 19:16:40 +0300 Subject: [PATCH] import seabios-1.16.3-4.el10 --- .gitignore | 1 + .seabios.metadata | 1 + ...dd-hwerr_printf-function-for-threads.patch | 88 +++++++++++ ...lay-error-message-for-blocksizes-512.patch | 53 +++++++ SOURCES/config.seabios-256k | 4 + SOURCES/config.vga-bochs-display | 3 + SOURCES/config.vga-cirrus | 3 + SOURCES/config.vga-ramfb | 3 + SOURCES/config.vga-stdvga | 3 + SOURCES/config.vga-virtio | 6 + SPECS/seabios.spec | 146 ++++++++++++++++++ 11 files changed, 311 insertions(+) create mode 100644 .gitignore create mode 100644 .seabios.metadata create mode 100644 SOURCES/0001-add-hwerr_printf-function-for-threads.patch create mode 100644 SOURCES/0002-display-error-message-for-blocksizes-512.patch create mode 100644 SOURCES/config.seabios-256k create mode 100644 SOURCES/config.vga-bochs-display create mode 100644 SOURCES/config.vga-cirrus create mode 100644 SOURCES/config.vga-ramfb create mode 100644 SOURCES/config.vga-stdvga create mode 100644 SOURCES/config.vga-virtio create mode 100644 SPECS/seabios.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c827fae --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/seabios-1.16.3.tar.gz diff --git a/.seabios.metadata b/.seabios.metadata new file mode 100644 index 0000000..8393e09 --- /dev/null +++ b/.seabios.metadata @@ -0,0 +1 @@ +391d3e99a670bff295c4b4e8ccc02c87ce908018 SOURCES/seabios-1.16.3.tar.gz diff --git a/SOURCES/0001-add-hwerr_printf-function-for-threads.patch b/SOURCES/0001-add-hwerr_printf-function-for-threads.patch new file mode 100644 index 0000000..4678840 --- /dev/null +++ b/SOURCES/0001-add-hwerr_printf-function-for-threads.patch @@ -0,0 +1,88 @@ +From 81218e2fd9442ce2cbc901b7f6d2b3df3f705bba Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Wed, 3 May 2023 10:31:23 +0200 +Subject: [PATCH] add hwerr_printf function for threads + +RH-Author: Gerd Hoffmann +RH-MergeRequest: 6: log error message to screen when booting with (unsupported) 4k sectors +RH-Jira: RHEL-7110 +RH-Acked-by: Miroslav Rezanina +RH-Commit: [1/2] 37f3d1b45b289e4efb18817c265be2bff2606ebb (kraxel.rh/centos-src-seabios) + +Printing to the screen from threads doesn't work, because that involves +a switch to real mode for using int10h services. + +Add a string buffer and hwerr_printf() helper functions to store error +messages. Print the buffer later, after device initialization, from main +thread in case it is not empty. + +Signed-off-by: Gerd Hoffmann + +Patch-name: seabios-add-hwerr_printf-function-for-threads.patch +Patch-id: 1 +Patch-present-in-specfile: True +--- + src/output.c | 17 +++++++++++++++++ + src/output.h | 5 +++++ + src/post.c | 4 ++++ + 3 files changed, 26 insertions(+) + +diff --git a/src/output.c b/src/output.c +index 0184444c..8c9d6b8f 100644 +--- a/src/output.c ++++ b/src/output.c +@@ -419,6 +419,23 @@ snprintf(char *str, size_t size, const char *fmt, ...) + return end - str; + } + ++char hwerror_str[512]; ++struct snprintfinfo hwerror_info = { ++ .info = { putc_str }, ++ .str = hwerror_str, ++ .end = hwerror_str + sizeof(hwerror_str) - 1, ++}; ++ ++void ++hwerr_printf(const char *fmt, ...) ++{ ++ ASSERT32FLAT(); ++ va_list args; ++ va_start(args, fmt); ++ bvprintf(&hwerror_info.info, fmt, args); ++ va_end(args); ++} ++ + // Build a formatted string - malloc'ing the memory. + char * + znprintf(size_t size, const char *fmt, ...) +diff --git a/src/output.h b/src/output.h +index 14288cf5..4548d2d4 100644 +--- a/src/output.h ++++ b/src/output.h +@@ -16,6 +16,11 @@ char * znprintf(size_t size, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); + void __dprintf(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); ++ ++extern char hwerror_str[512]; ++void hwerr_printf(const char *fmt, ...) ++ __attribute__ ((format (printf, 1, 2))); ++ + struct bregs; + void __debug_enter(struct bregs *regs, const char *fname); + void __debug_isr(const char *fname); +diff --git a/src/post.c b/src/post.c +index f93106a1..3e85da43 100644 +--- a/src/post.c ++++ b/src/post.c +@@ -216,6 +216,10 @@ maininit(void) + device_hardware_setup(); + wait_threads(); + } ++ if (hwerror_str[0]) ++ printf("\n" ++ "hardware setup errors:\n" ++ "%s", hwerror_str); + + // Run option roms + optionrom_setup(); diff --git a/SOURCES/0002-display-error-message-for-blocksizes-512.patch b/SOURCES/0002-display-error-message-for-blocksizes-512.patch new file mode 100644 index 0000000..cd0d666 --- /dev/null +++ b/SOURCES/0002-display-error-message-for-blocksizes-512.patch @@ -0,0 +1,53 @@ +From 39c280452e101edb814989300e2815cee3ea75c4 Mon Sep 17 00:00:00 2001 +From: Gerd Hoffmann +Date: Wed, 3 May 2023 10:36:32 +0200 +Subject: [PATCH] display error message for blocksizes != 512 + +RH-Author: Gerd Hoffmann +RH-MergeRequest: 6: log error message to screen when booting with (unsupported) 4k sectors +RH-Jira: RHEL-7110 +RH-Acked-by: Miroslav Rezanina +RH-Commit: [2/2] f4cdc59a968ed2cb795d0b7c357522423a16f4a2 (kraxel.rh/centos-src-seabios) + +This actually happens in case users try to use 4k sectors with seabios. +Printing the error to the screen instead of only the debug log helps +users to figure why their guest doesn't boot. + +Signed-off-by: Gerd Hoffmann + +Patch-name: seabios-display-error-message-for-blocksizes-512.patch +Patch-id: 2 +Patch-present-in-specfile: True +--- + src/hw/blockcmd.c | 2 +- + src/hw/virtio-blk.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c +index 6b6fea97..ff88680b 100644 +--- a/src/hw/blockcmd.c ++++ b/src/hw/blockcmd.c +@@ -336,7 +336,7 @@ scsi_drive_setup(struct drive_s *drive, const char *s, int prio) + // 64-bit LBA anyway. + drive->blksize = be32_to_cpu(capdata.blksize); + if (drive->blksize != DISK_SECTOR_SIZE) { +- dprintf(1, "%s: unsupported block size %d\n", s, drive->blksize); ++ hwerr_printf("%s: unsupported block size %d\n", s, drive->blksize); + return -1; + } + drive->sectors = (u64)be32_to_cpu(capdata.sectors) + 1; +diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c +index 137a2c3c..1d6f7d4b 100644 +--- a/src/hw/virtio-blk.c ++++ b/src/hw/virtio-blk.c +@@ -193,8 +193,8 @@ init_virtio_blk(void *data) + vdrive->drive.blksize = DISK_SECTOR_SIZE; + } + if (vdrive->drive.blksize != DISK_SECTOR_SIZE) { +- dprintf(1, "virtio-blk %pP block size %d is unsupported\n", +- pci, vdrive->drive.blksize); ++ hwerr_printf("virtio-blk %pP block size %d is unsupported\n", ++ pci, vdrive->drive.blksize); + goto fail; + } + dprintf(3, "virtio-blk %pP blksize=%d sectors=%u size_max=%u " diff --git a/SOURCES/config.seabios-256k b/SOURCES/config.seabios-256k new file mode 100644 index 0000000..d1bcc94 --- /dev/null +++ b/SOURCES/config.seabios-256k @@ -0,0 +1,4 @@ +# for qemu machine types 2.0 + newer +CONFIG_QEMU=y +CONFIG_ROM_SIZE=256 +CONFIG_ATA_DMA=n diff --git a/SOURCES/config.vga-bochs-display b/SOURCES/config.vga-bochs-display new file mode 100644 index 0000000..d2adaae --- /dev/null +++ b/SOURCES/config.vga-bochs-display @@ -0,0 +1,3 @@ +CONFIG_BUILD_VGABIOS=y +CONFIG_DISPLAY_BOCHS=y +CONFIG_VGA_PCI=y diff --git a/SOURCES/config.vga-cirrus b/SOURCES/config.vga-cirrus new file mode 100644 index 0000000..c8fe582 --- /dev/null +++ b/SOURCES/config.vga-cirrus @@ -0,0 +1,3 @@ +CONFIG_BUILD_VGABIOS=y +CONFIG_VGA_CIRRUS=y +CONFIG_VGA_PCI=y diff --git a/SOURCES/config.vga-ramfb b/SOURCES/config.vga-ramfb new file mode 100644 index 0000000..c809c79 --- /dev/null +++ b/SOURCES/config.vga-ramfb @@ -0,0 +1,3 @@ +CONFIG_BUILD_VGABIOS=y +CONFIG_VGA_RAMFB=y +CONFIG_VGA_PCI=n diff --git a/SOURCES/config.vga-stdvga b/SOURCES/config.vga-stdvga new file mode 100644 index 0000000..7d063b7 --- /dev/null +++ b/SOURCES/config.vga-stdvga @@ -0,0 +1,3 @@ +CONFIG_BUILD_VGABIOS=y +CONFIG_VGA_BOCHS=y +CONFIG_VGA_PCI=y diff --git a/SOURCES/config.vga-virtio b/SOURCES/config.vga-virtio new file mode 100644 index 0000000..aa7a15b --- /dev/null +++ b/SOURCES/config.vga-virtio @@ -0,0 +1,6 @@ +CONFIG_BUILD_VGABIOS=y +CONFIG_VGA_BOCHS=y +CONFIG_VGA_PCI=y +CONFIG_OVERRIDE_PCI_ID=y +CONFIG_VGA_VID=0x1af4 +CONFIG_VGA_DID=0x1050 diff --git a/SPECS/seabios.spec b/SPECS/seabios.spec new file mode 100644 index 0000000..9569c91 --- /dev/null +++ b/SPECS/seabios.spec @@ -0,0 +1,146 @@ +Name: seabios +Version: 1.16.3 +Release: 4%{?dist} +Summary: Open-source legacy BIOS implementation + +License: LGPL-3.0-only +URL: https://www.coreboot.org/SeaBIOS + +Source0: https://code.coreboot.org/p/seabios/downloads/get/seabios-1.16.3.tar.gz + + +Source10: config.vga-cirrus +Source13: config.vga-stdvga +Source18: config.seabios-256k +Source19: config.vga-virtio +Source20: config.vga-ramfb +Source21: config.vga-bochs-display + +Patch1: 0001-add-hwerr_printf-function-for-threads.patch +Patch2: 0002-display-error-message-for-blocksizes-512.patch + +BuildRequires: make +BuildRequires: gcc +BuildRequires: python3 iasl + +ExclusiveArch: x86_64 + +Requires: %{name}-bin = %{version}-%{release} +Requires: seavgabios-bin = %{version}-%{release} + +# Seabios is noarch, but required on architectures which cannot build it. +# Disable debuginfo because it is of no use to us. +%global debug_package %{nil} + +# Similarly, tell RPM to not complain about x86 roms being shipped noarch +%global _binaries_in_noarch_packages_terminate_build 0 + +# You can build a debugging version of the BIOS by setting this to a +# value > 1. See src/config.h for possible values, but setting it to +# a number like 99 will enable all possible debugging. Note that +# debugging goes to a special qemu port that you have to enable. See +# the SeaBIOS top-level README file for the magic qemu invocation to +# enable this. +%global debug_level 1 + + +%description +SeaBIOS is an open-source legacy BIOS implementation which can be used as +a coreboot payload. It implements the standard BIOS calling interfaces +that a typical x86 proprietary BIOS implements. + + +%package bin +Summary: Seabios for x86 +Buildarch: noarch + + +%description bin +SeaBIOS is an open-source legacy BIOS implementation which can be used as +a coreboot payload. It implements the standard BIOS calling interfaces +that a typical x86 proprietary BIOS implements. + + +%package -n seavgabios-bin +Summary: Seavgabios for x86 +Buildarch: noarch + +%description -n seavgabios-bin +SeaVGABIOS is an open-source VGABIOS implementation. + + +%prep +%setup -q +%autopatch -p1 + +%build +%define _lto_cflags %{nil} +export CFLAGS="$RPM_OPT_FLAGS" +mkdir binaries + +build_bios() { + make PYTHON=%{__python3} clean distclean + cp $1 .config + echo "CONFIG_TCGBIOS=n" >> .config + echo "CONFIG_DEBUG_LEVEL=%{debug_level}" >> .config + make PYTHON=%{__python3} oldnoconfig V=1 EXTRAVERSION="-%release" + + make V=1 \ + EXTRAVERSION="-%{release}" \ + PYTHON=%{__python3} \ +%if 0%{?cross:1} + HOSTCC=gcc \ + CC=x86_64-linux-gnu-gcc \ + AS=x86_64-linux-gnu-as \ + LD=x86_64-linux-gnu-ld \ + OBJCOPY=x86_64-linux-gnu-objcopy \ + OBJDUMP=x86_64-linux-gnu-objdump \ + STRIP=x86_64-linux-gnu-strip \ +%endif + $4 + + cp out/$2 binaries/$3 +} + +# seabios +build_bios %{_sourcedir}/config.seabios-256k bios.bin bios-256k.bin + + +# seavgabios +%global vgaconfigs cirrus stdvga virtio ramfb bochs-display +for config in %{vgaconfigs}; do + build_bios %{_sourcedir}/config.vga-${config} \ + vgabios.bin vgabios-${config}.bin out/vgabios.bin +done + + +%install +mkdir -p $RPM_BUILD_ROOT%{_datadir}/seabios +mkdir -p $RPM_BUILD_ROOT%{_datadir}/seavgabios +install -m 0644 binaries/bios-256k.bin $RPM_BUILD_ROOT%{_datadir}/seabios/bios-256k.bin +install -m 0644 binaries/vgabios*.bin $RPM_BUILD_ROOT%{_datadir}/seavgabios + + +%files +%doc COPYING COPYING.LESSER README + + +%files bin +%dir %{_datadir}/seabios/ +%{_datadir}/seabios/bios*.bin + +%files -n seavgabios-bin +%dir %{_datadir}/seavgabios/ +%{_datadir}/seavgabios/vgabios*.bin + +%changelog +* Tue Nov 26 2024 MSVSphere Packaging Team - 1.16.3-4 +- Rebuilt for MSVSphere 10 + +* Mon Jun 24 2024 Troy Dawson - 1.16.3-4 +- Bump release for June 2024 mass rebuild + +* Thu Apr 04 2024 Miroslav Rezanina - 1.16.3-3 +- Import package from RHEL 9 +- Resolves: RHEL-31220 + (Update seabios to RHEL structure)