[OpenWrt] Flash 由4M改8M(或者16M), openwrt源码的修改

http://www.right.com.cn/forum/thread-75309-1-1.html

trunk/tools/firmware-utils/src/mktplinkfw.c
只修改fw_max_len为0xfc0000,16M flash

                .id                = "4M",
                .fw_max_len        = 0xfc0000,
                .kernel_la        = 0x80060000,
                .kernel_ep        = 0x80060000,
                .rootfs_ofs        = 0x140000,
新版只用改fw的大小,分区表会自动认,不用像老版自己定义每个分区大小了。

==========================================================
trunk/tools/firmware-utils/src/mktplinkfw.c


点击(此处)折叠或打开

  1. static struct flash_layout layouts[] = {
  2.     {
  3.         .id        = "4M",
  4.         .fw_max_len    = 0x3c0000,
  5.         .kernel_la    = 0x80060000,
  6.         .kernel_ep    = 0x80060000,
  7.         .rootfs_ofs    = 0x140000,
  8.     }, {
  9.         .id        = "4Mlzma",
  10.         .fw_max_len    = 0x3c0000,
  11.         .kernel_la    = 0x80060000,
  12.         .kernel_ep    = 0x80060000,
  13.         .rootfs_ofs    = 0x100000,
  14.     }, {
  15.         .id        = "8M",
  16.         .fw_max_len    = 0x7c0000,
  17.         .kernel_la    = 0x80060000,
  18.         .kernel_ep    = 0x80060000,
  19.         .rootfs_ofs    = 0x140000,
  20.     }, {
  21.         .id        = "8Mlzma",
  22.         .fw_max_len    = 0x7c0000,
  23.         .kernel_la    = 0x80060000,
  24.         .kernel_ep    = 0x80060000,
  25.         .rootfs_ofs    = 0x100000,
  26.     }, {
  27.         /* terminating entry */
  28.     }
  29. };

  30. static struct board_info boards[] = {
  31.     {
  32.         .id        = "TL-MR3020v1",
  33.         .hw_id        = HWID_TL_MR3020_V1,
  34.         .hw_rev        = 1,
  35.         .layout_id    = "4Mlzma",
  36.     }, {
  37.         .id        = "TL-MR3220v1",
  38.         .hw_id        = HWID_TL_MR3220_V1,
  39.         .hw_rev        = 1,
  40.         .layout_id    = "4M",
  41.     }, {
  42.         .id        = "TL-MR3420v1",
  43.         .hw_id        = HWID_TL_MR3420_V1,
  44.         .hw_rev        = 1,
  45.         .layout_id    = "4M",
  46.     }, {
  47.         .id        = "TL-WA701Nv1",
  48.         .hw_id        = HWID_TL_WA701N_V1,
  49.         .hw_rev        = 1,
  50.         .layout_id    = "4M",
  51.     }, {
  52.         .id        = "TL-WA901NDv1",
  53.         .hw_id        = HWID_TL_WA901ND_V1,
  54.         .hw_rev        = 1,
  55.         .layout_id    = "4M",
  56.     }, {
  57.         .id = "TL-WA901NDv2",
  58.         .hw_id = HWID_TL_WA901ND_V2,
  59.         .hw_rev = 1,
  60.         .layout_id    = "4M",
  61.     }, {
  62.         .id        = "TL-WR741NDv1",
  63.         .hw_id        = HWID_TL_WR741ND_V1,
  64.         .hw_rev        = 1,
  65.         .layout_id    = "4M",
  66.     }, {
  67.         .id        = "TL-WR741NDv4",
  68.         .hw_id        = HWID_TL_WR741ND_V4,
  69.         .hw_rev        = 1,
  70.         .layout_id    = "4Mlzma",
  71.     }, {
  72.         .id        = "TL-WR740Nv1",
  73.         .hw_id        = HWID_TL_WR740N_V1,
  74.         .hw_rev        = 1,
  75.         .layout_id    = "4M",
  76.     }, {
  77.         .id        = "TL-WR740Nv3",
  78.         .hw_id        = HWID_TL_WR740N_V3,
  79.         .hw_rev        = 1,
  80.         .layout_id    = "4M",
  81.     }, {
  82.         .id        = "TL-WR743NDv1",
  83.         .hw_id        = HWID_TL_WR743ND_V1,
  84.         .hw_rev        = 1,
  85.         .layout_id    = "4M",
  86.     }, {
  87.         .id        = "TL-WR841Nv1.5",
  88.         .hw_id        = HWID_TL_WR841N_V1_5,
  89.         .hw_rev        = 2,
  90.         .layout_id    = "4M",
  91.     }, {
  92.         .id        = "TL-WR841NDv3",
  93.         .hw_id        = HWID_TL_WR841ND_V3,
  94.         .hw_rev        = 3,
  95.         .layout_id    = "4M",
  96.     }, {
  97.         .id        = "TL-WR841NDv5",
  98.         .hw_id        = HWID_TL_WR841ND_V5,
  99.         .hw_rev        = 1,
  100.         .layout_id    = "4M",
  101.     }, {
  102.         .id        = "TL-WR841NDv7",
  103.         .hw_id        = HWID_TL_WR841ND_V7,
  104.         .hw_rev        = 1,
  105.         .layout_id    = "4M",
  106.     }, {
  107.         .id        = "TL-WR941NDv2",
  108.         .hw_id        = HWID_TL_WR941ND_V2,
  109.         .hw_rev        = 2,
  110.         .layout_id    = "4M",
  111.     }, {
  112.         .id        = "TL-WR941NDv4",
  113.         .hw_id        = HWID_TL_WR941ND_V4,
  114.         .hw_rev        = 1,
  115.         .layout_id    = "4M",
  116.     }, {
  117.         .id        = "TL-WR1043NDv1",
  118.         .hw_id        = HWID_TL_WR1043ND_V1,
  119.         .hw_rev        = 1,
  120.         .layout_id    = "8M",
  121.     }, {
  122.         .id        = "TL-WR2543Nv1",
  123.         .hw_id        = HWID_TL_WR2543N_V1,
  124.         .hw_rev        = 1,
  125.         .layout_id    = "8Mlzma",
  126.     }, {
  127.         .id        = "TL-WR703Nv1",
  128.         .hw_id        = HWID_TL_WR703N_V1,
  129.         .hw_rev        = 1,
  130.         .layout_id    = "4Mlzma",//-->8Mlzma
  131.     }, {
  132.         /* terminating entry */
  133.     }
  134. };



Part Three: Compile your openwrt firmware:

1. Checkout trunk and update feeds as other common tutorials
2. Modify Openwrt code to support and partition your flash:

/trunk/tools/firmware-utils/src/mktplinkfw.c

fw_max_len = 0x7c0000 /* for 8M Flash, use 0xfc0000 for 16M flash*/







3. menuconfig and make your image as common tutorials. save the image openwrt-ar71xx-generic-tl-mr3420-v1-squashfs-factory.bin for future usage.
4. back up your 64k art (wirelss driver data, without it your wireless does not work.) this is important! you can also use the backup one from other tp-link ar7241 chipset routers.



http://www.right.com.cn/forum/thread-75309-1-1.html

你可能感兴趣的:([OpenWrt] Flash 由4M改8M(或者16M), openwrt源码的修改)