From: Florian Fainelli Date: Thu, 12 Mar 2009 08:54:04 +0000 (+0000) Subject: add support for AGPF-S0 (Pirelli Alice Gate VoIP 2 Plus Wi-Fi) #4366 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6495fa36ea584bbc5f58d21df982bf100e4d6591;p=librecmc%2Flibrecmc.git add support for AGPF-S0 (Pirelli Alice Gate VoIP 2 Plus Wi-Fi) #4366 SVN-Revision: 14850 --- diff --git a/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c b/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c index 56da94b8c2..8e71fd12c2 100644 --- a/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/target/linux/brcm63xx/files/arch/mips/bcm63xx/boards/board_bcm963xx.c @@ -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 }; diff --git a/target/linux/brcm63xx/image/Makefile b/target/linux/brcm63xx/image/Makefile index 6cb7a34c01..250cc8236d 100644 --- a/target/linux/brcm63xx/image/Makefile +++ b/target/linux/brcm63xx/image/Makefile @@ -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)) diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c index e24906e856..b50ee2eddc 100644 --- a/tools/firmware-utils/src/imagetag.c +++ b/tools/firmware-utils/src/imagetag.c @@ -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 - The output file\n"); fprintf(stderr, "-b - The board id to set in the image (i.e. \"96345GW2\")\n"); fprintf(stderr, "-c - The chip id to set in the image (i.e. \"6345\")\n"); - fprintf(stderr, "-s - \n"); + fprintf(stderr, "-s - Flash start address (i.e. \"0xBFC00000\"\n"); fprintf(stderr, "-n - \n"); + fprintf(stderr, "-v - \n"); + fprintf(stderr, "-m - \n"); + fprintf(stderr, "-k - \n"); fprintf(stderr, "-l - Address where the kernel expects to be loaded (defaults to 0x80010000)\n"); fprintf(stderr, "-e - 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; } + /* Fallback to defaults */ + 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); + return tagfile(kernel, rootfs, bin, boardid, chipid, fwaddr, loadaddr, entry, ver, magic2, flash_bs); }