G-cluster の フラッシュメモリアドレスマップ




![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/139524/2a8d059c-3287-6ad9-8db0-e455a305d440.png)

オンボードのチップ：

- ARM 1176JZF 600MHz CPU SoC CAVIUM PureVu Full-HD Media Processor CNW6611L-600BG324-SCP-G https://scrapbox.io/gcluster/CNW6611L_%E5%85%AC%E5%BC%8F%E8%B3%87%E6%96%99
- 256MBytes DDR3 16bit SDRAM SAMSUNG K4B2G1646E
- 128MBytes NAND Flash TOSHIBA TC58NVG0S3ETA00
- 128kBytes SPI Flash Macronix MX25L1006EMI-10G

あと860113 502 130129 とマーキングされた謎WiFiChipがありますが、内部の Linux で lsmod とすると

```

ath6kl_sdio           177554  0
mac80211              205075  0
cfg80211              158436  2 ath6kl_sdio,mac80211
compat                 14631  3 ath6kl_sdio,mac80211,cfg80211
```

と出てくるので、Atheros AR6103とかそこらへんぽいです。

# シリアルTTY


dlink/kernel-patch/nand.c などから、以下のように調査。

|offset|size|名称|名称|書き込み||
|:---:|:---:|:---:|:---:|:---:|:---:|
|+0x0000000|128K|miniloader|mtd3|writable||
|+0x0020000|512K|u-boot1|mtd4|read only||
|+0x00A0000|512K|u-boot2|mtd5|read only||
|+0x0120000|128K|nvram_factory|mtd6|read only||
|+0x0140000|256K|marlin|mtd7|writable||
|+0x0180000|128K|factory_hdr|mtd8|read only||
|+0x01A0000|128K|factory_bak_hdr|mtd9|read only||
|+0x01C0000|256K|kernel_hdr|mtd10|read only||
|+0x0200000|2M|splash|mtd11|read only||
|+0x0400000|32M|factory|mtd12|read only|"Factory File System":backup of mtd14?|
|+0x2400000|32K|kernel|mtd13|read only||
|+0x2408000|56.5M|filesystem|mtd14|read only||
|+0x5C88000|3M|blob|mtd15|writtable||
|+0x5F88000|残り全部？|reserve|mtd16|read only||
|+0x0000000|全部？|full|mtd17|writable||

mtdデバイスのマッピングは 起動モードなどで多少変更があるようだ。


dlink/kernel-patch/nand.c からの定義部分を抜粋

```


static struct mtd_partition cnc_nand_partitions[] = {
        {
                .name           = "miniloader",
                .offset         = 0,
                .size           = SZ_128K,
                .mask_flags     = MTD_WRITEABLE,
        }, {
                .name           = "u-boot1",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_512K,
                .mask_flags     = 0,/*Read only*/
        }, {
                .name           = "u-boot2",
                .offset         = MTDPART_OFS_APPEND,組み込み
                .size           = SZ_512K,
                .mask_flags     = 0,
        }, {
                .name           = "nvram_factory",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_128K,
                .mask_flags     = 0,/*Read only*/
        }, {
                .name           = "marlin",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_256K,
                .mask_flags     = MTD_WRITEABLE,
        }, {
                .name           = "factory_hdr",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_128K,
                .mask_flags     = 0,
        }, {
                .name           = "factory_bak_hdr",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_128K,
                .mask_flags     = 0,
        }, {
                .name           = "kernel_hdr",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_256K,
                .mask_flags     = 0,
        }, {
                .name           = "splash",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_2M,
                .mask_flags     = 0,
        }, {
                .name           = "factory",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_32M,
                .mask_flags     = 0,
        }, {
                .name           = "kernel",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_32M,
                .mask_flags     = 0,
        }, {
                .name           = "filesystem",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_48M + SZ_8M + SZ_512K,
                .mask_flags     = 0,
        }, {
                .name           = "blob",
                .offset         = MTDPART_OFS_APPEND,
                .size           = SZ_2M + SZ_1M,
                .mask_flags     = MTD_WRITEABLE,
        }, {
                .name           = "reserve",
                .offset         = MTDPART_OFS_APPEND,
                .size           = MTDPART_SIZ_FULL,
                .mask_flags     = 0,
        }, {
                .name           = "full",
                .offset         = 0,
                .size           = MTDPART_SIZ_FULL,
                .mask_flags     = MTD_WRITEABLE,
        }

};



```

cf., cat /proc/mtd

```

dev:    size   erasesize  name
mtd0: 0000c000 00001000 "miniloader"
mtd1: 00002000 00001000 "uboot-env1"
mtd2: 00002000 00001000 "uboot-env2"
mtd3: 00020000 00020000 "miniloader"
mtd4: 00080000 00020000 "u-boot1"
mtd5: 00080000 00020000 "u-boot2"
mtd6: 00020000 00020000 "nvram_factory"
mtd7: 00040000 00020000 "marlin"
mtd8: 00020000 00020000 "factory_hdr"
mtd9: 00020000 00020000 "factory_bak_hdr"
mtd10: 00040000 00020000 "kernel_hdr"
mtd11: 00200000 00020000 "splash"
mtd12: 02000000 00020000 "factory"
mtd13: 02000000 00020000 "kernel"
mtd14: 03880000 00020000 "filesystem"
mtd15: 00300000 00020000 "blob"
mtd16: 00080000 00020000 "reserve"
mtd17: 08000000 00020000 "full"

```

# その他

https://scrapbox.io/gcluster/%E3%80%90%E9%81%8A%E3%81%BC%E3%81%86%E3%80%91U-boot%E3%81%AE%E8%A1%A8%E7%A4%BA%E3%82%92%E5%A4%89%E3%81%88%E3%81%A6%E3%81%BF%E3%82%88%E3%81%86

U-boot で表示されるロゴ格納箇所？ 4400000 から 1c2010 バイト

ワークショップ用に書き換えたファームウェアでの、U-boot での起動アドレス

```

bootm_image=nand read ${RAM} 2400000 18e0000; bootm ${RAM}

```