| 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/archive3/public/freebsd-releng-10.4-src/sys/boot/common/load_elf.c freebsd-10.4/sys/boot/common/load_elf.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/boot/common/load_elf.c 2017-09-29 08:20:01.000000000 +0800 |
| +++ freebsd-10.4/sys/boot/common/load_elf.c 2019-08-17 22:11:53.101679679 +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/archive3/public/freebsd-releng-10.4-src/sys/boot/i386/libi386/multiboot.c freebsd-10.4/sys/boot/i386/libi386/multiboot.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/boot/i386/libi386/multiboot.c 2017-09-29 08:20:01.000000000 +0800 |
| +++ freebsd-10.4/sys/boot/i386/libi386/multiboot.c 2019-08-17 22:11:53.109673460 +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.4/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/archive3/public/freebsd-releng-10.4-src/sys/boot/i386/libi386/multiboot_tramp.S freebsd-10.4/sys/boot/i386/libi386/multiboot_tramp.S |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/boot/i386/libi386/multiboot_tramp.S 2017-09-29 08:20:01.000000000 +0800 |
| +++ freebsd-10.4/sys/boot/i386/libi386/multiboot_tramp.S 2019-08-17 22:11:53.110679188 +0800 |
| @@ -26,6 +26,8 @@ |
| * $FreeBSD: releng/10.4/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/archive3/public/freebsd-releng-10.4-src/sys/boot/i386/loader/conf.c freebsd-10.4/sys/boot/i386/loader/conf.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/boot/i386/loader/conf.c 2017-09-29 08:20:01.000000000 +0800 |
| +++ freebsd-10.4/sys/boot/i386/loader/conf.c 2019-08-17 22:11:53.110679188 +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 |
| }; |
| |