add support for AGPF-S0 (Pirelli Alice Gate VoIP 2 Plus Wi-Fi) #4366

SVN-Revision: 14850
This commit is contained in:
Florian Fainelli 2009-03-12 08:54:04 +00:00
parent 8065eb4a55
commit 6495fa36ea
3 changed files with 81 additions and 13 deletions

View File

@ -260,6 +260,28 @@ static struct board_info __initdata board_96358vw2 = {
.has_pccard = 1,
.has_ehci0 = 1,
};
static struct board_info __initdata board_AGPFS0 = {
.name = "AGPF-S0",
.expected_cpu_id = 0x6358,
.has_enet0 = 1,
.has_enet1 = 1,
.has_pci = 1,
.enet0 = {
.has_phy = 1,
.use_internal_phy = 1,
},
.enet1 = {
.force_speed_100 = 1,
.force_duplex_full = 1,
},
.has_ohci0 = 1,
.has_ehci0 = 1,
};
#endif
/*
@ -282,6 +304,7 @@ static const struct board_info __initdata *bcm963xx_boards[] = {
#ifdef CONFIG_BCM63XX_CPU_6358
&board_96358vw,
&board_96358vw2,
&board_AGPFS0,
#endif
};

View File

@ -37,6 +37,15 @@ define Image/Build/CFE
$(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin)
endef
define Image/Build/CFEAGPF
# Generate the tagged image
$(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
-o $(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin \
-b $(2) -c $(3) -e $(LOADADDR) -l $(LOADADDR) \
-v 8 -m IMAGE -k 131072
$(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin)
endef
define Image/Build/RedBoot
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(1)-vmlinux.elf
gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
@ -104,6 +113,8 @@ define Image/Build
$(call Image/Build/CFE,$(1),F@ST2404,6348)
# Inventel Livebox
$(call Image/Build/RedBoot,livebox)
# Pirelli Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0
$(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358)
endef
$(eval $(call BuildImage))

View File

@ -22,7 +22,7 @@
#define IMAGETAG_CRC_START 0xFFFFFFFF
#define DEFAULT_FW_OFFSET 0x10000
#define DEFAULT_FLASH_START 0xBFC00000
#define FLASH_BS (64 * 1024) /* TODO: Make this a command line option */
#define DEFAULT_FLASH_BS (64 * 1024)
/* Kernel header */
struct kernelhdr {
@ -118,7 +118,8 @@ size_t getlen(FILE *fp)
int tagfile(const char *kernel, const char *rootfs, const char *bin,
const char *boardid, const char *chipid, const uint32_t fwaddr,
const uint32_t loadaddr, const uint32_t entry)
const uint32_t loadaddr, const uint32_t entry,
const char *ver, const char *magic2, const uint32_t flash_bs)
{
struct imagetag tag;
struct kernelhdr khdr;
@ -168,9 +169,9 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
/* Build the rootfs address and length (start and end do need to be aligned on flash erase block boundaries */
rootfsoff = kerneloff + kernellen;
rootfsoff = (rootfsoff % FLASH_BS) > 0 ? (((rootfsoff / FLASH_BS) + 1) * FLASH_BS) : rootfsoff;
rootfsoff = (rootfsoff % flash_bs) > 0 ? (((rootfsoff / flash_bs) + 1) * flash_bs) : rootfsoff;
rootfslen = getlen(rootfsfile);
rootfslen = (rootfslen % FLASH_BS) > 0 ? (((rootfslen / FLASH_BS) + 1) * FLASH_BS) : rootfslen;
rootfslen = (rootfslen % flash_bs) > 0 ? (((rootfslen / flash_bs) + 1) * flash_bs) : rootfslen;
/* Seek to the start of the kernel */
fseek(binfile, kerneloff - fwaddr, SEEK_SET);
@ -202,9 +203,9 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
fclose(rootfsfile);
/* Build the tag */
strcpy(tag.tagver, IMAGETAG_VER);
strcpy(tag.tagver, ver);
strncpy(tag.sig1, IMAGETAG_MAGIC1, sizeof(tag.sig1) - 1);
strncpy(tag.sig2, IMAGETAG_MAGIC2, sizeof(tag.sig2) - 1);
strncpy(tag.sig2, magic2, sizeof(tag.sig2) - 1);
strcpy(tag.chipid, chipid);
strcpy(tag.boardid, boardid);
strcpy(tag.bigendian, "1");
@ -238,9 +239,9 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
int main(int argc, char **argv)
{
int c;
char *kernel, *rootfs, *bin, *boardid, *chipid;
char *kernel, *rootfs, *bin, *boardid, *chipid, *magic2, *ver;
uint32_t flashstart, fwoffset, loadaddr, entry;
uint32_t fwaddr;
uint32_t fwaddr, flash_bs;
kernel = rootfs = bin = boardid = chipid = NULL;
entry = 0;
@ -248,11 +249,12 @@ int main(int argc, char **argv)
flashstart = DEFAULT_FLASH_START;
fwoffset = DEFAULT_FW_OFFSET;
loadaddr = IMAGETAG_DEFAULT_LOADADDR;
flash_bs = DEFAULT_FLASH_BS;
printf("Broadcom image tagger - v0.1.0\n");
printf("Broadcom image tagger - v0.1.1\n");
printf("Copyright (C) 2008 Axel Gembe\n");
while ((c = getopt(argc, argv, "i:f:o:b:c:s:n:l:e:h")) != -1) {
while ((c = getopt(argc, argv, "i:f:o:b:c:s:n:v:m:k:l:e:h")) != -1) {
switch (c) {
case 'i':
kernel = optarg;
@ -275,6 +277,15 @@ int main(int argc, char **argv)
case 'n':
fwoffset = strtoul(optarg, NULL, 16);
break;
case 'v':
ver = optarg;
break;
case 'm':
magic2 = optarg;
break;
case 'k':
flash_bs = strtoul(optarg, NULL, 16);
break;
case 'l':
loadaddr = strtoul(optarg, NULL, 16);
break;
@ -289,8 +300,11 @@ int main(int argc, char **argv)
fprintf(stderr, "-o <bin> - The output file\n");
fprintf(stderr, "-b <boardid> - The board id to set in the image (i.e. \"96345GW2\")\n");
fprintf(stderr, "-c <chipid> - The chip id to set in the image (i.e. \"6345\")\n");
fprintf(stderr, "-s <flashstart> - \n");
fprintf(stderr, "-s <flashstart> - Flash start address (i.e. \"0xBFC00000\"\n");
fprintf(stderr, "-n <fwoffset> - \n");
fprintf(stderr, "-v <version> - \n");
fprintf(stderr, "-m <magic2> - \n");
fprintf(stderr, "-k <flash_bs> - \n");
fprintf(stderr, "-l <loadaddr> - Address where the kernel expects to be loaded (defaults to 0x80010000)\n");
fprintf(stderr, "-e <entry> - Address where the kernel entry point will end up\n");
fprintf(stderr, "-h - Displays this text\n");
@ -308,7 +322,27 @@ int main(int argc, char **argv)
return 1;
}
fwaddr = flashstart + fwoffset;
/* Fallback to defaults */
return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry);
fwaddr = flashstart + fwoffset;
if (!magic2) {
magic2 = malloc(sizeof(char) * 14);
if (!magic2) {
perror("malloc");
return 1;
}
strcpy(magic2, IMAGETAG_MAGIC2);
}
if (!ver) {
ver = malloc(sizeof(char) * 4);
if (!ver) {
perror("malloc");
return 1;
}
strcpy(ver, IMAGETAG_VER);
}
return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs);
}