Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148449613
D5512.id14200.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
19 KB
Referenced Files
None
Subscribers
None
D5512.id14200.diff
View Options
Index: sys/boot/Makefile.arm64
===================================================================
--- sys/boot/Makefile.arm64
+++ sys/boot/Makefile.arm64
@@ -4,4 +4,4 @@
SUBDIR+= fdt
.endif
-SUBDIR+= efi
+SUBDIR+= efi uboot
Index: sys/boot/arm64/Makefile
===================================================================
--- sys/boot/arm64/Makefile
+++ sys/boot/arm64/Makefile
@@ -1,3 +1,5 @@
# $FreeBSD$
+SUBDIR= uboot
+
.include <bsd.subdir.mk>
Index: sys/boot/arm64/Makefile.inc
===================================================================
--- sys/boot/arm64/Makefile.inc
+++ sys/boot/arm64/Makefile.inc
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"
Index: sys/boot/arm64/uboot/Makefile
===================================================================
--- sys/boot/arm64/uboot/Makefile
+++ sys/boot/arm64/uboot/Makefile
@@ -0,0 +1,154 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+FILES= ubldr ubldr.bin
+
+NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH}
+BINDIR?= /boot
+INSTALLFLAGS= -b
+WARNS?= 1
+# Address at which ubldr will be loaded.
+# This varies for different boards and SOCs.
+UBLDR_LOADADDR?= 0x1000000
+
+# Architecture-specific loader code
+SRCS= start.S conf.c self_reloc.c vers.c
+
+.if !defined(LOADER_NO_DISK_SUPPORT)
+LOADER_DISK_SUPPORT?= yes
+.else
+LOADER_DISK_SUPPORT= no
+.endif
+LOADER_UFS_SUPPORT?= yes
+LOADER_CD9660_SUPPORT?= no
+LOADER_EXT2FS_SUPPORT?= no
+.if ${MK_NAND} != "no"
+LOADER_NANDFS_SUPPORT?= yes
+.else
+LOADER_NANDFS_SUPPORT?= no
+.endif
+LOADER_NET_SUPPORT?= yes
+LOADER_NFS_SUPPORT?= yes
+LOADER_TFTP_SUPPORT?= no
+LOADER_GZIP_SUPPORT?= no
+LOADER_BZIP2_SUPPORT?= no
+.if ${MK_FDT} != "no"
+LOADER_FDT_SUPPORT= yes
+.else
+LOADER_FDT_SUPPORT= no
+.endif
+
+.if ${LOADER_DISK_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_DISK_SUPPORT
+.endif
+.if ${LOADER_UFS_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_UFS_SUPPORT
+.endif
+.if ${LOADER_CD9660_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_CD9660_SUPPORT
+.endif
+.if ${LOADER_EXT2FS_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_EXT2FS_SUPPORT
+.endif
+.if ${LOADER_NANDFS_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_NANDFS_SUPPORT
+.endif
+.if ${LOADER_GZIP_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_GZIP_SUPPORT
+.endif
+.if ${LOADER_BZIP2_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_BZIP2_SUPPORT
+.endif
+.if ${LOADER_NET_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_NET_SUPPORT
+.endif
+.if ${LOADER_NFS_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_NFS_SUPPORT
+.endif
+.if ${LOADER_TFTP_SUPPORT} == "yes"
+CFLAGS+= -DLOADER_TFTP_SUPPORT
+.endif
+.if ${LOADER_FDT_SUPPORT} == "yes"
+CFLAGS+= -I${.CURDIR}/../../fdt
+CFLAGS+= -I${.OBJDIR}/../../fdt
+CFLAGS+= -DLOADER_FDT_SUPPORT
+LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a
+LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
+.endif
+
+CFLAGS+= -DNETIF_OPEN_CLOSE_ONCE
+
+.if ${MK_FORTH} != "no"
+# Enable BootForth
+BOOT_FORTH= yes
+CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/aarch64
+LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
+.endif
+
+# Always add MI sources
+.PATH: ${.CURDIR}/../../common
+.include "${.CURDIR}/../../common/Makefile.inc"
+CFLAGS+= -I${.CURDIR}/../../common
+CFLAGS+= -I.
+
+CLEANFILES+= vers.c loader.help
+
+CFLAGS+= -ffreestanding -msoft-float
+
+LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
+
+# Pull in common loader code
+.PATH: ${.CURDIR}/../../uboot/common
+.include "${.CURDIR}/../../uboot/common/Makefile.inc"
+CFLAGS+= -I${.CURDIR}/../../uboot/common
+
+# U-Boot standalone support library
+LIBUBOOT= ${.OBJDIR}/../../uboot/lib/libuboot.a
+CFLAGS+= -I${.CURDIR}/../../uboot/lib
+CFLAGS+= -I${.OBJDIR}/../../uboot/lib
+
+# where to get libstand from
+CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+
+# clang doesn't understand %D as a specifier to printf
+NO_WERROR.clang=
+
+DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
+LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
+
+OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
+
+vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
+ sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
+
+loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
+ cat ${.ALLSRC} | \
+ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
+
+ubldr: ${OBJS} ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
+ ${CC} ${CFLAGS} ${LDFLAGS} \
+ -Wl,--defsym,UBLDR_LOADADDR=${UBLDR_LOADADDR} \
+ -o ${.TARGET} ${OBJS} ${LDADD}
+
+ubldr.pie: ${OBJS} ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
+ ${CC} ${CFLAGS} ${LDFLAGS} -pie -Wl,-Bsymbolic \
+ -Wl,--defsym,UBLDR_LOADADDR=0 -o ${.TARGET} ${OBJS} ${LDADD}
+
+ubldr.bin: ubldr.pie
+ ${OBJCOPY} -S -O binary ubldr.pie ${.TARGET}
+
+CLEANFILES+= ubldr ubldr.pie ubldr.bin
+
+.if !defined(LOADER_ONLY)
+.PATH: ${.CURDIR}/../../forth
+.include "${.CURDIR}/../../forth/Makefile.inc"
+
+# Install loader.rc.
+FILES+= loader.rc
+# Put sample menu.rc on disk but don't enable it by default.
+FILES+= menu.rc
+FILESNAME_menu.rc= menu.rc.sample
+.endif
+
+.include <bsd.prog.mk>
Index: sys/boot/arm64/uboot/conf.c
===================================================================
--- sys/boot/arm64/uboot/conf.c
+++ sys/boot/arm64/uboot/conf.c
@@ -0,0 +1,94 @@
+/*-
+ * Copyright (c) 2008 Semihalf, Rafal Jaworowski
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stand.h>
+#include "bootstrap.h"
+#include "libuboot.h"
+
+#if defined(LOADER_NET_SUPPORT)
+#include "dev_net.h"
+#endif
+
+struct devsw *devsw[] = {
+#if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT)
+ &uboot_storage,
+#endif
+#if defined(LOADER_NET_SUPPORT)
+ &netdev,
+#endif
+ NULL
+};
+
+struct fs_ops *file_system[] = {
+#if defined(LOADER_UFS_SUPPORT)
+ &ufs_fsops,
+#endif
+#if defined(LOADER_CD9660_SUPPORT)
+ &cd9660_fsops,
+#endif
+#if defined(LOADER_EXT2FS_SUPPORT)
+ &ext2fs_fsops,
+#endif
+#if defined(LOADER_NANDFS_SUPPORT)
+ &nandfs_fsops,
+#endif
+#if defined(LOADER_NFS_SUPPORT)
+ &nfs_fsops,
+#endif
+#if defined(LOADER_TFTP_SUPPORT)
+ &tftp_fsops,
+#endif
+#if defined(LOADER_GZIP_SUPPORT)
+ &gzipfs_fsops,
+#endif
+#if defined(LOADER_BZIP2_SUPPORT)
+ &bzipfs_fsops,
+#endif
+ NULL
+};
+
+struct netif_driver *netif_drivers[] = {
+#if defined(LOADER_NET_SUPPORT)
+ &uboot_net,
+#endif
+ NULL,
+};
+
+struct file_format *file_formats[] = {
+ &uboot_elf,
+ NULL
+};
+
+extern struct console uboot_console;
+
+struct console *consoles[] = {
+ &uboot_console,
+ NULL
+};
Index: sys/boot/arm64/uboot/help.uboot
===================================================================
--- sys/boot/arm64/uboot/help.uboot
+++ sys/boot/arm64/uboot/help.uboot
@@ -0,0 +1,27 @@
+$FreeBSD$
+
+###############################################################################
+# Tubenv DShow or import U-Boot environment variables
+
+ ubenv <import | show> [varname ...]
+
+ Display U-Boot environment variables, or import them into the
+ loader environment (which makes them available in the kernel).
+
+###############################################################################
+# Tubenv Simport DImport U-Boot env vars
+
+ ubenv import [varname ...]
+
+ If no variable names are specified, all U-Boot environment
+ variables are imported. Each variable is prefixed with "uboot."
+ to avoid any possible conflicts with loader or kernel variables.
+
+###############################################################################
+# Tubenv Sshow DShow U-Boot env vars
+
+ ubenv show [varname ...]
+
+ If no variable names are specified, all U-Boot environment
+ variables are shown.
+
Index: sys/boot/arm64/uboot/ldscript.aarch64
===================================================================
--- sys/boot/arm64/uboot/ldscript.aarch64
+++ sys/boot/arm64/uboot/ldscript.aarch64
@@ -0,0 +1,138 @@
+/* $FreeBSD$ */
+
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+ . = UBLDR_LOADADDR;
+ ImageBase = .;
+
+ /* Align text section so that 4K boundaries are preserved when headers are
+ * stripped. Otherwise, pc-relative accesses can break in stripped binary.
+ */
+ . = UBLDR_LOADADDR + 0x1000;
+
+ /* Read-only sections, merged into text segment: */
+ .text :
+ {
+ *(.text)
+ /* .gnu.warning sections are handled specially by elf32.em. */
+ *(.gnu.warning)
+ *(.gnu.linkonce.t*)
+ } =0
+ _etext = .;
+ PROVIDE (etext = .);
+ .interp : { *(.interp) }
+ .hash : { *(.hash) }
+ .dynsym : { *(.dynsym) }
+ .dynstr : { *(.dynstr) }
+ .gnu.version : { *(.gnu.version) }
+ .gnu.version_d : { *(.gnu.version_d) }
+ .gnu.version_r : { *(.gnu.version_r) }
+ .rela.text :
+ { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+ .rela.data :
+ { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+ .rela.rodata :
+ { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+ .rela.got : { *(.rela.got) }
+ .rela.got1 : { *(.rela.got1) }
+ .rela.got2 : { *(.rela.got2) }
+ .rela.ctors : { *(.rela.ctors) }
+ .rela.dtors : { *(.rela.dtors) }
+ .rela.init : { *(.rela.init) }
+ .rela.fini : { *(.rela.fini) }
+ .rela.bss : { *(.rela.bss) }
+ .rela.plt : { *(.rela.plt) }
+ .rela.sdata : { *(.rela.sdata) }
+ .rela.sbss : { *(.rela.sbss) }
+ .rela.sdata2 : { *(.rela.sdata2) }
+ .rela.sbss2 : { *(.rela.sbss2) }
+ .init : { *(.init) } =0
+ .fini : { *(.fini) } =0
+ .rodata : { *(.rodata) *(.gnu.linkonce.r*) }
+ .rodata1 : { *(.rodata1) }
+ .sdata2 : { *(.sdata2) }
+ .sbss2 : { *(.sbss2) }
+ .data :
+ {
+ *(.data)
+ *(.gnu.linkonce.d*)
+ CONSTRUCTORS
+ }
+ .data1 : { *(.data1) }
+ .got1 : { *(.got1) }
+ .dynamic : { *(.dynamic) }
+ /* Put .ctors and .dtors next to the .got2 section, so that the pointers
+ get relocated with -mrelocatable. Also put in the .fixup pointers.
+ The current compiler no longer needs this, but keep it around for 2.7.2 */
+ PROVIDE (_GOT2_START_ = .);
+ .got2 : { *(.got2) }
+ PROVIDE (__CTOR_LIST__ = .);
+ .ctors : { *(.ctors) }
+ PROVIDE (__CTOR_END__ = .);
+ PROVIDE (__DTOR_LIST__ = .);
+ .dtors : { *(.dtors) }
+ PROVIDE (__DTOR_END__ = .);
+ PROVIDE (_FIXUP_START_ = .);
+ .fixup : { *(.fixup) }
+ PROVIDE (_FIXUP_END_ = .);
+ PROVIDE (_GOT2_END_ = .);
+ PROVIDE (_GOT_START_ = .);
+ .got : { *(.got) }
+ .got.plt : { *(.got.plt) }
+ PROVIDE (_GOT_END_ = .);
+ /* We want the small data sections together, so single-instruction offsets
+ can access them all, and initialized data all before uninitialized, so
+ we can shorten the on-disk segment size. */
+ .sdata : { *(.sdata) }
+ _edata = .;
+ PROVIDE (edata = .);
+ .sbss :
+ {
+ PROVIDE (__sbss_start = .);
+ *(.sbss)
+ *(.scommon)
+ *(.dynsbss)
+ PROVIDE (__sbss_end = .);
+ }
+ .plt : { *(.plt) }
+ .bss :
+ {
+ PROVIDE (__bss_start = .);
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ _end = . ;
+ PROVIDE (end = .);
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+ /* SGI/MIPS DWARF 2 extensions */
+ .debug_weaknames 0 : { *(.debug_weaknames) }
+ .debug_funcnames 0 : { *(.debug_funcnames) }
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ /* These must appear regardless of . */
+}
Index: sys/boot/arm64/uboot/loader.conf
===================================================================
--- sys/boot/arm64/uboot/loader.conf
+++ sys/boot/arm64/uboot/loader.conf
@@ -0,0 +1,13 @@
+# This is defaults/loader.conf for ARM 64, containing defaults for loader(8).
+# Do not modify the contents of this file, instead put your customizations
+# into /boot/loader.conf or /boot/loader.conf.local
+# $FreeBSD$
+
+autoboot_delay=10
+bootfile="kernel" # Kernel name (possibly absolute path)
+kernel="kernel" # /boot sub-directory containing kernel and modules
+loader_conf_files="/boot/loader.conf /boot/loader.conf.local"
+module_path="/boot/kernel;/boot/modules;/boot/dtb"
+nextboot_conf="/boot/nextboot.conf"
+nextboot_enable="NO"
+verbose_loading="NO"
Index: sys/boot/arm64/uboot/start.S
===================================================================
--- sys/boot/arm64/uboot/start.S
+++ sys/boot/arm64/uboot/start.S
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 2016 Thomas Skibo <skibo@freebsd.org>
+ * Copyright (c) 2008 Semihalf, Rafal Czubak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <machine/asm.h>
+#include <machine/armreg.h>
+
+ .text
+ .extern _C_LABEL(self_reloc), _C_LABEL(main)
+ .weak _DYNAMIC
+/*
+ * Entry point to the loader that U-Boot passes control to.
+ */
+ .globl _start
+_start:
+ /* Do self-relocation if this external symbol reference has not been
+ * filled in the literal pool.
+ */
+ ldr x0, =_C_LABEL(self_reloc)
+ cbnz x0, 2f
+
+ adr x0, ImageBase /* x0 = addr where we were loaded. */
+ adr x1, _DYNAMIC /* x1 = dynamic section addr. */
+ bl _C_LABEL(self_reloc)
+2:
+ /* Hint where to look for the API signature */
+ adr x15, uboot_address
+ mov x0, sp
+ str x0, [x15]
+
+ /* Save U-Boot's x18 */
+ adr x15, saved_regs
+ str x18, [x15, #0]
+
+ /*
+ * Start loader. This is basically a tail-recursion call; if main()
+ * returns, it returns to u-boot (which reports the value returned x0).
+ */
+ b main
+/*
+ * syscall()
+ */
+ENTRY(syscall)
+ /* Save caller's lr, x18 */
+ adr x15, saved_regs
+ str x18, [x15, #8]
+ str lr, [x15, #16]
+
+ /* Restore U-Boot's x18 */
+ ldr x18, saved_regs
+
+ /* Call into U-Boot */
+ adr lr, return_from_syscall
+ ldr x15, syscall_ptr
+ br x15
+return_from_syscall:
+ /* Restore loader's x18 and lr */
+ ldr lr, saved_regs + 16
+ ldr x18, saved_regs + 8
+ /* Return to caller */
+ ret
+
+/*
+ * Data section
+ */
+ .data
+ .align 3
+ .globl syscall_ptr
+syscall_ptr:
+ .quad 0
+
+ .globl uboot_address
+uboot_address:
+ .quad 0
+
+saved_regs:
+ .quad 0 /* U-Boot's x18 */
+ .quad 0 /* Loader's x18 */
+ .quad 0 /* Loader's lr */
Index: sys/boot/arm64/uboot/version
===================================================================
--- sys/boot/arm64/uboot/version
+++ sys/boot/arm64/uboot/version
@@ -0,0 +1,6 @@
+$FreeBSD$
+
+NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
+file is important. Make sure the current version number is on line 6.
+
+1.0: Initial U-Boot/arm64 version derived from U-boot/arm.
Index: sys/boot/common/load_elf.c
===================================================================
--- sys/boot/common/load_elf.c
+++ sys/boot/common/load_elf.c
@@ -50,6 +50,10 @@
#define ELF_TARG_MACH EM_X86_64
#endif
+#if defined(__aarch64__)
+#define KERN_ALIGN (2 * 1024 * 1024)
+#endif
+
typedef struct elf_file {
Elf_Phdr *ph;
Elf_Ehdr *ehdr;
@@ -198,7 +202,7 @@
* leave dest set to the value calculated by archsw.arch_loadaddr() and
* passed in to this function.
*/
-#ifndef __arm__
+#if !defined(__arm__) && !defined(__aarch64__)
if (ehdr->e_type == ET_EXEC)
dest = (ehdr->e_entry & ~PAGE_MASK);
#endif
@@ -375,6 +379,23 @@
#ifdef ELF_VERBOSE
printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", ehdr->e_entry, off);
#endif
+#elif defined(__aarch64__) && !defined(EFI)
+ /*
+ * The elf headers in arm kernels specify virtual addresses in all
+ * header fields, even the ones that should be physical addresses.
+ * We assume the entry point is in the first 2MB, and masking the lower
+ * bits will leave us with the virtual address the kernel was linked
+ * at. We subtract that from the load offset, making 'off' into the
+ * value which, when added to a virtual address in an elf header,
+ * translates it to a physical address. We do the va->pa conversion on
+ * the entry point address in the header now, so that later we can
+ * launch the kernel by just jumping to that address.
+ */
+ off -= ehdr->e_entry & ~(KERN_ALIGN - 1);
+ ehdr->e_entry += off;
+#ifdef ELF_VERBOSE
+ printf("ehdr->e_entry %p, va<->pa off 0x%llx\n", ehdr->e_entry, off);
+#endif
#else
off = 0; /* other archs use direct mapped kernels */
#endif
Index: sys/boot/uboot/lib/copy.c
===================================================================
--- sys/boot/uboot/lib/copy.c
+++ sys/boot/uboot/lib/copy.c
@@ -40,7 +40,7 @@
* MD primitives supporting placement of module data
*/
-#ifdef __arm__
+#if defined(__arm__) || defined(__aarch64__)
#define KERN_ALIGN (2 * 1024 * 1024)
#else
#define KERN_ALIGN PAGE_SIZE
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 18, 11:31 PM (6 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29932248
Default Alt Text
D5512.id14200.diff (19 KB)
Attached To
Mode
D5512: ubldr for arm64
Attached
Detach File
Event Timeline
Log In to Comment