Index: sys/boot/efi/Makefile =================================================================== --- sys/boot/efi/Makefile +++ sys/boot/efi/Makefile @@ -14,7 +14,8 @@ .if ${MACHINE_CPUARCH} == "aarch64" || \ ${MACHINE_CPUARCH} == "amd64" || \ - ${MACHINE_CPUARCH} == "arm" + ${MACHINE_CPUARCH} == "arm" || \ + ${MACHINE_CPUARCH} == "i386" SUBDIR+= libefi loader boot1 .endif Index: sys/boot/efi/loader/arch/i386/efimd.c =================================================================== --- sys/boot/efi/loader/arch/i386/efimd.c +++ sys/boot/efi/loader/arch/i386/efimd.c @@ -48,7 +48,10 @@ static UINTN mapkey; -uint64_t +int ldr_bootinfo(struct bootinfo *, uint64_t *); +int ldr_enter(const char *); + +static uint64_t ldr_alloc(vm_offset_t va) { Index: sys/boot/efi/loader/arch/i386/elf32_freebsd.c =================================================================== --- sys/boot/efi/loader/arch/i386/elf32_freebsd.c +++ sys/boot/efi/loader/arch/i386/elf32_freebsd.c @@ -35,12 +35,16 @@ #include #include +#include +#include + #include "bootstrap.h" #include "../libi386/libi386.h" #include "../btx/lib/btxv86.h" extern void __exec(caddr_t addr, ...); - +extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); +extern int ldr_enter(const char *kernel); static int elf32_exec(struct preloaded_file *amp); static int elf32_obj_exec(struct preloaded_file *amp); @@ -72,14 +76,14 @@ ehdr = (Elf_Ehdr *)&(md->md_data); efi_time_fini(); - err = bi_load(fp->f_args, &boothowto, &bootdev, &bootinfop, &modulep, &kernend); + err = bi_load(fp->f_args, &modulep, &kernend); if (err != 0) { efi_time_init(); return(err); } entry = ehdr->e_entry & 0xffffff; - printf("Start @ 0x%lx ...\n", entry); + printf("Start @ 0x%x ...\n", entry); ldr_enter(fp->f_name); Index: sys/boot/efi/loader/arch/i386/exec.c =================================================================== --- sys/boot/efi/loader/arch/i386/exec.c +++ sys/boot/efi/loader/arch/i386/exec.c @@ -36,6 +36,12 @@ uint32_t __base; struct __v86 __v86; +/* XXX - Needed a definition here to implicitly define exit(); do not remove. */ +static void +exit(int x) +{ +} + void __v86int() { Index: sys/boot/ficl/Makefile =================================================================== --- sys/boot/ficl/Makefile +++ sys/boot/ficl/Makefile @@ -41,6 +41,10 @@ # Optional OO extension softwords #SOFTWORDS+= oo.fr classes.fr +.if ${MACHINE_CPUARCH} == "i386" +CFLAGS+= -DEFI +.endif + .if ${MACHINE_CPUARCH} == "amd64" .if defined(FICL32) CFLAGS+= -m32 -I. Index: sys/boot/ficl/loader.c =================================================================== --- sys/boot/ficl/loader.c +++ sys/boot/ficl/loader.c @@ -800,7 +800,7 @@ } -#ifdef __i386__ +#if (defined(__i386__) && !defined(EFI)) /* * pcibios-device-count (devid -- count) * @@ -1004,7 +1004,7 @@ dictAppendWord(dp, "pnphandlers",ficlPnphandlers, FW_DEFAULT); #endif #endif -#ifdef __i386__ +#if (defined(__i386__) && !defined(EFI)) dictAppendWord(dp, "pcibios-device-count", ficlPciBiosCountDevices, FW_DEFAULT); dictAppendWord(dp, "pcibios-read-config", ficlPciBiosReadConfig, FW_DEFAULT); dictAppendWord(dp, "pcibios-write-config", ficlPciBiosWriteConfig, FW_DEFAULT); Index: targets/pseudo/userland/misc/Makefile.depend =================================================================== --- targets/pseudo/userland/misc/Makefile.depend +++ targets/pseudo/userland/misc/Makefile.depend @@ -77,7 +77,7 @@ DIRDEPS.arm= ${_sys_boot_fdt} ${_sys_boot_efi} DIRDEPS.arm64= ${_sys_boot_fdt} ${_sys_boot_efi} -DIRDEPS.i386= ${DIRDEPS.x86sys} sys/boot/efi/libefi +DIRDEPS.i386= ${DIRDEPS.x86sys} ${_sys_boot_efi} DIRDEPS.powerpc= ${_sys_boot_fdt} sys/boot/libstand32 sys/boot/ofw sys/boot/uboot DIRDEPS.pc98= sys/boot/libstand32 DIRDEPS.sparc64= sys/boot/ofw ${_sys_boot_zfs}