Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Dec 2015 11:31:47 -0800
From:      Thomas Skibo <thomasskibo@yahoo.com>
To:        freebsd-arm@freebsd.org
Subject:   Re: u-boot and ubldr on arm64
Message-ID:  <5A031837-F7D6-467F-A6B7-35B1F0A467D9@yahoo.com>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_F075A616-44A9-4C1F-98E9-03F8A745328B
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hello.

Attached is the corrected patch for supporting ubldr on arm64.

Happy New Year!
=E2=80=94Thomas

=E2=80=94=E2=80=94
Thomas Skibo
thomasskibo@yahoo.com



--Apple-Mail=_F075A616-44A9-4C1F-98E9-03F8A745328B
Content-Disposition: attachment;
	filename=ubldr-patches.txt
Content-Type: text/plain;
	name="ubldr-patches.txt"
Content-Transfer-Encoding: quoted-printable

Index: sys/boot/Makefile.arm64
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/Makefile.arm64	(revision 292987)
+++ sys/boot/Makefile.arm64	(working copy)
@@ -4,4 +4,4 @@
 SUBDIR+=3D		fdt
 .endif
=20
-SUBDIR+=3D		efi
+SUBDIR+=3D		efi uboot
Index: sys/boot/arm64/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/Makefile	(revision 292987)
+++ sys/boot/arm64/Makefile	(working copy)
@@ -1,3 +1,5 @@
 # $FreeBSD$
=20
+SUBDIR=3D		uboot
+
 .include <bsd.subdir.mk>
Index: sys/boot/arm64/Makefile.inc
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/Makefile.inc	(nonexistent)
+++ sys/boot/arm64/Makefile.inc	(working copy)
@@ -0,0 +1,3 @@
+# $FreeBSD$
+
+.include "../Makefile.inc"

Property changes on: sys/boot/arm64/Makefile.inc
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=3D%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: sys/boot/arm64/uboot/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/uboot/Makefile	(nonexistent)
+++ sys/boot/arm64/uboot/Makefile	(working copy)
@@ -0,0 +1,159 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+FILES=3D		ubldr ubldr.bin
+
+NEWVERSWHAT=3D	"U-Boot loader" ${MACHINE_ARCH}
+BINDIR?=3D	/boot
+INSTALLFLAGS=3D	-b
+WARNS?=3D		1
+# Address at which ubldr will be loaded.
+# This varies for different boards and SOCs.
+UBLDR_LOADADDR?=3D	0x1000000
+
+# Architecture-specific loader code
+SRCS=3D		start.S conf.c self_reloc.c vers.c
+
+.if !defined(LOADER_NO_DISK_SUPPORT)
+LOADER_DISK_SUPPORT?=3D	yes
+.else
+LOADER_DISK_SUPPORT=3D	no
+.endif
+LOADER_UFS_SUPPORT?=3D	yes
+LOADER_CD9660_SUPPORT?=3D	no
+LOADER_EXT2FS_SUPPORT?=3D	no
+.if ${MK_NAND} !=3D "no"
+LOADER_NANDFS_SUPPORT?=3D yes
+.else
+LOADER_NANDFS_SUPPORT?=3D no
+.endif
+LOADER_NET_SUPPORT?=3D	yes
+LOADER_NFS_SUPPORT?=3D	yes
+LOADER_TFTP_SUPPORT?=3D	no
+LOADER_GZIP_SUPPORT?=3D	no
+LOADER_BZIP2_SUPPORT?=3D	no
+.if ${MK_FDT} !=3D "no"
+LOADER_FDT_SUPPORT=3D	yes
+.else
+LOADER_FDT_SUPPORT=3D	no
+.endif
+
+.if ${LOADER_DISK_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_DISK_SUPPORT
+.endif
+.if ${LOADER_UFS_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_UFS_SUPPORT
+.endif
+.if ${LOADER_CD9660_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_CD9660_SUPPORT
+.endif
+.if ${LOADER_EXT2FS_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_EXT2FS_SUPPORT
+.endif
+.if ${LOADER_NANDFS_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_NANDFS_SUPPORT
+.endif
+.if ${LOADER_GZIP_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_GZIP_SUPPORT
+.endif
+.if ${LOADER_BZIP2_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_BZIP2_SUPPORT
+.endif
+.if ${LOADER_NET_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_NET_SUPPORT
+.endif
+.if ${LOADER_NFS_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_NFS_SUPPORT
+.endif
+.if ${LOADER_TFTP_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-DLOADER_TFTP_SUPPORT
+.endif
+.if ${LOADER_FDT_SUPPORT} =3D=3D "yes"
+CFLAGS+=3D	-I${.CURDIR}/../../fdt
+CFLAGS+=3D	-I${.OBJDIR}/../../fdt
+CFLAGS+=3D	-DLOADER_FDT_SUPPORT
+LIBUBOOT_FDT=3D	${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a
+LIBFDT=3D		${.OBJDIR}/../../fdt/libfdt.a
+.endif
+
+CFLAGS+=3D	-DNETIF_OPEN_CLOSE_ONCE
+
+.if ${MK_FORTH} !=3D "no"
+# Enable BootForth
+BOOT_FORTH=3D	yes
+CFLAGS+=3D	-DBOOT_FORTH -I${.CURDIR}/../../ficl =
-I${.CURDIR}/../../ficl/aarch64
+LIBFICL=3D	${.OBJDIR}/../../ficl/libficl.a
+.endif
+
+# Always add MI sources
+.PATH:		${.CURDIR}/../../common
+.include	"${.CURDIR}/../../common/Makefile.inc"
+CFLAGS+=3D	-I${.CURDIR}/../../common
+CFLAGS+=3D	-I.
+
+CLEANFILES+=3D	vers.c loader.help
+
+CFLAGS+=3D	-ffreestanding -msoft-float
+
+LDFLAGS=3D	-nostdlib -static -T =
${.CURDIR}/ldscript.${MACHINE_CPUARCH}
+
+# Pull in common loader code
+.PATH:		${.CURDIR}/../../uboot/common
+.include	"${.CURDIR}/../../uboot/common/Makefile.inc"
+CFLAGS+=3D	-I${.CURDIR}/../../uboot/common
+
+# U-Boot standalone support library
+LIBUBOOT=3D	${.OBJDIR}/../../uboot/lib/libuboot.a
+CFLAGS+=3D	-I${.CURDIR}/../../uboot/lib
+CFLAGS+=3D	-I${.OBJDIR}/../../uboot/lib
+
+# where to get libstand from
+CFLAGS+=3D	-I${.CURDIR}/../../../../lib/libstand/
+
+# clang doesn't understand %D as a specifier to printf
+NO_WERROR.clang=3D
+
+DPADD=3D		${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} =
${LIBSTAND}
+LDADD=3D		${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} =
-lstand
+
+OBJS+=3D  ${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}
+
+ldscript.abs:
+	echo "UBLDR_LOADADDR =3D ${UBLDR_LOADADDR};" >${.TARGET}
+
+ldscript.pie:
+	echo "UBLDR_LOADADDR =3D 0;" >${.TARGET}
+
+ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} =
${DPADD}
+	${CC} ${CFLAGS} -T ldscript.abs ${LDFLAGS} \
+	    -o ${.TARGET} ${OBJS} ${LDADD}
+
+ubldr.pie: ${OBJS} ldscript.pie ${.CURDIR}/ldscript.${MACHINE_CPUARCH} =
${DPADD}
+	${CC} ${CFLAGS} -T ldscript.pie ${LDFLAGS} -pie -Wl,-Bsymbolic \
+	    -o ${.TARGET} ${OBJS} ${LDADD}
+
+ubldr.bin: ubldr.pie
+	${OBJCOPY} -S -O binary ubldr.pie ${.TARGET}
+
+CLEANFILES+=3D	ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
+
+.if !defined(LOADER_ONLY)
+.PATH: ${.CURDIR}/../../forth
+.include	"${.CURDIR}/../../forth/Makefile.inc"
+
+# Install loader.rc.
+FILES+=3D	loader.rc
+# Put sample menu.rc on disk but don't enable it by default.
+FILES+=3D	menu.rc
+FILESNAME_menu.rc=3D	menu.rc.sample
+.endif
+
+.include <bsd.prog.mk>

Property changes on: sys/boot/arm64/uboot/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=3D%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: sys/boot/arm64/uboot/conf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/uboot/conf.c	(nonexistent)
+++ sys/boot/arm64/uboot/conf.c	(working copy)
@@ -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[] =3D {
+#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[] =3D {
+#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[] =3D {
+#if defined(LOADER_NET_SUPPORT)
+	&uboot_net,
+#endif
+	NULL,
+};
+
+struct file_format *file_formats[] =3D {
+	&uboot_elf,
+	NULL
+};
+
+extern struct console uboot_console;
+
+struct console *consoles[] =3D {
+	&uboot_console,
+	NULL
+};

Property changes on: sys/boot/arm64/uboot/conf.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=3D%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: sys/boot/arm64/uboot/help.uboot
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/uboot/help.uboot	(nonexistent)
+++ sys/boot/arm64/uboot/help.uboot	(working copy)
@@ -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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/uboot/ldscript.aarch64	(nonexistent)
+++ sys/boot/arm64/uboot/ldscript.aarch64	(working copy)
@@ -0,0 +1,133 @@
+/* $FreeBSD$ */
+
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . =3D UBLDR_LOADADDR + SIZEOF_HEADERS;
+  .text      :
+  {
+    *(.text)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+    *(.gnu.linkonce.t*)
+  } =3D0
+  _etext =3D .;
+  PROVIDE (etext =3D .);
+  .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)    } =3D0
+  .fini      : { *(.fini)    } =3D0
+  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
+  .rodata1   : { *(.rodata1) }
+  .sdata2    : { *(.sdata2)  }
+  .sbss2     : { *(.sbss2)   }
+  /* Adjust the address for the data segment to the next page up. */
+  . =3D ((. + 0x1000) & ~(0x1000 - 1));
+  .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_ =3D .);
+  .got2           :  { *(.got2) }
+                PROVIDE (__CTOR_LIST__ =3D .);
+  .ctors          : { *(.ctors) }
+                PROVIDE (__CTOR_END__ =3D .);
+                PROVIDE (__DTOR_LIST__ =3D .);
+  .dtors          : { *(.dtors) }
+                PROVIDE (__DTOR_END__ =3D .);
+                PROVIDE (_FIXUP_START_ =3D .);
+  .fixup          : { *(.fixup) }
+                PROVIDE (_FIXUP_END_ =3D .);
+                PROVIDE (_GOT2_END_ =3D .);
+                PROVIDE (_GOT_START_ =3D .);
+  .got            : { *(.got) }
+  .got.plt        : { *(.got.plt) }
+                PROVIDE (_GOT_END_ =3D .);
+  /* 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  =3D  .;
+  PROVIDE (edata =3D .);
+  .sbss      :
+  {
+    PROVIDE (__sbss_start =3D .);
+    *(.sbss)
+    *(.scommon)
+    *(.dynsbss)
+    PROVIDE (__sbss_end =3D .);
+  }
+  .plt   : { *(.plt) }
+  .bss       :
+  {
+   PROVIDE (__bss_start =3D .);
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end =3D . ;
+  PROVIDE (end =3D .);
+  /* 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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/uboot/loader.conf	(nonexistent)
+++ sys/boot/arm64/uboot/loader.conf	(working copy)
@@ -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=3D10
+bootfile=3D"kernel"      # Kernel name (possibly absolute path)
+kernel=3D"kernel"        # /boot sub-directory containing kernel and =
modules
+loader_conf_files=3D"/boot/loader.conf /boot/loader.conf.local"
+module_path=3D"/boot/kernel;/boot/modules;/boot/dtb"
+nextboot_conf=3D"/boot/nextboot.conf"
+nextboot_enable=3D"NO"
+verbose_loading=3D"NO"

Property changes on: sys/boot/arm64/uboot/loader.conf
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=3D%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: sys/boot/arm64/uboot/start.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/uboot/start.S	(nonexistent)
+++ sys/boot/arm64/uboot/start.S	(working copy)
@@ -0,0 +1,122 @@
+/*-
+ * 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:
+
+	/*=20
+	 * Do self-relocation when the weak external symbol _DYNAMIC is =
non-NULL.
+	 * When linked as a dynamic relocatable file, the linker =
automatically
+	 * defines _DYNAMIC with a value that is the offset of the =
dynamic
+	 * relocation info section.
+	 * Note that we're still on u-boot's stack here, but the =
self_reloc=20
+	 * code uses only a couple dozen bytes of stack space.
+	 */
+	ldr	x15, =3D.here_off		/* .here_off is a symbol =
whose value */
+	ldr	x0, [x15]		/* is its own offset in the text =
seg. */
+	sub	x0, x15, x0		/* Get its pc-relative address =
and */
+	ldr	x1, .dynamic_off	/* subtract its value and we get =
*/
+	cmp	x1, #0			/* x0 =3D physaddr we were =
loaded at. */
+	b.eq	2f
+	add	x1, x1, x0		/* x1 =3D dynamic section =
physaddr. */
+	bl	_C_LABEL(self_reloc)	/* Do reloc if _DYNAMIC is =
non-NULL. */
+2:=09
+	/* Hint where to look for the API signature */
+	ldr	x15, =3Duboot_address
+	mov	x0, sp
+	str	x0, [x15]
+
+	/* Save U-Boot's x18 */
+	ldr	x15, =3Dsaved_regs
+	str	x18, [x15, #0]
+
+	/*=20
+	 * 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
+
+	/*=20
+	 * Data for self-relocation, in the text segment for pc-rel =
access.
+	 */
+	.align 3
+.here_off:
+	.quad	.
+.dynamic_off:
+	.quad	_DYNAMIC
+
+/*
+ * syscall()
+ */
+ENTRY(syscall)
+	/* Save caller's lr, x18 */
+	ldr	x15, =3Dsaved_regs
+	str	x18, [x15, #8]
+	str	lr, [x15, #16]
+=09
+	/* Restore U-Boot's x18 */
+	ldr	x18, saved_regs
+=09
+	/* Call into U-Boot */
+	ldr	lr, =3Dreturn_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 */

Property changes on: sys/boot/arm64/uboot/start.S
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=3D%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: sys/boot/arm64/uboot/version
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/arm64/uboot/version	(nonexistent)
+++ sys/boot/arm64/uboot/version	(working copy)
@@ -0,0 +1,9 @@
+$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.2:	Extended with NAND FS support.
+1.1:	Flattened Device Tree blob support.
+1.0:	Added storage support. Booting from HDD, USB, etc. is now =
possible.
+0.5:	Initial U-Boot/arm version (netbooting only).
Index: sys/boot/common/load_elf.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/common/load_elf.c	(revision 292987)
+++ sys/boot/common/load_elf.c	(working copy)
@@ -198,7 +198,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 =3D=3D ET_EXEC)
 	    dest =3D (ehdr->e_entry & ~PAGE_MASK);
 #endif
@@ -370,6 +370,24 @@
 #ifdef ELF_VERBOSE
 	printf("ehdr->e_entry 0x%08x, va<->pa off %llx\n", =
ehdr->e_entry, off);
 #endif
+#elif defined(__aarch64__)
+	/*
+	 * 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.
+	 */
+#define KERN_ALIGN (2 * 1024 * 1024) /* XXX: where should this go? */
+	off -=3D ehdr->e_entry & ~(KERN_ALIGN-1);
+	ehdr->e_entry +=3D off;
+#ifdef ELF_VERBOSE
+	printf("ehdr->e_entry %p, va<->pa off 0x%llx\n", ehdr->e_entry, =
off);
+#endif
 #else
 	off =3D 0;		/* other archs use direct mapped kernels =
*/
 #endif
Index: sys/boot/efi/loader/bootinfo.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/efi/loader/bootinfo.c	(revision 292987)
+++ sys/boot/efi/loader/bootinfo.c	(working copy)
@@ -219,7 +219,7 @@
 		if (fp->f_args)
 			MOD_ARGS(addr, fp->f_args, c);
 		v =3D fp->f_addr;
-#if defined(__arm__)
+#if defined(__arm__) || defined(__aarch64__)
 		v -=3D __elfN(relocation_offset);
 #endif
 		MOD_ADDR(addr, v, c);
@@ -350,7 +350,7 @@
 	vm_offset_t dtbp;
 	int dtb_size;
 #endif
-#if defined(__arm__)
+#if defined(__arm__) || defined(__aarch64__)
 	vm_offset_t vaddr;
 	int i;
 	/*
@@ -439,7 +439,7 @@
 	md =3D file_findmetadata(kfp, MODINFOMD_KERNEND);
 	bcopy(&kernend, md->md_data, sizeof kernend);
=20
-#if defined(__arm__)
+#if defined(__arm__) || defined(__aarch64__)
 	*modulep -=3D __elfN(relocation_offset);
=20
 	/* Do relocation fixup on metadata of each module. */
Index: sys/boot/uboot/common/main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/uboot/common/main.c	(revision 292987)
+++ sys/boot/uboot/common/main.c	(working copy)
@@ -133,7 +133,7 @@
 		size =3D memsize(si, t[i]);
 		if (size > 0)
 			printf("%s: %lldMB\n", ub_mem_type(t[i]),
-			    size / 1024 / 1024);
+			       (unsigned long long)size / 1024 / 1024);
 	}
 }
=20
@@ -512,7 +512,7 @@
 {
=20
 	printf("heap base at %p, top at %p, used %d\n", end, sbrk(0),
-	    sbrk(0) - end);
+	       (int)(sbrk(0) - end));
=20
 	return (CMD_OK);
 }
Index: sys/boot/uboot/fdt/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/uboot/fdt/Makefile	(revision 292987)
+++ sys/boot/uboot/fdt/Makefile	(working copy)
@@ -24,7 +24,7 @@
 CFLAGS+=3D	-I${.CURDIR}/../../common -I${.CURDIR}/../../.. -I.
=20
 machine:
-	ln -sf ${.CURDIR}/../../../${MACHINE_CPUARCH}/include machine
+	ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
=20
 CLEANFILES+=3D	machine
=20
Index: sys/boot/uboot/lib/Makefile
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/uboot/lib/Makefile	(revision 292987)
+++ sys/boot/uboot/lib/Makefile	(working copy)
@@ -42,7 +42,7 @@
 .endif
=20
 machine:
-	ln -sf ${.CURDIR}/../../../${MACHINE_CPUARCH}/include machine
+	ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
=20
 CLEANFILES+=3D	machine
=20
Index: sys/boot/uboot/lib/copy.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/uboot/lib/copy.c	(revision 292987)
+++ sys/boot/uboot/lib/copy.c	(working copy)
@@ -40,7 +40,7 @@
  * MD primitives supporting placement of module data=20
  */
=20
-#ifdef __arm__
+#if defined(__arm__) || defined(__aarch64__)
 #define	KERN_ALIGN	(2 * 1024 * 1024)
 #else
 #define	KERN_ALIGN	PAGE_SIZE
Index: sys/boot/uboot/lib/disk.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/uboot/lib/disk.c	(revision 292987)
+++ sys/boot/uboot/lib/disk.c	(working copy)
@@ -156,8 +156,8 @@
 	}
=20
 	if (size % SI(dev).bsize) {
-		stor_printf("size=3D%d not multiple of device block =
size=3D%d\n",
-		    size, SI(dev).bsize);
+		stor_printf("size=3D%ld not multiple of device block =
size=3D%d\n",
+		    (long)size, SI(dev).bsize);
 		return (EIO);
 	}
 	bcount =3D size / SI(dev).bsize;
Index: sys/boot/uboot/lib/elf_freebsd.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/uboot/lib/elf_freebsd.c	(revision 292987)
+++ sys/boot/uboot/lib/elf_freebsd.c	(working copy)
@@ -81,7 +81,7 @@
 		return (error);
=20
 	entry =3D (void *)e->e_entry;
-	printf("Kernel entry at 0x%x...\n", (unsigned)entry);
+	printf("Kernel entry at 0x%p...\n", entry);
=20
 	dev_cleanup();
 	printf("Kernel args: %s\n", fp->f_args);
Index: sys/boot/uboot/lib/glue.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/boot/uboot/lib/glue.c	(revision 292987)
+++ sys/boot/uboot/lib/glue.c	(working copy)
@@ -109,7 +109,7 @@
 {
 	int c;
=20
-	if (!syscall(API_GETC, NULL, (uint32_t)&c))
+	if (!syscall(API_GETC, NULL, (uintptr_t)&c))
 		return (-1);
=20
 	return (c);
@@ -120,7 +120,7 @@
 {
 	int t;
=20
-	if (!syscall(API_TSTC, NULL, (uint32_t)&t))
+	if (!syscall(API_TSTC, NULL, (uintptr_t)&t))
 		return (-1);
=20
 	return (t);
@@ -130,7 +130,7 @@
 ub_putc(char c)
 {
=20
-	syscall(API_PUTC, NULL, (uint32_t)&c);
+	syscall(API_PUTC, NULL, (uintptr_t)&c);
 }
=20
 void
@@ -137,7 +137,7 @@
 ub_puts(const char *s)
 {
=20
-	syscall(API_PUTS, NULL, (uint32_t)s);
+	syscall(API_PUTS, NULL, (uintptr_t)s);
 }
=20
 /****************************************
@@ -166,7 +166,7 @@
 	si.mr_no =3D UB_MAX_MR;
 	memset(&mr, 0, sizeof(mr));
=20
-	if (!syscall(API_GET_SYS_INFO, &err, (u_int32_t)&si))
+	if (!syscall(API_GET_SYS_INFO, &err, (uintptr_t)&si))
 		return (NULL);
=20
 	return ((err) ? NULL : &si);
@@ -483,7 +483,7 @@
 {
 	char *value;
=20
-	if (!syscall(API_ENV_GET, NULL, (uint32_t)name, =
(uint32_t)&value))
+	if (!syscall(API_ENV_GET, NULL, (uintptr_t)name, =
(uintptr_t)&value))
 		return (NULL);
=20
 	return (value);
@@ -493,7 +493,7 @@
 ub_env_set(const char *name, char *value)
 {
=20
-	syscall(API_ENV_SET, NULL, (uint32_t)name, (uint32_t)value);
+	syscall(API_ENV_SET, NULL, (uintptr_t)name, (uintptr_t)value);
 }
=20
 static char env_name[256];
@@ -510,7 +510,7 @@
 	 * internally, which handles such case
 	 */
 	env =3D NULL;
-	if (!syscall(API_ENV_ENUM, NULL, (uint32_t)last, =
(uint32_t)&env))
+	if (!syscall(API_ENV_ENUM, NULL, (uintptr_t)last, =
(uintptr_t)&env))
 		return (NULL);
=20
 	if (env =3D=3D NULL || last =3D=3D env)

--Apple-Mail=_F075A616-44A9-4C1F-98E9-03F8A745328B--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5A031837-F7D6-467F-A6B7-35B1F0A467D9>