-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
raj
authored and
raj
committed
Oct 14, 2008
1 parent
556a646
commit 745c5c7
Showing
15 changed files
with
518 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/*- | ||
* Copyright (C) 2006-2008 Semihalf, Marian Balakowicz <m8@semihalf.com> | ||
* 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 ``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 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$ | ||
*/ | ||
|
||
#ifndef _MACHINE_BOOTINFO_H_ | ||
#define _MACHINE_BOOTINFO_H_ | ||
|
||
#if !defined(LOCORE) | ||
|
||
/* Platform hardware spec, received from loader(8) */ | ||
|
||
#define BI_VERSION 1 | ||
|
||
struct bi_mem_region { | ||
vm_paddr_t mem_base; | ||
vm_size_t mem_size; | ||
}; | ||
|
||
struct bi_eth_addr { | ||
u_int8_t mac_addr[6]; | ||
u_int8_t padding[2]; | ||
}; | ||
|
||
struct bootinfo { | ||
u_int32_t bi_version; | ||
vm_offset_t bi_bar_base; | ||
u_int32_t bi_cpu_clk; | ||
u_int32_t bi_bus_clk; | ||
u_int8_t bi_mem_reg_no; | ||
u_int8_t bi_eth_addr_no; | ||
u_int8_t padding[2]; | ||
|
||
u_int8_t bi_data[1]; | ||
/* | ||
* The bi_data container is allocated in run time and has the | ||
* following layout: | ||
* | ||
* - bi_mem_reg_no elements of struct bi_mem_region | ||
* - bi_eth_addr_no elements of struct bi_eth_addr | ||
*/ | ||
}; | ||
|
||
extern struct bootinfo *bootinfo; | ||
|
||
struct bi_mem_region *bootinfo_mr(void); | ||
struct bi_eth_addr *bootinfo_eth(void); | ||
#endif | ||
|
||
#endif /* _MACHINE_BOOTINFO_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# $FreeBSD$ | ||
|
||
SUBDIR= | ||
SUBDIR= uboot | ||
|
||
.include <bsd.subdir.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# $FreeBSD$ | ||
|
||
PROG= ubldr | ||
NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH} | ||
BINDIR?= /boot | ||
INSTALLFLAGS= -b | ||
NO_MAN= | ||
WARNS?= 1 | ||
|
||
# Architecture-specific loader code | ||
SRCS= start.S conf.c vers.c | ||
|
||
LOADER_DISK_SUPPORT?= no | ||
LOADER_UFS_SUPPORT?= no | ||
LOADER_CD9660_SUPPORT?= no | ||
LOADER_EXT2FS_SUPPORT?= no | ||
LOADER_NET_SUPPORT?= yes | ||
LOADER_NFS_SUPPORT?= yes | ||
LOADER_TFTP_SUPPORT?= no | ||
LOADER_GZIP_SUPPORT?= no | ||
LOADER_BZIP2_SUPPORT?= no | ||
|
||
.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_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 !defined(NO_FORTH) | ||
# Enable BootForth | ||
BOOT_FORTH= yes | ||
CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm | ||
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 ${PROG}.help | ||
|
||
CFLAGS+= -ffreestanding | ||
|
||
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.arm | ||
|
||
# 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/ | ||
|
||
DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBSTAND} | ||
LDADD= ${LIBFICL} ${LIBUBOOT} -lstand | ||
|
||
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version | ||
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} | ||
|
||
${PROG}.help: help.common help.uboot | ||
cat ${.ALLSRC} | \ | ||
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} | ||
|
||
.PATH: ${.CURDIR}/../../forth | ||
FILES= ${PROG}.help | ||
|
||
.include <bsd.prog.mk> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/*- | ||
* 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_disk, | ||
#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_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 | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$FreeBSD$ |
Oops, something went wrong.