| Disable Multiboot support in boot loader, as it was designed for Xen only. |
| Includes boot-i386-loader-multiboot-deprioritize.diff. |
| |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/sys/boot/common/load_elf.c freebsd-10.3/usr/src/sys/boot/common/load_elf.c |
| --- /var/tmp/freebsd-10.3-src/usr/src/sys/boot/common/load_elf.c 2016-03-25 09:09:27.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/boot/common/load_elf.c 2019-05-15 18:46:30.670084560 +0800 |
| @@ -161,6 +161,9 @@ |
| Elf_Ehdr *ehdr; |
| int err; |
| |
| +#ifndef LOADER_USE_MULTIBOOT |
| + if(multiboot) panic("%s: multiboot requested but LOADER_USE_MULTIBOOT was not set in build time", __func__); |
| +#endif |
| fp = NULL; |
| bzero(&ef, sizeof(struct elf_file)); |
| ef.fd = -1; |
| @@ -210,12 +213,14 @@ |
| ef.kernel = 1; |
| |
| } else if (ehdr->e_type == ET_DYN) { |
| +#ifdef LOADER_USE_MULTIBOOT |
| /* Looks like a kld module */ |
| if (multiboot != 0) { |
| printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module as multiboot\n"); |
| err = EPERM; |
| goto oerr; |
| } |
| +#endif |
| if (kfp == NULL) { |
| printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: can't load module before kernel\n"); |
| err = EPERM; |
| @@ -248,14 +253,20 @@ |
| err = EPERM; |
| goto out; |
| } |
| +#ifdef LOADER_USE_MULTIBOOT |
| if (ef.kernel == 1 && multiboot == 0) |
| +#endif |
| setenv("kernelname", filename, 1); |
| fp->f_name = strdup(filename); |
| +#ifdef LOADER_USE_MULTIBOOT |
| if (multiboot == 0) |
| +#endif |
| fp->f_type = strdup(ef.kernel ? |
| __elfN(kerneltype) : __elfN(moduletype)); |
| +#ifdef LOADER_USE_MULTIBOOT |
| else |
| fp->f_type = strdup("elf multiboot kernel"); |
| +#endif |
| |
| #ifdef ELF_VERBOSE |
| if (ef.kernel) |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/sys/boot/i386/libi386/multiboot.c freebsd-10.3/usr/src/sys/boot/i386/libi386/multiboot.c |
| --- /var/tmp/freebsd-10.3-src/usr/src/sys/boot/i386/libi386/multiboot.c 2016-03-25 09:09:27.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/boot/i386/libi386/multiboot.c 2019-05-15 18:41:48.203156332 +0800 |
| @@ -34,6 +34,8 @@ |
| * http://www.gnu.org/software/grub/manual/multiboot/multiboot.html |
| */ |
| |
| +#ifdef LOADER_USE_MULTIBOOT |
| + |
| #include <sys/cdefs.h> |
| __FBSDID("$FreeBSD: releng/10.3/sys/boot/i386/libi386/multiboot.c 294417 2016-01-20 13:23:02Z royger $"); |
| |
| @@ -423,3 +425,5 @@ |
| |
| return (EFTYPE); |
| } |
| + |
| +#endif |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/sys/boot/i386/libi386/multiboot_tramp.S freebsd-10.3/usr/src/sys/boot/i386/libi386/multiboot_tramp.S |
| --- /var/tmp/freebsd-10.3-src/usr/src/sys/boot/i386/libi386/multiboot_tramp.S 2016-03-25 09:09:27.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/boot/i386/libi386/multiboot_tramp.S 2019-05-15 18:12:21.049222631 +0800 |
| @@ -26,6 +26,8 @@ |
| * $FreeBSD: releng/10.3/sys/boot/i386/libi386/multiboot_tramp.S 294417 2016-01-20 13:23:02Z royger $ |
| */ |
| |
| +#ifdef LOADER_USE_MULTIBOOT |
| + |
| #define ASM_FILE |
| #include "multiboot.h" |
| |
| @@ -49,3 +51,5 @@ |
| movl 4(%esp), %ecx |
| |
| call *%ecx |
| + |
| +#endif |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/tmp/freebsd-10.3-src/usr/src/sys/boot/i386/loader/conf.c freebsd-10.3/usr/src/sys/boot/i386/loader/conf.c |
| --- /var/tmp/freebsd-10.3-src/usr/src/sys/boot/i386/loader/conf.c 2016-03-25 09:09:27.000000000 +0800 |
| +++ freebsd-10.3/usr/src/sys/boot/i386/loader/conf.c 2019-05-15 18:41:37.218103623 +0800 |
| @@ -107,12 +107,12 @@ |
| extern struct file_format i386_elf_obj; |
| extern struct file_format amd64_elf; |
| extern struct file_format amd64_elf_obj; |
| +#ifdef LOADER_USE_MULTIBOOT |
| extern struct file_format multiboot; |
| extern struct file_format multiboot_obj; |
| +#endif |
| |
| struct file_format *file_formats[] = { |
| - &multiboot, |
| - &multiboot_obj, |
| #ifdef LOADER_PREFER_AMD64 |
| &amd64_elf, |
| &amd64_elf_obj, |
| @@ -123,6 +123,10 @@ |
| &amd64_elf, |
| &amd64_elf_obj, |
| #endif |
| +#ifdef LOADER_USE_MULTIBOOT |
| + &multiboot, |
| + &multiboot_obj, |
| +#endif |
| NULL |
| }; |
| |