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
diff --git a/util/cbfstool/EXAMPLE b/util/cbfstool/EXAMPLE
new file mode 100644
index 0000000..e4e198e
--- /dev/null
+++ b/util/cbfstool/EXAMPLE
@@ -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/
diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile
new file mode 100644
index 0000000..71e0d3b
--- /dev/null
+++ b/util/cbfstool/Makefile
@@ -0,0 +1,40 @@
+#
+#
+#
+
+obj ?= $(shell pwd)
+
+COMMANDS=create.o bootblock.o delete.o add.o print.o resize.o
+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)/cbfstool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
+
+$(obj)/cbfstool: $(patsubst %,$(obj)/%,$(OBJ))
+ $(CC) -o $@ $(patsubst %,$(obj)/%,$(OBJ))
+
+tobj = $(obj)/tools
+tsrc = $(shell pwd)/tools
+
+include $(tsrc)/Makefile
+
+$(obj)/%.o: %.c $(INC)
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+install: $(obj)/cbfstool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
+ @ install -d $(DESTDIR)
+ @ 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
+
+tags:
+ ctags *.[ch] */*.[ch]
+
+clean: tools-clean
+ rm -f $(patsubst %,$(obj)/%,$(OBJ)) $(obj)/cbfstool
+
diff --git a/util/romtool/README b/util/cbfstool/README
similarity index 88%
rename from util/romtool/README
rename to util/cbfstool/README
index 10c5cdf..9c8e818 100644
--- a/util/romtool/README
+++ b/util/cbfstool/README
@@ -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 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 @@
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 @@
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 @@
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 @@
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 @@
= 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 @@
/--------\ <- start
| Header |
-|--------| <- sizeof(struct romfs_file)
+|--------| <- sizeof(struct cbfs_file)
| Name |
|--------| <- 'offset'
| Data |
@@ -165,25 +165,25 @@
== 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 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 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 @@
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;
diff --git a/util/romtool/TODO b/util/cbfstool/TODO
similarity index 62%
rename from util/romtool/TODO
rename to util/cbfstool/TODO
index 9889e90..0f8ed27 100644
--- a/util/romtool/TODO
+++ b/util/cbfstool/TODO
@@ -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
diff --git a/util/romtool/add.c b/util/cbfstool/add.c
similarity index 93%
rename from util/romtool/add.c
rename to util/cbfstool/add.c
index 3ffc74b..642d8ce 100644
--- a/util/romtool/add.c
+++ b/util/cbfstool/add.c
@@ -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 @@
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 @@
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 @@
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 @@
}
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 @@
}
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);
}
diff --git a/util/romtool/bootblock.c b/util/cbfstool/bootblock.c
similarity index 96%
rename from util/romtool/bootblock.c
rename to util/cbfstool/bootblock.c
index 4eaf16d..11f362c 100644
--- a/util/romtool/bootblock.c
+++ b/util/cbfstool/bootblock.c
@@ -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)
{
diff --git a/util/romtool/romfs.h b/util/cbfstool/cbfs.h
similarity index 82%
rename from util/romtool/romfs.h
rename to util/cbfstool/cbfs.h
index d0a9b5f..95159eb 100644
--- a/util/romtool/romfs.h
+++ b/util/cbfstool/cbfs.h
@@ -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 @@
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 @@
#define COMPONENT_MAGIC "LARCHIVE"
-struct romfs_file {
+struct cbfs_file {
char magic[8];
unsigned int len;
unsigned int type;
@@ -94,7 +94,7 @@
/** 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 @@
/** 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 @@
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 @@
#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
diff --git a/util/romtool/romtool.c b/util/cbfstool/cbfstool.c
similarity index 91%
rename from util/romtool/romtool.c
rename to util/cbfstool/cbfstool.c
index 0d4c103..b9915e3 100644
--- a/util/romtool/romtool.c
+++ b/util/cbfstool/cbfstool.c
@@ -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 @@
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 @@
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:");
diff --git a/util/romtool/romtool.h b/util/cbfstool/cbfstool.h
similarity index 83%
rename from util/romtool/romtool.h
rename to util/cbfstool/cbfstool.h
index ab083a6..43abb6c 100644
--- a/util/romtool/romtool.h
+++ b/util/cbfstool/cbfstool.h
@@ -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 @@
int size;
int fssize;
- struct romfs_header *header;
+ struct cbfs_header *header;
};
/* Macros */
@@ -47,8 +47,8 @@
#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 @@
/* 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);
diff --git a/util/romtool/create.c b/util/cbfstool/create.c
similarity index 97%
rename from util/romtool/create.c
rename to util/cbfstool/create.c
index b98e13b..23e7850 100644
--- a/util/romtool/create.c
+++ b/util/cbfstool/create.c
@@ -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)
{
diff --git a/util/romtool/delete.c b/util/cbfstool/delete.c
similarity index 96%
rename from util/romtool/delete.c
rename to util/cbfstool/delete.c
index 1189dc1..5185e83 100644
--- a/util/romtool/delete.c
+++ b/util/cbfstool/delete.c
@@ -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)
{
diff --git a/util/romtool/fs.c b/util/cbfstool/fs.c
similarity index 74%
rename from util/romtool/fs.c
rename to util/cbfstool/fs.c
index 200bc67..c5e9892 100644
--- a/util/romtool/fs.c
+++ b/util/cbfstool/fs.c
@@ -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 @@
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 @@
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 @@
}
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 @@
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 @@
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_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 @@
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 @@
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;
diff --git a/util/romtool/print.c b/util/cbfstool/print.c
similarity index 87%
rename from util/romtool/print.c
rename to util/cbfstool/print.c
index fb5d809..7eb9ee4 100644
--- a/util/romtool/print.c
+++ b/util/cbfstool/print.c
@@ -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 @@
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 @@
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 @@
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);
diff --git a/util/romtool/resize.c b/util/cbfstool/resize.c
similarity index 94%
rename from util/romtool/resize.c
rename to util/cbfstool/resize.c
index f08501a..1575156 100644
--- a/util/romtool/resize.c
+++ b/util/cbfstool/resize.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 @@
/* 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 @@
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 @@
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 @@
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 */
diff --git a/util/romtool/tools/Makefile b/util/cbfstool/tools/Makefile
similarity index 100%
rename from util/romtool/tools/Makefile
rename to util/cbfstool/tools/Makefile
diff --git a/util/romtool/tools/common.c b/util/cbfstool/tools/common.c
similarity index 99%
rename from util/romtool/tools/common.c
rename to util/cbfstool/tools/common.c
index d2aff46..377561b 100644
--- a/util/romtool/tools/common.c
+++ b/util/cbfstool/tools/common.c
@@ -1,5 +1,5 @@
/*
- * romtool
+ * cbfstool
*
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
*
diff --git a/util/romtool/tools/common.h b/util/cbfstool/tools/common.h
similarity index 98%
rename from util/romtool/tools/common.h
rename to util/cbfstool/tools/common.h
index 58230c6..146c828 100644
--- a/util/romtool/tools/common.h
+++ b/util/cbfstool/tools/common.h
@@ -1,5 +1,5 @@
/*
- * romtool
+ * cbfstool
*
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
*
diff --git a/util/romtool/tools/compress.c b/util/cbfstool/tools/compress.c
similarity index 98%
rename from util/romtool/tools/compress.c
rename to util/cbfstool/tools/compress.c
index d4cd152..fb8fe82 100644
--- a/util/romtool/tools/compress.c
+++ b/util/cbfstool/tools/compress.c
@@ -1,5 +1,5 @@
/*
- * romtool
+ * cbfstool
*
* Copyright (C) 2008 Jordan Crouse <jordan@cosmicpenguin.net>
*
diff --git a/util/romtool/tools/elf.h b/util/cbfstool/tools/elf.h
similarity index 100%
rename from util/romtool/tools/elf.h
rename to util/cbfstool/tools/elf.h
diff --git a/util/romtool/tools/lzma/C/7zip/Common/InBuffer.h b/util/cbfstool/tools/lzma/C/7zip/Common/InBuffer.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Common/InBuffer.h
rename to util/cbfstool/tools/lzma/C/7zip/Common/InBuffer.h
diff --git a/util/romtool/tools/lzma/C/7zip/Common/OutBuffer.cpp b/util/cbfstool/tools/lzma/C/7zip/Common/OutBuffer.cpp
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Common/OutBuffer.cpp
rename to util/cbfstool/tools/lzma/C/7zip/Common/OutBuffer.cpp
diff --git a/util/romtool/tools/lzma/C/7zip/Common/OutBuffer.h b/util/cbfstool/tools/lzma/C/7zip/Common/OutBuffer.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Common/OutBuffer.h
rename to util/cbfstool/tools/lzma/C/7zip/Common/OutBuffer.h
diff --git a/util/romtool/tools/lzma/C/7zip/Common/StdAfx.h b/util/cbfstool/tools/lzma/C/7zip/Common/StdAfx.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Common/StdAfx.h
rename to util/cbfstool/tools/lzma/C/7zip/Common/StdAfx.h
diff --git a/util/romtool/tools/lzma/C/7zip/Common/StreamUtils.cpp b/util/cbfstool/tools/lzma/C/7zip/Common/StreamUtils.cpp
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Common/StreamUtils.cpp
rename to util/cbfstool/tools/lzma/C/7zip/Common/StreamUtils.cpp
diff --git a/util/romtool/tools/lzma/C/7zip/Common/StreamUtils.h b/util/cbfstool/tools/lzma/C/7zip/Common/StreamUtils.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Common/StreamUtils.h
rename to util/cbfstool/tools/lzma/C/7zip/Common/StreamUtils.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree2.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree2.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree2.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree2.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree3.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree3.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree3.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree3.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree4.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree4.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree4.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTree4.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/BinTree/BinTreeMain.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/HashChain/HC4.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/HashChain/HC4.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/HashChain/HC4.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/HashChain/HC4.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/HashChain/HCMain.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/HashChain/HCMain.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/HashChain/HCMain.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/HashChain/HCMain.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/IMatchFinder.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.cpp b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.cpp
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.cpp
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.cpp
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/LZInWindow.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZ/StdAfx.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZ/StdAfx.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZ/StdAfx.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZ/StdAfx.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZMA/LZMA.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/LZMA.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZMA/LZMA.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/LZMA.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.cpp b/util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.cpp
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.cpp
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.cpp
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/LZMAEncoder.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/LZMA/StdAfx.h b/util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/StdAfx.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/LZMA/StdAfx.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/LZMA/StdAfx.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoder.h b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoder.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoder.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoder.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp
rename to util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.h b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBit.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBitTree.h b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBitTree.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBitTree.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderBitTree.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/RangeCoderOpt.h
diff --git a/util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/StdAfx.h b/util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/StdAfx.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Compress/RangeCoder/StdAfx.h
rename to util/cbfstool/tools/lzma/C/7zip/Compress/RangeCoder/StdAfx.h
diff --git a/util/romtool/tools/lzma/C/7zip/Decompress/LzmaDecode.c b/util/cbfstool/tools/lzma/C/7zip/Decompress/LzmaDecode.c
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Decompress/LzmaDecode.c
rename to util/cbfstool/tools/lzma/C/7zip/Decompress/LzmaDecode.c
diff --git a/util/romtool/tools/lzma/C/7zip/Decompress/LzmaDecode.h b/util/cbfstool/tools/lzma/C/7zip/Decompress/LzmaDecode.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/Decompress/LzmaDecode.h
rename to util/cbfstool/tools/lzma/C/7zip/Decompress/LzmaDecode.h
diff --git a/util/romtool/tools/lzma/C/7zip/ICoder.h b/util/cbfstool/tools/lzma/C/7zip/ICoder.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/ICoder.h
rename to util/cbfstool/tools/lzma/C/7zip/ICoder.h
diff --git a/util/romtool/tools/lzma/C/7zip/IStream.h b/util/cbfstool/tools/lzma/C/7zip/IStream.h
similarity index 100%
rename from util/romtool/tools/lzma/C/7zip/IStream.h
rename to util/cbfstool/tools/lzma/C/7zip/IStream.h
diff --git a/util/romtool/tools/lzma/C/Common/Alloc.cpp b/util/cbfstool/tools/lzma/C/Common/Alloc.cpp
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/Alloc.cpp
rename to util/cbfstool/tools/lzma/C/Common/Alloc.cpp
diff --git a/util/romtool/tools/lzma/C/Common/Alloc.h b/util/cbfstool/tools/lzma/C/Common/Alloc.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/Alloc.h
rename to util/cbfstool/tools/lzma/C/Common/Alloc.h
diff --git a/util/romtool/tools/lzma/C/Common/CRC.cpp b/util/cbfstool/tools/lzma/C/Common/CRC.cpp
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/CRC.cpp
rename to util/cbfstool/tools/lzma/C/Common/CRC.cpp
diff --git a/util/romtool/tools/lzma/C/Common/CRC.h b/util/cbfstool/tools/lzma/C/Common/CRC.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/CRC.h
rename to util/cbfstool/tools/lzma/C/Common/CRC.h
diff --git a/util/romtool/tools/lzma/C/Common/Defs.h b/util/cbfstool/tools/lzma/C/Common/Defs.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/Defs.h
rename to util/cbfstool/tools/lzma/C/Common/Defs.h
diff --git a/util/romtool/tools/lzma/C/Common/MyCom.h b/util/cbfstool/tools/lzma/C/Common/MyCom.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/MyCom.h
rename to util/cbfstool/tools/lzma/C/Common/MyCom.h
diff --git a/util/romtool/tools/lzma/C/Common/MyGuidDef.h b/util/cbfstool/tools/lzma/C/Common/MyGuidDef.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/MyGuidDef.h
rename to util/cbfstool/tools/lzma/C/Common/MyGuidDef.h
diff --git a/util/romtool/tools/lzma/C/Common/MyInitGuid.h b/util/cbfstool/tools/lzma/C/Common/MyInitGuid.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/MyInitGuid.h
rename to util/cbfstool/tools/lzma/C/Common/MyInitGuid.h
diff --git a/util/romtool/tools/lzma/C/Common/MyUnknown.h b/util/cbfstool/tools/lzma/C/Common/MyUnknown.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/MyUnknown.h
rename to util/cbfstool/tools/lzma/C/Common/MyUnknown.h
diff --git a/util/romtool/tools/lzma/C/Common/MyWindows.h b/util/cbfstool/tools/lzma/C/Common/MyWindows.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/MyWindows.h
rename to util/cbfstool/tools/lzma/C/Common/MyWindows.h
diff --git a/util/romtool/tools/lzma/C/Common/NewHandler.h b/util/cbfstool/tools/lzma/C/Common/NewHandler.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/NewHandler.h
rename to util/cbfstool/tools/lzma/C/Common/NewHandler.h
diff --git a/util/romtool/tools/lzma/C/Common/StdAfx.h b/util/cbfstool/tools/lzma/C/Common/StdAfx.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/StdAfx.h
rename to util/cbfstool/tools/lzma/C/Common/StdAfx.h
diff --git a/util/romtool/tools/lzma/C/Common/Types.h b/util/cbfstool/tools/lzma/C/Common/Types.h
similarity index 100%
rename from util/romtool/tools/lzma/C/Common/Types.h
rename to util/cbfstool/tools/lzma/C/Common/Types.h
diff --git a/util/romtool/tools/lzma/C/LGPL.txt b/util/cbfstool/tools/lzma/C/LGPL.txt
similarity index 100%
rename from util/romtool/tools/lzma/C/LGPL.txt
rename to util/cbfstool/tools/lzma/C/LGPL.txt
diff --git a/util/romtool/tools/lzma/C/ORIGIN b/util/cbfstool/tools/lzma/C/ORIGIN
similarity index 79%
rename from util/romtool/tools/lzma/C/ORIGIN
rename to util/cbfstool/tools/lzma/C/ORIGIN
index d1fbb77..d631056 100644
--- a/util/romtool/tools/lzma/C/ORIGIN
+++ b/util/cbfstool/tools/lzma/C/ORIGIN
@@ -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.
diff --git a/util/romtool/tools/lzma/Makefile b/util/cbfstool/tools/lzma/Makefile
similarity index 100%
rename from util/romtool/tools/lzma/Makefile
rename to util/cbfstool/tools/lzma/Makefile
diff --git a/util/romtool/tools/lzma/minilzma.cc b/util/cbfstool/tools/lzma/minilzma.cc
similarity index 100%
rename from util/romtool/tools/lzma/minilzma.cc
rename to util/cbfstool/tools/lzma/minilzma.cc
diff --git a/util/romtool/tools/rom-mkpayload.c b/util/cbfstool/tools/rom-mkpayload.c
similarity index 92%
rename from util/romtool/tools/rom-mkpayload.c
rename to util/cbfstool/tools/rom-mkpayload.c
index 190e53a..4466cc1 100644
--- a/util/romtool/tools/rom-mkpayload.c
+++ b/util/cbfstool/tools/rom-mkpayload.c
@@ -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 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 @@
/* 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 @@
*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 @@
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 @@
}
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;
}
diff --git a/util/romtool/tools/rom-mkstage.c b/util/cbfstool/tools/rom-mkstage.c
similarity index 90%
rename from util/romtool/tools/rom-mkstage.c
rename to util/cbfstool/tools/rom-mkstage.c
index 7145d9d..ff43e77 100644
--- a/util/romtool/tools/rom-mkstage.c
+++ b/util/cbfstool/tools/rom-mkstage.c
@@ -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 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 @@
}
/* 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 @@
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 @@
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 @@
}
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;
}
diff --git a/util/romtool/types.c b/util/cbfstool/types.c
similarity index 98%
rename from util/romtool/types.c
rename to util/cbfstool/types.c
index 6e36809..88b4ea7 100644
--- a/util/romtool/types.c
+++ b/util/cbfstool/types.c
@@ -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;
diff --git a/util/romtool/util.c b/util/cbfstool/util.c
similarity index 90%
rename from util/romtool/util.c
rename to util/cbfstool/util.c
index 03479c5..51905a6 100644
--- a/util/romtool/util.c
+++ b/util/cbfstool/util.c
@@ -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 @@
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 @@
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 @@
//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 @@
}
/* 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 @@
/* 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;
}
diff --git a/util/romtool/EXAMPLE b/util/romtool/EXAMPLE
deleted file mode 100644
index 6d5e917..0000000
--- a/util/romtool/EXAMPLE
+++ /dev/null
@@ -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/
diff --git a/util/romtool/Makefile b/util/romtool/Makefile
deleted file mode 100644
index 291c940a..0000000
--- a/util/romtool/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-#
-#
-
-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
-
-CC=gcc
-CFLAGS=-g -Wall # -W -Werror
-
-DESTDIR ?= /usr/local/bin
-
-all: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
-
-$(obj)/romtool: $(patsubst %,$(obj)/%,$(OBJ))
- $(CC) -o $@ $(patsubst %,$(obj)/%,$(OBJ))
-
-tobj = $(obj)/tools
-tsrc = $(shell pwd)/tools
-
-include $(tsrc)/Makefile
-
-$(obj)/%.o: %.c $(INC)
- $(CC) $(CFLAGS) -c -o $@ $<
-
-install: $(obj)/romtool $(obj)/tools/rom-mkpayload $(obj)/tools/rom-mkstage
- @ install -d $(DESTDIR)
- @ install -m 0755 $(obj)/romtool $(DESTDIR)/romtool
- @ install -m 0755 $(obj)/tools/rom-mkstage $(DESTDIR)/rom-mkstage
- @ install -m 0755 $(obj)/tools/rom-mkpayload $(DESTDIR)/rom-mkpayload
-
-tags:
- ctags *.[ch] */*.[ch]
-
-clean: tools-clean
- rm -f $(patsubst %,$(obj)/%,$(OBJ)) $(obj)/romtool
-