From 745c5c702fbda516ce2ffc4ea5fab4733a300b08 Mon Sep 17 00:00:00 2001 From: raj Date: Tue, 14 Oct 2008 10:11:14 +0000 Subject: Initial support of loader(8) for ARM machines running U-Boot. This uses the common U-Boot support lib (sys/boot/uboot, already used on FreeBSD/powerpc), and assumes the underlying firmware has the modern API for stand-alone apps enabled in the config (CONFIG_API). Only netbooting is supported at the moment. Obtained from: Marvell, Semihalf --- sys/boot/common/Makefile.inc | 2 +- sys/boot/common/load_elf.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'sys/boot/common') diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc index 753d112..9ede386 100644 --- a/sys/boot/common/Makefile.inc +++ b/sys/boot/common/Makefile.inc @@ -9,7 +9,7 @@ SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c .elif ${MACHINE} == "pc98" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c -.elif ${MACHINE_ARCH} == "powerpc" +.elif ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm" SRCS+= load_elf32.c reloc_elf32.c .elif ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "ia64" SRCS+= load_elf64.c reloc_elf64.c diff --git a/sys/boot/common/load_elf.c b/sys/boot/common/load_elf.c index eabc426..35b3f0b 100644 --- a/sys/boot/common/load_elf.c +++ b/sys/boot/common/load_elf.c @@ -289,7 +289,16 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, u_int64_t off) #ifdef ELF_VERBOSE printf("Converted entry 0x%08x\n", ehdr->e_entry); #endif - } else + } else + off = 0; +#elif defined(__arm__) + if (off & 0xf0000000u) { + off = -(off & 0xf0000000u); + ehdr->e_entry += off; +#ifdef ELF_VERBOSE + printf("Converted entry 0x%08x\n", ehdr->e_entry); +#endif + } else off = 0; #else off = 0; /* other archs use direct mapped kernels */ -- cgit v1.1