Commit Graph

52 Commits

Author SHA1 Message Date
Tim Kientzle
7beaf3ae9b Print kernel args as late as possible before jumping into kernel. 2013-02-23 20:27:03 +00:00
Tim Kientzle
3772ab21ab Clarify an error message. The addresses here are
really offsets within the primary mapped memory block
(which may not start at address zero).
2013-02-18 20:11:20 +00:00
Ian Lepore
33f9e1bd94 Do metadata relocation fixup on all loaded modules, not just the kernel.
Approved by:	cognet (mentor)
2013-01-30 23:49:36 +00:00
Oleksandr Tymoshenko
ee9b837148 - Implement "fdt mres" sub-command that prints reserved memory regions
- Add "fdt addr" subcommand that lets you specify preloaded blob address
- Do not pre-initialize blob for "fdt addr"
- Do not try to load dtb every time fdt subcommand is issued,
    do it only once
- Change the way DTB is passed to kernel. With introduction of "fdt addr"
    actual blob address can be not virtual but physical or reside in
    area higher then 64Mb. ubldr should create copy of it in kernel area
    and pass pointer to this newly allocated buffer which is guaranteed to work
    in kernel after switching on MMU.
- Convert memreserv FDT info to "memreserv" property of root node
    FDT uses /memreserve/ data to notify OS about reserved memory areas.
    Technically it's not real property, it's just data blob, sequence
    of <start, size> pairs where both start and size are 64-bit integers.
    It doesn't fit nicely with OF API we use in kernel, so in order to unify
    thing ubldr converts this data to "memreserve" property using the same
    format for addresses and sizes as /memory node.
2012-11-30 03:15:50 +00:00
Tim Kientzle
2462328ee0 Print kernel args when booting the kernel. 2012-11-25 18:22:53 +00:00
Andrey V. Elsukov
9add094157 Add the flags parameter to the disk_open() function and DISK_F_NOCACHE
flag, that disables the caching of partition tables metadata.
Use this flag for floppies in the libi386/biosdisk driver.
2012-10-21 12:14:58 +00:00
Andrey V. Elsukov
f9cd8b07a4 Almost each time when loader opens a file, this leads to calling
disk_open(). Very often this is called several times for one file.
This leads to reading partition table metadata for each call. To
reduce the number of disk I/O we have a simple block cache, but it
is very dumb and more than half of I/O operations related to reading
metadata, misses this cache.

Introduce new cache layer to resolve this problem. It is independent
and doesn't need initialization like bcache, and will work by default
for all loaders which use the new DISK API. A successful disk_open()
call to each new disk or partition produces new entry in the cache.
Even more, when disk was already open, now opening of any nested
partitions does not require reading top level partition table.
So, if without this cache, partition table metadata was read around
20-50 times during boot, now it reads only once. This affects the booting
from GPT and MBR from the UFS.
2012-09-29 16:47:56 +00:00
Andrey V. Elsukov
60dff4f9f8 Update according to the change of struct uboot_devdesc. 2012-09-09 11:37:17 +00:00
Andrey V. Elsukov
9efbc4f52e Build disk.c only when DISK_SUPPORT is enabled. 2012-09-09 11:34:27 +00:00
Andrey V. Elsukov
d958ec0ca3 Update uboot's disk driver to use new DISK API. 2012-09-09 11:33:06 +00:00
Andrey V. Elsukov
8be6260966 Use disk_fmtdev() and disk_parsedev() functions from the new DISK API. 2012-09-09 11:32:06 +00:00
Andrey V. Elsukov
6c96358f5f Make struct uboot_devdesc compatible with struct disk_devdesc. 2012-09-09 11:30:45 +00:00
Tim Kientzle
5f5ec09bfb Determine kernel load address dynamically from u-boot memory map.
The generic ELF loading code maps the kernel into low memory
by subtracting KERN_BASE.  So the copyin/copyout/readin functions
are always called with low addresses.  This code finds the largest
DRAM block from the U-Boot memory map and adds that base to
the addresses.

In particular, this fixes ubldr on AM3358, which has DRAM
mapped to 0x80000000 at power-on.
2012-05-20 18:07:35 +00:00
Grzegorz Bernacki
b91fab4255 Add architecture dependent code to support NAND Framework on Marvell SoCs.
Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-18 14:41:14 +00:00
Tim Kientzle
c3a9b90973 Access the device tree blob via copyin/copyout.
The code previously assumed that copyin/copyout did no
address translation and that the device tree blob could
be manipulated in-place (with only a few adjustments for
the ELF loader offset).  This isn't possible on all platforms,
so the revised code uses copyout() to copy the device tree
blob into a heap-allocated buffer and then updates the
device tree with copyout().  This isn't ideal, since it
bloats the loader memory usage, but seems the only feasible
approach (short of rewriting all of the fdt manipulation
routines).
2012-05-17 04:04:48 +00:00
Tim Kientzle
50ddc3c4f7 Ooops. Back out changes to main.c from r235094.
This change is specific to BeagleBone; I need to figure out how to
generalize this before committing.
2012-05-06 16:32:28 +00:00
Tim Kientzle
5bf877dace Don't call strcmp with a NULL pointer.
In particular, on the AM335x, which comes up with no memory
mapped to low addresses, dereferencing the NULL causes a crash.
2012-05-06 16:01:58 +00:00
Tim Kientzle
803a5133e8 Teach ubldr(8) about simple MBR partitioning. 2012-05-01 05:04:49 +00:00
Marius Strobl
3e18d022e4 Use the common/shared CRC-32 implementation instead of duplicating it.
MFC after:	1 week
2012-03-21 20:53:47 +00:00
Rafal Jaworowski
04296b6f18 Improve device tree blob (DTB) handling in loader(8).
Enable using the statically embedded blob from the kernel, if present. The KLD
loaded DTB takes precedence, but they are both recognized and handled in the
same way.

Submitted by:	Lukasz Wojcik
Obtained from:	Semihalf
MFC after:	1 week
2012-03-20 13:08:57 +00:00
Andreas Tobler
6bac4c3e6a Rename the linker emulation name for powerpc and powerc64. This is needed that
we can also use the upstream binutils linker where we have to have a unique
name for the FreeBSD emulation.
2011-11-19 19:25:57 +00:00
Warner Losh
f0e82e0b01 MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCH (which simplifies some powerpc/powerpc64 ifs) 2010-08-23 01:50:34 +00:00
Nathan Whitehorn
67167531f0 Provide support in loader for booting 64-bit PowerPC kernels. Like amd64,
64-bit PowerPC kernels are loaded by a 32-bit loader, since nearly all
powerpc64 firmwares execute in 32-bit mode.
2010-07-12 00:49:22 +00:00
Rafal Jaworowski
6031d0b167 Get rid of bootinfo for good in loader (U-Boot-based) and ARM.
For FDT-enabled platforms the device tree is a modern replacement for bootinfo
config data.
2010-07-11 21:11:23 +00:00
Rafal Jaworowski
29d268b567 Fix conditional FDT support in loader(8). 2010-06-13 12:46:32 +00:00
Rafal Jaworowski
04cb90189b Initial loader(8) support for Flattened Device Tree.
o This is disabled by default for now, and can be enabled using WITH_FDT at
  build time.

o Tested with ARM and PowerPC.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-05-25 15:21:39 +00:00
Rafal Jaworowski
a0e34aa0ab Mostly revert r200691. U-Boot syscall() entry point returns 1 on success. 2010-05-25 10:15:30 +00:00
Rafal Jaworowski
75770ded45 Use loader devices only when they initialized properly. 2010-05-25 09:59:53 +00:00
Rafal Jaworowski
3d5ffb0eb6 Minor style correction. 2010-02-25 15:30:26 +00:00
Rafal Jaworowski
04bfe19a09 Fix handling of GPT disk partition index.
Obtained from:	Semihalf
MFC after:	1 week
2010-02-25 15:29:41 +00:00
Rafal Jaworowski
f5b6b801e6 Let loader(8) for U-Boot use default storage more flexibly.
Obtained from:	Semihalf
MFC after:	1 week
2010-02-25 15:27:13 +00:00
Marcel Moolenaar
e7f42eade6 Fix ub_env_enum(): syscall() returns 0 when properly invoked. 2009-12-18 21:12:37 +00:00
Rafal Jaworowski
035622ef18 Provide an effective (relocated) address when building modules metadata.
This lets modules loaded dynamically in loader(8) work for U-Boot-based
platforms.

MFC after:	1 week
2009-11-19 16:25:41 +00:00
Antoine Brodin
18ca996c25 - Remove trailing ";" after if statement
- Remove #if 0 section that was never needed/used

Reviewed by:	raj@
MFC after:	1 month
2009-11-11 19:39:45 +00:00
Rafal Jaworowski
f439325342 Make GPT style partitiong endian-safe in U-Boot support library.
Submitted by:	Piotr Ziecik
Obtained from:	Semihalf
2009-06-03 16:28:29 +00:00
Marcel Moolenaar
7a6c5e0bb1 Fix NETIF_DEBUG compilation. 2009-05-30 19:28:38 +00:00
Rafal Jaworowski
91e8591acd GPT style partitioning for loader(8) with U-Boot support library (tested on
ARM).

Submitted by:	Piotr Ziecik kosmo ! semihalf dot com
2009-05-05 16:29:08 +00:00
Rafal Jaworowski
845a6f19d2 Improve style(9) in PowerPC U-Boot support lib. 2008-12-17 15:58:07 +00:00
Rafal Jaworowski
11cdd0c0c2 Initial storage functionality for U-Boot support library.
- Only non-sliced bsdlabel style partitioning is currently supported (but provisions
  are made towards GPT support, which should follow soon)
- Enable storage support in loader on ARM

Obtained from:	Semihalf
2008-11-19 17:34:28 +00:00
Rafal Jaworowski
0ed948780c 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
2008-10-14 10:11:14 +00:00
Rafal Jaworowski
0258b0bc1b Minor style(9) fixes for U-Boot API glue. 2008-10-04 13:19:15 +00:00
Rafal Jaworowski
4c0a9db94a U-Boot API glue improvements:
- extend ub_dev_read() and ub_dev_recv() so that the actual len and
  all error codes can be passed and processed properly; unify behaviour of
  these routines

- introduce syscall general error code (API_ESYSC)
2008-10-04 13:10:38 +00:00
Rafal Jaworowski
cf725aeb0b Improve loader support for U-Boot.
- add new diag commands: devinfo, sysinfo for U-Boot-style details about the system
  configuration
- better memory info summary
- style corrections

Obtained from:	Semihalf
2008-09-03 17:48:41 +00:00
Rafal Jaworowski
51e8f5a470 Make metadata.c shared across all platforms using U-Boot.
This will [soon] be needed for ARM.
2008-09-03 15:52:05 +00:00
Rafal Jaworowski
aa8fb78b88 Move U-Boot compatibility library to WARNS=2 level. 2008-09-03 15:39:50 +00:00
Ruslan Ermilov
042df2e2da Enable GCC stack protection (aka Propolice) for userland:
- It is opt-out for now so as to give it maximum testing, but it may be
  turned opt-in for stable branches depending on the consensus.  You
  can turn it off with WITHOUT_SSP.
- WITHOUT_SSP was previously used to disable the build of GNU libssp.
  It is harmless to steal the knob as SSP symbols have been provided
  by libc for a long time, GNU libssp should not have been much used.
- SSP is disabled in a few corners such as system bootstrap programs
  (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves.
- It should be safe to use -fstack-protector-all to build world, however
  libc will be automatically downgraded to -fstack-protector because it
  breaks rtld otherwise.
- This option is unavailable on ia64.

Enable GCC stack protection (aka Propolice) for kernel:
- It is opt-out for now so as to give it maximum testing.
- Do not compile your kernel with -fstack-protector-all, it won't work.

Submitted by:	Jeremie Le Hen <jeremie@le-hen.org>
2008-06-25 21:33:28 +00:00
David E. O'Brien
149c7c86d2 style(9) & style.Makefile(9)
Reviewed by:	raj
2008-03-13 17:54:21 +00:00
Rafal Jaworowski
7572ed5a08 Eliminate artificial increasing of 'netdev_opens' counter in loader's net_open().
This was introduced as a workaround long time ago for some Alpha firmware
(which is now gone), and actually prevented net_close() to ever be
called.

Certain firmwares (U-Boot) need local shutdown operations to be performed on a
network controller upon transaction end: such platform-specific hooks are
supposed to be called via netif_close() (from within net_close()).

This change effectively reverts the following CVS commit:

    sys/boot/common/dev_net.c

    revision 1.7
    date: 2000/05/13 15:40:46;  author: dfr;  state: Exp;  lines: +2 -1
    Only probe network settings on the first open of the network device.
    The alpha firmware takes a seriously long time to open the network device
    the first time.

Also suppress excessive output while netbooting via loader, unless debugging.

While there, make sys/boot/uboot more style(9) compliant.

Reviewed by:	imp
Approved by:	cognet (mentor)
2008-03-12 16:01:34 +00:00
Marcel Moolenaar
b8c02f17ea o Include glue.h
o  Support multiple memory regions.
2008-02-23 17:58:12 +00:00
Marcel Moolenaar
9dbb1b6e7d o Build libuboot with -msoft-float like everything else.
o  Move the API prototypes to a separate header (glue.h)
o  Allow the platform to hint libuboot about where to look
   for the API signature. The uboot_address variable is
   expected to be defined by the platform.
2008-02-23 17:56:17 +00:00