Skip to content

Instantly share code, notes, and snippets.

@fcicq
Last active August 29, 2015 13:58

Revisions

  1. fcicq revised this gist Aug 27, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion openwrt-tplink-uboot-and-hwrev.patch
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,6 @@ index ab952b6..effcac7 100644

    parts[1].name = "kernel";
    parts[1].offset = offset;

    diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
    index a6aab59..46b3559 100644
    --- a/tools/firmware-utils/src/mktplinkfw.c
  2. fcicq revised this gist Aug 27, 2014. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions openwrt-tplink-uboot-and-hwrev.patch
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,16 @@
    diff --git a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    index ab952b6..effcac7 100644
    --- a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    +++ b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    @@ -149,7 +149,6 @@ static int tplink_parse_partitions(struct mtd_info *master,
    parts[0].name = "u-boot";
    parts[0].offset = 0;
    parts[0].size = offset;
    - parts[0].mask_flags = MTD_WRITEABLE;

    parts[1].name = "kernel";
    parts[1].offset = offset;

    diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
    index a6aab59..46b3559 100644
    --- a/tools/firmware-utils/src/mktplinkfw.c
  3. fcicq revised this gist Jul 24, 2014. 1 changed file with 22 additions and 34 deletions.
    56 changes: 22 additions & 34 deletions openwrt-tplink-uboot-and-hwrev.patch
    Original file line number Diff line number Diff line change
    @@ -1,39 +1,27 @@
    diff --git a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    index cabb960..0edaeee 100644
    --- a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    +++ b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    @@ -149,7 +149,6 @@ static int tplink_parse_partitions(struct mtd_info *master,
    parts[0].name = "u-boot";
    parts[0].offset = 0;
    parts[0].size = offset;
    - parts[0].mask_flags = MTD_WRITEABLE;

    parts[1].name = "kernel";
    parts[1].offset = offset;
    diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
    index 176269b..953389b 100644
    index a6aab59..46b3559 100644
    --- a/tools/firmware-utils/src/mktplinkfw.c
    +++ b/tools/firmware-utils/src/mktplinkfw.c
    @@ -519,16 +519,19 @@ static int check_options(void)
    }
    if (layout_id == NULL)
    layout_id = board->layout_id;
    @@ -583,16 +583,19 @@ static int check_options(void)
    }
    if (layout_id == NULL)
    layout_id = board->layout_id;
    -
    + ERR("opt_hw_rev %s", opt_hw_rev);
    hw_id = board->hw_id;
    - hw_rev = board->hw_rev;
    + if (opt_hw_rev)
    + hw_rev = strtoul(opt_hw_rev, NULL, 0);
    + else
    + hw_rev = board->hw_rev;
    } else {
    if (layout_id == NULL) {
    ERR("flash layout is not specified");
    return -1;
    }
    hw_id = strtoul(opt_hw_id, NULL, 0);
    + ERR("opt_hw_rev %s", opt_hw_rev);
    hw_id = board->hw_id;
    - hw_rev = board->hw_rev;
    + if (opt_hw_rev)
    + hw_rev = strtoul(opt_hw_rev, NULL, 0);
    + else
    + hw_rev = board->hw_rev;
    } else {
    if (layout_id == NULL) {
    ERR("flash layout is not specified");
    return -1;
    }
    hw_id = strtoul(opt_hw_id, NULL, 0);
    -
    + ERR("opt_hw_rev %s", opt_hw_rev);
    if (opt_hw_rev)
    hw_rev = strtoul(opt_hw_rev, NULL, 0);
    else
    + ERR("opt_hw_rev %s", opt_hw_rev);
    if (opt_hw_rev)
    hw_rev = strtoul(opt_hw_rev, NULL, 0);
    else
  4. fcicq created this gist Apr 5, 2014.
    39 changes: 39 additions & 0 deletions openwrt-tplink-uboot-and-hwrev.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    diff --git a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    index cabb960..0edaeee 100644
    --- a/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    +++ b/target/linux/ar71xx/files/drivers/mtd/tplinkpart.c
    @@ -149,7 +149,6 @@ static int tplink_parse_partitions(struct mtd_info *master,
    parts[0].name = "u-boot";
    parts[0].offset = 0;
    parts[0].size = offset;
    - parts[0].mask_flags = MTD_WRITEABLE;

    parts[1].name = "kernel";
    parts[1].offset = offset;
    diff --git a/tools/firmware-utils/src/mktplinkfw.c b/tools/firmware-utils/src/mktplinkfw.c
    index 176269b..953389b 100644
    --- a/tools/firmware-utils/src/mktplinkfw.c
    +++ b/tools/firmware-utils/src/mktplinkfw.c
    @@ -519,16 +519,19 @@ static int check_options(void)
    }
    if (layout_id == NULL)
    layout_id = board->layout_id;
    -
    + ERR("opt_hw_rev %s", opt_hw_rev);
    hw_id = board->hw_id;
    - hw_rev = board->hw_rev;
    + if (opt_hw_rev)
    + hw_rev = strtoul(opt_hw_rev, NULL, 0);
    + else
    + hw_rev = board->hw_rev;
    } else {
    if (layout_id == NULL) {
    ERR("flash layout is not specified");
    return -1;
    }
    hw_id = strtoul(opt_hw_id, NULL, 0);
    -
    + ERR("opt_hw_rev %s", opt_hw_rev);
    if (opt_hw_rev)
    hw_rev = strtoul(opt_hw_rev, NULL, 0);
    else