mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
The system will default to old behaviour. See Kconfig in the root. I still wish to kill ELF mode very soon, however. LAR is a very capable format. With two simple extensions, we can use LAR to replace all that we are using ELF for now. This change can really make life better: 1. we can use streaming decompress instead of the current "uncompress elf to memory and then copy segments" approach. So we can get rid of THIS hardcode: #define UNCOMPRESS_AREA (0x400000) 2. A simple lar l can show ALL segments, including payload segments 3. It's really easy to see where things will go in memory, and catch problems 4. We can figure out an ELF input file is bogus BEFORE we flash, not AFTER we flash and try to boot it 5. did I mention streaming decompress? 6. We no longer have to worry about where we decompress the elf in memory (this problem was causing trouble when the payload was a linux kernel -- it was so big) 7. Since we have a load address, we can create this lar entry: normal/cmdline and specify that it be loaded at a place where linux will find it as the cmdline. 8. The decision on whether to XIP can be made in the LAR entry, not in hardcode. For example, if initram needs to be XIP, set the load address to 0xffffffff. Done. The change is simple. Add a load address and entry point to the lar header. Extend the lar tool to parse the elf file and create multiple lar segments. It looks like this: normal/payload0 (33192 bytes, lzma compressed to 18088 bytes @0x38 load @0x100000, entry 0x105258) normal/payload1 (72 bytes, lzma compressed to 47 bytes @0x4718 load @0x1225a0, entry 0x105258) normal/option_table (932 bytes @0x4798 load @0, entry 0) normal/stage2 (33308 bytes, lzma compressed to 15474 bytes @0x4b78 load @0, entry 0) normal/initram (4208 bytes @0x8828 load @0, entry 0) linuxbios.bootblock (16384 bytes @0xfc000 load @0, entry 0) note that the payload is now payload/segment0, payload/segment1, etc. I've extended linuxbios to look for these. Note that you can now see all the things that get loaded ;they're no longer hidden in an ELF header somewhere. Elf failures are gone! Note that I've left legacy elf support in, for now, but recommend we get rid of it as soon as possible. patch attached. This is a first pass. lar.c needs some refactoring but I want to get the cmdline going. You can now have a linux payload and it will uncompress with no problems. This has been tested with filo and BOCHS. This patch includes ONLY the lar changes, the other changes are next. Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@481 f3766cd6-281f-0410-b1cd-43a5c92072e9 |
||
---|---|---|
.. | ||
bootblock.c | ||
example.c | ||
lar.c | ||
lar.h | ||
lib.c | ||
lib.h | ||
Makefile | ||
README | ||
stream.c |
LinuxBIOS Archiver: lar ----------------------- Table of Contents - Introduction - Usage - Archive format - TODO - Copyright and License Introduction ------------ This is a simple archiver, similar to cpio, ar or tar. Design goals were - minimum overhead - maximum fault tolerance - simplicity For a usage example see example.c. For questions contact Stefan Reinauer <stepan@coresystems.de>. Usage ----- Create archive archive.lar containing files file1 ... fileN: $ lar c archive.lar file1 ... fileN Extract files from archive.lar: $ lar x archive.lar [file1 ... fileN] List files in archive: $ lar l archive.lar Archive format -------------- The rough format is: |--------------| | header | |--------------| | data | |--------------| | header | |--------------| | data | |--------------| ... Headers have to be 16 byte aligned. |----------------------------| | magic (8 bytes) | |----------------------------| | length (4 bytes) | |----------------------------| | checksum (4 bytes) | |----------------------------| | offset to blob (4 bytes) | |----------------------------| | "path name" | <-- null terminated, aligned to 16 bytes |----------------------------| | blob (aligned to 16 bytes) | |----------------------------| TODO ---- - Reading flash layouts - This does not enforce any alignment yet - Alignment enforcing will be optional Copyright and License --------------------- Copyright (C) 2006-2007 coresystems GmbH Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA Note: The files lar.h and example.c are dual-licensed. You can choose between: - The GNU GPL, version 2, as published by the Free Software Foundation. - The revised BSD license (without advertising clause). See lar.h.