Fix broadcom squashfs images:

We switched over to appending the jffs2 eof mark to the squashfs images,
but since the squashfs is not always aligned to eraseblocksize, the eof
mark landed in the wrong place. This commit adds an extra flag to the
trx utility that can append extra data to a partition with alignment.
This is used to place the jffs2 eof mark at the right offset.

SVN-Revision: 7253
master
Felix Fietkau 18 years ago
parent 5015ad650c
commit 63300d3d91
  1. 16
      target/linux/brcm-2.4/image/Makefile
  2. 11
      tools/firmware-utils/src/trx.c

@ -19,6 +19,9 @@ define Image/Prepare
TARGET="$(KDIR)" \ TARGET="$(KDIR)" \
clean install clean install
echo -ne "\\x00" >> $(KDIR)/loader.gz echo -ne "\\x00" >> $(KDIR)/loader.gz
rm -f $(KDIR)/fs_mark
touch $(KDIR)/fs_mark
$(call prepare_generic_squashfs,$(KDIR)/fs_mark)
endef endef
ifneq ($(KERNEL),2.4) ifneq ($(KERNEL),2.4)
@ -41,22 +44,17 @@ define Image/Build/USR
endef endef
define trxalign/jffs2-128k define trxalign/jffs2-128k
-a 0x20000 -a 0x20000 -f $(KDIR)/root.$(1)
endef endef
define trxalign/jffs2-64k define trxalign/jffs2-64k
-a 0x10000 -a 0x10000 -f $(KDIR)/root.$(1)
endef endef
define trxalign/squashfs define trxalign/squashfs
-a 1024 -a 1024 -f $(KDIR)/root.$(1) -a 0x10000 -A $(KDIR)/fs_mark
endef
define Image/Build/squashfs
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
endef endef
define Image/Build define Image/Build
$(call Image/Build/$(1)) $(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1),$(1))
$(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
ifneq ($(1),jffs2-128k) ifneq ($(1),jffs2-128k)
$(call Image/Build/CyberTAN,$(1),wrt54g3g,W54F,2.01.1,$(patsubst jffs2-%,jffs2,$(1))) $(call Image/Build/CyberTAN,$(1),wrt54g3g,W54F,2.01.1,$(patsubst jffs2-%,jffs2,$(1)))
$(call Image/Build/CyberTAN,$(1),wrt54g,W54G,4.60.1,$(patsubst jffs2-%,jffs2,$(1))) $(call Image/Build/CyberTAN,$(1),wrt54g,W54G,4.60.1,$(patsubst jffs2-%,jffs2,$(1)))

@ -88,7 +88,7 @@ int main(int argc, char **argv)
char *ofn = NULL; char *ofn = NULL;
char *buf; char *buf;
char *e; char *e;
int c, i; int c, i, append;
size_t n; size_t n;
uint32_t cur_len; uint32_t cur_len;
unsigned long maxlen = TRX_MAX_LEN; unsigned long maxlen = TRX_MAX_LEN;
@ -110,11 +110,15 @@ int main(int argc, char **argv)
in = NULL; in = NULL;
i = 0; i = 0;
while ((c = getopt(argc, argv, "-:o:m:a:b:f:")) != -1) { while ((c = getopt(argc, argv, "-:o:m:a:b:f:A:")) != -1) {
switch (c) { switch (c) {
case 'A':
append = 1;
/* fall through */
case 'f': case 'f':
case 1: case 1:
p->offsets[i++] = STORE32_LE(cur_len); if (!append)
p->offsets[i++] = STORE32_LE(cur_len);
if (!(in = fopen(optarg, "r"))) { if (!(in = fopen(optarg, "r"))) {
fprintf(stderr, "can not open \"%s\" for reading\n", optarg); fprintf(stderr, "can not open \"%s\" for reading\n", optarg);
@ -134,6 +138,7 @@ int main(int argc, char **argv)
n += ROUND - (n & (ROUND-1)); n += ROUND - (n & (ROUND-1));
} }
cur_len += n; cur_len += n;
append = 0;
break; break;
case 'o': case 'o':

Loading…
Cancel
Save