v2/util: romfs -> cbfs rename
It's all sed here. romfs->cbfs, ROMFS->CBFS, romtool->cbfstool Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4110 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
450b23fb2e
commit
1d862ded11
|
@ -0,0 +1,8 @@
|
|||
rm coreboot.rom;
|
||||
./cbfstool coreboot.rom create 0x80000 0x10000 /tmp/coreboot.strip
|
||||
./cbfstool coreboot.rom add-payload /tmp/filo.elf normal/payload l
|
||||
./cbfstool coreboot.rom print
|
||||
#./cbfstool coreboot.rom add-stage /tmp/filo.elf normal/payload
|
||||
|
||||
./cbfstool coreboot.rom print
|
||||
cp coreboot.rom /home/rminnich/qemutest/
|
|
@ -5,17 +5,17 @@
|
|||
obj ?= $(shell pwd)
|
||||
|
||||
COMMANDS=create.o bootblock.o delete.o add.o print.o resize.o
|
||||
OBJ=$(COMMANDS) romtool.o util.o fs.o
|
||||
INC=romtool.h romfs.h
|
||||
OBJ=$(COMMANDS) cbfstool.o util.o fs.o
|
||||
INC=cbfstool.h cbfs.h
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-g -Wall # -W -Werror
|
||||
|
||||
DESTDIR ?= /usr/local/bin
|
||||
|
||||
all: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
||||
all: $(obj)/cbfstool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
||||
|
||||
$(obj)/romtool: $(patsubst %,$(obj)/%,$(OBJ))
|
||||
$(obj)/cbfstool: $(patsubst %,$(obj)/%,$(OBJ))
|
||||
$(CC) -o $@ $(patsubst %,$(obj)/%,$(OBJ))
|
||||
|
||||
tobj = $(obj)/tools
|
||||
|
@ -26,9 +26,9 @@ include $(tsrc)/Makefile
|
|||
$(obj)/%.o: %.c $(INC)
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
install: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
||||
install: $(obj)/cbfstool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
|
||||
@ install -d $(DESTDIR)
|
||||
@ install -m 0755 $(obj)/romtool $(DESTDIR)/romtool
|
||||
@ install -m 0755 $(obj)/cbfstool $(DESTDIR)/cbfstool
|
||||
@ install -m 0755 $(obj)/tools/rom-mkstage $(DESTDIR)/rom-mkstage
|
||||
@ install -m 0755 $(obj)/tools/rom-mkpayload $(DESTDIR)/rom-mkpayload
|
||||
|
||||
|
@ -36,5 +36,5 @@ tags:
|
|||
ctags *.[ch] */*.[ch]
|
||||
|
||||
clean: tools-clean
|
||||
rm -f $(patsubst %,$(obj)/%,$(OBJ)) $(obj)/romtool
|
||||
rm -f $(patsubst %,$(obj)/%,$(OBJ)) $(obj)/cbfstool
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
Coreboot ROMFS Specification
|
||||
Coreboot CBFS Specification
|
||||
Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
|
||||
= Introduction =
|
||||
|
||||
This document describes the coreboot ROMFS specification (from here referred
|
||||
to as ROMFS). ROMFS is a scheme for managing independent chunks of data in
|
||||
This document describes the coreboot CBFS specification (from here referred
|
||||
to as CBFS). CBFS is a scheme for managing independent chunks of data in
|
||||
a system ROM. Though not a true filesystem, the style and concepts are
|
||||
similar.
|
||||
|
||||
= Architecture =
|
||||
|
||||
The ROMFS architecture looks like the following:
|
||||
The CBFS architecture looks like the following:
|
||||
|
||||
/---------------\ <-- Start of ROM
|
||||
| /-----------\ | --|
|
||||
|
@ -41,7 +41,7 @@ The ROMFS architecture looks like the following:
|
|||
\---------------/
|
||||
|
||||
|
||||
The ROMFS architecture consists of a binary associated with a physical
|
||||
The CBFS architecture consists of a binary associated with a physical
|
||||
ROM disk referred hereafter as the ROM. A number of independent of
|
||||
components, each with a header prepended on to data are located within
|
||||
the ROM. The components are nominally arranged sequentially, though they
|
||||
|
@ -50,12 +50,12 @@ are aligned along a pre-defined boundary.
|
|||
The bootblock occupies the last 20k of the ROM. Within
|
||||
the bootblock is a master header containing information about the ROM
|
||||
including the size, alignment of the components, and the offset of the
|
||||
start of the first ROMFS component within the ROM.
|
||||
start of the first CBFS component within the ROM.
|
||||
|
||||
= Master Header =
|
||||
|
||||
The master header contains essential information about the ROM that is
|
||||
used by both the ROMFS implementation within coreboot at runtime as well
|
||||
used by both the CBFS implementation within coreboot at runtime as well
|
||||
as host based utilities to create and manage the ROM. The master header
|
||||
will be located somewhere within the bootblock (high end of the ROM). A
|
||||
pointer to the location of the header will be located at offset
|
||||
|
@ -67,7 +67,7 @@ need to read the pointer and do the appropriate math to locate the header.
|
|||
|
||||
The following is the structure of the master header:
|
||||
|
||||
struct romfs_header {
|
||||
struct cbfs_header {
|
||||
unsigned int magic;
|
||||
unsigned int version;
|
||||
unsigned int romsize;
|
||||
|
@ -79,10 +79,10 @@ struct romfs_header {
|
|||
|
||||
The meaning of each member is as follows:
|
||||
|
||||
'magic' is a 32 bit number that identifies the ROM as a ROMFS type. The magic
|
||||
'magic' is a 32 bit number that identifies the ROM as a CBFS type. The magic
|
||||
number is 0x4F524243, which is 'ORBC' in ASCII.
|
||||
|
||||
'version' is a 32 bit number that identifies the version of ROMFS. The current
|
||||
'version' is a 32 bit number that identifies the version of CBFS. The current
|
||||
version is 0x31313131 ('1111' in ASCII) which is endian-independent.
|
||||
|
||||
'romsize' is the size of the ROM in bytes. Coreboot will subtract 'size' from
|
||||
|
@ -96,7 +96,7 @@ ROM. This is used to make sure that each component is aligned correctly with
|
|||
regards to the erase block sizes on the ROM - allowing one to replace a
|
||||
component at runtime without disturbing the others.
|
||||
|
||||
'offset' is the offset of the the first ROMFS component (from the start of
|
||||
'offset' is the offset of the the first CBFS component (from the start of
|
||||
the ROM). This is to allow for arbitrary space to be left at the beginning
|
||||
of the ROM for things like embedded controller firmware.
|
||||
|
||||
|
@ -111,19 +111,19 @@ firmware. The bootblock does not have a component header attached to it.
|
|||
|
||||
= Components =
|
||||
|
||||
ROMFS components are placed in the ROM starting at 'offset' specified in
|
||||
CBFS components are placed in the ROM starting at 'offset' specified in
|
||||
the master header and ending at the bootblock. Thus the total size available
|
||||
for components in the ROM is (ROM size - bootblocksize - 'offset'). Each ROMFS
|
||||
for components in the ROM is (ROM size - bootblocksize - 'offset'). Each CBFS
|
||||
component is to be aligned according to the 'align' value in the header.
|
||||
Thus, if a component of size 1052 is located at offset 0 with an 'align' value
|
||||
of 1024, the next component will be located at offset 2048.
|
||||
|
||||
Each ROMFS component will be indexed with a unique ASCII string name of
|
||||
Each CBFS component will be indexed with a unique ASCII string name of
|
||||
unlimited size.
|
||||
|
||||
Each ROMFS component starts with a header:
|
||||
Each CBFS component starts with a header:
|
||||
|
||||
struct ROMFS_file {
|
||||
struct CBFS_file {
|
||||
char magic[8];
|
||||
unsigned int len;
|
||||
unsigned int type;
|
||||
|
@ -155,7 +155,7 @@ structure of the header:
|
|||
|
||||
/--------\ <- start
|
||||
| Header |
|
||||
|--------| <- sizeof(struct romfs_file)
|
||||
|--------| <- sizeof(struct cbfs_file)
|
||||
| Name |
|
||||
|--------| <- 'offset'
|
||||
| Data |
|
||||
|
@ -165,25 +165,25 @@ structure of the header:
|
|||
== Searching Alogrithm ==
|
||||
|
||||
To locate a specific component in the ROM, one starts at the 'offset'
|
||||
specified in the ROMFS master header. For this example, the offset will
|
||||
specified in the CBFS master header. For this example, the offset will
|
||||
be 0.
|
||||
|
||||
From that offset, the code should search for the magic string on the
|
||||
component, jumping 'align' bytes each time. So, assuming that 'align' is
|
||||
16, the code will search for the string 'LARCHIVE' at offset 0, 16, 32, etc.
|
||||
If the offset ever exceeds the allowable range for ROMFS components, then no
|
||||
If the offset ever exceeds the allowable range for CBFS components, then no
|
||||
component was found.
|
||||
|
||||
Upon recognizing a component, the software then has to search for the
|
||||
specific name of the component. This is accomplished by comparing the
|
||||
desired name with the string on the component located at
|
||||
offset + sizeof(struct romfs_file). If the string matches, then the component
|
||||
offset + sizeof(struct cbfs_file). If the string matches, then the component
|
||||
has been located, otherwise the software should add 'offset' + 'len' to
|
||||
the offset and resume the search for the magic value.
|
||||
|
||||
== Data Types ==
|
||||
|
||||
The 'type' member of struct romfs_file is used to identify the content
|
||||
The 'type' member of struct cbfs_file is used to identify the content
|
||||
of the component data, and is used by coreboot and other
|
||||
run-time entities to make decisions about how to handle the data.
|
||||
|
||||
|
@ -214,7 +214,7 @@ The following is the format of a stage component:
|
|||
|
||||
The header is defined as:
|
||||
|
||||
struct romfs_stage {
|
||||
struct cbfs_stage {
|
||||
unsigned int compression;
|
||||
unsigned long long entry;
|
||||
unsigned long long load;
|
||||
|
@ -273,8 +273,8 @@ The following is the format of a stage component:
|
|||
|
||||
The header is as follows:
|
||||
|
||||
struct romfs_payload {
|
||||
struct romfs_payload_segment segments;
|
||||
struct cbfs_payload {
|
||||
struct cbfs_payload_segment segments;
|
||||
}
|
||||
|
||||
The header contains a number of segments corresponding to the segments
|
||||
|
@ -282,7 +282,7 @@ that need to be loaded for the payload.
|
|||
|
||||
The following is the structure of each segment header:
|
||||
|
||||
struct romfs_payload_segment {
|
||||
struct cbfs_payload_segment {
|
||||
unsigned int type;
|
||||
unsigned int compression;
|
||||
unsigned int offset;
|
|
@ -1,4 +1,4 @@
|
|||
Add interactive mode
|
||||
Add script mode (./romtool [ROM] -s script)
|
||||
Add script mode (./cbfstool [ROM] -s script)
|
||||
Support compression for stages and payloads
|
||||
Add nrv2b
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -26,7 +26,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
#define MAX_PATH 255
|
||||
|
||||
|
@ -221,7 +221,7 @@ void add_payload_usage(void)
|
|||
|
||||
int add_handler(struct rom *rom, int argc, char **argv)
|
||||
{
|
||||
unsigned int type = ROMFS_COMPONENT_NULL;
|
||||
unsigned int type = CBFS_COMPONENT_NULL;
|
||||
|
||||
if (argc < 2) {
|
||||
add_usage();
|
||||
|
@ -240,7 +240,7 @@ int add_handler(struct rom *rom, int argc, char **argv)
|
|||
type = strtoul(argv[2], 0, 0);
|
||||
}
|
||||
|
||||
if (type == ROMFS_COMPONENT_NULL)
|
||||
if (type == CBFS_COMPONENT_NULL)
|
||||
WARN("No file type was given for %s - using default\n",
|
||||
argv[0]);
|
||||
|
||||
|
@ -250,18 +250,18 @@ int add_handler(struct rom *rom, int argc, char **argv)
|
|||
char *find_tool(char *tool)
|
||||
{
|
||||
static char toolpath[MAX_PATH];
|
||||
extern char romtool_bindir[];
|
||||
extern char cbfstool_bindir[];
|
||||
|
||||
snprintf(toolpath, MAX_PATH - 1, "tools/%s", tool);
|
||||
if (!access(toolpath, X_OK))
|
||||
return toolpath;
|
||||
|
||||
snprintf(toolpath, MAX_PATH - 1, "%s/tools/%s", romtool_bindir, tool);
|
||||
snprintf(toolpath, MAX_PATH - 1, "%s/tools/%s", cbfstool_bindir, tool);
|
||||
|
||||
if (!access(toolpath, X_OK))
|
||||
return toolpath;
|
||||
|
||||
snprintf(toolpath, MAX_PATH - 1, "%s/%s", romtool_bindir, tool);
|
||||
snprintf(toolpath, MAX_PATH - 1, "%s/%s", cbfstool_bindir, tool);
|
||||
|
||||
if (!access(toolpath, X_OK))
|
||||
return toolpath;
|
||||
|
@ -294,7 +294,7 @@ int add_payload_handler(struct rom *rom, int argc, char **argv)
|
|||
}
|
||||
|
||||
return fork_tool_and_add(rom, find_tool("rom-mkpayload"), argv[0],
|
||||
argv[1], ROMFS_COMPONENT_PAYLOAD, argc - 2,
|
||||
argv[1], CBFS_COMPONENT_PAYLOAD, argc - 2,
|
||||
argc > 2 ? &argv[2] : NULL);
|
||||
}
|
||||
|
||||
|
@ -322,6 +322,6 @@ int add_stage_handler(struct rom *rom, int argc, char **argv)
|
|||
}
|
||||
|
||||
return fork_tool_and_add(rom, find_tool("rom-mkstage"), argv[0],
|
||||
argv[1], ROMFS_COMPONENT_STAGE, argc - 2,
|
||||
argv[1], CBFS_COMPONENT_STAGE, argc - 2,
|
||||
argc > 2 ? &argv[2] : NULL);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -20,7 +20,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
void bootblock_usage(void)
|
||||
{
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -17,30 +17,30 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _ROMFS_H_
|
||||
#define _ROMFS_H_
|
||||
#ifndef _CBFS_H_
|
||||
#define _CBFS_H_
|
||||
|
||||
/** These are standard values for the known compression
|
||||
alogrithms that coreboot knows about for stages and
|
||||
payloads. Of course, other LAR users can use whatever
|
||||
values they want, as long as they understand them. */
|
||||
|
||||
#define ROMFS_COMPRESS_NONE 0
|
||||
#define ROMFS_COMPRESS_LZMA 1
|
||||
#define ROMFS_COMPRESS_NRV2B 2
|
||||
#define CBFS_COMPRESS_NONE 0
|
||||
#define CBFS_COMPRESS_LZMA 1
|
||||
#define CBFS_COMPRESS_NRV2B 2
|
||||
|
||||
/** These are standard component types for well known
|
||||
components (i.e - those that coreboot needs to consume.
|
||||
Users are welcome to use any other value for their
|
||||
components */
|
||||
|
||||
#define ROMFS_COMPONENT_STAGE 0x10
|
||||
#define ROMFS_COMPONENT_PAYLOAD 0x20
|
||||
#define ROMFS_COMPONENT_OPTIONROM 0x30
|
||||
#define CBFS_COMPONENT_STAGE 0x10
|
||||
#define CBFS_COMPONENT_PAYLOAD 0x20
|
||||
#define CBFS_COMPONENT_OPTIONROM 0x30
|
||||
|
||||
#define ROMFS_COMPONENT_NULL 0xFFFFFFFF
|
||||
#define CBFS_COMPONENT_NULL 0xFFFFFFFF
|
||||
|
||||
/** this is the master romfs header - it need to be
|
||||
/** this is the master cbfs header - it need to be
|
||||
located somewhere in the bootblock. Where it
|
||||
actually lives is up to coreboot. A pointer to
|
||||
this header will live at 0xFFFFFFF4, so we can
|
||||
|
@ -51,7 +51,7 @@
|
|||
/* this is a version that gives the right answer in any endian-ness */
|
||||
#define VERSION1 0x31313131
|
||||
|
||||
struct romfs_header {
|
||||
struct cbfs_header {
|
||||
unsigned int magic;
|
||||
unsigned int version;
|
||||
unsigned int romsize;
|
||||
|
@ -61,7 +61,7 @@ struct romfs_header {
|
|||
unsigned int pad[2];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/** This is a component header - every entry in the ROMFS
|
||||
/** This is a component header - every entry in the CBFS
|
||||
will have this header.
|
||||
|
||||
This is how the component is arranged in the ROM:
|
||||
|
@ -78,7 +78,7 @@ struct romfs_header {
|
|||
|
||||
#define COMPONENT_MAGIC "LARCHIVE"
|
||||
|
||||
struct romfs_file {
|
||||
struct cbfs_file {
|
||||
char magic[8];
|
||||
unsigned int len;
|
||||
unsigned int type;
|
||||
|
@ -94,7 +94,7 @@ struct romfs_file {
|
|||
/** This is the sub-header for stage components. Stages are
|
||||
loaded by coreboot during the normal boot process */
|
||||
|
||||
struct romfs_stage {
|
||||
struct cbfs_stage {
|
||||
unsigned int compression; /** Compression type */
|
||||
unsigned long long entry; /** entry point */
|
||||
unsigned long long load; /** Where to load in memory */
|
||||
|
@ -105,7 +105,7 @@ struct romfs_stage {
|
|||
/** this is the sub-header for payload components. Payloads
|
||||
are loaded by coreboot at the end of the boot process */
|
||||
|
||||
struct romfs_payload_segment {
|
||||
struct cbfs_payload_segment {
|
||||
unsigned int type;
|
||||
unsigned int compression;
|
||||
unsigned int offset;
|
||||
|
@ -114,8 +114,8 @@ struct romfs_payload_segment {
|
|||
unsigned int mem_len;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct romfs_payload {
|
||||
struct romfs_payload_segment segments;
|
||||
struct cbfs_payload {
|
||||
struct cbfs_payload_segment segments;
|
||||
};
|
||||
|
||||
#define PAYLOAD_SEGMENT_CODE 0x45444F43
|
||||
|
@ -124,6 +124,6 @@ struct romfs_payload {
|
|||
#define PAYLOAD_SEGMENT_PARAMS 0x41524150
|
||||
#define PAYLOAD_SEGMENT_ENTRY 0x52544E45
|
||||
|
||||
#define ROMFS_NAME(_c) (((unsigned char *) (_c)) + sizeof(struct romfs_file))
|
||||
#define CBFS_NAME(_c) (((unsigned char *) (_c)) + sizeof(struct cbfs_file))
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -18,9 +18,9 @@
|
|||
*/
|
||||
|
||||
/* v2 compat: First, assumes a 64K bootblock.
|
||||
* romtool coreboot.rom create 0x80000 coreboot.strip
|
||||
* romtool coreboot.rom add-payload /tmp/filo.elf payload
|
||||
* romtool coreboot.rom print
|
||||
* cbfstool coreboot.rom create 0x80000 coreboot.strip
|
||||
* cbfstool coreboot.rom add-payload /tmp/filo.elf payload
|
||||
* cbfstool coreboot.rom print
|
||||
*/
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <sys/mman.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
extern int create_handler(struct rom *, int, char **);
|
||||
extern int bootblock_handler(struct rom *, int, char **);
|
||||
|
@ -66,13 +66,13 @@ struct {
|
|||
|
||||
static struct rom rom;
|
||||
|
||||
char romtool_bindir[255];
|
||||
char cbfstool_bindir[255];
|
||||
|
||||
void show_help(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
printf("romtool [OPTION] [[FILE] [COMMAND] [PARAMETERS]...\n");
|
||||
printf("cbfstool [OPTION] [[FILE] [COMMAND] [PARAMETERS]...\n");
|
||||
printf("Apply COMMANDS with PARAMETERS to FILE. If no COMMAND is\n");
|
||||
printf("given, run in interactive mode\n\n");
|
||||
printf("OPTIONs:\n");
|
||||
|
@ -91,7 +91,7 @@ int main(int argc, char **argv)
|
|||
char *cmd;
|
||||
int ret = -1, i;
|
||||
|
||||
strncpy(romtool_bindir, dirname(argv[0]), 254);
|
||||
strncpy(cbfstool_bindir, dirname(argv[0]), 254);
|
||||
|
||||
while (1) {
|
||||
signed ch = getopt(argc, argv, "hC:");
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "romfs.h"
|
||||
#include "cbfs.h"
|
||||
|
||||
/* Definitions */
|
||||
|
||||
|
@ -36,7 +36,7 @@ struct rom {
|
|||
int size;
|
||||
int fssize;
|
||||
|
||||
struct romfs_header *header;
|
||||
struct cbfs_header *header;
|
||||
};
|
||||
|
||||
/* Macros */
|
||||
|
@ -47,8 +47,8 @@ struct rom {
|
|||
#define ROM_WRITEL(_r, _o, _v) do { *((unsigned int *) ROM_PTR((_r), (_o))) = (_v); } while(0)
|
||||
#define ROM_READL(_r, _o) *((unsigned int *) (ROM_PTR((_r), (_o))))
|
||||
|
||||
#define ERROR(err, args...) fprintf(stderr, "(romtool) E: " err, ##args)
|
||||
#define WARN(err, args...) fprintf(stderr, "(romtool) W: " err, ##args)
|
||||
#define ERROR(err, args...) fprintf(stderr, "(cbfstool) E: " err, ##args)
|
||||
#define WARN(err, args...) fprintf(stderr, "(cbfstool) W: " err, ##args)
|
||||
#define VERBOSE(str, args...) printf(str, ##args)
|
||||
|
||||
#define ALIGN(_v, _a) ( ( (_v) + ( (_a) - 1 ) ) & ~( (_a) - 1 ) )
|
||||
|
@ -66,9 +66,9 @@ int add_bootblock(struct rom *rom, const char *filename);
|
|||
|
||||
/* fs.c */
|
||||
|
||||
struct romfs_file *rom_find(struct rom *rom, unsigned int offset);
|
||||
struct romfs_file *rom_find_first(struct rom *);
|
||||
struct romfs_file *rom_find_next(struct rom *, struct romfs_file *);
|
||||
struct cbfs_file *rom_find(struct rom *rom, unsigned int offset);
|
||||
struct cbfs_file *rom_find_first(struct rom *);
|
||||
struct cbfs_file *rom_find_next(struct rom *, struct cbfs_file *);
|
||||
int rom_add(struct rom *rom, const char *name, void *, int size, int type);
|
||||
int rom_remove(struct rom *rom, const char *name);
|
||||
unsigned int rom_used_space(struct rom *rom);
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -20,7 +20,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
void create_usage(void)
|
||||
{
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -20,7 +20,7 @@
|
|||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
void delete_usage(void)
|
||||
{
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -18,13 +18,13 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
struct romfs_file *rom_find(struct rom *rom, unsigned int offset)
|
||||
struct cbfs_file *rom_find(struct rom *rom, unsigned int offset)
|
||||
{
|
||||
while (offset < rom->fssize) {
|
||||
struct romfs_file *c =
|
||||
(struct romfs_file *)ROM_PTR(rom, offset);
|
||||
struct cbfs_file *c =
|
||||
(struct cbfs_file *)ROM_PTR(rom, offset);
|
||||
|
||||
if (!strcmp(c->magic, COMPONENT_MAGIC))
|
||||
return c;
|
||||
|
@ -35,12 +35,12 @@ struct romfs_file *rom_find(struct rom *rom, unsigned int offset)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct romfs_file *rom_find_first(struct rom *rom)
|
||||
struct cbfs_file *rom_find_first(struct rom *rom)
|
||||
{
|
||||
return rom_find(rom, ntohl(rom->header->offset));
|
||||
}
|
||||
|
||||
struct romfs_file *rom_find_next(struct rom *rom, struct romfs_file *prev)
|
||||
struct cbfs_file *rom_find_next(struct rom *rom, struct cbfs_file *prev)
|
||||
{
|
||||
unsigned int offset = ROM_OFFSET(rom, prev);
|
||||
|
||||
|
@ -49,15 +49,15 @@ struct romfs_file *rom_find_next(struct rom *rom, struct romfs_file *prev)
|
|||
ntohl(rom->header->align)));
|
||||
}
|
||||
|
||||
struct romfs_file *rom_find_empty(struct rom *rom)
|
||||
struct cbfs_file *rom_find_empty(struct rom *rom)
|
||||
{
|
||||
unsigned int offset = ntohl(rom->header->offset);
|
||||
unsigned int ret = ntohl(rom->header->offset);
|
||||
|
||||
while (offset < rom->fssize) {
|
||||
|
||||
struct romfs_file *c =
|
||||
(struct romfs_file *)ROM_PTR(rom, offset);
|
||||
struct cbfs_file *c =
|
||||
(struct cbfs_file *)ROM_PTR(rom, offset);
|
||||
|
||||
if (!strcmp(c->magic, COMPONENT_MAGIC)) {
|
||||
offset += ALIGN(ntohl(c->offset) + ntohl(c->len),
|
||||
|
@ -69,15 +69,15 @@ struct romfs_file *rom_find_empty(struct rom *rom)
|
|||
}
|
||||
|
||||
return (ret < rom->fssize) ?
|
||||
(struct romfs_file *)ROM_PTR(rom, ret) : NULL;
|
||||
(struct cbfs_file *)ROM_PTR(rom, ret) : NULL;
|
||||
}
|
||||
|
||||
struct romfs_file *rom_find_by_name(struct rom *rom, const char *name)
|
||||
struct cbfs_file *rom_find_by_name(struct rom *rom, const char *name)
|
||||
{
|
||||
struct romfs_file *c = rom_find_first(rom);
|
||||
struct cbfs_file *c = rom_find_first(rom);
|
||||
|
||||
while (c) {
|
||||
if (!strcmp((char *)ROMFS_NAME(c), name))
|
||||
if (!strcmp((char *)CBFS_NAME(c), name))
|
||||
return c;
|
||||
|
||||
c = rom_find_next(rom, c);
|
||||
|
@ -88,7 +88,7 @@ struct romfs_file *rom_find_by_name(struct rom *rom, const char *name)
|
|||
|
||||
unsigned int rom_used_space(struct rom *rom)
|
||||
{
|
||||
struct romfs_file *c = rom_find_first(rom);
|
||||
struct cbfs_file *c = rom_find_first(rom);
|
||||
unsigned int ret = 0;
|
||||
|
||||
while (c) {
|
||||
|
@ -101,8 +101,8 @@ unsigned int rom_used_space(struct rom *rom)
|
|||
|
||||
int rom_remove(struct rom *rom, const char *name)
|
||||
{
|
||||
struct romfs_file *c = rom_find_by_name(rom, name);
|
||||
struct romfs_file *n;
|
||||
struct cbfs_file *c = rom_find_by_name(rom, name);
|
||||
struct cbfs_file *n;
|
||||
int clear;
|
||||
|
||||
if (c == NULL) {
|
||||
|
@ -126,7 +126,7 @@ int rom_remove(struct rom *rom, const char *name)
|
|||
|
||||
int rom_add(struct rom *rom, const char *name, void *buffer, int size, int type)
|
||||
{
|
||||
struct romfs_file *c = rom_find_empty(rom);
|
||||
struct cbfs_file *c = rom_find_empty(rom);
|
||||
unsigned int offset;
|
||||
unsigned int csize;
|
||||
|
||||
|
@ -140,7 +140,7 @@ int rom_add(struct rom *rom, const char *name, void *buffer, int size, int type)
|
|||
return -1;
|
||||
}
|
||||
|
||||
csize = sizeof(struct romfs_file) + ALIGN(strlen(name), 16) + size;
|
||||
csize = sizeof(struct cbfs_file) + ALIGN(strlen(name), 16) + size;
|
||||
|
||||
offset = ROM_OFFSET(rom, c);
|
||||
|
||||
|
@ -154,14 +154,14 @@ int rom_add(struct rom *rom, const char *name, void *buffer, int size, int type)
|
|||
|
||||
strcpy(c->magic, COMPONENT_MAGIC);
|
||||
|
||||
csize = sizeof(struct romfs_file) + ALIGN(strlen(name) + 1, 16);
|
||||
csize = sizeof(struct cbfs_file) + ALIGN(strlen(name) + 1, 16);
|
||||
|
||||
c->len = htonl(size);
|
||||
c->offset = htonl(csize);
|
||||
c->type = htonl(type);
|
||||
|
||||
memset(ROMFS_NAME(c), 0, ALIGN(strlen(name) + 1, 16));
|
||||
strcpy((char *)ROMFS_NAME(c), name);
|
||||
memset(CBFS_NAME(c), 0, ALIGN(strlen(name) + 1, 16));
|
||||
strcpy((char *)CBFS_NAME(c), name);
|
||||
|
||||
memcpy(((unsigned char *)c) + csize, buffer, size);
|
||||
return 0;
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
void print_usage(void)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ int print_handler(struct rom *rom, int argc, char **argv)
|
|||
ntohl(rom->header->bootblocksize), ntohl(rom->header->romsize), ntohl(rom->header->offset));
|
||||
printf("Alignment: %d bytes\n\n", ntohl(rom->header->align));
|
||||
|
||||
struct romfs_file *c = rom_find_first(rom);
|
||||
struct cbfs_file *c = rom_find_first(rom);
|
||||
|
||||
printf("%-30s Offset %-12s Size\n", "Name", "Type");
|
||||
|
||||
|
@ -39,13 +39,13 @@ int print_handler(struct rom *rom, int argc, char **argv)
|
|||
char type[12];
|
||||
|
||||
switch (htonl(c->type)) {
|
||||
case ROMFS_COMPONENT_STAGE:
|
||||
case CBFS_COMPONENT_STAGE:
|
||||
strcpy(type, "stage");
|
||||
break;
|
||||
case ROMFS_COMPONENT_PAYLOAD:
|
||||
case CBFS_COMPONENT_PAYLOAD:
|
||||
strcpy(type, "payload");
|
||||
break;
|
||||
case ROMFS_COMPONENT_OPTIONROM:
|
||||
case CBFS_COMPONENT_OPTIONROM:
|
||||
strcpy(type, "optionrom");
|
||||
break;
|
||||
default:
|
||||
|
@ -53,7 +53,7 @@ int print_handler(struct rom *rom, int argc, char **argv)
|
|||
break;
|
||||
}
|
||||
|
||||
printf("%-30s 0x%-8x %-12s %d\n", ROMFS_NAME(c),
|
||||
printf("%-30s 0x%-8x %-12s %d\n", CBFS_NAME(c),
|
||||
ROM_OFFSET(rom, c), type, htonl(c->len));
|
||||
|
||||
c = rom_find_next(rom, c);
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
void resize_usage(void)
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ int resize_handler(struct rom *rom, int argc, char **argv)
|
|||
/* We only have to rewrite the entries if the alignment changed */
|
||||
|
||||
if (align != ntohl(rom->header->align)) {
|
||||
struct romfs_file *c;
|
||||
struct cbfs_file *c;
|
||||
|
||||
/* The first entry doesn't have to move */
|
||||
|
||||
|
@ -97,7 +97,7 @@ int resize_handler(struct rom *rom, int argc, char **argv)
|
|||
offset = rom->header->offset;
|
||||
|
||||
while (c) {
|
||||
struct romfs_file *n = rom_find_next(rom, c);
|
||||
struct cbfs_file *n = rom_find_next(rom, c);
|
||||
unsigned int next;
|
||||
|
||||
if (n == NULL)
|
||||
|
@ -113,7 +113,7 @@ int resize_handler(struct rom *rom, int argc, char **argv)
|
|||
memmove(ROM_PTR(rom, next), n,
|
||||
ntohl(n->offset) + ntohl(n->len));
|
||||
|
||||
c = (struct romfs_file *)ROM_PTR(rom, next);
|
||||
c = (struct cbfs_file *)ROM_PTR(rom, next);
|
||||
|
||||
/* If the previous header wasn't overwritten by the change,
|
||||
corrupt the header so we don't accidently find it */
|
||||
|
@ -133,7 +133,7 @@ int resize_handler(struct rom *rom, int argc, char **argv)
|
|||
|
||||
offset = ROM_READL(rom, size - 12);
|
||||
|
||||
rom->header = (struct romfs_header *)
|
||||
rom->header = (struct cbfs_header *)
|
||||
ROM_PTR(rom, size - (0xFFFFFFFF - offset) - 1);
|
||||
|
||||
/* Put the new values in the header */
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
|
@ -1,3 +1,3 @@
|
|||
The contents of this directory are extracted from
|
||||
the official LZMA SDK, version lzma442.tar.bz2 ,
|
||||
for the use in mkcromfs.
|
||||
for the use in mkccbfs.
|
|
@ -28,7 +28,7 @@
|
|||
#include <arpa/inet.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "../romfs.h"
|
||||
#include "../cbfs.h"
|
||||
|
||||
int parse_elf(unsigned char *input, unsigned char **output, int algo,
|
||||
void (*compress) (char *, int, char *, int *))
|
||||
|
@ -43,7 +43,7 @@ int parse_elf(unsigned char *input, unsigned char **output, int algo,
|
|||
int segments = 1;
|
||||
int isize = 0, osize = 0;
|
||||
int doffset = 0;
|
||||
struct romfs_payload_segment *segs;
|
||||
struct cbfs_payload_segment *segs;
|
||||
int i;
|
||||
|
||||
ehdr = (Elf32_Ehdr *) input;
|
||||
|
@ -93,14 +93,14 @@ int parse_elf(unsigned char *input, unsigned char **output, int algo,
|
|||
/* Allocate a block of memory to store the data in */
|
||||
|
||||
sptr =
|
||||
calloc((segments * sizeof(struct romfs_payload_segment)) + isize,
|
||||
calloc((segments * sizeof(struct cbfs_payload_segment)) + isize,
|
||||
1);
|
||||
doffset = (segments * sizeof(struct romfs_payload_segment));
|
||||
doffset = (segments * sizeof(struct cbfs_payload_segment));
|
||||
|
||||
if (sptr == NULL)
|
||||
goto err;
|
||||
|
||||
segs = (struct romfs_payload_segment *)sptr;
|
||||
segs = (struct cbfs_payload_segment *)sptr;
|
||||
segments = 0;
|
||||
|
||||
for (i = 0; i < ehdr->e_shnum; i++) {
|
||||
|
@ -182,7 +182,7 @@ int parse_elf(unsigned char *input, unsigned char **output, int algo,
|
|||
|
||||
*output = sptr;
|
||||
|
||||
return (segments * sizeof(struct romfs_payload_segment)) + osize;
|
||||
return (segments * sizeof(struct cbfs_payload_segment)) + osize;
|
||||
|
||||
err:
|
||||
return -1;
|
||||
|
@ -218,10 +218,10 @@ int main(int argc, char **argv)
|
|||
output = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
algo = ROMFS_COMPRESS_LZMA;
|
||||
algo = CBFS_COMPRESS_LZMA;
|
||||
break;
|
||||
case 'n':
|
||||
algo = ROMFS_COMPRESS_NONE;
|
||||
algo = CBFS_COMPRESS_NONE;
|
||||
break;
|
||||
default:
|
||||
//usage();
|
||||
|
@ -245,10 +245,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
switch (algo) {
|
||||
case ROMFS_COMPRESS_NONE:
|
||||
case CBFS_COMPRESS_NONE:
|
||||
compress = none_compress;
|
||||
break;
|
||||
case ROMFS_COMPRESS_LZMA:
|
||||
case CBFS_COMPRESS_LZMA:
|
||||
compress = lzma_compress;
|
||||
break;
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "../romfs.h"
|
||||
#include "../cbfs.h"
|
||||
|
||||
int parse_elf(unsigned char *input, unsigned char **output,
|
||||
int mode, void (*compress) (char *, int, char *, int *))
|
||||
|
@ -40,7 +40,7 @@ int parse_elf(unsigned char *input, unsigned char **output,
|
|||
|
||||
int headers;
|
||||
int i;
|
||||
struct romfs_stage *stage;
|
||||
struct cbfs_stage *stage;
|
||||
unsigned int data_start, data_end, mem_end;
|
||||
|
||||
headers = ehdr->e_phnum;
|
||||
|
@ -107,14 +107,14 @@ int parse_elf(unsigned char *input, unsigned char **output,
|
|||
}
|
||||
|
||||
/* Now make the output buffer */
|
||||
out = calloc(sizeof(struct romfs_stage) + data_end - data_start, 1);
|
||||
out = calloc(sizeof(struct cbfs_stage) + data_end - data_start, 1);
|
||||
|
||||
if (out == NULL) {
|
||||
fprintf(stderr, "E: Unable to allocate memory: %m\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
stage = (struct romfs_stage *)out;
|
||||
stage = (struct cbfs_stage *)out;
|
||||
|
||||
stage->load = data_start;
|
||||
stage->memlen = mem_end - data_start;
|
||||
|
@ -122,18 +122,18 @@ int parse_elf(unsigned char *input, unsigned char **output,
|
|||
stage->entry = ehdr->e_entry;
|
||||
|
||||
compress(buffer, data_end - data_start,
|
||||
(char *)(out + sizeof(struct romfs_stage)),
|
||||
(char *)(out + sizeof(struct cbfs_stage)),
|
||||
(int *)&stage->len);
|
||||
|
||||
*output = out;
|
||||
|
||||
return sizeof(struct romfs_stage) + stage->len;
|
||||
return sizeof(struct cbfs_stage) + stage->len;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void (*compress) (char *, int, char *, int *);
|
||||
int algo = ROMFS_COMPRESS_LZMA;
|
||||
int algo = CBFS_COMPRESS_LZMA;
|
||||
|
||||
char *output = NULL;
|
||||
char *input = NULL;
|
||||
|
@ -160,10 +160,10 @@ int main(int argc, char **argv)
|
|||
output = optarg;
|
||||
break;
|
||||
case 'l':
|
||||
algo = ROMFS_COMPRESS_LZMA;
|
||||
algo = CBFS_COMPRESS_LZMA;
|
||||
break;
|
||||
case 'n':
|
||||
algo = ROMFS_COMPRESS_NONE;
|
||||
algo = CBFS_COMPRESS_NONE;
|
||||
break;
|
||||
default:
|
||||
//usage();
|
||||
|
@ -185,10 +185,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
switch (algo) {
|
||||
case ROMFS_COMPRESS_NONE:
|
||||
case CBFS_COMPRESS_NONE:
|
||||
compress = none_compress;
|
||||
break;
|
||||
case ROMFS_COMPRESS_LZMA:
|
||||
case CBFS_COMPRESS_LZMA:
|
||||
compress = lzma_compress;
|
||||
break;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
static const struct {
|
||||
char *type;
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* romtool
|
||||
* cbfstool
|
||||
*
|
||||
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
|
||||
*
|
||||
|
@ -23,7 +23,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mman.h>
|
||||
#include "romtool.h"
|
||||
#include "cbfstool.h"
|
||||
|
||||
int get_size(const char *size)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ int open_rom(struct rom *rom, const char *filename)
|
|||
|
||||
offset = ROM_READL(rom, s.st_size - 4);
|
||||
|
||||
rom->header = (struct romfs_header *)
|
||||
rom->header = (struct cbfs_header *)
|
||||
ROM_PTR(rom, s.st_size - (0xFFFFFFFF - offset) - 1);
|
||||
|
||||
if (ntohl(rom->header->magic) != HEADER_MAGIC) {
|
||||
|
@ -205,11 +205,11 @@ int create_rom(struct rom *rom, const unsigned char *filename,
|
|||
memset(rom->ptr + rom->size - 16, 0, 16);
|
||||
|
||||
ROM_WRITEL(rom, rom->size - 4,
|
||||
0xFFFFFFF0 - sizeof(struct romfs_header));
|
||||
0xFFFFFFF0 - sizeof(struct cbfs_header));
|
||||
|
||||
/* This is a pointer to the header for easy access */
|
||||
rom->header = (struct romfs_header *)
|
||||
ROM_PTR(rom, rom->size - 16 - sizeof(struct romfs_header));
|
||||
rom->header = (struct cbfs_header *)
|
||||
ROM_PTR(rom, rom->size - 16 - sizeof(struct cbfs_header));
|
||||
|
||||
rom->header->magic = htonl(HEADER_MAGIC);
|
||||
rom->header->romsize = htonl(romsize);
|
||||
|
@ -226,7 +226,7 @@ int add_bootblock(struct rom *rom, const char *filename)
|
|||
//unsigned int offset;
|
||||
int fd = size_and_open(filename, &size);
|
||||
int ret;
|
||||
struct romfs_header tmp;
|
||||
struct cbfs_header tmp;
|
||||
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
|
@ -238,7 +238,7 @@ int add_bootblock(struct rom *rom, const char *filename)
|
|||
}
|
||||
|
||||
/* Copy the current header into a temporary buffer */
|
||||
memcpy(&tmp, rom->header, sizeof(struct romfs_header));
|
||||
memcpy(&tmp, rom->header, sizeof(struct cbfs_header));
|
||||
|
||||
/* Copy the bootblock into place at the end of the file */
|
||||
|
||||
|
@ -254,22 +254,22 @@ int add_bootblock(struct rom *rom, const char *filename)
|
|||
/* FIXME: This should point to a location defined by coreboot */
|
||||
|
||||
ROM_WRITEL(rom, rom->size - 4,
|
||||
0xFFFFFFF0 - sizeof(struct romfs_header));
|
||||
0xFFFFFFF0 - sizeof(struct cbfs_header));
|
||||
|
||||
/* This is a pointer to the header for easy access */
|
||||
rom->header = (struct romfs_header *)
|
||||
ROM_PTR(rom, rom->size - 16 - sizeof(struct romfs_header));
|
||||
rom->header = (struct cbfs_header *)
|
||||
ROM_PTR(rom, rom->size - 16 - sizeof(struct cbfs_header));
|
||||
|
||||
#if 0
|
||||
/* Figure out the new location for the header */
|
||||
offset = ROM_READL(rom, rom->size - 4);
|
||||
|
||||
rom->header = (struct romfs_header *)
|
||||
rom->header = (struct cbfs_header *)
|
||||
ROM_PTR(rom, offset - (0xFFFFFFFF - rom->size));
|
||||
#endif
|
||||
|
||||
/* Replace the LAR header */
|
||||
memcpy(rom->header, &tmp, sizeof(struct romfs_header));
|
||||
memcpy(rom->header, &tmp, sizeof(struct cbfs_header));
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
rm coreboot.rom;
|
||||
./romtool coreboot.rom create 0x80000 0x10000 /tmp/coreboot.strip
|
||||
./romtool coreboot.rom add-payload /tmp/filo.elf normal/payload l
|
||||
./romtool coreboot.rom print
|
||||
#./romtool coreboot.rom add-stage /tmp/filo.elf normal/payload
|
||||
|
||||
./romtool coreboot.rom print
|
||||
cp coreboot.rom /home/rminnich/qemutest/
|
Loading…
Reference in New Issue