Index: sys/boot/common/Makefile.inc =================================================================== --- sys/boot/common/Makefile.inc +++ sys/boot/common/Makefile.inc @@ -20,6 +20,8 @@ SRCS+= load_elf64.c reloc_elf64.c .elif ${MACHINE_ARCH} == "mips64" || ${MACHINE_ARCH} == "mips64el" SRCS+= load_elf64.c reloc_elf64.c +.elif ${MACHINE_ARCH} == "mips" || ${MACHINE_ARCH} == "mipsel" +SRCS+= load_elf32.c reloc_elf32.c .endif .if defined(LOADER_NET_SUPPORT) Index: sys/boot/common/dev_net.c =================================================================== --- sys/boot/common/dev_net.c +++ sys/boot/common/dev_net.c @@ -164,8 +164,7 @@ * info from bootp or other sources. */ d = socktodesc(netdev_sock); - sprintf(temp, "%6D", d->myea, ":"); - setenv("boot.netif.hwaddr", temp, 1); + setenv("boot.netif.hwaddr", ether_sprintf(d->myea), 1); setenv("boot.netif.ip", inet_ntoa(myip), 1); setenv("boot.netif.netmask", intoa(netmask), 1); setenv("boot.netif.gateway", inet_ntoa(gateip), 1); Index: sys/boot/common/self_reloc.c =================================================================== --- sys/boot/common/self_reloc.c +++ sys/boot/common/self_reloc.c @@ -36,7 +36,7 @@ #define ElfW_Dyn Elf64_Dyn #define ELFW_R_TYPE ELF64_R_TYPE #define ELF_RELA -#elif defined(__arm__) || defined(__i386__) +#elif defined(__arm__) || defined(__i386__) || defined(__mips__) #define ElfW_Rel Elf32_Rel #define ElfW_Dyn Elf32_Dyn #define ELFW_R_TYPE ELF32_R_TYPE @@ -56,6 +56,9 @@ #elif defined(__arm__) #define RELOC_TYPE_NONE R_ARM_NONE #define RELOC_TYPE_RELATIVE R_ARM_RELATIVE +#elif defined(__mips__) +#define RELOC_TYPE_NONE R_MIPS_NONE +#define RELOC_TYPE_RELATIVE R_MIPS_REL #elif defined(__i386__) #define RELOC_TYPE_NONE R_386_NONE #define RELOC_TYPE_RELATIVE R_386_RELATIVE Index: sys/boot/fdt/fdt_loader_cmd.c =================================================================== --- sys/boot/fdt/fdt_loader_cmd.c +++ sys/boot/fdt/fdt_loader_cmd.c @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -296,8 +297,8 @@ /* If we were given the address of a valid blob in memory, use it. */ if (fdt_to_load != NULL) { if (fdt_load_dtb_addr(fdt_to_load) == 0) { - printf("Using DTB from memory address 0x%08X.\n", - (unsigned int)fdt_to_load); + printf("Using DTB from memory address 0x%" PRIxPTR + ".\n", (uintptr_t)fdt_to_load); return (0); } } @@ -427,6 +428,7 @@ } } +#ifdef notyet static int fdt_reg_valid(uint32_t *reg, int len, int addr_cells, int size_cells) { @@ -458,6 +460,7 @@ } return (0); } +#endif void fdt_fixup_memory(struct fdt_mem_region *region, size_t num) Index: sys/boot/uboot/common/main.c =================================================================== --- sys/boot/uboot/common/main.c +++ sys/boot/uboot/common/main.c @@ -30,6 +30,8 @@ __FBSDID("$FreeBSD$"); #include +#include + #include #include "api_public.h" @@ -132,7 +134,7 @@ for (i = 0; i < 3; i++) { size = memsize(si, t[i]); if (size > 0) - printf("%s: %lldMB\n", ub_mem_type(t[i]), + printf("%s: %" PRIu64 "MB\n", ub_mem_type(t[i]), size / 1024 / 1024); } } @@ -426,7 +428,7 @@ * Set up console. */ cons_probe(); - printf("Compatible U-Boot API signature found @%x\n", (uint32_t)sig); + printf("Compatible U-Boot API signature found @%" PRIxPTR "\n", sig); printf("\n"); printf("%s, Revision %s\n", bootprog_name, bootprog_rev); @@ -511,7 +513,7 @@ command_heap(int argc, char *argv[]) { - printf("heap base at %p, top at %p, used %d\n", end, sbrk(0), + printf("heap base at %p, top at %p, used %" PRIuPTR "\n", end, sbrk(0), sbrk(0) - end); return (CMD_OK); Index: sys/boot/uboot/lib/disk.c =================================================================== --- sys/boot/uboot/lib/disk.c +++ sys/boot/uboot/lib/disk.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "api_public.h" @@ -156,7 +157,8 @@ } if (size % SI(dev).bsize) { - stor_printf("size=%d not multiple of device block size=%d\n", + stor_printf("size=%" PRIuPTR " not multiple of device " + "block size=%d\n", size, SI(dev).bsize); return (EIO); } Index: sys/boot/uboot/lib/elf_freebsd.c =================================================================== --- sys/boot/uboot/lib/elf_freebsd.c +++ sys/boot/uboot/lib/elf_freebsd.c @@ -31,10 +31,15 @@ #include #include +#ifdef __mips +#include +#include +#endif #include #include #include +#include #include #include "bootstrap.h" @@ -81,7 +86,7 @@ return (error); entry = (void *)e->e_entry; - printf("Kernel entry at 0x%x...\n", (unsigned)entry); + printf("Kernel entry at 0x%" PRIxPTR "...\n", (uintptr_t)entry); dev_cleanup(); printf("Kernel args: %s\n", fp->f_args); Index: sys/boot/uboot/lib/glue.c =================================================================== --- sys/boot/uboot/lib/glue.c +++ sys/boot/uboot/lib/glue.c @@ -83,8 +83,13 @@ if (uboot_address == 0) uboot_address = 255 * 1024 * 1024; +#ifdef __mips__ + sp = (void *)(uboot_address & ~0x0000ffff); + spend = sp + 0x00010000 - API_SIG_MAGLEN; +#else sp = (void *)(uboot_address & ~0x000fffff); spend = sp + 0x00300000 - API_SIG_MAGLEN; +#endif while (sp < spend) { if (!bcmp(sp, API_SIG_MAGIC, API_SIG_MAGLEN)) { *sig = (struct api_signature *)sp; @@ -109,7 +114,7 @@ { int c; - if (!syscall(API_GETC, NULL, (uint32_t)&c)) + if (!syscall(API_GETC, NULL, &c)) return (-1); return (c); @@ -120,24 +125,24 @@ { int t; - if (!syscall(API_TSTC, NULL, (uint32_t)&t)) + if (!syscall(API_TSTC, NULL, &t)) return (-1); return (t); } void -ub_putc(char c) +ub_putc(const char c) { - syscall(API_PUTC, NULL, (uint32_t)&c); + syscall(API_PUTC, NULL, &c); } void ub_puts(const char *s) { - syscall(API_PUTS, NULL, (uint32_t)s); + syscall(API_PUTS, NULL, s); } /**************************************** @@ -166,7 +171,7 @@ si.mr_no = UB_MAX_MR; memset(&mr, 0, sizeof(mr)); - if (!syscall(API_GET_SYS_INFO, &err, (u_int32_t)&si)) + if (!syscall(API_GET_SYS_INFO, &err, &si)) return (NULL); return ((err) ? NULL : &si); @@ -433,7 +438,7 @@ int i; printf("device info (%d):\n", handle); - printf(" cookie\t= 0x%08x\n", (uint32_t)di->cookie); + printf(" cookie\t= 0x%08lx\n", (unsigned long)di->cookie); printf(" type\t\t= 0x%08x\n", di->type); if (di->type == DEV_TYP_NET) { @@ -483,7 +488,7 @@ { char *value; - if (!syscall(API_ENV_GET, NULL, (uint32_t)name, (uint32_t)&value)) + if (!syscall(API_ENV_GET, NULL, name, &value)) return (NULL); return (value); @@ -493,7 +498,7 @@ ub_env_set(const char *name, char *value) { - syscall(API_ENV_SET, NULL, (uint32_t)name, (uint32_t)value); + syscall(API_ENV_SET, NULL, name, value); } static char env_name[256]; @@ -510,7 +515,7 @@ * internally, which handles such case */ env = NULL; - if (!syscall(API_ENV_ENUM, NULL, (uint32_t)last, (uint32_t)&env)) + if (!syscall(API_ENV_ENUM, NULL, last, &env)) return (NULL); if (env == NULL || last == env)