20180305_jeffrey - silenceuncrio/diary GitHub Wiki

0925

review

1040

commit f1f850dde6ac05c08fbafc85d20aab415a992040
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Mon Mar 5 10:40:20 2018 +0800

    modify the 'VLAN' web page according to the proposal by original designer

 proscend/prosrc/www/app/feature/vlan.html |  2 ++
 proscend/prosrc/www/app/feature/vlan.js   | 13 +++++++++++++
 2 files changed, 15 insertions(+)

1145

目前針對 dual image 所做的努力有點進展

例如 uboot 該怎麼跟 linux kernel 溝通

uboot - lib_mips/board.c

typedef struct proscend_dual_image_header {
    uint32_t    test_1;
    uint32_t    test_2;
} proscend_dual_image_header_t __attribute__((packed));

__attribute__((nomips16)) void board_init_r (gd_t *id, ulong dest_addr)
{

        /*
        ** wirte something to somewhere indicate linux kernel
        ** end of the reserve partition: 0x4140000
        */
        printf("[%s:%d]wirte something to somewhere indicate linux kernel\n", __FUNCTION__, __LINE__);
        proscend_dual_image_header_t pdi_header;
        pdi_header.test_1 = 1;
        pdi_header.test_2 = 2;
        printf("[%s:%d]ranand_erase_write(0x%X, 0x%X)\n", __FUNCTION__, __LINE__, &pdi_header, 0x4140000);
        ranand_erase_write(&pdi_header, 0x4140000, sizeof(pdi_header));

}

linux kernel - build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7621/linux-3.10.14/drivers/mtd/nand/mtk_nand.c

static int mtk_nand_probe(struct platform_device *pdev)
{

	struct {
		__be32 test_1;
		__be32 test_2;
	} proscend_dual_image_header;
	size_t len;

	if (mtd_read(mtd, 0x4140000, sizeof(proscend_dual_image_header), &len, (void *) &proscend_dual_image_header))
	{
		int i = mtd->erasesize;
		while (mtd_read(mtd, 0x4140000 + i, sizeof(proscend_dual_image_header), &len, (void *) &proscend_dual_image_header))
			i+= mtd->erasesize;
	}

    printk("JT[%s:%d]read something from somewhere indicated by uboot()\n", __FUNCTION__, __LINE__);
    printk("JT[%s:%d]proscend_dual_image_header.test_1: %u\n", __FUNCTION__, __LINE__, proscend_dual_image_header.test_1);
    printk("JT[%s:%d]proscend_dual_image_header.test_2: %u\n", __FUNCTION__, __LINE__, proscend_dual_image_header.test_2);

}

這樣一來 linux kernel 便可以依據該結構來決定哪個 partition 要稱之為 firmware

1155

commit 057132b49ef44b51e0566cf718b99d2c99a5a882
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Mon Mar 5 11:56:05 2018 +0800

    hide the 'Mode' field of 'VLAN' web page

 proscend/prosrc/www/app/feature/vlan.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

1400

linux 可以利用 fw_printenvfw_setenv 來存取 uboot env

但要搭配適當的 /etc/fw_env.config

# device name   Device offset   Env. size       sector size
/dev/mtdblock2  0x0             0x1000          0x20000

這樣已經可以提供未來生產時寫入 mac, mcsv 和 serialno 做使用

1440

commit e9a05053b096a8f5cf623728ef40e4806ee0e22a
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Mon Mar 5 14:39:36 2018 +0800

    give the linux ability to access the uboot env

 proscend/base_fs/default/rootfs/etc/fw_env.config | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

1640

commit 0cea641c7375dfbf6f216dd832ae08fa8e5d4b60
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Mon Mar 5 16:37:59 2018 +0800

    modify the 'VLAN' web page according to the proposal and the original designer

 proscend/prosrc/webcgi/vlan.c             |  2 ++
 proscend/prosrc/www/app/feature/vlan.html |  4 ++--
 proscend/prosrc/www/app/feature/vlan.js   | 13 -------------
 3 files changed, 4 insertions(+), 15 deletions(-)