stand: userboot: allow building on !x86
We can still get plenty of use out of a userboot that doesn't know anything about how to load or boot a kernel; notably, the test harness in tools/boot can still be used to test lua changes. Hack out the necessary bits to simply build on other platforms, and add a small warning with ample time to view the warning on other platforms. We still won't build userboot by default on these platforms, since the build product isn't useful for most people. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D41529
This commit is contained in:
@@ -13,18 +13,30 @@ SHLIB_NAME= userboot_${LOADER_INTERP}.so
|
||||
STRIP=
|
||||
LIBDIR= /boot
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "amd64"
|
||||
USERBOOT_KERNEL_SUPPORT= yes
|
||||
.else
|
||||
USERBOOT_KERNEL_SUPPORT= no
|
||||
.endif
|
||||
|
||||
.PATH: ${.CURDIR}/../userboot
|
||||
SRCS= autoload.c
|
||||
SRCS+= bcache.c
|
||||
.if ${MACHINE_CPUARCH} == "amd64"
|
||||
SRCS+= biossmap.c
|
||||
.endif
|
||||
.if ${USERBOOT_KERNEL_SUPPORT} == "yes"
|
||||
SRCS+= bootinfo.c
|
||||
SRCS+= bootinfo32.c
|
||||
SRCS+= bootinfo64.c
|
||||
.endif
|
||||
SRCS+= conf.c
|
||||
SRCS+= copy.c
|
||||
SRCS+= devicename.c
|
||||
.if ${USERBOOT_KERNEL_SUPPORT} == "yes"
|
||||
SRCS+= elf32_freebsd.c
|
||||
SRCS+= elf64_freebsd.c
|
||||
.endif
|
||||
SRCS+= host.c
|
||||
SRCS+= main.c
|
||||
SRCS+= userboot_cons.c
|
||||
@@ -49,6 +61,10 @@ VERSION_FILE?= ${.CURDIR}/../userboot/version
|
||||
LINKS+= ${BINDIR}/${SHLIB_NAME} ${BINDIR}/userboot.so
|
||||
.endif
|
||||
|
||||
.if ${USERBOOT_KERNEL_SUPPORT} == "yes"
|
||||
CFLAGS+= -DUSERBOOT_KERNEL_SUPPORT
|
||||
.endif
|
||||
|
||||
.if ${MK_LOADER_ZFS} != "no"
|
||||
CFLAGS+= -DUSERBOOT_ZFS_SUPPORT
|
||||
HAVE_ZFS=yes
|
||||
|
||||
@@ -83,16 +83,20 @@ struct netif_driver *netif_drivers[] = {
|
||||
* Sort formats so that those that can detect based on arguments
|
||||
* rather than reading the file go first.
|
||||
*/
|
||||
#if defined(__amd64__)
|
||||
extern struct file_format i386_elf;
|
||||
extern struct file_format i386_elf_obj;
|
||||
extern struct file_format amd64_elf;
|
||||
extern struct file_format amd64_elf_obj;
|
||||
#endif
|
||||
|
||||
struct file_format *file_formats[] = {
|
||||
#if defined(__amd64__)
|
||||
&i386_elf,
|
||||
&i386_elf_obj,
|
||||
&amd64_elf,
|
||||
&amd64_elf_obj,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -205,6 +205,11 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks)
|
||||
devinit();
|
||||
extract_currdev();
|
||||
|
||||
#if !defined(USERBOOT_KERNEL_SUPPORT)
|
||||
printf("WARNING: This userboot does not support loading a kernel\n");
|
||||
delay(1500000);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Checking the interpreter isn't worth the overhead unless we
|
||||
* actually have the swap_interpreter callback, so we actually version
|
||||
|
||||
Reference in New Issue
Block a user